-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·34 lines (26 loc) · 933 Bytes
/
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
#!/bin/bash
build_for_mac_target () {
MACARCH=$(awk -F '-' '{print $1}' <<< $1)
pushd poseidon/sources
sed "/CFLAGS = -Wall -O3 -fPIC/ s/$/ -target $1/" Makefile > "Makefile_$MACARCH"
make -f "Makefile_$MACARCH" only_c
rm *.o "Makefile_$MACARCH"
popd
mv poseidon/sources/lib_pos.so "$(awk -F '-' '{print $1}' <<< $1)_lib_pos.dylib"
}
echo "Building poseidon..."
command -v make >/dev/null 2>&1
if [ $? -eq 1 ]; then
echo >&2 "Error: make not found. Make sure it is installed."
exit 1
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
build_for_mac_target "x86_64-apple-macos11"
build_for_mac_target "arm64-apple-macos11"
lipo -create -output lib_pos.dylib x86_64_lib_pos.dylib arm64_lib_pos.dylib
find . -type f -not -name lib_pos.dylib -name '*.dylib' -delete
else
make -C poseidon/sources only_c
mv poseidon/sources/lib_pos.so lib_pos.so
fi
make -C poseidon/sources clean