diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/hidapi/BUILD.autotools.md | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/hidapi/BUILD.autotools.md')
| -rw-r--r-- | contrib/SDL-3.2.8/src/hidapi/BUILD.autotools.md | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/hidapi/BUILD.autotools.md b/contrib/SDL-3.2.8/src/hidapi/BUILD.autotools.md new file mode 100644 index 0000000..24b20a5 --- /dev/null +++ b/contrib/SDL-3.2.8/src/hidapi/BUILD.autotools.md | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | # Building HIDAPI using Autotools (deprecated) | ||
| 2 | |||
| 3 | --- | ||
| 4 | **NOTE**: for all intentions and purposes the Autotools build scripts for HIDAPI are _deprecated_ and going to be obsolete in the future. | ||
| 5 | HIDAPI Team recommends using CMake build for HIDAPI. | ||
| 6 | If you are already using Autotools build scripts provided by HIDAPI, | ||
| 7 | consider switching to CMake build scripts as soon as possible. | ||
| 8 | |||
| 9 | --- | ||
| 10 | |||
| 11 | To be able to use Autotools to build HIDAPI, it has to be [installed](#installing-autotools)/available in the system. | ||
| 12 | |||
| 13 | Make sure you've checked [prerequisites](BUILD.md#prerequisites) and installed all required dependencies. | ||
| 14 | |||
| 15 | ## Installing Autotools | ||
| 16 | |||
| 17 | HIDAPI uses few specific tools/packages from Autotools: `autoconf`, `automake`, `libtool`. | ||
| 18 | |||
| 19 | On different platforms or package managers, those could be named a bit differently or packaged together. | ||
| 20 | You'll have to check the documentation/package list for your specific package manager. | ||
| 21 | |||
| 22 | ### Linux | ||
| 23 | |||
| 24 | On Ubuntu the tools are available via APT: | ||
| 25 | |||
| 26 | ```sh | ||
| 27 | sudo apt install autoconf automake libtool | ||
| 28 | ``` | ||
| 29 | |||
| 30 | ### FreeBSD | ||
| 31 | |||
| 32 | FreeBSD Autotools can be installed as: | ||
| 33 | |||
| 34 | ```sh | ||
| 35 | pkg_add -r autotools | ||
| 36 | ``` | ||
| 37 | |||
| 38 | Additionally, on FreeBSD you will need to install GNU make: | ||
| 39 | ```sh | ||
| 40 | pkg_add -r gmake | ||
| 41 | ``` | ||
| 42 | |||
| 43 | ## Building HIDAPI with Autotools | ||
| 44 | |||
| 45 | A simple command list, to build HIDAPI with Autotools as a _shared library_ and install in into your system: | ||
| 46 | |||
| 47 | ```sh | ||
| 48 | ./bootstrap # this prepares the configure script | ||
| 49 | ./configure | ||
| 50 | make # build the library | ||
| 51 | make install # as root, or using sudo, this will install hidapi into your system | ||
| 52 | ``` | ||
| 53 | |||
| 54 | `./configure` can take several arguments which control the build. A few commonly used options: | ||
| 55 | ```sh | ||
| 56 | --enable-testgui | ||
| 57 | # Enable the build of Foxit-based Test GUI. This requires Fox toolkit to | ||
| 58 | # be installed/available. See README.md#test-gui for remarks. | ||
| 59 | |||
| 60 | --prefix=/usr | ||
| 61 | # Specify where you want the output headers and libraries to | ||
| 62 | # be installed. The example above will put the headers in | ||
| 63 | # /usr/include and the binaries in /usr/lib. The default is to | ||
| 64 | # install into /usr/local which is fine on most systems. | ||
| 65 | |||
| 66 | --disable-shared | ||
| 67 | # By default, both shared and static libraries are going to be built/installed. | ||
| 68 | # This option disables shared library build, if only static library is required. | ||
| 69 | ``` | ||
| 70 | |||
| 71 | |||
| 72 | ## Cross Compiling | ||
| 73 | |||
| 74 | This section talks about cross compiling HIDAPI for Linux using Autotools. | ||
| 75 | This is useful for using HIDAPI on embedded Linux targets. These | ||
| 76 | instructions assume the most raw kind of embedded Linux build, where all | ||
| 77 | prerequisites will need to be built first. This process will of course vary | ||
| 78 | based on your embedded Linux build system if you are using one, such as | ||
| 79 | OpenEmbedded or Buildroot. | ||
| 80 | |||
| 81 | For the purpose of this section, it will be assumed that the following | ||
| 82 | environment variables are exported. | ||
| 83 | ```sh | ||
| 84 | $ export STAGING=$HOME/out | ||
| 85 | $ export HOST=arm-linux | ||
| 86 | ``` | ||
| 87 | |||
| 88 | `STAGING` and `HOST` can be modified to suit your setup. | ||
| 89 | |||
| 90 | ### Prerequisites | ||
| 91 | |||
| 92 | Depending on what backend you want to cross-compile, you also need to prepare the dependencies: | ||
| 93 | `libusb` for libusb HIDAPI backend, or `libudev` for hidraw HIDAPI backend. | ||
| 94 | |||
| 95 | An example of cross-compiling `libusb`. From `libusb` source directory, run: | ||
| 96 | ```sh | ||
| 97 | ./configure --host=$HOST --prefix=$STAGING | ||
| 98 | make | ||
| 99 | make install | ||
| 100 | ``` | ||
| 101 | |||
| 102 | An example of cross-comping `libudev` is not covered by this section. | ||
| 103 | Check `libudev`'s documentation for details. | ||
| 104 | |||
| 105 | ### Building HIDAPI | ||
| 106 | |||
| 107 | Build HIDAPI: | ||
| 108 | ```sh | ||
| 109 | PKG_CONFIG_DIR= \ | ||
| 110 | PKG_CONFIG_LIBDIR=$STAGING/lib/pkgconfig:$STAGING/share/pkgconfig \ | ||
| 111 | PKG_CONFIG_SYSROOT_DIR=$STAGING \ | ||
| 112 | ./configure --host=$HOST --prefix=$STAGING | ||
| 113 | # make / make install - same as for a regular build | ||
| 114 | ``` | ||
