Hash :
ab214b56
Author :
Date :
2023-02-27T07:26:07
handle i?86 for 32-bit CMake builds
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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
#!/bin/sh
set -e
unset CC
if type apt-get >/dev/null
then
sudo apt-get update
sudo apt-get install -y cmake ninja-build
fi
./autogen.sh
if [ "x$ARCH" = "xnative" ]; then
# test autotools
./configure
make -j 4 distcheck
# make distribution
make dist
tar zxvf libressl-*.tar.gz
cd libressl-*
mkdir build-static
mkdir build-shared
cd build-static
# test cmake and ninja
if [ `uname` = "Darwin" ]; then
cmake ..
make -j 4
make test
cd ../build-shared
cmake -DBUILD_SHARED_LIBS=ON ..
make -j 4
make test
else
cmake -GNinja ..
ninja -j 4
ninja test
cd ../build-shared
cmake -GNinja -DBUILD_SHARED_LIBS=ON ..
ninja -j 4
ninja test
fi
elif [ "x$ARCH" = "xmingw32" -o "x$ARCH" = "xmingw64" ]; then
CPU=i686
if [ "x$ARCH" = "xmingw64" ]; then
CPU=x86_64
fi
sudo apt-get install -y mingw-w64
./configure --host=$CPU-w64-mingw32
make -j 4
(
rm -fr build-static
mkdir build-static
cd build-static
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../scripts/$CPU-w64-mingw32.cmake ..
ninja -j 4
)
(
rm -fr build-shared
mkdir build-shared
cd build-shared
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../scripts/$CPU-w64-mingw32.cmake -DBUILD_SHARED_LIBS=ON ..
ninja -j 4
)
elif [ "x$ARCH" = "xarm32" -o "x$ARCH" = "xarm64" ]; then
sudo apt-get install -y qemu-user-static binfmt-support
if [ "x$ARCH" = "xarm32" ]; then
sudo apt-get install -y g++-arm-linux-gnueabihf
sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/
./configure --host=arm-linux-gnueabihf
LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib make -j 4 check
else
sudo apt-get install -y g++-aarch64-linux-gnu
sudo ln -sf /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/
./configure --host=aarch64-linux-gnu
LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib make -j 4 check
fi
file apps/openssl/.libs/openssl
elif [ "x$ARCH" = "xandroid" ]; then
export TC_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
# set target API level and architecture
level_arch=""
level=$MIN_NAL
while [ $level -le $MAX_NAL ]
do
level_arch="$level_arch $level;x86_64"
level_arch="$level_arch $level;x86"
level_arch="$level_arch $level;arm64-v8a"
level=`expr $level + 1`
done
echo "##### level_arch = $level_arch"
# build each API level and architecture
for la in $level_arch
do
NAL=`echo $la | cut -d ';' -f 1`
ABI=`echo $la | cut -d ';' -f 2`
echo ""
echo "##### Date: `date`, Native API level: $NAL, ABI: $ABI"
(
build_dir=build-$NAL_$ABI
rm -fr $build_dir include/openssl/opensslconf.h
mkdir $build_dir
cd $build_dir
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 .."
cmake -GNinja -DCMAKE_MAKE_PROGRAM=ninja \
-DANDROID_NDK=$ANDROID_NDK_HOME \
-DCMAKE_TOOLCHAIN_FILE=$TC_FILE \
-DANDROID_ABI=$ABI -DANDROID_NATIVE_API_LEVEL=$NAL ..
ninja -j 4
echo ""
file apps/openssl/openssl
)
done
fi