From 491f3e060a709ccb33ed119923a0be8bd7fc48fc Mon Sep 17 00:00:00 2001 From: Yingjie Wang Date: Tue, 25 Mar 2025 18:20:26 -0400 Subject: [PATCH] feat: add CFLAGS support --- leaf | 10 ++++++++++ leaf.conf | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/leaf b/leaf index dcc0752..182af14 100755 --- a/leaf +++ b/leaf @@ -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" diff --git a/leaf.conf b/leaf.conf index 9600d45..825721a 100644 --- a/leaf.conf +++ b/leaf.conf @@ -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"