-
Notifications
You must be signed in to change notification settings - Fork 4
/
make_static.sh
33 lines (31 loc) · 960 Bytes
/
make_static.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
mkdir -p include
mkdir -p lib
cmake -Bbuild . && cd build && make FSG && cd .. || exit 1
find build/third_party/ -name "*.a" -exec cp {} ./lib \;
find build/third_party/ -name "*.h" -exec cp {} ./include \;
cd lib
echo "Concatening static libs..."
ar -M <<EOM
CREATE libfsg.a
ADDLIB libminecraft_nether_gen_rs.a
ADDLIB libcubiomes.a
ADDLIB libgcrypt.a
ADDLIB libgpg-error.a
SAVE
END
EOM
echo "Linking it..."
ranlib libfsg.a
cd ..
echo "Building the executables..."
mkdir -p bin
declare -a source=("main.c" "fsg_power_village_looting_sword.c" "fsg_power_village_plusplus.c")
declare -a bins=("seed" "power_seed" "super_seed")
for (( i=0; i<${#source[@]}; i++ ));
do
echo "Building ${bins[i]} from ${source[i]}"
gcc "${source[i]}" -I./include -L./lib -lfsg -lm -lpthread -o bin/"${bins[i]}" -Wl,--no-as-needed -ldl
strip bin/"${bins[i]}"
done;
echo "Removing the single libs..."
find lib -type f -not -name 'libfsg.a' -delete