diff options
-rw-r--r-- | brp-clean-perl-files | 5 | ||||
-rw-r--r-- | macros | 27 | ||||
-rw-r--r-- | macros.extension | 24 | ||||
-rw-r--r-- | openEuler-rpm-config.spec | 11 |
4 files changed, 38 insertions, 29 deletions
diff --git a/brp-clean-perl-files b/brp-clean-perl-files new file mode 100644 index 0000000..92c7c7d --- /dev/null +++ b/brp-clean-perl-files @@ -0,0 +1,5 @@ +#!/bin/sh + +find $RPM_BUILD_ROOT/usr/{lib,lib64,share}/perl5 -type f -name ".packlist" -delete +find $RPM_BUILD_ROOT/usr/{lib,lib64,share}/perl5 -type f -name "*.bs" -size 0 -delete +find $RPM_BUILD_ROOT/%{perl_archlib}/perllocal.pod -delete @@ -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} @@ -234,6 +259,7 @@ %__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink %__brp_remove_la_files /usr/lib/rpm/brp-remove-la-files %__brp_remove_info_dir /usr/lib/rpm/brp-remove-info-dir +%__brp_clean_perl_files /usr/lib/rpm/brp-clean-perl-files %__os_install_post \ %{?__brp_ldconfig} \ @@ -247,6 +273,7 @@ %{?__brp_check_elf_files} \ %{?__brp_remove_la_files} \ %{?__brp_remove_info_dir} \ + %{?__brp_clean_perl_files} \ %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \ %{?__brp_python_hardlink} \ %{nil} diff --git a/macros.extension b/macros.extension deleted file mode 100644 index 8118708..0000000 --- a/macros.extension +++ /dev/null @@ -1,24 +0,0 @@ -# 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} diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec index 33bbeb0..b721b52 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -30,7 +30,6 @@ Source101: macros.forge Source102: macros.go Source103: macros.python Source104: macros.kmp -Source105: macros.extension # Dependency generator scripts Source200: find-requires.ksyms @@ -56,6 +55,7 @@ Source703: brp-ldconfig Source704: brp-remove-info-dir Source705: brp-check-elf-files Source706: brp-strip-lto +Source707: brp-clean-perl-files # Convenience lua functions Source800: common.lua @@ -147,13 +147,13 @@ install -p -m 755 -t %{buildroot}%{rpmvdir} find-requires* install -p -m 755 -t %{buildroot}%{rpmvdir} find-provides* mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d -install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d/ macros.* +install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d/ macros.perl macros.python macros.go macros.forge macros.kmp mkdir -p %{buildroot}%{_fileattrsdir} install -p -m 644 -t %{buildroot}%{_fileattrsdir} *.attr mkdir -p %{buildroot}%{_rpmluadir}/%{_vendor}/{rpm,srpm} -install -p -m 644 -t %{buildroot}%{_rpmluadir}/%{_vendor} *.lua +install -p -m 644 -t %{buildroot}%{_rpmluadir}/%{_vendor} common.lua # Adaptive according to vendor sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir}` @@ -179,8 +179,9 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %{rpmvdir}/find-requires.ksyms %changelog -* Thu Oct 24 2024 Funda Wang <fundawang@yeah.net> - 31-7 -- add python.lua from fedora +* Sat Oct 26 2024 Funda Wang <fundawang@yeah.net> - 31-7 +- remove useless perl .packlist, empty .bs files and + wrongly created perllocal.pod from buildroot * Sat Oct 19 2024 Funda Wang <fundawang@yeah.net> - 31-6 - add extension flags for python modules |