Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cross build OpenSSL (Debian)
#!/bin/bash
set -e
if [ ! -d openssl ]; then
git clone -b OpenSSL_1_1_1q https://github.com/openssl/openssl
fi
pushd openssl
# i686
if which i686-linux-gnu-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=i686-linux-gnu- no-shared linux-x86
make -j`nproc`
make DESTDIR=../openssl-binaries/i686 install
make distclean
fi
# x86_64
if which x86_64-linux-gnu-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=x86_64-linux-gnu- no-shared linux-x86_64
make -j`nproc`
make DESTDIR=../openssl-binaries/x86_64 install
make distclean
fi
# armel
if which arm-linux-gnueabi-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=arm-linux-gnueabi- no-shared linux-generic32
make -j`nproc`
make DESTDIR=../openssl-binaries/armel install
make distclean
fi
# armhf
if which arm-linux-gnueabihf-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=arm-linux-gnueabihf- no-shared linux-generic32
make -j`nproc`
make DESTDIR=../openssl-binaries/armhf install
make distclean
fi
# aarch64
if which aarch64-linux-gnu-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=aarch64-linux-gnu- no-shared linux-aarch64
make -j`nproc`
make DESTDIR=../openssl-binaries/aarch64 install
make distclean
fi
# mips
if which mips-linux-gnu-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=mips-linux-gnu- no-shared linux-mips32
make -j`nproc`
make DESTDIR=../openssl-binaries/mips install
make distclean
fi
# mipsel
if which mipsel-linux-gnu-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=mipsel-linux-gnu- no-shared linux-mips32
make -j`nproc`
make DESTDIR=../openssl-binaries/mipsel install
make distclean
fi
# mips64
if which mips64-linux-gnuabi64-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=mips64-linux-gnuabi64- no-shared linux64-mips64
make -j`nproc`
make DESTDIR=../openssl-binaries/mips64 install
make distclean
fi
# mips64el
if which mips64el-linux-gnuabi64-gcc > /dev/null 2>&1; then
./Configure --prefix=/ --cross-compile-prefix=mips64el-linux-gnuabi64- no-shared linux64-mips64
make -j`nproc`
make DESTDIR=../openssl-binaries/mips64el install
make distclean
fi
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment