From d1acaafe7ff6ef29a8ddc6b749dad3c398aa84c1 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Sat, 5 Oct 2024 11:18:31 +0800 Subject: [PATCH] Drop symlinks of .la and .a also --- find-provides.nbdkit | 23 ++++++++++++++++++++ fix-libtool-from-moving-options-after-libs | 15 +++++++++++++ infopages.attr | 4 ++++ macros | 14 +++++++++--- manpages.attr | 4 ++++ nbdkit.attr | 3 +++ openEuler-rpm-config.spec | 25 +++++++++++++++++++--- 7 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 find-provides.nbdkit create mode 100644 fix-libtool-from-moving-options-after-libs create mode 100644 infopages.attr create mode 100644 manpages.attr create mode 100644 nbdkit.attr 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 new file mode 100644 index 0000000..1f4d5ad --- /dev/null +++ b/fix-libtool-from-moving-options-after-libs @@ -0,0 +1,15 @@ +#!/usr/bin/sh +# Copyright 2011-2023, Mageia +# Modified 2024, Funda Wang +# 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 earliest" + + sed -i \ + -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 + diff --git a/infopages.attr b/infopages.attr new file mode 100644 index 0000000..805c570 --- /dev/null +++ b/infopages.attr @@ -0,0 +1,4 @@ +%__infopages_requires() %{lua: + print(string.format("/usr/bin/info", rpm.expand("%1"))) +} +%__infopages_path ^%{_infodir}/.* diff --git a/macros b/macros index c44e1fe..832399b 100644 --- a/macros +++ b/macros @@ -172,9 +172,12 @@ diff -u $file.backup $file && mv $file.backup $file \ done +%__fix_libtool_from_moving_options_after_libs /usr/lib/rpm/fix-libtool-from-moving-options-after-libs $(dirname %{_configure}) + %configure \ %{set_build_flags}; \ [ "%{_lto_cflags}"x != x ] && %{_fix_broken_configure_for_lto}; \ + %{?_ld_as_needed:%{__fix_libtool_from_moving_options_after_libs} ;} \ [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \ [ -f /usr/lib/rpm/%{_vendor}/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/%{_vendor}/$(basename $i) $i ; \ done ; \ @@ -208,11 +211,15 @@ mkdir "$RPM_BUILD_ROOT"\ %[0%{?_auto_set_build_cc} ? "%{set_build_cc}" : ""]\ %[0%{?_auto_set_build_flags} ? "%{set_build_flags}" : ""]\ + export AM_UPDATE_INFO_DIR="no"\ %{nil} # ---- 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} @@ -422,8 +429,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 -name "*.la" -delete \ -find $RPM_BUILD_ROOT -type f -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} @@ -433,7 +442,6 @@ find $RPM_BUILD_ROOT -type f -name "*.a" -delete %package help \ Summary: Documents for %{name} \ Buildarch: noarch \ -Requires: man info \ \ %description help \ Man pages and other related documents for %{name}. diff --git a/manpages.attr b/manpages.attr new file mode 100644 index 0000000..6b4cbd7 --- /dev/null +++ b/manpages.attr @@ -0,0 +1,4 @@ +%__manpages_requires() %{lua: + print(string.format("/usr/bin/man", rpm.expand("%1"))) +} +%__manpages_path ^%{_mandir}/.* 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 d61dc6b..7d48a31 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -3,7 +3,7 @@ Name: %{vendor}-rpm-config Version: 31 -Release: 4 +Release: 5 License: GPL+ Summary: specific rpm configuration files URL: https://gitee.com/src-openeuler/openEuler-rpm-config @@ -33,10 +33,15 @@ Source104: macros.kmp # Dependency generator scripts Source200: find-requires.ksyms +Source201: infopages.attr +Source202: manpages.attr +Source203: nbdkit.attr +Source204: find-provides.nbdkit # Misc helper scripts Source300: kmodtool Source301: find-requires +Source303: fix-libtool-from-moving-options-after-libs # Snapshots from http://git.savannah.gnu.org/gitweb/?p=config.git Source500: config.guess @@ -68,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} @@ -134,13 +140,16 @@ install -p -m 644 -t %{buildroot}%{rpmvdir} macros rpmrc install -p -m 755 -t %{buildroot}%{rpmvdir} config.* install -p -m 755 -t %{buildroot}%{_rpmconfigdir} brp-* 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 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} common.lua @@ -154,8 +163,10 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %{rpmvdir}/rpmrc %{_rpmconfigdir}/brp-* %{rpmvdir}/config.* +%{rpmvdir}/find-provides.nbdkit %{_rpmconfigdir}/generic-* -%{_fileattrsdir}/ +%{_rpmconfigdir}/fix-libtool-from-moving-options-after-libs +%{_fileattrsdir}/*.attr %{_rpmconfigdir}/macros.d/ %{_rpmluadir}/%{_vendor}/*.lua %exclude %{_rpmconfigdir}/macros.d/macros.kmp @@ -167,6 +178,14 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %{rpmvdir}/find-requires.ksyms %changelog +* Thu Sep 19 2024 Funda Wang - 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 - 31-4 - Enable LTO by default @@ -292,7 +311,7 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir - update the definition of python3_version * Wed Oct 13 2021 wangkerong - 30-23 -- add common lua scripts resolve "%fontpkg" macro translation failure +- add common lua scripts resolve "%%fontpkg" macro translation failure * Sat Sep 4 2021 yangmingtai - 30-22 - add brp scripts to delete rpath -- Gitee