aboutsummaryrefslogtreecommitdiff
path: root/core/bearssl/build
blob: 2faf0498d7a7e6585db7c1c12676e1e1f36c6dc2 (plain)
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
#!/bin/sh -e

for patch in *.patch; do
    patch -p1 < "$patch"
done

kinstall() {
    mkdir -p "${3%/*}"; cp "$2" "$3"
    chmod "$1" "$3"
}

[ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc AR=$CPT_CROSS_TRIPLET-ar

make "CC=${CC:=cc}" "AR=${AR:=ar}" LD=$CC LDDLL=$CC

# Build static binary for bearssl, word splitting on CFLAGS is intentional.
# shellcheck disable=2086
"$CC" -static $CFLAGS \
      -I ./inc \
      -include tools/brssl.h \
      tools/*.c \
      build/libbearssl.a \
      -o brssl

kinstall 755 brssl               "$1/usr/bin/brssl"
kinstall 644 build/libbearssl.a  "$1/usr/lib/libbearssl.a"
kinstall 755 build/libbearssl.so "$1/usr/lib/libbearssl.so"

mv inc "$1/usr/include"