feat: add CFLAGS support

This commit is contained in:
Yingjie Wang 2025-03-25 18:20:26 -04:00
parent eed2162309
commit 491f3e060a
2 changed files with 18 additions and 0 deletions

10
leaf
View File

@ -19,6 +19,10 @@ fi
export MAKEFLAGS="-j${PARALLEL_JOBS}"
export NINJAJOBS="${PARALLEL_JOBS}"
export LC_ALL=C
export leaf_flags="CFLAGS CXXFLAGS FCFLAGS FFLAGS RUSTFLAGS"
for flag in ${leaf_flags}; do
export $flag
done
declare -A BUILD_OPTIONS
BUILD_OPTIONS=([strip]="0" [libtool]="0" [zipman]="0")
@ -80,6 +84,12 @@ main() {
fi
}
leaf_clear_flags() {
for flag in $leaf_flags; do
unset $flag
done
}
leaf_check_directories() {
if [ -z "${BUILD_DIR}" ]; then
leaf_error "Directory \${BUILD_DIR} must be existed"

View File

@ -15,3 +15,11 @@ COMPRESS_PROG="zstd -19 -T0"
BINARY_EXT=".pkg.tar.zst"
ENABLE_DEBUG_TREE="true"
COMMON_FLAGS="-pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native"