forked from k2-fsa/sherpa-ncnn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-arm-linux-gnueabihf.sh
executable file
·47 lines (38 loc) · 1.23 KB
/
build-arm-linux-gnueabihf.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
if ! command -v arm-linux-gnueabihf-gcc &> /dev/null; then
echo "Please install a toolchain for cross-compiling."
echo "You can refer to: "
echo " https://k2-fsa.github.io/sherpa/ncnn/install/arm-embedded-linux.html"
echo "for help."
exit 1
fi
set -ex
dir=build-arm-linux-gnueabihf
mkdir -p $dir
cd $dir
if [ ! -f alsa-lib/src/.libs/libasound.so ]; then
echo "Start to cross-compile alsa-lib"
if [ ! -d alsa-lib ]; then
git clone --depth 1 https://github.com/alsa-project/alsa-lib
fi
pushd alsa-lib
CC=arm-linux-gnueabihf-gcc ./gitcompile --host=arm-linux-gnueabihf
popd
echo "Finish cross-compiling alsa-lib"
fi
export CPLUS_INCLUDE_PATH=$PWD/alsa-lib/include:$CPLUS_INCLUDE_PATH
export SHERPA_NCNN_ALSA_LIB_DIR=$PWD/alsa-lib/src/.libs
cmake \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DSHERPA_NCNN_ENABLE_PYTHON=OFF \
-DSHERPA_NCNN_ENABLE_PORTAUDIO=OFF \
-DSHERPA_NCNN_ENABLE_JNI=OFF \
-DSHERPA_NCNN_ENABLE_BINARY=ON \
-DSHERPA_NCNN_ENABLE_TEST=OFF \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabihf.toolchain.cmake \
..
make VERBOSE=1 -j4
make install/strip
cp -v $SHERPA_NCNN_ALSA_LIB_DIR/libasound.so* ./install/lib/