Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
This folder, contains build scripts used by the CI, to generate prebuilt versions
(or latest version by default) of:
A) TCC from https://repo.or.cz/tinycc.git/
B) libgc from https://github.com/ivmai/bdwgc/
In time, if everything works fine, we can deprecate the older approach, keeping 2 *separate*
binary repos, tccbin/ and libgcbin/, with just pointers back to the build scripts here.
Note: the previous approach (before 2024/08), used in https://github.com/vlang/tccbin/,
where that separate repo contained both prebuilt binaries for tcc AND libgc.a,
AND the separate scripts to generate them, in *separate branches*.
In contrast, this folder contains *all scripts in the same location, in the same branch*, just
with different names, thus making editing them all at the same time and in atomic commits,
that can be reviewed and tested separately in PRs on the CI *much easier*.
WARNING: this is still experimental, and should not be used, except to ease testing on the CI.
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
set -e
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export CC="${CC:-gcc}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc}"
export LIBGC_COMMIT="${LIBGC_COMMIT:-master}"
mkdir -p $TCC_FOLDER/lib/
echo " CC: $CC"
echo " TCC_FOLDER: $TCC_FOLDER"
echo "LIBGC_COMMIT: $LIBGC_COMMIT"
echo ===============================================================
rm -rf bdwgc/
pushd .
git clone https://github.com/ivmai/bdwgc
cd bdwgc/
git checkout $LIBGC_COMMIT
export LIBGC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
./autogen.sh
CC=$CC CFLAGS='-Os -mtune=generic -fPIC' LDFLAGS='-Os -fPIC' ./configure \
--disable-dependency-tracking \
--disable-docs \
--enable-handle-fork=yes \
--enable-rwlock \
--enable-threads=posix \
--enable-static \
--enable-shared=no \
--enable-parallel-mark \
--enable-single-obj-compilation \
--enable-gc-debug \
--with-libatomic-ops=yes \
--enable-sigrt-signals \
--enable-mmap
make
popd
cp bdwgc/.libs/libgc.a $TCC_FOLDER/lib/libgc.a
date > $TCC_FOLDER/lib/libgc_build_on_date.txt
echo $LIBGC_COMMIT_FULL_HASH > $TCC_FOLDER/lib/libgc_build_source_hash.txt
uname -a > $TCC_FOLDER/lib/libgc_build_machine_uname.txt
ls -la $TCC_FOLDER/lib/libgc.a
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,0 +1,98 @@
## NOTE: this script does *not* use a shebang **deliberately**, in order to
## access the same shell, to capture its own launching command with `fc`,
## and to record it later in the new commit message in thirdpart/tcc.
## WARNING: THE ORIGINAL OF THIS SCRIPT IS IN:
## https://github.com/vlang/v/blob/master/thirdparty/build_scripts/thirdparty-freebsd-amd64_tcc.sh ,
## I.E. IN THE MAIN V REPOSITORY. IF YOU NEED TO MAKE CHANGES, CHANGE THAT.
##
## THE `build.sh` FILE IN `vlang/tccbin` REPO IS A COPY, RECORDED AT THE TIME
## OF REBUILDING, FOR EASIER/RELIABLE REPRODUCTION OF HISTORIC VERSIONS.
## IT IS NOT INTENDED TO BE MODIFIED.
if test -z "$BUILD_CMD"; then
BUILD_CMD="$(fc -nl -0 2>/dev/null || true)"
fi
## remove whitespaces before/after the actual command:
BUILD_CMD="$(echo "${BUILD_CMD}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
if test -z "$BUILD_CMD"; then
BUILD_CMD="$0"
fi
set -e
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
export CFLAGS='-O3'
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export TCC_COMMIT="${TCC_COMMIT:-mob}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
export CC="${CC:-gcc}"
echo " BUILD_CMD: \`$BUILD_CMD\`"
echo " CC: $CC"
echo "TCC_COMMIT: $TCC_COMMIT"
echo "TCC_FOLDER: \`$TCC_FOLDER\`"
echo ===============================================================
rm -rf tinycc/
rm -rf thirdparty/tcc.original/
rsync -a thirdparty/tcc/ thirdparty/tcc.original/
## rm -rf $TCC_FOLDER
pushd .
git clone https://repo.or.cz/tinycc.git
cd tinycc
git checkout $TCC_COMMIT
export TCC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
./configure \
--prefix=$TCC_FOLDER \
--bindir=$TCC_FOLDER \
--crtprefix=$TCC_FOLDER/lib:/usr/lib:/usr/lib64 \
--sysincludepaths=$TCC_FOLDER/lib/tcc/include:/usr/local/include:/usr/include \
--libpaths=$TCC_FOLDER/lib/tcc:$TCC_FOLDER/lib:/usr/lib64:/usr/lib:/lib:/usr/local/lib \
--cc="$CC" \
--extra-cflags="$CFLAGS" \
--config-backtrace=yes \
--config-bcheck=yes \
--debug
## --extra-ldflags="-L/usr/home/ec2-user/v/tinycc -ltcc" \
gmake
gmake install
popd
rsync -a --delete tinycc/$TCC_FOLDER/ $TCC_FOLDER/
rsync -a thirdparty/tcc.original/.git/ $TCC_FOLDER/.git/
rsync -a thirdparty/tcc.original/lib/libgc* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/lib/build* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/README.md $TCC_FOLDER/README.md
rsync -a $CURRENT_SCRIPT_PATH $TCC_FOLDER/build.sh
mv $TCC_FOLDER/tcc $TCC_FOLDER/tcc.exe
date > $TCC_FOLDER/build_on_date.txt
echo $TCC_COMMIT_FULL_HASH > $TCC_FOLDER/build_source_hash.txt
$TCC_FOLDER/tcc.exe --version > $TCC_FOLDER/build_version.txt
uname -a > $TCC_FOLDER/build_machine_uname.txt
## show the builtin search paths for sanity checking:
$TCC_FOLDER/tcc.exe -v -v
pushd .
cd $TCC_FOLDER
git add .
git commit -m "build with \`$BUILD_CMD\`"
popd
echo "tcc commit: $TCC_COMMIT , full hash: $TCC_COMMIT_FULL_HASH ."
echo "The tcc executable is ready in $TCC_FOLDER/tcc.exe"
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
set -e
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export CC="${CC:-gcc}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc}"
export LIBGC_COMMIT="${LIBGC_COMMIT:-master}"
mkdir -p $TCC_FOLDER/lib/
echo " CC: $CC"
echo " TCC_FOLDER: $TCC_FOLDER"
echo "LIBGC_COMMIT: $LIBGC_COMMIT"
echo ===============================================================
rm -rf bdwgc/
pushd .
git clone https://github.com/ivmai/bdwgc
cd bdwgc/
git checkout $LIBGC_COMMIT
export LIBGC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
./autogen.sh
CC=$CC CFLAGS='-Os -mtune=generic -fPIC' LDFLAGS='-Os -fPIC' ./configure \
--disable-dependency-tracking \
--disable-docs \
--enable-handle-fork=yes \
--enable-rwlock \
--enable-threads=pthreads \
--enable-static \
--enable-shared=no \
--enable-parallel-mark \
--enable-single-obj-compilation \
--enable-gc-debug \
--with-libatomic-ops=yes \
--enable-sigrt-signals
make
popd
cp bdwgc/.libs/libgc.a $TCC_FOLDER/lib/libgc.a
date > $TCC_FOLDER/lib/libgc_build_on_date.txt
echo $LIBGC_COMMIT_FULL_HASH > $TCC_FOLDER/lib/libgc_build_source_hash.txt
uname -a > $TCC_FOLDER/lib/libgc_build_machine_uname.txt
ls -la $TCC_FOLDER/lib/libgc.a
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,0 +1,98 @@
## NOTE: this script does *not* use a shebang **deliberately**, in order to
## access the same shell, to capture its own launching command with `fc`,
## and to record it later in the new commit message in thirdpart/tcc.
## WARNING: THE ORIGINAL OF THIS SCRIPT IS IN:
## https://github.com/vlang/v/blob/master/thirdparty/build_scripts/thirdparty-linux-amd64_tcc.sh ,
## I.E. IN THE MAIN V REPOSITORY. IF YOU NEED TO MAKE CHANGES, CHANGE THAT.
##
## THE `build.sh` FILE IN `vlang/tccbin` REPO IS A COPY, RECORDED AT THE TIME
## OF REBUILDING, FOR EASIER/RELIABLE REPRODUCTION OF HISTORIC VERSIONS.
## IT IS NOT INTENDED TO BE MODIFIED.
if test -z "$BUILD_CMD"; then
BUILD_CMD="$(fc -nl -0 2>/dev/null || true)"
fi
## remove whitespaces before/after the actual command:
BUILD_CMD="$(echo "${BUILD_CMD}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
if test -z "$BUILD_CMD"; then
BUILD_CMD="$0"
fi
set -e
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export TCC_COMMIT="${TCC_COMMIT:-mob}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
export CC="${CC:-gcc}"
echo " BUILD_CMD: \`$BUILD_CMD\`"
echo " CC: $CC"
echo "TCC_COMMIT: $TCC_COMMIT"
echo "TCC_FOLDER: \`$TCC_FOLDER\`"
echo ===============================================================
rm -rf tinycc/
rm -rf thirdparty/tcc.original/
rsync -a thirdparty/tcc/ thirdparty/tcc.original/
## rm -rf $TCC_FOLDER
pushd .
git clone https://repo.or.cz/tinycc.git
cd tinycc
git checkout $TCC_COMMIT
export TCC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
## Note: crt1.o is located in:
## /usr/lib/x86_64-linux-gnu on Debian/Ubuntu
## /usr/lib64 on Redhat/CentOS
## /usr/lib on ArchLinux
./configure \
--prefix=$TCC_FOLDER \
--bindir=$TCC_FOLDER \
--crtprefix=$TCC_FOLDER/lib:/usr/lib/x86_64-linux-gnu:/usr/lib64:/usr/lib:/lib/x86_64-linux-gnu:/lib \
--libpaths=$TCC_FOLDER/lib/tcc:$TCC_FOLDER/lib:/usr/lib/x86_64-linux-gnu:/usr/lib64:/usr/lib:/lib/x86_64-linux-gnu:/lib:/usr/local/lib/x86_64-linux-gnu:/usr/local/lib \
--cc=$CC \
--extra-cflags=-O3 \
--config-bcheck=yes \
--config-backtrace=yes \
--debug
make
make install
popd
rsync -a --delete tinycc/$TCC_FOLDER/ $TCC_FOLDER/
rsync -a thirdparty/tcc.original/.git/ $TCC_FOLDER/.git/
rsync -a thirdparty/tcc.original/lib/libgc* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/lib/build* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/README.md $TCC_FOLDER/README.md
rsync -a $CURRENT_SCRIPT_PATH $TCC_FOLDER/build.sh
mv $TCC_FOLDER/tcc $TCC_FOLDER/tcc.exe
date > $TCC_FOLDER/build_on_date.txt
echo $TCC_COMMIT_FULL_HASH > $TCC_FOLDER/build_source_hash.txt
$TCC_FOLDER/tcc.exe --version > $TCC_FOLDER/build_version.txt
uname -a > $TCC_FOLDER/build_machine_uname.txt
## show the builtin search paths for sanity checking:
$TCC_FOLDER/tcc.exe -v -v
pushd .
cd $TCC_FOLDER
git add .
git commit -m "build with \`$BUILD_CMD\`"
popd
echo "tcc commit: $TCC_COMMIT , full hash: $TCC_COMMIT_FULL_HASH . The tcc executable is ready in $TCC_FOLDER/tcc.exe "
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
# NOTE: The configure step may require:
# sudo apt-get install libatomic-ops-dev
set -e
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export CC="${CC:-gcc}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc}"
export LIBGC_COMMIT="${LIBGC_COMMIT:-master}"
mkdir -p $TCC_FOLDER/lib/
echo " CC: $CC"
echo " TCC_FOLDER: $TCC_FOLDER"
echo "LIBGC_COMMIT: $LIBGC_COMMIT"
echo ===============================================================
rm -rf bdwgc/
pushd .
git clone https://github.com/ivmai/bdwgc
cd bdwgc/
git checkout $LIBGC_COMMIT
export LIBGC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
./autogen.sh
CC=$CC CFLAGS='-fPIC' LDFLAGS='-fPIC' ./configure \
--disable-dependency-tracking \
--disable-docs \
--enable-handle-fork=yes \
--enable-rwlock \
--enable-threads=pthreads \
--enable-static \
--enable-shared=no \
--enable-parallel-mark \
--enable-single-obj-compilation \
--enable-gc-debug \
--with-libatomic-ops=yes \
--enable-sigrt-signals
make
popd
cp bdwgc/.libs/libgc.a $TCC_FOLDER/lib/libgc.a
date > $TCC_FOLDER/lib/libgc_build_on_date.txt
echo $LIBGC_COMMIT_FULL_HASH > $TCC_FOLDER/lib/libgc_build_source_hash.txt
uname -a > $TCC_FOLDER/lib/libgc_build_machine_uname.txt
ls -la $TCC_FOLDER/lib/libgc.a
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,0 +1,114 @@
## NOTE: this script does *not* use a shebang **deliberately**, in order to
## access the same shell, to capture its own launching command with `fc`,
## and to record it later in the new commit message in thirdpart/tcc.
## WARNING: THE ORIGINAL OF THIS SCRIPT IS IN:
## https://github.com/vlang/v/blob/master/thirdparty/build_scripts/thirdparty-macos-amd64_tcc.sh ,
## I.E. IN THE MAIN V REPOSITORY. IF YOU NEED TO MAKE CHANGES, CHANGE THAT.
##
## THE `build.sh` FILE IN `vlang/tccbin` REPO IS A COPY, RECORDED AT THE TIME
## OF REBUILDING, FOR EASIER/RELIABLE REPRODUCTION OF HISTORIC VERSIONS.
## IT IS NOT INTENDED TO BE MODIFIED.
if test -z "$BUILD_CMD"; then
BUILD_CMD="$(fc -nl -0 2>/dev/null || true)"
fi
## remove whitespaces before/after the actual command:
BUILD_CMD="$(echo "${BUILD_CMD}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
if test -z "$BUILD_CMD"; then
BUILD_CMD="$0"
fi
set -e
## make sure that commands use English in their output, instead of the local system's local:
export LANG=C
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
export CFLAGS='-O3'
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export TCC_COMMIT="${TCC_COMMIT:-mob}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
export CC="${CC:-clang}"
echo " BUILD_CMD: \`$BUILD_CMD\`"
echo " CC: $CC"
echo "TCC_COMMIT: $TCC_COMMIT"
echo "TCC_FOLDER: \`$TCC_FOLDER\`"
echo ===============================================================
rm -rf tinycc/
rm -rf thirdparty/tcc.original/
rsync -a thirdparty/tcc/ thirdparty/tcc.original/
## rm -rf $TCC_FOLDER
pushd .
git clone https://repo.or.cz/tinycc.git
cd tinycc
git checkout $TCC_COMMIT
export TCC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
### NB: the symlinks below are needed, to ensure proper support for bootstrapping tcc, otherwise backtraces will be disabled .
for i in include/*.h; do echo $i; ln -s $i $(basename $i); done
# --libdir=$TCC_FOLDER/lib \
./configure \
--prefix=$TCC_FOLDER \
--bindir=$TCC_FOLDER \
--tccdir=$TCC_FOLDER/lib \
--includedir=$TCC_FOLDER/include \
--crtprefix=$TCC_FOLDER/lib:/usr/lib \
--sysincludepaths=$TCC_FOLDER/include:$TCC_FOLDER/lib/include:/usr/local/include:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include \
--libpaths=$TCC_FOLDER/lib:/usr/local/lib:/usr/lib:/lib \
--config-new_macho=yes \
--config-codesign \
--cc="$CC" \
--extra-cflags="$CFLAGS" \
--config-bcheck=yes \
--config-backtrace=yes \
--enable-static \
--dwarf=5 \
--debug
gmake
gmake install
popd
rsync -a --delete tinycc/$TCC_FOLDER/* $TCC_FOLDER/
rsync -a thirdparty/tcc.original/.git/ $TCC_FOLDER/.git/
rsync -a thirdparty/tcc.original/lib/libgc* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/lib/build* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/README.md $TCC_FOLDER/README.md
rsync -a $CURRENT_SCRIPT_PATH $TCC_FOLDER/build.sh
mv $TCC_FOLDER/tcc $TCC_FOLDER/tcc.exe
date > $TCC_FOLDER/build_on_date.txt
echo $TCC_COMMIT_FULL_HASH > $TCC_FOLDER/build_source_hash.txt
$TCC_FOLDER/tcc.exe --version > $TCC_FOLDER/build_version.txt
uname -a > $TCC_FOLDER/build_machine_uname.txt
## needed for Big Sur
ln -s /System/DriverKit/usr/lib/libSystem.dylib $TCC_FOLDER/lib/libc.dylib
## show the builtin search paths for sanity checking:
$TCC_FOLDER/tcc.exe -v -v
pushd .
cd $TCC_FOLDER
git add .
git commit -m "build with \`$BUILD_CMD\`"
popd
echo "tcc commit: $TCC_COMMIT , full hash: $TCC_COMMIT_FULL_HASH ."
echo "The tcc executable is ready in $TCC_FOLDER/tcc.exe"
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
set -e
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
## ensure all output is in English, independent from the current user's local:
export LANG=C
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export CC="${CC:-gcc}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc}"
export LIBGC_COMMIT="${LIBGC_COMMIT:-master}"
mkdir -p $TCC_FOLDER/lib/
echo " CC: $CC"
echo " TCC_FOLDER: $TCC_FOLDER"
echo "LIBGC_COMMIT: $LIBGC_COMMIT"
echo ===============================================================
rm -rf bdwgc/
pushd .
git clone https://github.com/ivmai/bdwgc
cd bdwgc/
git checkout $LIBGC_COMMIT
export LIBGC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
git clone https://github.com/bdwgc/libatomic_ops
./autogen.sh
CC=$CC CFLAGS="-Os -mtune=generic -fPIC" LDFLAGS="-Os -fPIC" ./configure \
--disable-dependency-tracking \
--disable-docs \
--enable-static=yes \
--enable-shared=yes \
--enable-single-obj-compilation \
--enable-gc-debug \
--enable-large-config \
--enable-cplusplus \
--with-libatomic-ops=check \
--enable-sigrt-signals
make
cd .libs/
for dname in *.dylib; do
echo "Post processing ${dname} ..."
install_name_tool -id "@rpath/${dname}" $dname;
otool -D $dname;
done
popd
################################################################################################
date > $TCC_FOLDER/lib/libgc_build_on_date.txt
echo $LIBGC_COMMIT_FULL_HASH > $TCC_FOLDER/lib/libgc_build_source_hash.txt
uname -a > $TCC_FOLDER/lib/libgc_build_machine_uname.txt
echo "$0" > $TCC_FOLDER/lib/libgc_build_cmd.txt
rsync -a bdwgc/.libs/ $TCC_FOLDER/lib/
ls -lad $TCC_FOLDER/lib/*
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,0 +1,114 @@
## NOTE: this script does *not* use a shebang **deliberately**, in order to
## access the same shell, to capture its own launching command with `fc`,
## and to record it later in the new commit message in thirdpart/tcc.
## WARNING: THE ORIGINAL OF THIS SCRIPT IS IN:
## https://github.com/vlang/v/blob/master/thirdparty/build_scripts/thirdparty-macos-arm64_tcc.sh ,
## I.E. IN THE MAIN V REPOSITORY. IF YOU NEED TO MAKE CHANGES, CHANGE THAT.
##
## THE `build.sh` FILE IN `vlang/tccbin` REPO IS A COPY, RECORDED AT THE TIME
## OF REBUILDING, FOR EASIER/RELIABLE REPRODUCTION OF HISTORIC VERSIONS.
## IT IS NOT INTENDED TO BE MODIFIED.
if test -z "$BUILD_CMD"; then
BUILD_CMD="$(fc -nl -0 2>/dev/null || true)"
fi
## remove whitespaces before/after the actual command:
BUILD_CMD="$(echo "${BUILD_CMD}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
if test -z "$BUILD_CMD"; then
BUILD_CMD="$0"
fi
set -e
## make sure that commands use English in their output, instead of the local system's local:
export LANG=C
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
export CFLAGS='-O3'
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export TCC_COMMIT="${TCC_COMMIT:-mob}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
export CC="${CC:-clang}"
echo " BUILD_CMD: \`$BUILD_CMD\`"
echo " CC: $CC"
echo "TCC_COMMIT: $TCC_COMMIT"
echo "TCC_FOLDER: \`$TCC_FOLDER\`"
echo ===============================================================
rm -rf tinycc/
rm -rf thirdparty/tcc.original/
rsync -a thirdparty/tcc/ thirdparty/tcc.original/
## rm -rf $TCC_FOLDER
pushd .
git clone https://repo.or.cz/tinycc.git
cd tinycc
git checkout $TCC_COMMIT
export TCC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
### NB: the symlinks below are needed, to ensure proper support for bootstrapping tcc, otherwise backtraces will be disabled .
for i in include/*.h; do echo $i; ln -s $i $(basename $i); done
# --libdir=$TCC_FOLDER/lib \
./configure \
--prefix=$TCC_FOLDER \
--bindir=$TCC_FOLDER \
--tccdir=$TCC_FOLDER/lib \
--includedir=$TCC_FOLDER/include \
--crtprefix=$TCC_FOLDER/lib:/usr/lib \
--sysincludepaths=$TCC_FOLDER/include:$TCC_FOLDER/lib/include:/usr/local/include:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include \
--libpaths=$TCC_FOLDER/lib:/usr/local/lib:/usr/lib:/lib \
--config-new_macho=yes \
--config-codesign \
--cc="$CC" \
--extra-cflags="$CFLAGS" \
--config-bcheck=yes \
--config-backtrace=yes \
--enable-static \
--dwarf=5 \
--debug
gmake
gmake install
popd
rsync -a --delete tinycc/$TCC_FOLDER/* $TCC_FOLDER/
rsync -a thirdparty/tcc.original/.git/ $TCC_FOLDER/.git/
rsync -a thirdparty/tcc.original/lib/libgc* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/lib/build* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/README.md $TCC_FOLDER/README.md
rsync -a $CURRENT_SCRIPT_PATH $TCC_FOLDER/build.sh
mv $TCC_FOLDER/tcc $TCC_FOLDER/tcc.exe
date > $TCC_FOLDER/build_on_date.txt
echo $TCC_COMMIT_FULL_HASH > $TCC_FOLDER/build_source_hash.txt
$TCC_FOLDER/tcc.exe --version > $TCC_FOLDER/build_version.txt
uname -a > $TCC_FOLDER/build_machine_uname.txt
## needed for Big Sur
ln -s /System/DriverKit/usr/lib/libSystem.dylib $TCC_FOLDER/lib/libc.dylib
## show the builtin search paths for sanity checking:
$TCC_FOLDER/tcc.exe -v -v
pushd .
cd $TCC_FOLDER
git add .
git commit -m "build with \`$BUILD_CMD\`"
popd
echo "tcc commit: $TCC_COMMIT , full hash: $TCC_COMMIT_FULL_HASH ."
echo "The tcc executable is ready in $TCC_FOLDER/tcc.exe"
@@ -0,0 +1,95 @@
## NOTE: this script does *not* use a shebang **deliberately**, in order to
## access the same shell, to capture its own launching command with `fc`,
## and to record it later in the new commit message in thirdpart/tcc.
## WARNING: THE ORIGINAL OF THIS SCRIPT IS IN:
## https://github.com/vlang/v/blob/master/thirdparty/build_scripts/thirdparty-openbsd-amd64_tcc.sh ,
## I.E. IN THE MAIN V REPOSITORY. IF YOU NEED TO MAKE CHANGES, CHANGE THAT.
##
## THE `build.sh` FILE IN `vlang/tccbin` REPO IS A COPY, RECORDED AT THE TIME
## OF REBUILDING, FOR EASIER/RELIABLE REPRODUCTION OF HISTORIC VERSIONS.
## IT IS NOT INTENDED TO BE MODIFIED.
if test -z "$BUILD_CMD"; then
BUILD_CMD="$(fc -nl -0 2>/dev/null || true)"
fi
## remove whitespaces before/after the actual command:
BUILD_CMD="$(echo "${BUILD_CMD}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
if test -z "$BUILD_CMD"; then
BUILD_CMD="$0"
fi
set -e
if ! test -f vlib/v/compiler_errors_test.v; then
echo "this script should be run in V's main repo folder!"
exit 1
fi
export CFLAGS='-O3'
export CURRENT_SCRIPT_PATH=$(realpath "$0")
export TCC_COMMIT="${TCC_COMMIT:-mob}"
export TCC_FOLDER="${TCC_FOLDER:-thirdparty/tcc.$TCC_COMMIT}"
export CC="${CC:-clang}"
echo " BUILD_CMD: \`$BUILD_CMD\`"
echo " CC: $CC"
echo "TCC_COMMIT: $TCC_COMMIT"
echo "TCC_FOLDER: \`$TCC_FOLDER\`"
echo ===============================================================
rm -rf tinycc/
rm -rf thirdparty/tcc.original/
rsync -a thirdparty/tcc/ thirdparty/tcc.original/
pushd .
git clone https://repo.or.cz/tinycc.git
cd tinycc
git checkout $TCC_COMMIT
export TCC_COMMIT_FULL_HASH=$(git rev-parse HEAD)
./configure \
--prefix=$TCC_FOLDER \
--bindir=$TCC_FOLDER \
--crtprefix=$TCC_FOLDER/lib:/usr/lib \
--sysincludepaths=$TCC_FOLDER/lib/tcc/include:/usr/local/include:/usr/include \
--libpaths=$TCC_FOLDER/lib/tcc:$TCC_FOLDER/lib:/usr/lib:/usr/local/lib \
--cc="$CC" \
--extra-cflags="$CFLAGS" \
--config-backtrace=yes \
--config-bcheck=yes \
--debug
gmake
gmake install
popd
rsync -a --delete tinycc/$TCC_FOLDER/ $TCC_FOLDER/
rsync -a thirdparty/tcc.original/.git/ $TCC_FOLDER/.git/
# rsync -a thirdparty/tcc.original/lib/libgc* $TCC_FOLDER/lib/
# rsync -a thirdparty/tcc.original/lib/build* $TCC_FOLDER/lib/
rsync -a thirdparty/tcc.original/README.md $TCC_FOLDER/README.md
rsync -a $CURRENT_SCRIPT_PATH $TCC_FOLDER/build.sh
mv $TCC_FOLDER/tcc $TCC_FOLDER/tcc.exe
date > $TCC_FOLDER/build_on_date.txt
echo $TCC_COMMIT_FULL_HASH > $TCC_FOLDER/build_source_hash.txt
$TCC_FOLDER/tcc.exe --version > $TCC_FOLDER/build_version.txt
uname -a > $TCC_FOLDER/build_machine_uname.txt
## show the builtin search paths for sanity checking:
$TCC_FOLDER/tcc.exe -v -v
pushd .
cd $TCC_FOLDER
git add .
git commit -m "build with \`$BUILD_CMD\`"
popd
echo "tcc commit: $TCC_COMMIT , full hash: $TCC_COMMIT_FULL_HASH ."
echo "The tcc executable is ready in $TCC_FOLDER/tcc.exe"