33true # Dummy command required to prevent first ShellCheck directive from having global scope.
44
55# shellcheck disable=SC2153 # Fix false positive of ShellCheck rule SC2153.
6- export PREFIX=/opt/lib/${CROSS_COMPILE}
6+
7+ LIB_PATH=${LIB_PATH:-/ opt/ lib}
8+ NPROC=${NPROC:- " $( nproc) " }
9+ export PREFIX=${PREFIX:-/ opt/ lib/ ${CROSS_COMPILE} }
710
811if [ " $CROSS_COMPILER " == " " ]; then
912 CROSS_COMPILER=${CROSS_COMPILE} -gcc
1518 CROSS_COMPILER=$CC
1619 # CROSS_COMPILER_CXX=$CXX
1720fi
18- cd /opt/lib/ libusb-1.0.28
21+ cd " ${LIB_PATH} / libusb-1.0.28"
1922LIBUSB_DIR=$( pwd)
2023export LIBUSB_DIR
2124./configure --prefix=" ${PREFIX} " --with-pic --disable-udev --enable-static --disable-shared --host=" ${CROSS_COMPILE} "
2225make distclean
2326./configure --prefix=" ${PREFIX} " --with-pic --disable-udev --enable-static --disable-shared --host=" ${CROSS_COMPILE} "
24- make -j" $( nproc ) "
27+ make -j" ${NPROC} "
2528make install
2629
2730export PKG_CONFIG_PATH=$PREFIX /lib/pkgconfig
2831
29- if [[ $CROSS_COMPILE == " x86_64-apple-darwin13" ]]; then
32+ if [[ $CROSS_COMPILE == " x86_64-apple-darwin13" || $CROSS_COMPILE == " aarch64-apple-darwin " ]]; then
3033 export LIBUSB_1_0_CFLAGS=-I${PREFIX} /include/libusb-1.0
3134 export LIBUSB_1_0_LIBS=" -L${PREFIX} /lib -lusb-1.0"
3235fi
33- cd /opt/lib/ libusb-compat-0.1.8
36+ cd " ${LIB_PATH} / libusb-compat-0.1.8"
3437LIBUSB0_DIR=$( pwd)
3538export LIBUSB0_DIR
3639PKG_CONFIG_PATH=" $PREFIX /lib/pkgconfig" ./configure --prefix=" ${PREFIX} " --enable-static --disable-shared --host=" ${CROSS_COMPILE} "
3740make distclean
3841PKG_CONFIG_PATH=" $PREFIX /lib/pkgconfig" ./configure --prefix=" ${PREFIX} " --enable-static --disable-shared --host=" ${CROSS_COMPILE} "
39- make -j" $( nproc ) "
42+ make -j" ${NPROC} "
4043make install
4144
42- cd /opt/lib/ libftdi1-1.4
45+ cd " ${LIB_PATH} / libftdi1-1.4"
4346rm -rf build && mkdir build && cd build
4447
4548CMAKE_EXTRA_FLAG=" -DSHAREDLIBS=OFF -DBUILD_TESTS=OFF -DPYTHON_BINDINGS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF"
@@ -48,7 +51,7 @@ if [[ $CROSS_COMPILE == "i686-w64-mingw32" ]]; then
4851 CMAKE_EXTRA_FLAG=" $CMAKE_EXTRA_FLAG -DCMAKE_TOOLCHAIN_FILE=./cmake/Toolchain-i686-w64-mingw32.cmake"
4952fi
5053
51- if [[ $CROSS_COMPILE == " x86_64-apple-darwin13" ]]; then
54+ if [[ $CROSS_COMPILE == " x86_64-apple-darwin13" || $CROSS_COMPILE == " aarch64-apple-darwin " ]]; then
5255 CMAKE_EXTRA_FLAG=" $CMAKE_EXTRA_FLAG -DCMAKE_AR=$AR -DCMAKE_RANLIB=$RANLIB "
5356fi
5457
5760# make -j"$(nproc)"
5861# make install
5962
60- cd /opt/lib/ libelf-0.8.13
63+ cd " ${LIB_PATH} / libelf-0.8.13"
6164LIBELF_DIR=$( pwd)
6265export LIBELF_DIR
6366./configure --disable-shared --host=" $CROSS_COMPILE " --prefix=" ${PREFIX} "
6467make distclean
6568./configure --disable-shared --host=" $CROSS_COMPILE " --prefix=" ${PREFIX} "
66- make -j" $( nproc ) "
69+ make -j" ${NPROC} "
6770make install
6871
6972echo " *****************"
@@ -72,47 +75,47 @@ echo "*****************"
7275
7376export CPPFLAGS=" -P"
7477
75- cd /opt/lib/ ncurses-6.3
78+ cd " ${LIB_PATH} / ncurses-6.3"
7679NCURSES_DIR=$( pwd)
7780export NCURSES_DIR
7881
7982./configure " $EXTRAFLAGS " --target=" $CROSS_COMPILE " --without-pthread --enable-database --enable-sp-funcs --enable-term-driver --without-shared --without-debug --without-ada --enable-termcap --without-manpages --without-progs --without-tests --host=" $CROSS_COMPILE " --prefix=" ${PREFIX} "
8083make distclean
8184./configure " $EXTRAFLAGS " --target=" $CROSS_COMPILE " --without-pthread --enable-database --enable-sp-funcs --enable-term-driver --without-shared --without-debug --without-ada --enable-termcap --without-manpages --without-progs --without-tests --host=" $CROSS_COMPILE " --prefix=" ${PREFIX} "
82- make -j" $( nproc ) "
85+ make -j" ${NPROC} "
8386make install.libs
8487
85- cd /opt/lib/ readline-8.0
88+ cd " ${LIB_PATH} / readline-8.0"
8689READLINE_DIR=$( pwd)
8790export READLINE_DIR
8891./configure --prefix=" $PREFIX " --disable-shared --host=" $CROSS_COMPILE "
8992make distclean
9093./configure --prefix=" $PREFIX " --disable-shared --host=" $CROSS_COMPILE "
91- make -j" $( nproc ) "
94+ make -j" ${NPROC} "
9295make install-static
9396
94- if [[ $CROSS_COMPILE != " i686-w64-mingw32" && $CROSS_COMPILE != " x86_64-apple-darwin13" ]]; then
95- cd /opt/lib/ eudev-3.2.10
97+ if [[ $CROSS_COMPILE != " i686-w64-mingw32" && $CROSS_COMPILE != " x86_64-apple-darwin13" && $CROSS_COMPILE != " aarch64-apple-darwin " ]]; then
98+ cd " ${LIB_PATH} / eudev-3.2.10"
9699 ./autogen.sh
97100 ./configure --enable-static --disable-gudev --disable-introspection --disable-shared --disable-blkid --disable-kmod --disable-manpages --prefix=" $PREFIX " --host=" ${CROSS_COMPILE} "
98101 make distclean
99102 ./autogen.sh
100103 ./configure --enable-static --disable-gudev --disable-introspection --disable-shared --disable-blkid --disable-kmod --disable-manpages --prefix=" $PREFIX " --host=" ${CROSS_COMPILE} "
101- make -j" $( nproc ) "
104+ make -j" ${NPROC} "
102105 make install
103106fi
104107
105- cd /opt/lib/ hidapi-0.12.0
108+ cd " ${LIB_PATH} / hidapi-0.12.0"
106109export PKG_CONFIG_PATH=$PREFIX /lib/pkgconfig
107110./bootstrap
108111./configure --prefix=" $PREFIX " --enable-static --disable-shared --host=" $CROSS_COMPILE "
109112make distclean
110113./bootstrap
111114./configure --prefix=" $PREFIX " --enable-static --disable-shared --host=" $CROSS_COMPILE "
112- make -j" $( nproc ) "
115+ make -j" ${NPROC} "
113116make install
114117
115- tar -xzf /opt/lib/ libxml2-2.14.3.tar.gz -C /tmp && cd /tmp/libxml2-2.14.3
118+ tar -xzf " ${LIB_PATH} / libxml2-2.14.3.tar.gz" -C /tmp && cd /tmp/libxml2-2.14.3
116119./autogen.sh --prefix=" $PREFIX " --disable-shared --enable-static --without-python --without-iconv --host=" $CROSS_COMPILE "
117- make -j" $( nproc ) "
120+ make -j" ${NPROC} "
118121make install
0 commit comments