forked from devsisters/goquic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_libs.sh
executable file
·65 lines (52 loc) · 1.15 KB
/
build_libs.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
#!/bin/sh -e
ARCH_TYPE=$(uname -m)
OS_TYPE=$(uname -s)
if [ $ARCH_TYPE = "x86_64" ]; then
GOARCH="amd64"
elif [ $ARCH_TYPE = "x86" ]; then
GOARCH="386"
elif [ $ARCH_TYPE = "amd64" ]; then # freeBSD?
GOARCH="amd64"
else
echo "Unknown architecture"
exit 1
fi
if [ $OS_TYPE = "Linux" ]; then
GOOS="linux"
elif [ $OS_TYPE = "Darwin" ]; then
GOOS="darwin"
elif [ $OS_TYPE = "FreeBSD" ]; then
GOOS="freebsd"
else
echo "Unknown OS"
exit 1
fi
if [ "$GOQUIC_BUILD" = "Release" ]; then
OPT="-DCMAKE_BUILD_TYPE=Release"
else
OPT=""
fi
echo "GOARCH: $GOARCH"
echo "GOOS: $GOOS"
echo "OPTION: $OPT"
if [ ! -d libquic ]; then
git clone https://github.com/devsisters/libquic.git
fi
cd libquic
rm -fr build
mkdir -p build
cd build
cmake -GNinja $OPT ..
ninja
cd ../..
TARGET_DIR=lib/${GOOS}_${GOARCH}/
mkdir -p $TARGET_DIR
cp libquic/build/boringssl/crypto/libcrypto.a libquic/build/boringssl/ssl/libssl.a libquic/build/libquic.a libquic/build/protobuf/libprotobuf.a $TARGET_DIR
rm -fr build libgoquic.a
if [ $GOOS = "freebsd" ]; then
gmake -j
else
make -j
fi
mv libgoquic.a $TARGET_DIR
echo $TARGET_DIR updated