summaryrefslogtreecommitdiff
path: root/macros.extension
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-10-25 03:16:35 +0000
committerCoprDistGit <infra@openeuler.org>2024-10-25 03:16:35 +0000
commit82da4aaf5636a13119dcd387c7dafaaf47cc9c28 (patch)
treec9e5b62552367f2fb373bb073766dadfacbb4d53 /macros.extension
parent34d0ba766b3725539dc1199fc145cf704462d5a2 (diff)
automatic import of openEuler-rpm-config
Diffstat (limited to 'macros.extension')
-rw-r--r--macros.extension24
1 files changed, 24 insertions, 0 deletions
diff --git a/macros.extension b/macros.extension
new file mode 100644
index 0000000..8118708
--- /dev/null
+++ b/macros.extension
@@ -0,0 +1,24 @@
+# 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}