diff options
-rw-r--r-- | find-provides.nbdkit | 23 | ||||
-rw-r--r-- | fix-libtool-from-moving-options-after-libs | 12 | ||||
-rw-r--r-- | macros | 34 | ||||
-rw-r--r-- | nbdkit.attr | 3 | ||||
-rw-r--r-- | openEuler-rpm-config.spec | 13 |
5 files changed, 76 insertions, 9 deletions
diff --git a/find-provides.nbdkit b/find-provides.nbdkit new file mode 100644 index 0000000..7013ccd --- /dev/null +++ b/find-provides.nbdkit @@ -0,0 +1,23 @@ +#!/bin/bash - + +# Generate RPM provides automatically for nbdkit packages and filters. +# Copyright (C) 2009-2022 Red Hat Inc. + +# To test: +# find /usr/lib64/nbdkit/plugins | ./nbdkit-find-provides VER REL +# find /usr/lib64/nbdkit/filters | ./nbdkit-find-provides VER REL + +ver="$1" +rel="$2" + +function process_file +{ + if [[ $1 =~ /plugins/nbdkit-.*-plugin ]] || + [[ $1 =~ /filters/nbdkit-.*-filter ]]; then + echo "Provides:" "$(basename $1 .so)" "=" "$ver-$rel" + fi +} + +while read line; do + process_file "$line" +done diff --git a/fix-libtool-from-moving-options-after-libs b/fix-libtool-from-moving-options-after-libs index 134a2e3..1f4d5ad 100644 --- a/fix-libtool-from-moving-options-after-libs +++ b/fix-libtool-from-moving-options-after-libs @@ -1,15 +1,15 @@ #!/usr/bin/sh +# Copyright 2011-2023, Mageia +# Modified 2024, Funda Wang <fundawang@yeah.net> +# Licensed under GPL-2.0-or-later CONFIGURE_TOP="${1:-.}" if [ -e $CONFIGURE_TOP/configure ] && grep -q -F '$deplibs $compiler_flags' $CONFIGURE_TOP/configure; then - echo "Fixing libtool inside configure to pass -Wl,xxx options before libraries" - - # a similar patch has been applied in libtool in libtool package (#47273) - # but this works even if autoreconf is not called + echo "Fixing libtool inside configure to pass -Wl,xxx options earliest" sed -i \ - -e 's,$deplibs $compiler_flags,$compiler_flags $deplibs,' \ - -e 's,$deplibs $postdep_objects $compiler_flags,$compiler_flags $deplibs $postdep_objects,' \ + -e 's,$libobjs $deplibs $compiler_flags,$compiler_flags $libobjs $deplibs,' \ + -e 's,$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags,$compiler_flags $predep_objects $libobjs $deplibs $postdep_objects,' \ $CONFIGURE_TOP/configure fi @@ -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} diff --git a/nbdkit.attr b/nbdkit.attr new file mode 100644 index 0000000..1053e1a --- /dev/null +++ b/nbdkit.attr @@ -0,0 +1,3 @@ +%__nbdkit_provides %{_rpmconfigdir}/@VENDOR@/find-provides.nbdkit %{version} %{release} +%__nbdkit_path %{_libdir}/nbdkit/(plugins|filters)/nbdkit-.*-(plugin|filter)(\.so)?$ +%__nbdkit_flags exeonly diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec index dbe593c..d044886 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -3,7 +3,7 @@ Name: %{vendor}-rpm-config Version: 31 -Release: 666 +Release: 6 License: GPL+ Summary: specific rpm configuration files URL: https://gitee.com/src-openeuler/openEuler-rpm-config @@ -35,6 +35,8 @@ Source104: macros.kmp Source200: find-requires.ksyms Source201: infopages.attr Source202: manpages.attr +Source203: nbdkit.attr +Source204: find-provides.nbdkit # Misc helper scripts Source300: kmodtool @@ -71,6 +73,7 @@ Provides: perl-srpm-macros = 1-28 Provides: rust-srpm-macros = 10-1 Provides: go-srpm-macros = 2-18 Provides: perl-macros = 4:5.32.0-1 +Provides: nbdkit-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: perl-macros < 4:5.32.0-1 Obsoletes: python-rpm-macros < %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: python2-rpm-macros < %{?epoch:%{epoch}:}%{version}-%{release} @@ -140,6 +143,7 @@ install -p -m 644 -t %{buildroot}%{_rpmconfigdir} generic-* install -p -m 755 -t %{buildroot}%{_rpmconfigdir} fix-libtool-from-moving-options-after-libs install -p -m 755 -t %{buildroot}%{rpmvdir} kmodtool 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.perl macros.python macros.go macros.forge macros.kmp @@ -159,6 +163,7 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %{rpmvdir}/rpmrc %{_rpmconfigdir}/brp-* %{rpmvdir}/config.* +%{rpmvdir}/find-provides.nbdkit %{_rpmconfigdir}/generic-* %{_rpmconfigdir}/fix-libtool-from-moving-options-after-libs %{_fileattrsdir}/*.attr @@ -173,10 +178,16 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %{rpmvdir}/find-requires.ksyms %changelog +* Sat Oct 19 2024 Funda Wang <fundawang@yeah.net> - 31-6 +- add extension flags for python modules + * Thu Sep 19 2024 Funda Wang <fundawang@yeah.net> - 31-5 - Drop symlinks of .la and .a also - move hardcode requires on man and info to file attrs - add helper script for mageia to fix libtool linking order +- disable info dir generatiion by setting AM_UPDATE_INFO_DIR=no +- add helper macro for extensions of man pages and info pages +- add helper scripts for nbdkit * Fri Sep 06 2024 Funda Wang <fudnawang@yeah.net> - 31-4 - Enable LTO by default |