cd6d0ce
# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_of_Additional_RPM_Macros
cd6d0ce
%global macrosdir       %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
cd6d0ce
cd6d0ce
%global rrcdir          %_libexecdir
cd6d0ce
cd6d0ce
Summary: Multilib packaging helpers
cd6d0ce
Name: multilib-rpm-config
cd6d0ce
Version: 1
f718b09
Release: 10%{?dist}
cd6d0ce
License: GPLv2+
23edc20
23edc20
# TODO: resolve directly in rpm/redhat-rpm-config (instead of this hack).
23edc20
# Note that to avoid FTBFS against plain RHEL6, we can't put this hack before
23edc20
# License tag.
23edc20
%{!?_licensedir:%global license %%doc}
23edc20
cd6d0ce
URL: https://fedoraproject.org/wiki/PackagingDrafts/MultilibTricks
cd6d0ce
ec18e42
BuildRequires: gcc
ec18e42
cd6d0ce
Source0: multilib-fix
cd6d0ce
Source1: macros.ml
cd6d0ce
Source2: README
cd6d0ce
Source3: COPYING
657cae1
Source4: multilib-library
657cae1
Source5: multilib-info
cd6d0ce
cd6d0ce
BuildArch: noarch
cd6d0ce
cd6d0ce
# Most probably we want to move everything here?
cd6d0ce
Requires: redhat-rpm-config
cd6d0ce
cd6d0ce
%description
cd6d0ce
Set of tools (shell scripts, RPM macro files) to help with multilib packaging
cd6d0ce
issues.
cd6d0ce
cd6d0ce
cd6d0ce
%prep
cd6d0ce
%setup -c -T
cd6d0ce
install -m 644 %{SOURCE2} %{SOURCE3} .
cd6d0ce
cd6d0ce
cd6d0ce
%build
cd6d0ce
%global ml_fix %rrcdir/multilib-fix
657cae1
%global ml_info %rrcdir/multilib-info
657cae1
657cae1
lib_sed_pattern='/@LIB@/ {
657cae1
    r %{SOURCE4}
657cae1
    d
657cae1
}'
657cae1
cd6d0ce
sed -e 's|@ML_FIX@|%ml_fix|g' \
657cae1
    -e 's|@ML_INFO@|%ml_info|g' \
cd6d0ce
    %{SOURCE1} > macros.multilib
657cae1
sed -e "$lib_sed_pattern" \
657cae1
    %{SOURCE0} > multilib-fix
657cae1
sed -e "$lib_sed_pattern" \
657cae1
    %{SOURCE5} > multilib-info
cd6d0ce
cd6d0ce
cd6d0ce
%install
cd6d0ce
mkdir -p %{buildroot}%{rrcdir}
cd6d0ce
mkdir -p %{buildroot}%{macrosdir}
cd6d0ce
install -m 644 -p macros.multilib %{buildroot}/%{macrosdir}
657cae1
install -m 755 -p multilib-fix %{buildroot}/%{ml_fix}
657cae1
install -m 755 -p multilib-info %{buildroot}/%{ml_info}
cd6d0ce
cd6d0ce
ec18e42
%check
ec18e42
mkdir tests ; cd tests
ec18e42
ml_fix="sh `pwd`/../multilib-fix --buildroot `pwd`"
ec18e42
capable="sh `pwd`/../multilib-info --multilib-capable"
ec18e42
ec18e42
mkdir template
ec18e42
cat > template/main.c <
ec18e42
#include "header.h"
ec18e42
int main () { call (); return 0; }
ec18e42
EOF
ec18e42
cat > template/header.h <
ec18e42
#include <stdio.h>
ec18e42
void call (void) { printf ("works!\n"); }
ec18e42
EOF
ec18e42
ec18e42
cp -r template basic
ec18e42
gcc ./basic/main.c
ec18e42
./a.out
ec18e42
ec18e42
pwd
d44f6e2
if `$capable`; then
ec18e42
    cp -r template really-works
ec18e42
    $ml_fix --file /really-works/header.h
ec18e42
    gcc really-works/main.c
ec18e42
    ./a.out
ec18e42
    test -f really-works/header-*.h
ec18e42
fi
ec18e42
ec18e42
cp -r template other_arch
ec18e42
$ml_fix --file /other_arch/header.h --arch ppc64
ec18e42
test -f other_arch/header-*.h
ec18e42
ec18e42
cp -r template other_arch_fix
ec18e42
$ml_fix --file /other_arch_fix/header.h --arch ppc64p7
ec18e42
test -f other_arch_fix/header-ppc64.h
ec18e42
ec18e42
cp -r template aarch64-no-change
ec18e42
$ml_fix --file /aarch64-no-change/header.h --arch aarch64
ec18e42
test ! -f aarch64-no-change/header-*.h
ec18e42
ec18e42
test `$capable --arch x86_64` = true
ec18e42
test `$capable --arch aarch64` = false
ec18e42
test `$capable --arch ppc64p7` = true
ec18e42
ec18e42
cd6d0ce
%files
cd6d0ce
%license COPYING
cd6d0ce
%doc README
cd6d0ce
%{rrcdir}/*
cd6d0ce
%{macrosdir}/*
cd6d0ce
cd6d0ce
cd6d0ce
%changelog
f718b09
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1-10
f718b09
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
f718b09
1d565a8
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1-9
1d565a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
1d565a8
23edc20
* Fri Apr 07 2017 Pavel Raiskup <praiskup@redhat.com> - 1-8
23edc20
- fix FTBFS on plain RHEL6
23edc20
7edeb07
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1-7
7edeb07
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
7edeb07
d44f6e2
* Fri Jul 01 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 1-6
d44f6e2
- Fix testsuite on non-multilib arches (#1352164)
d44f6e2
f2fed85
* Wed Jun 22 2016 Pavel Raiskup <praiskup@redhat.com> - 1-5
f2fed85
- document why there is no need for '#else' in the replacement header
ec18e42
- add basic testsuite
f2fed85
9f438cf
* Mon Jun 13 2016 Pavel Raiskup <praiskup@redhat.com> - 1-4
aeb305b
- use '-' as a field separator by default
9f438cf
cd6d0ce
* Thu Jun 09 2016 Pavel Raiskup <praiskup@redhat.com> - 1-3
cd6d0ce
- package separately from redhat-rpm-config
cd6d0ce
cd6d0ce
* Fri Nov 27 2015 Pavel Raiskup <praiskup@redhat.com> - 1-2
cd6d0ce
- fix licensing in Sources
cd6d0ce
- allow undefined %%namespace
cd6d0ce
cd6d0ce
* Wed Nov 18 2015 Pavel Raiskup <praiskup@redhat.com> - 1-1
cd6d0ce
- initial packaging