summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-10-20 16:39:46 +0000
committerCoprDistGit <infra@openeuler.org>2024-10-20 16:39:46 +0000
commitcd1ea5cb068fba2a8880050990b9c1a944404bae (patch)
tree1bfb1f88212baa4b26342c68dbe8bd209c130783 /macros
parent4953fcc6090531a3281b0ab338392a129a8842d9 (diff)
automatic import of openEuler-rpm-config
Diffstat (limited to 'macros')
-rw-r--r--macros34
1 files changed, 32 insertions, 2 deletions
diff --git a/macros b/macros
index aec7a31..1ee4a4d 100644
--- a/macros
+++ b/macros
@@ -106,6 +106,31 @@
%[0%{?_auto_set_build_cc} ? "%{set_build_cc}" : ""] \
%[0%{?_auto_set_build_flags} ? "%{set_build_flags}" : ""]
+# Internal-only. Do not use. Expand a variable and strip the flags
+# not suitable to extension builders.
+%__extension_strip_flags() %{lua:
+--the only argument to this macro is the "name" of the flags we strip (e.g. cflags, ldflags, etc.)
+local name = rpm.expand("%{1}")
+--store all the individual flags in a variable as a continuous string
+local flags = rpm.expand("%{build_" .. name .. "}")
+--create an empty table for the minimal set of flags we wanna preserve
+local stripped_flags = { }
+--iterate over the individual flags and store the ones we want in the table as unique keys
+for flag in flags:gmatch("%S+") do
+ if flag:find("^%-fexceptions") or flag:find("^%-fcf%-protection") then
+ stripped_flags[flag] = true end
+ end
+--print out the finalized set of flags for use by the extension builders
+for k,_ in pairs(stripped_flags) do print(k .. " ") end
+}
+
+# Variants of CFLAGS, CXXFLAGS, FFLAGS, LDFLAGS for use within
+# extension builders.
+%extension_cflags %{__extension_strip_flags cflags}
+%extension_cxxflags %{__extension_strip_flags cxxflags}
+%extension_fflags %{__extension_strip_flags fflags}
+%extension_ldflags %{__extension_strip_flags ldflags}
+
#For backwards compatibility only.
%__global_cflags %{build_cflags}
%__global_cxxflags %{build_cxxflags}
@@ -217,6 +242,9 @@
# ---- Expanded at end of %install scriptlet.
%__arch_install_post /usr/lib/rpm/check-buildroot
+# Default extension to use (for man pages and info files)
+%_extension .gz
+
# Build root policy macros. Standard naming:
# convert all '-' in basename to '_', add two leading underscores.
%__brp_chrpath /usr/lib/rpm/brp-chrpath %{buildroot}
@@ -426,8 +454,10 @@ sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%delete_la_and_a \
-find "$RPM_BUILD_ROOT" -type f,l -name '*.la' 2>/dev/null -print0 | xargs -0 grep --fixed-strings '.la - a libtool library file' --files-with-matches --null | xargs -0 rm --force \
-find "$RPM_BUILD_ROOT" -type f,l -name "*.a" -delete
+find "$RPM_BUILD_ROOT" -type l -name '*.la' 2>/dev/null -print0 | xargs -0 grep --fixed-strings '.la - a libtool library file' --files-with-matches --null | xargs -0 rm --force \
+find "$RPM_BUILD_ROOT" -type f -name '*.la' 2>/dev/null -print0 | xargs -0 grep --fixed-strings '.la - a libtool library file' --files-with-matches --null | xargs -0 rm --force \
+find "$RPM_BUILD_ROOT" -type l -name "*.a" -delete \
+find "$RPM_BUILD_ROOT" -type f -name "*.a" -delete
%delete_la %{nil}