1- #! /bin/bash
1+ #! /bin/bash -ex
2+
3+ export PREFIX=/opt/lib/${CROSS_COMPILE}
24
35if [ x$CROSS_COMPILER == x ]; then
46CROSS_COMPILER=${CROSS_COMPILE} -gcc
7+ CROSS_COMPILER_CXX=${CROSS_COMPILE} -g++
8+ # AR=${CROSS_COMPILE}-ar
59else
610export CC=$CROSS_COMPILER
7- fi
8- # udev lib not required for macos
9- if [[ ${CROSS_COMPILE} != * apple* ]]; then
10- cd /opt/lib/eudev-3.2.10
11- export UDEV_DIR=` pwd`
12- ./autogen.sh
13- ./configure --enable-static --disable-shared --disable-blkid --disable-kmod --disable-manpages --host=${CROSS_COMPILE}
14- make clean
15- make -j4
16- cd ..
17- export CFLAGS=" -I$UDEV_DIR /src/libudev/"
18- export LDFLAGS=" -L$UDEV_DIR /src/libudev/.libs/"
19- export LIBS=" -ludev"
11+ export CXX=$CROSS_COMPILER ++
12+ CROSS_COMPILER=$CC
13+ CROSS_COMPILER_CXX=$CXX
2014fi
2115cd /opt/lib/libusb-1.0.20
2216export LIBUSB_DIR=` pwd`
23- ./configure --enable-static --disable-shared --host=${CROSS_COMPILE}
24- make clean
17+ ./configure --prefix=${PREFIX} --disable-udev --enable-static --disable-shared --host=${CROSS_COMPILE}
18+ make distclean
19+ ./configure --prefix=${PREFIX} --disable-udev --enable-static --disable-shared --host=${CROSS_COMPILE}
20+ make
21+ make install
22+
23+ export PKG_CONFIG_PATH=$PREFIX /lib/pkgconfig
24+
25+ if [[ $CROSS_COMPILE == " i686-w64-mingw32" ]] ; then
26+ # libusb-compat is a mess to compile for win32
27+ # use a precompiled version from libusb-win32 project
28+ curl http://download.sourceforge.net/project/libusb-win32/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip -o libusb-win32-bin-1.2.6.0.zip -L
29+ unzip libusb-win32-bin-1.2.6.0.zip
30+ # mkdir -p $PREFIX/bin/
31+ # cp libusb-win32-bin-1.2.6.0/bin/x86/libusb0_x86.dll $PREFIX/bin/libusb0.dll
32+ cp libusb-win32-bin-1.2.6.0/include/lusb0_usb.h $PREFIX /include
33+ cp libusb-win32-bin-1.2.6.0/lib/gcc/libusb.a $PREFIX /lib
34+ else
35+ if [[ $CROSS_COMPILE == " x86_64-apple-darwin13" ]]; then
36+ export LIBUSB_1_0_CFLAGS=-I${PREFIX} /include/libusb-1.0
37+ export LIBUSB_1_0_LIBS=" -L${PREFIX} /lib -lusb-1.0"
38+ fi
39+ cd /opt/lib/libusb-compat-0.1.5
40+ export LIBUSB0_DIR=` pwd`
41+ PKG_CONFIG_PATH=" $PREFIX /lib/pkgconfig" ./configure --prefix=${PREFIX} --enable-static --disable-shared --host=${CROSS_COMPILE}
42+ make distclean
43+ PKG_CONFIG_PATH=" $PREFIX /lib/pkgconfig" ./configure --prefix=${PREFIX} --enable-static --disable-shared --host=${CROSS_COMPILE}
44+ make
45+ make install
46+ fi
47+
48+ cd /opt/lib/libftdi1-1.4
49+ rm -rf build && mkdir build && cd build
50+
51+ CMAKE_EXTRA_FLAG=" -DSHAREDLIBS=OFF -DBUILD_TESTS=OFF -DPYTHON_BINDINGS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF"
52+
53+ if [[ $CROSS_COMPILE == " i686-w64-mingw32" ]] ; then
54+ CMAKE_EXTRA_FLAG=" $CMAKE_EXTRA_FLAG -DCMAKE_TOOLCHAIN_FILE=./cmake/Toolchain-i686-w64-mingw32.cmake"
55+ fi
56+
57+ if [[ $CROSS_COMPILE == " x86_64-apple-darwin13" ]]; then
58+ CMAKE_EXTRA_FLAG=" $CMAKE_EXTRA_FLAG -DCMAKE_AR=$AR -DCMAKE_RANLIB=$RANLIB "
59+ fi
60+
61+ cmake -DCMAKE_C_COMPILER=$CROSS_COMPILER -DCMAKE_CXX_COMPILER=$CROSS_COMPILER_CXX -DCMAKE_INSTALL_PREFIX=" $PREFIX " $CMAKE_EXTRA_FLAG -DLIBUSB_INCLUDE_DIR=" $PREFIX /include/libusb-1.0" -DLIBFTDI_LIBRARY_DIRS=" $PREFIX /lib" -DLIBUSB_LIBRARIES=" usb-1.0" ../
2562make
26- cd ..
27- # libusbudev.a merged not required for macos
28- if [[ ${CROSS_COMPILE} != * apple* ]]; then
29- mkdir -p ${CROSS_COMPILE} /libusb
30- mkdir -p ${CROSS_COMPILE} /libudev
31- cd ${CROSS_COMPILE} /libusb/
32- ar -x ../../libusb-1.0.20/libusb/.libs/libusb-1.0.a
33- cd ../libudev/
34- ar -x ../../eudev-3.2.10/src/libudev/.libs/libudev.a
35- cd ..
36- ar -qc libusbudev.a libudev/* libusb/*
63+ make install
64+
65+ cd /opt/lib/libelf-0.8.13
66+ export LIBELF_DIR=` pwd`
67+ ./configure --disable-shared --host=$CROSS_COMPILE --prefix=${PREFIX}
68+ make distclean
69+ ./configure --disable-shared --host=$CROSS_COMPILE --prefix=${PREFIX}
70+ make
71+ make install
72+
73+ echo " *****************"
74+ file ${PREFIX} /lib/*
75+ echo " *****************"
76+
77+ export CPPFLAGS=" -P"
78+
79+ cd /opt/lib/ncurses-5.9
80+ export NCURSES_DIR=` pwd`
81+
82+ ./configure $EXTRAFLAGS --disable-shared --without-debug --without-ada --with-termlib --enable-termcap --without-manpages --without-progs --without-tests --host=$CROSS_COMPILE --prefix=${PREFIX}
83+ make distclean
84+ ./configure $EXTRAFLAGS --disable-shared --without-debug --without-ada --with-termlib --enable-termcap --without-manpages --without-progs --without-tests --host=$CROSS_COMPILE --prefix=${PREFIX}
85+ make
86+ make install.libs
87+
88+ cd /opt/lib/readline-8.0
89+ export READLINE_DIR=` pwd`
90+ ./configure --prefix=$PREFIX --disable-shared --host=$CROSS_COMPILE
91+ make distclean
92+ ./configure --prefix=$PREFIX --disable-shared --host=$CROSS_COMPILE
93+ make
94+ make install-static
95+
96+ if [[ $CROSS_COMPILE != " i686-w64-mingw32" && $CROSS_COMPILE != " x86_64-apple-darwin13" ]] ; then
97+ cd /opt/lib/eudev-3.2.10
98+ ./autogen.sh
99+ ./configure --enable-static --disable-gudev --disable-introspection --disable-shared --disable-blkid --disable-kmod --disable-manpages --prefix=$PREFIX --host=${CROSS_COMPILE}
100+ make distclean
101+ ./autogen.sh
102+ ./configure --enable-static --disable-gudev --disable-introspection --disable-shared --disable-blkid --disable-kmod --disable-manpages --prefix=$PREFIX --host=${CROSS_COMPILE}
103+ make
104+ make install
37105fi
106+
107+ cd /opt/lib/hidapi
108+ export PKG_CONFIG_PATH=$PREFIX /lib/pkgconfig
109+ ./bootstrap
110+ ./configure --prefix=$PREFIX --enable-static --disable-shared --host=$CROSS_COMPILE
111+ make distclean
112+ ./bootstrap
113+ ./configure --prefix=$PREFIX --enable-static --disable-shared --host=$CROSS_COMPILE
114+ make
115+ make install
0 commit comments