Accepting request 894596 from home:Andreas_Schwab:Factory

- Add cross-*-linux-glibc-devel packages

OBS-URL: https://build.opensuse.org/request/show/894596
OBS-URL: https://build.opensuse.org/package/show/Base:System/linux-glibc-devel?expand=0&rev=165
This commit is contained in:
Andreas Schwab 2021-05-20 10:24:44 +00:00 committed by Git OBS Bridge
parent 0fe826e2dc
commit d560d3bdd7
2 changed files with 86 additions and 35 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu May 20 09:46:11 UTC 2021 - Andreas Schwab <schwab@suse.de>
- Add cross-*-linux-glibc-devel packages
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Apr 27 09:22:59 UTC 2021 - Andreas Schwab <schwab@suse.de> Tue Apr 27 09:22:59 UTC 2021 - Andreas Schwab <schwab@suse.de>

View File

@ -25,7 +25,6 @@ Group: Development/Libraries/C and C++
URL: http://www.kernel.org/ URL: http://www.kernel.org/
Source: %{name}-%{version}.tar.xz Source: %{name}-%{version}.tar.xz
Source1: install_all.sh Source1: install_all.sh
BuildRequires: fdupes
BuildRequires: xz BuildRequires: xz
# rpm-build requires gettext-tools; ignore this, in order to shorten cycles (we have no translations) # rpm-build requires gettext-tools; ignore this, in order to shorten cycles (we have no translations)
#!BuildIgnore: gettext-tools #!BuildIgnore: gettext-tools
@ -35,31 +34,42 @@ PreReq: coreutils
Provides: kernel-headers Provides: kernel-headers
Provides: linux-kernel-headers = %{version} Provides: linux-kernel-headers = %{version}
Obsoletes: linux-kernel-headers < %{version} Obsoletes: linux-kernel-headers < %{version}
%global kernel_arch %_target_cpu
%ifarch x86_64 %ix86 %{lua:
%global kernel_arch x86 function cross_archs()
%endif return "aarch64", "arm", "hppa", "i386", "m68k", "mips", "ppc64", "ppc64le", "riscv64", "s390x", "sparc", "sparc64", "x86_64"
%ifarch ppc ppc64 ppc64le end
%global kernel_arch powerpc
%endif function kernel_arch(arch)
%ifarch %arm local map = {
%global kernel_arch arm ["aarch64"] = "arm64",
%endif ["armv6hl"] = "arm",
%ifarch aarch64 ["armv7hl"] = "arm",
%global kernel_arch arm64 ["hppa"] = "parisc",
%endif ["i386"] = "x86",
%ifarch riscv64 ["i586"] = "x86",
%global kernel_arch riscv ["i686"] = "x86",
%endif ["ppc"] = "powerpc",
%ifarch s390x ["ppc64"] = "powerpc",
%global kernel_arch s390 ["ppc64le"] = "powerpc",
%endif ["riscv64"] = "riscv",
%ifarch hppa ["s390x"] = "s390",
%global kernel_arch parisc ["sparc64"] = "sparc",
%endif ["x86_64"] = "x86",
%ifarch sparc64 }
%global kernel_arch sparc return map[arch] or arch
%endif end
function gcc_target(arch)
local map = {
["arm"] = "arm-suse-linux-gnueabi",
["i386"] = "i586-suse-linux",
["ppc64"] = "powerpc64-suse-linux",
["ppc64le"] = "powerpc64le-suse-linux",
}
return map[arch] or arch.."-suse-linux"
end
}
%description %description
This package provides Linux kernel headers, the kernel API description This package provides Linux kernel headers, the kernel API description
@ -68,11 +78,27 @@ interface; compiling external kernel modules requires
kernel-(flavor)-devel, or kernel-syms to pull in all kernel-*-devel, kernel-(flavor)-devel, or kernel-syms to pull in all kernel-*-devel,
packages, instead. packages, instead.
%{lua:
for i,arch in ipairs({cross_archs()}) do
print(rpm.expand([[
%package -n cross-]]..arch..[[-linux-glibc-devel
Summary: Linux headers for ]]..arch..[[ userspace cross development
Group: Development/Libraries/C and C++
BuildArch: noarch
%description -n cross-]]..arch..[[-linux-glibc-devel
This package provides Linux kernel headers for ]]..arch..[[, the kernel API description
required for compilation of almost all programs.
]]))
end}
%prep %prep
%setup -q -n linux-glibc-devel-%{version} %setup -q -n linux-glibc-devel-%{version}
%build %build
cd %{kernel_arch} for karch in *; do
cd $karch
cat > version.h <<\BOGUS cat > version.h <<\BOGUS
#ifdef __KERNEL__ #ifdef __KERNEL__
#error "=======================================================" #error "======================================================="
@ -114,13 +140,26 @@ cat usr/include/linux/version.h >> version.h
cat >> version.h <<\BOGUS cat >> version.h <<\BOGUS
#endif #endif
BOGUS BOGUS
cat version.h cd ..
done
%install %install
cd %{kernel_arch} cd %{lua:print(kernel_arch(rpm.expand("%_target_cpu")))}
cp -a usr %{buildroot}/ cp -a usr %{buildroot}/
cp -a version.h %{buildroot}%{_includedir}/linux/ cp -a version.h %{buildroot}%{_includedir}/linux/
%fdupes %{buildroot}%{_includedir} cd ..
%{lua:
for i,arch in ipairs({cross_archs()}) do
print(rpm.expand([[
sysroot=%{_prefix}/]]..gcc_target(arch)..[[/sys-root
mkdir -p %{buildroot}${sysroot}/%{_includedir}/linux/
cd ]]..kernel_arch(arch)..[[
cp -a usr %{buildroot}${sysroot}
cp -a version.h %{buildroot}${sysroot}/%{_includedir}/linux/
cd ..
]]))
end}
%pre %pre
if test -L %{_includedir}/asm; then if test -L %{_includedir}/asm; then
@ -128,7 +167,14 @@ if test -L %{_includedir}/asm; then
fi fi
%files %files
%defattr(-,root,root)
%{_includedir}/* %{_includedir}/*
%{lua:
for i,arch in ipairs({cross_archs()}) do
print(rpm.expand([[
%files -n cross-]]..arch..[[-linux-glibc-devel
%{_prefix}/]]..gcc_target(arch).."\n"))
end}
%changelog %changelog