-
Notifications
You must be signed in to change notification settings - Fork 30
/
build.sh
executable file
·93 lines (82 loc) · 2.67 KB
/
build.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
#!/bin/sh
# CI script to build for "ubuntu", "macos", "ape", "coverity"
set -ex -o xtrace
DEPS="gengetopt help2man automake libtool"
case "$1" in
ubuntu|coverity)
DEPS="$DEPS gccgo golang-go openjdk-8-jdk openjdk-8-jre-headless python-dev ruby-dev swig xutils-dev doxygen"
;;
macos)
DEPS="$DEPS openssl"
;;
esac
case "$1" in
ubuntu|coverity|ape)
sudo apt-get update
sudo apt-get install -y $DEPS
;;
macos)
brew install $DEPS
;;
esac
case "$1" in
ubuntu)
# full documentation is only built on ubuntu
pip install -U sphinx sphinx-bootstrap-theme breathe sphinxcontrib-programoutput
;;
esac
case "$1" in
ape)
sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register"
sudo mkdir -p /opt
sudo chmod 1777 /opt
test -d /opt/cosmo || (wget https://cosmo.zip/pub/cosmocc/cosmocc-3.2.4.zip && sudo unzip cosmocc-3.2.4.zip -d /opt/cosmo)
test -d openssl || git clone --depth=1 https://github.com/openssl/openssl.git -b openssl-3.0 openssl
# see also https://github.com/ahgamut/superconfigure/blob/main/lib/openssl/BUILD.mk
cd openssl
git apply ../.github/openssl_getrandom.diff
./Configure linux-aarch64 --with-rand-seed=getrandom no-asm no-shared no-dso no-engine no-dynamic-engine no-tests -DPURIFY CC="/opt/cosmo/bin/cosmocc -I/opt/cosmo/include -L/opt/cosmo/lib" AR=/opt/cosmo/bin/cosmoar
make -j DESTDIR=$PWD/openssl_ape install_sw
cd -
;;
esac
autoreconf -vis
case "$1" in
ubuntu|coverity)
export GCCGOFLAGS="-static-libgcc $CFLAGS"
./configure --enable-python --enable-java --enable-ruby --enable-go
;;
ape)
./configure CC=/opt/cosmo/bin/cosmocc INSTALL="/opt/cosmo/bin/cosmoinstall" AR="/opt/cosmo/bin/cosmoar" CRYPTO_CFLAGS="-I$PWD/openssl/include" CRYPTO_LIBS="-L$PWD/openssl -lcrypto" --disable-shared
#echo "#define ossl_unused" >> config.h
#echo "#define ossl_inline" >> config.h
#echo "#define __owur" >> config.h
#echo "#define ossl_noreturn" >> config.h
;;
macos)
./configure
;;
esac
case "$1" in
ubuntu)
make
make check
sudo make install
make distcheck
sudo make uninstall
;;
ape|macos)
make
;;
esac
case "$1" in
ape)
mkdir -p openpace_ape
find .
for file in openssl_ape/bin/openssl src/eactest src/cvc-create src/cvc-print
do
objcopy -SO binary $file openpace_ape/${file##*/}.com
done
cp -r docs openpace_ape
;;
esac