Skip to content

Commit

Permalink
refactor and make build prefix constant & independent from src folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ludvigch committed Feb 18, 2025
1 parent b97ba2c commit 9e4f3a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/scripts/ddc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

# globals
cwd=$(pwd)
build_dir=$(realpath "./build")
build_dir=/tmp/build
prefix=${build_dir}/tcc-root
ln_location=${build_dir}/tcc-root
log_file=/tmp/${ddc_env}.txt

# default config
untrusted_cc="tcc"
Expand Down Expand Up @@ -45,13 +48,12 @@ EOF
# self-regeneration of untrusted compiler
tar xvf ./tcc_src/"tinycc-f6385c0.tar.gz" 1> /dev/null
cd tinycc-f6385c0
prefix=$(pwd)/tcc-root
make clean
./configure --cc="${build_dir}/gcc-tcc/bin/tcc" --prefix=${prefix} --extra-ldflags=${extra_flags}
make
objcopy -D libtcc.a
make install DESTDIR=${build_dir}/cp-tcc
ln -sfT ${build_dir}/cp-tcc${prefix} ./tcc-root
ln -sfT ${build_dir}/cp-tcc${prefix} ${ln_location}
make clean
./configure --cc=${build_dir}/cp-tcc${prefix}/bin/tcc --prefix=${prefix} --extra-ldflags=${extra_flags}
make
Expand All @@ -63,14 +65,13 @@ make clean
make
objcopy -D libtcc.a
make install DESTDIR=${build_dir}/stage1-tcc
ln -sfT ${build_dir}/stage1-tcc${prefix} ./tcc-root
ln -sfT ${build_dir}/stage1-tcc${prefix} ${ln_location}
./configure --cc=${build_dir}/stage1-tcc${prefix}/bin/tcc --prefix=${prefix} --extra-ldflags=${extra_flags}
make
objcopy -D libtcc.a
make install DESTDIR=${build_dir}/stage2-tcc
# save & print hashes
log_file=/tmp/${ddc_env}.txt
echo "***********${ddc_env}***********" >> ${log_file}
echo "***********${ddc_env}***********" > ${log_file}
echo "___________BINARIES___________" >> ${log_file}
sha256sum ${build_dir}/cp-tcc${prefix}/bin/tcc ${build_dir}/ca-tcc${prefix}/bin/tcc ${build_dir}/stage2-tcc${prefix}/bin/tcc >> ${log_file}
echo "___________LIBTCC___________" >> ${log_file}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bin_dir="${bin_prefix}/bin"

# default config
compromise=false
build_dir=$(realpath "./build")
build_dir=/tmp/build
tcc_archive="tinycc-f6385c0.tar.gz"
extra_flags="-s -fno-stack-protector"

Expand Down

0 comments on commit 9e4f3a6

Please sign in to comment.