pegh/.ci/build.sh

36 lines
1.2 KiB
Bash
Raw Normal View History

2019-12-27 01:00:10 -05:00
#!/bin/sh
set -exu
# change to the directory this script is in
cd "$(dirname "$0")"
# dependencies to build+test pegh
apk add build-base clang bash libsodium-dev libsodium-static openssl-dev openssl-libs-static
2019-12-27 01:00:10 -05:00
# gcc is apparantly incapable of building a static binary, even gcc -static helloworld.c ends up linked to libc, instead of solving, use clang
2019-12-30 02:55:42 -05:00
make clean all PEGH_LIBSODIUM=1 CC=clang LDFLAGS="-static"
2019-12-27 01:00:10 -05:00
mv pegh pegh.static.libsodium
2019-12-30 02:55:42 -05:00
make clean all PEGH_OPENSSL=1 CC=clang LDFLAGS="-static"
2019-12-27 01:00:10 -05:00
mv pegh pegh.static.openssl
2019-12-30 02:55:42 -05:00
make clean all PEGH_LIBSODIUM=1 PEGH_OPENSSL=1 CC=clang LDFLAGS="-static"
2019-12-30 00:10:18 -05:00
mv pegh pegh.static.libsodium-openssl
2019-12-27 01:00:10 -05:00
./pegh.static.libsodium-openssl -h
2019-12-27 01:00:10 -05:00
ls -lah pegh.static.*
strip pegh.static.*
# print out some info about this, size, and to ensure it's actually fully static
ls -lah pegh.static.*
file pegh.static.*
ldd pegh.static.* || true
2020-01-01 02:17:35 -05:00
export TEST_BINS="./pegh.static.openssl ./pegh.openssl ./pegh.static.libsodium-openssl ./pegh.libsodium-openssl ./pegh.static.libsodium ./pegh.libsodium"
2019-12-27 01:00:10 -05:00
# compile dynamically linked versions (with gcc) to openssl and libsodium, then test all 4 against each other
./test.sh
echo "successfully built and tested static pegh against libsodium and openssl!"