Skip to content

Commit 9072cc1

Browse files
authored
thirdparty: add script to build libgc on FreeBSD/amd64 (#24717)
1 parent 6a3f12d commit 9072cc1

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
if ! test -f vlib/v/compiler_errors_test.v; then
6+
echo "this script should be run in V's main repo folder!"
7+
exit 1
8+
fi
9+
10+
export CURRENT_SCRIPT_PATH=$(realpath "$0")
11+
12+
export CC="${CC:-gcc}"
13+
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc}"
14+
export LIBGC_COMMIT="${LIBGC_COMMIT:-master}"
15+
mkdir -p $TCC_FOLDER/lib/
16+
17+
echo " CC: $CC"
18+
echo " TCC_FOLDER: $TCC_FOLDER"
19+
echo "LIBGC_COMMIT: $LIBGC_COMMIT"
20+
echo ===============================================================
21+
22+
rm -rf bdwgc/
23+
24+
pushd .
25+
git clone https://github.com/ivmai/bdwgc
26+
cd bdwgc/
27+
28+
git checkout $LIBGC_COMMIT
29+
export LIBGC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
30+
31+
./autogen.sh
32+
33+
CC=$CC CFLAGS='-Os -mtune=generic -fPIC' LDFLAGS='-Os -fPIC' ./configure \
34+
--disable-dependency-tracking \
35+
--disable-docs \
36+
--enable-handle-fork=yes \
37+
--enable-rwlock \
38+
--enable-threads=posix \
39+
--enable-static \
40+
--enable-shared=no \
41+
--enable-parallel-mark \
42+
--enable-single-obj-compilation \
43+
--enable-gc-debug \
44+
--with-libatomic-ops=yes \
45+
--enable-sigrt-signals \
46+
--enable-mmap
47+
48+
make
49+
50+
popd
51+
52+
cp bdwgc/.libs/libgc.a $TCC_FOLDER/lib/libgc.a
53+
54+
date > $TCC_FOLDER/lib/libgc_build_on_date.txt
55+
echo $LIBGC_COMMIT_FULL_HASH > $TCC_FOLDER/lib/libgc_build_source_hash.txt
56+
uname -a > $TCC_FOLDER/lib/libgc_build_machine_uname.txt
57+
58+
ls -la $TCC_FOLDER/lib/libgc.a
59+
echo "Done compiling libgc, at commit $LIBGC_COMMIT , full hash: $LIBGC_COMMIT_FULL_HASH . The static library is in $TCC_FOLDER/lib/libgc.a "

0 commit comments

Comments
 (0)