multilib-rpm-config/multilib-rpm-config.spec

109 lines
2.8 KiB
RPMSpec
Raw Normal View History

2019-12-14 18:58:22 +08:00
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
%{!?_licensedir:%global license %%doc}
Name: multilib-rpm-config
Summary: Multilib packaging helpers
Version: 1
2022-12-22 11:03:09 +08:00
Release: 16
2019-12-14 18:58:22 +08:00
License: GPLv2+
2020-07-15 16:45:00 +08:00
URL: https://fedoraproject.org/wiki/PackagingDrafts/MultilibTricks
2019-12-14 18:58:22 +08:00
2020-07-15 16:45:00 +08:00
Source0: https://src.fedoraproject.org/rpms/multilib-rpm-config/blob/master/f/multilib-fix
Source1: https://src.fedoraproject.org/rpms/multilib-rpm-config/blob/master/f/macros.ml
Source3: https://src.fedoraproject.org/rpms/multilib-rpm-config/blob/master/f/COPYING
2019-12-14 18:58:22 +08:00
Source4: multilib-library
2020-07-15 16:45:00 +08:00
Source5: https://src.fedoraproject.org/rpms/multilib-rpm-config/blob/master/f/multilib-info
2019-12-14 18:58:22 +08:00
BuildRequires: gcc
2022-12-22 11:03:09 +08:00
Requires: %{_vendor}-rpm-config
2019-12-14 18:58:22 +08:00
BuildArch: noarch
%description
Set of tools (shell scripts, RPM macro files) to help with multilib packaging
issues.
%prep
%autosetup -c -T
2020-01-10 15:21:55 +08:00
install -m 644 %{SOURCE3} .
2019-12-14 18:58:22 +08:00
%build
%global ml_fix %_libexecdir/multilib-fix
%global ml_info %_libexecdir/multilib-info
lib_sed_pattern='/@LIB@/ {
r %{SOURCE4}
d
}'
sed -e 's|@ML_FIX@|%ml_fix|g' -e 's|@ML_INFO@|%ml_info|g' %{SOURCE1} > macros.multilib
sed -e "$lib_sed_pattern" %{SOURCE0} > multilib-fix
sed -e "$lib_sed_pattern" %{SOURCE5} > multilib-info
%install
install -d $RPM_BUILD_ROOT%_libexecdir
install -d $RPM_BUILD_ROOT%{macrosdir}
install -m 644 -p macros.multilib $RPM_BUILD_ROOT/%{macrosdir}
install -m 755 -p multilib-fix $RPM_BUILD_ROOT/%{ml_fix}
install -m 755 -p multilib-info $RPM_BUILD_ROOT/%{ml_info}
%check
mkdir tests ; cd tests
ml_fix="sh `pwd`/../multilib-fix --buildroot `pwd`"
capable="sh `pwd`/../multilib-info --multilib-capable"
mkdir template
cat > template/main.c <<EOF
#include "header.h"
int main () { call (); return 0; }
EOF
cat > template/header.h <<EOF
#include <stdio.h>
void call (void) { printf ("works!\n"); }
EOF
cp -r template basic
gcc ./basic/main.c
./a.out
pwd
if `$capable`; then
cp -r template really-works
$ml_fix --file /really-works/header.h
gcc really-works/main.c
./a.out
test -f really-works/header-*.h
fi
cp -r template other_arch
$ml_fix --file /other_arch/header.h --arch ppc64
test -f other_arch/header-*.h
cp -r template other_arch_fix
$ml_fix --file /other_arch_fix/header.h --arch ppc64p7
test -f other_arch_fix/header-ppc64.h
cp -r template aarch64-no-change
$ml_fix --file /aarch64-no-change/header.h --arch aarch64
test ! -f aarch64-no-change/header-*.h
test `$capable --arch x86_64` = true
test `$capable --arch aarch64` = false
test `$capable --arch ppc64p7` = true
%files
%license COPYING
%_libexecdir/*
%{macrosdir}/*
%changelog
2022-12-22 11:03:09 +08:00
* Thu Dec 22 2022 wanglin <wangl29@chinatelecom.cn> - 1-16
- Fix rpm-config hard code problem
2020-07-15 16:45:00 +08:00
* Thu Jul 9 2020 chengzihan <chengzihan2@huawei.com> - 1-15
- supply files source
2019-12-14 18:58:22 +08:00
* Fri Dec 6 2019 caomeng<caomeng5@huawei.com> - 1-14
- Package init