109 lines
2.4 KiB
RPMSpec
109 lines
2.4 KiB
RPMSpec
%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
|
|
Release: 14
|
|
License: GPLv2+
|
|
URL: https://github.com/EuroLinux/els-tests-multilib-rpm-config
|
|
|
|
Source0: multilib-fix
|
|
Source1: macros.ml
|
|
Source2: README
|
|
Source3: COPYING
|
|
Source4: multilib-library
|
|
Source5: multilib-info
|
|
|
|
BuildRequires: gcc
|
|
|
|
Requires: openEuler-rpm-config
|
|
|
|
BuildArch: noarch
|
|
|
|
%description
|
|
Set of tools (shell scripts, RPM macro files) to help with multilib packaging
|
|
issues.
|
|
|
|
%package_help
|
|
|
|
%prep
|
|
%autosetup -c -T
|
|
install -m 644 %{SOURCE2} %{SOURCE3} .
|
|
|
|
%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}/*
|
|
|
|
%files help
|
|
%doc README
|
|
|
|
%changelog
|
|
* Fri Dec 6 2019 caomeng<caomeng5@huawei.com> - 1-14
|
|
- Package init
|