From 71764b6d4cdee1f74cfc603050ced59009950169 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Fri, 13 Jan 2023 11:32:52 +1000 Subject: [PATCH] makepkg.conf: allow configuration additions via a subdirectory Move rust related buildflags to their own configuration file to provide an example of how other languages could be supported. Signed-off-by: Allan McRae --- etc/makepkg.conf.d/rust.conf.in | 11 +++++++++++ etc/makepkg.conf.in | 2 -- meson.build | 6 ++++++ scripts/libmakepkg/util/config.sh.in | 5 +++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 etc/makepkg.conf.d/rust.conf.in diff --git a/etc/makepkg.conf.d/rust.conf.in b/etc/makepkg.conf.d/rust.conf.in new file mode 100644 index 00000000..003be6a9 --- /dev/null +++ b/etc/makepkg.conf.d/rust.conf.in @@ -0,0 +1,11 @@ +#!/hint/bash +# +# @sysconfdir@/makepkg.conf.d/rust.conf +# + +######################################################################### +# RUST LANGUAGE SUPPORT +######################################################################### +# +#RUSTFLAGS="-C opt-level=2" +#DEBUG_RUSTFLAGS="-C debuginfo=2" diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index edc5f442..90d3f20a 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -42,13 +42,11 @@ CHOST="@CHOST@" #CXXFLAGS="-O2 -pipe" #LDFLAGS="" #LTOFLAGS="-flto" -#RUSTFLAGS="-C opt-level=2" #-- Make Flags: change this for DistCC/SMP systems #MAKEFLAGS="-j2" #-- Debugging flags #DEBUG_CFLAGS="-g" #DEBUG_CXXFLAGS="-g" -#DEBUG_RUSTFLAGS="-C debuginfo=2" ######################################################################### # BUILD ENVIRONMENT diff --git a/meson.build b/meson.build index 4fd92d3f..89712c97 100644 --- a/meson.build +++ b/meson.build @@ -401,6 +401,12 @@ configure_file( configuration : substs, install_dir : SYSCONFDIR) +configure_file( + input : 'etc/makepkg.conf.d/rust.conf.in', + output : 'rust.conf', + configuration : substs, + install_dir : join_paths(SYSCONFDIR, 'makepkg.conf.d/')) + configure_file( input : 'etc/pacman.conf.in', output : 'pacman.conf', diff --git a/scripts/libmakepkg/util/config.sh.in b/scripts/libmakepkg/util/config.sh.in index f38e5c83..2045fa9e 100644 --- a/scripts/libmakepkg/util/config.sh.in +++ b/scripts/libmakepkg/util/config.sh.in @@ -37,6 +37,11 @@ source_makepkg_config() { # Source the config file; fail if it is not found if [[ -r $MAKEPKG_CONF ]]; then source_safe "$MAKEPKG_CONF" + if [[ -d "$MAKEPKG_CONF.d" ]]; then + for c in "$MAKEPKG_CONF.d"/*.conf; do + source_safe $c + done + fi else error "$(gettext "%s not found.")" "$MAKEPKG_CONF" plainerr "$(gettext "Aborting...")"