-
Notifications
You must be signed in to change notification settings - Fork 751
/
Copy pathcppbuild.sh
executable file
·117 lines (112 loc) · 4.23 KB
/
cppbuild.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# This file is meant to be included by the parent cppbuild.sh script
if [[ -z "$PLATFORM" ]]; then
pushd ..
bash cppbuild.sh "$@" libffi
popd
exit
fi
LIBFFI_VERSION=3.4.6
download https://github.com/libffi/libffi/releases/download/v$LIBFFI_VERSION/libffi-$LIBFFI_VERSION.tar.gz libffi-$LIBFFI_VERSION.tar.gz
mkdir -p $PLATFORM
cd $PLATFORM
INSTALL_PATH=`pwd`
echo "Decompressing archives..."
tar --totals -xzf ../libffi-$LIBFFI_VERSION.tar.gz
cd libffi-$LIBFFI_VERSION
#patch -Np1 < ../../../libffi.patch
case $PLATFORM in
android-arm)
export AR="$ANDROID_PREFIX-ar"
export RANLIB="$ANDROID_PREFIX-ranlib"
export CC="$ANDROID_CC $ANDROID_FLAGS"
export STRIP="$ANDROID_PREFIX-strip"
export LIBS="$ANDROID_LIBS"
./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="arm-linux-androideabi" --with-sysroot="$ANDROID_ROOT"
make -j $MAKEJ
make install-strip
;;
android-arm64)
export AR="$ANDROID_PREFIX-ar"
export RANLIB="$ANDROID_PREFIX-ranlib"
export CC="$ANDROID_CC $ANDROID_FLAGS"
export STRIP="$ANDROID_PREFIX-strip"
export LIBS="$ANDROID_LIBS"
./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="aarch64-linux-android" --with-sysroot="$ANDROID_ROOT"
make -j $MAKEJ
make install-strip
;;
android-x86)
export AR="$ANDROID_PREFIX-ar"
export RANLIB="$ANDROID_PREFIX-ranlib"
export CC="$ANDROID_CC $ANDROID_FLAGS"
export STRIP="$ANDROID_PREFIX-strip"
export LIBS="$ANDROID_LIBS"
./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="i686-linux-android" --with-sysroot="$ANDROID_ROOT"
make -j $MAKEJ
make install-strip
;;
android-x86_64)
export AR="$ANDROID_PREFIX-ar"
export RANLIB="$ANDROID_PREFIX-ranlib"
export CC="$ANDROID_CC $ANDROID_FLAGS"
export STRIP="$ANDROID_PREFIX-strip"
export LIBS="$ANDROID_LIBS"
./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="x86_64-linux-android" --with-sysroot="$ANDROID_ROOT"
make -j $MAKEJ
make install-strip
;;
linux-x86)
CC="gcc -m32" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory
make -j $MAKEJ
make install-strip
;;
linux-x86_64)
CC="gcc -m64" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory
make -j $MAKEJ
make install-strip
;;
linux-armhf)
CC="arm-linux-gnueabihf-gcc" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="arm-linux-gnueabihf"
make -j $MAKEJ
make install-strip
;;
linux-arm64)
CC="aarch64-linux-gnu-gcc" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="aarch64-linux-gnu"
make -j $MAKEJ
make install-strip
;;
linux-ppc64le)
CC="powerpc64le-linux-gnu-gcc" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="powerpc64le-linux-gnu"
make -j $MAKEJ
make install-strip
;;
macosx-arm64)
sedinplace 's/\\\$rpath/@rpath/g' configure
CC="clang -arch arm64" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="aarch64-apple-darwin"
make -j $MAKEJ
make install-strip
;;
macosx-x86_64)
sedinplace 's/\\\$rpath/@rpath/g' configure
CC="clang" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory
make -j $MAKEJ
make install-strip
;;
windows-x86)
CC="../msvcc.sh -m32" LD="link" CPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory
make -j $MAKEJ
make install || true
cp */.libs/* ../lib
;;
windows-x86_64)
CC="../msvcc.sh -m64" LD="link" CPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory
make -j $MAKEJ
make install || true
cp */.libs/* ../lib
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
;;
esac
cd ../..