aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test78
1 files changed, 64 insertions, 14 deletions
diff --git a/scripts/test b/scripts/test
index e389728..2148d52 100755
--- a/scripts/test
+++ b/scripts/test
@@ -2,9 +2,45 @@
2set -e 2set -e
3set -x 3set -x
4 4
5unset CC 5if [ "$ARCH" = "" ]; then
6 ARCH=`uname -m`
7fi
8
9if [ "$ARCH" = "mingw32" -o "$ARCH" = "mingw64" -o "$ARCH" = "arm32" ]; then
10 unset CC
11fi
12
6ENABLE_ASM="${ENABLE_ASM:=ON}" 13ENABLE_ASM="${ENABLE_ASM:=ON}"
7 14
15# setup_cross_compiler sets up environment variables for cross-compilation with the given prefix.
16setup_cross_compiler() {
17 cross_prefix=$1
18
19 CC=${cross_prefix}-gcc
20 CXX=${cross_prefix}-g++
21 AR=${cross_prefix}-ar
22 STRIP=${cross_prefix}-strip
23 RANLIB=${cross_prefix}-ranlib
24
25 # If the unversioned symlink for gcc doesn't exist, find versioned binary.
26 if ! command -v "$CC" >/dev/null 2>&1; then
27 gcc_ver=$(find /usr/bin -name "${CC}-[0-9]*" -prune 2>/dev/null \
28 | sed "s/.*${CC}-//" | sort -n | tail -n 1)
29 CC=${CC}-${gcc_ver}
30 CXX=${CXX}-${gcc_ver}
31 fi
32
33 # Check all binaries actually exist.
34 for c in "$CC" "$CXX" "$AR" "$STRIP" "$RANLIB"; do
35 if ! command -v "$c" >/dev/null 2>&1; then
36 echo "##### Error: $c not found"
37 exit 1
38 fi
39 done
40
41 echo "##### Using $($CC --version | head -n 1)"
42}
43
8if type apt-get >/dev/null 2>&1; then 44if type apt-get >/dev/null 2>&1; then
9 sudo apt-get update 45 sudo apt-get update
10 sudo apt-get install -y cmake ninja-build 46 sudo apt-get install -y cmake ninja-build
@@ -15,10 +51,6 @@ fi
15 51
16VERSION=`cat VERSION` 52VERSION=`cat VERSION`
17 53
18if [ "$ARCH" = "" ]; then
19 ARCH=`uname -m`
20fi
21
22# test macOS 54# test macOS
23if [ `uname` = "Darwin" ]; then 55if [ `uname` = "Darwin" ]; then
24 # test autotools 56 # test autotools
@@ -84,7 +116,7 @@ elif [ "$ARCH" = "native" ]; then
84 ninja test 116 ninja test
85 ) 117 )
86 118
87elif [ "$ARCH" = "mingw32" -o "$ARCH" = "mingw64" ]; then 119elif [ "$ARCH" = "mingw32" ] || [ "$ARCH" = "mingw64" ]; then
88 CPU=i686 120 CPU=i686
89 if [ "$ARCH" = "mingw64" ]; then 121 if [ "$ARCH" = "mingw64" ]; then
90 CPU=x86_64 122 CPU=x86_64
@@ -112,39 +144,57 @@ elif [ "$ARCH" = "mingw32" -o "$ARCH" = "mingw64" ]; then
112 ninja -j 4 144 ninja -j 4
113 ) 145 )
114 146
115elif [ "$ARCH" = "arm32" -o "$ARCH" = "arm64" ]; then 147elif [ "$ARCH" = "arm32" ] || [ "$ARCH" = "arm64" ]; then
116 sudo apt-get install -y qemu-user-static binfmt-support 148 sudo apt-get install -y qemu-user-static binfmt-support
117 149
118 if [ "$ARCH" = "arm32" ]; then 150 if [ "$ARCH" = "arm32" ]; then
119 sudo apt-get install -y g++-arm-linux-gnueabihf 151 sudo apt-get install -y g++-arm-linux-gnueabihf
120 sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ 152 sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/
153 setup_cross_compiler arm-linux-gnueabihf
154
121 ./configure --host=arm-linux-gnueabihf 155 ./configure --host=arm-linux-gnueabihf
122 LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib make -j 4 check 156 LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib make -j 4 check
123 else 157 else
124 sudo apt-get install -y g++-aarch64-linux-gnu 158 sudo apt-get install -y g++-aarch64-linux-gnu
125 sudo ln -sf /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ 159 sudo ln -sf /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/
160 setup_cross_compiler aarch64-linux-gnu
161
126 ./configure --host=aarch64-linux-gnu 162 ./configure --host=aarch64-linux-gnu
127 LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib make -j 4 check 163 LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib make -j 4 check
128 fi 164 fi
129 165
130 file apps/openssl/.libs/openssl 166 file apps/openssl/openssl
131 167
132elif [ "$ARCH" = "mips32" -o "$ARCH" = "mips64" ]; then 168elif [ "$ARCH" = "loong64" ]; then
169 sudo apt install -y qemu-user-static binfmt-support g++-14-loongarch64-linux-gnu
170 sudo ln -sf /usr/loongarch64-linux-gnu/lib64/ld-linux-loongarch-lp64d.so.1 /lib64
171 setup_cross_compiler loongarch64-linux-gnu
172
173 ./configure --host=loongarch64-linux-gnu
174 LD_LIBRARY_PATH=/usr/loongarch64-linux-gnu/lib make -j 4 check
175
176 file apps/openssl/openssl
177
178elif [ "$ARCH" = "mips32" ] || [ "$ARCH" = "mips64" ]; then
133 sudo apt-get install -y qemu-user-static binfmt-support 179 sudo apt-get install -y qemu-user-static binfmt-support
134 180
135 if [ "$ARCH" = "mips32" ]; then 181 if [ "$ARCH" = "mips32" ]; then
136 sudo apt-get install -y g++-mips-linux-gnu 182 sudo apt-get install -y g++-mips-linux-gnu
137 sudo ln -sf /usr/mipsel-linux-gnu/lib/ld.so.1 /lib/ 183 sudo ln -sf /usr/mips-linux-gnu/lib/ld.so.1 /lib/
138 ./configure --host=mipsel-linux-gnu 184 setup_cross_compiler mips-linux-gnu
139 LD_LIBRARY_PATH=/usr/mipsel-linux-gnu/lib make -j 4 check 185
186 ./configure --host=mips-linux-gnu
187 LD_LIBRARY_PATH=/usr/mips-linux-gnu/lib make -j 4 check
140 else 188 else
141 sudo apt-get install -y g++-mips64el-linux-gnuabi64 189 sudo apt-get install -y g++-mips64el-linux-gnuabi64
142 sudo ln -sf /usr/mips64el-linux-gnuabi64/lib64/ld.so.1 /lib64 190 sudo ln -sf /usr/mips64el-linux-gnuabi64/lib64/ld.so.1 /lib64
191 setup_cross_compiler mips64el-linux-gnuabi64
192
143 ./configure --host=mips64el-linux-gnuabi64 193 ./configure --host=mips64el-linux-gnuabi64
144 LD_LIBRARY_PATH=/usr/mips64el-linux-gnuabi64/lib make -j 4 check 194 LD_LIBRARY_PATH=/usr/mips64el-linux-gnuabi64/lib make -j 4 check
145 fi 195 fi
146 196
147 file apps/openssl/.libs/openssl 197 file apps/openssl/openssl
148 198
149elif [ "$ARCH" = "android" ]; then 199elif [ "$ARCH" = "android" ]; then
150 export TC_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake 200 export TC_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
@@ -173,7 +223,7 @@ elif [ "$ARCH" = "android" ]; then
173 223
174 ( 224 (
175 build_dir=build-$NAL_$ABI 225 build_dir=build-$NAL_$ABI
176 rm -fr $build_dir include/openssl/opensslconf.h 226 rm -fr $build_dir
177 mkdir $build_dir 227 mkdir $build_dir
178 cd $build_dir 228 cd $build_dir
179 echo "##### cmake -GNinja -DCMAKE_MAKE_PROGRAM=ninja -DANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_TOOLCHAIN_FILE=$TC_FILE -DANDROID_ABI=$ABI -DANDROID_NATIVE_API_LEVEL=$NAL .." 229 echo "##### cmake -GNinja -DCMAKE_MAKE_PROGRAM=ninja -DANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_TOOLCHAIN_FILE=$TC_FILE -DANDROID_ABI=$ABI -DANDROID_NATIVE_API_LEVEL=$NAL .."