14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
- ARCH=` arm-linux-gnueabihf-gcc -v 2>&1 | awk ' /Target/ { print $2 }' `
17
+
18
+ if [ x$CROSS_COMPILER == x ]; then
19
+ CROSS_COMPILER=${CROSS_COMPILE} -gcc
20
+ fi
21
+
22
+ ARCH=` $CROSS_COMPILER -v 2>&1 | awk ' /Target/ { print $2 }' `
18
23
19
24
mkdir -p distrib/$ARCH
20
25
cd distrib/$ARCH
24
29
# disable pkg-config
25
30
export PKG_CONFIG_PATH=` pwd`
26
31
27
- if [[ ${ARCH} != * darwin* ]]; then
32
+ if [[ ${ARCH} == * mingw* ]]; then
33
+ export CFLAGS=" -mno-ms-bitfields"
34
+ fi
35
+
36
+ if [[ ${ARCH} == * linux* ]]; then
28
37
29
38
cd eudev-3.1.5
30
39
export UDEV_DIR=` pwd`
31
40
./autogen.sh
32
- ./configure --enable-static --disable-shared --disable-blkid --disable-kmod --disable-manpages --host=arm-linux-gnueabihf
41
+ ./configure --enable-static --disable-shared --disable-blkid --disable-kmod --disable-manpages --host=${CROSS_COMPILE}
33
42
make clean
34
43
make -j4
35
44
cd ..
42
51
43
52
cd libusb-1.0.20
44
53
export LIBUSB_DIR=` pwd`
45
- ./configure --enable-static --disable-shared --host=arm-linux-gnueabihf
54
+ ./configure --enable-static --disable-shared --host=${CROSS_COMPILE}
46
55
make clean
47
56
make
48
57
cd ..
@@ -57,7 +66,7 @@ cd libusb-compat-0.1.5
57
66
export LIBUSB0_DIR=` pwd`
58
67
automake --add-missing
59
68
autoreconf
60
- ./configure --enable-static --disable-shared --host=arm-linux-gnueabihf
69
+ ./configure --enable-static --disable-shared --host=${CROSS_COMPILE}
61
70
make clean
62
71
make
63
72
cd ..
@@ -70,7 +79,7 @@ export libudev_LIBS="-L$UDEV_DIR/src/libudev/.libs/ -ludev"
70
79
cd hidapi
71
80
./bootstrap
72
81
export HIDAPI_DIR=` pwd`
73
- ./configure --enable-static --disable-shared --host=arm-linux-gnueabihf
82
+ ./configure --enable-static --disable-shared --host=${CROSS_COMPILE}
74
83
make clean
75
84
make -j4
76
85
cd ..
@@ -81,7 +90,7 @@ if [ -d build ]; then
81
90
rm -rf build
82
91
fi
83
92
mkdir build && cd build
84
- cmake -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DBUILD_TESTS=no -DDOCUMENTATION=no -DEXAMPLES=no -DFTDIPP=no -DFTDI_EEPROM=no -DLINK_PYTHON_LIBRARY=no -DPYTHON_BINDINGS=no -DCMAKE_INSTALL_PREFIX=$LIBFTDI1_DIR ..
93
+ cmake -DCMAKE_C_COMPILER=${CROSS_COMPILER} -DBUILD_TESTS=no -DDOCUMENTATION=no -DEXAMPLES=no -DFTDIPP=no -DFTDI_EEPROM=no -DLINK_PYTHON_LIBRARY=no -DPYTHON_BINDINGS=no -DCMAKE_INSTALL_PREFIX=$LIBFTDI1_DIR ..
85
94
cd ..
86
95
make clean
87
96
make ftdi1-static
@@ -97,23 +106,30 @@ export LIBFTDI_CFLAGS="-I$LIBFTDI1_DIR/src/"
97
106
export LIBFTDI_LIBS=" -L$LIBFTDI1_DIR /src/ -lftdi1 -lpthread"
98
107
export HIDAPI_CFLAGS=" -I$HIDAPI_DIR /hidapi/"
99
108
100
- if [[ ${ARCH} != * darwin* ]]; then
101
-
102
- export HIDAPI_LIBS=" -L$HIDAPI_DIR /linux/.libs/ -L$HIDAPI_DIR /libusb/.libs/ -lhidapi-hidraw -lhidapi-libusb"
103
-
104
- else
109
+ if [[ ${ARCH} == * linux* ]]; then
110
+ export HIDAPI_LIBS=" -L$HIDAPI_DIR /linux/.libs/ -L$HIDAPI_DIR /libusb/.libs/ -lhidapi-hidraw -lhidapi-libusb"
111
+ fi
105
112
113
+ if [[ ${ARCH} == * darwin* ]]; then
106
114
export HIDAPI_LIBS=" -L$HIDAPI_DIR /mac/.libs/ -L$HIDAPI_DIR /libusb/.libs/ -lhidapi"
107
115
fi
108
116
117
+ if [[ ${ARCH} == * mingw* ]]; then
118
+ export HIDAPI_LIBS=" -L$HIDAPI_DIR /windows/.libs/ -L$HIDAPI_DIR /libusb/.libs/ -lhidapi"
119
+ fi
120
+
121
+ if [[ ${ARCH} == * mingw* ]]; then
122
+ OPENOCD_COMPILE_SWITCHES=" --enable-remote-bitbang --enable-stlink --enable-usb-blaster-2 --enable-ti-icdi --enable-jlink --enable-usbprog --enable-cmsis-dap"
123
+ else
109
124
OPENOCD_COMPILE_SWITCHES=" --enable-remote-bitbang --enable-stlink --enable-usb-blaster-2 --enable-ti-icdi --enable-jlink --enable-usbprog --enable-cmsis-dap --enable-jtag_vpi --enable-ioutil"
125
+ fi
110
126
111
- if [[ ${ARCH} != * darwin * ]]; then
127
+ if [[ ${ARCH} == * linux * ]]; then
112
128
OPENOCD_COMPILE_SWITCHES=" $OPENOCD_COMPILE_SWITCHES --enable-sysfsgpio"
113
129
fi
114
130
115
131
export CFLAGS=" -DHAVE_LIBUSB_ERROR_NAME"
116
- PKG_CONFIG_PATH=` pwd` ./configure $OPENOCD_COMPILE_SWITCHES --disable-werror --prefix=$PREFIX --host=arm-linux-gnueabihf
132
+ PKG_CONFIG_PATH=` pwd` ./configure $OPENOCD_COMPILE_SWITCHES --disable-werror --prefix=$PREFIX --host=${CROSS_COMPILE}
117
133
make clean
118
134
CFLAGS=-static make
119
135
make install
0 commit comments