[packages/xorg-driver-video-fglrx] - switch to macro driven module build for multiple kernel versions - rel 20
baggins
baggins at pld-linux.org
Mon Oct 28 23:48:59 CET 2013
commit 4f51afbab5b9fd2b841e2efc9f579af1f8cb63a8
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Mon Oct 28 23:48:17 2013 +0100
- switch to macro driven module build for multiple kernel versions
- rel 20
xorg-driver-video-fglrx.spec | 111 +++++++++++++++++++++++++++----------------
1 file changed, 70 insertions(+), 41 deletions(-)
---
diff --git a/xorg-driver-video-fglrx.spec b/xorg-driver-video-fglrx.spec
index 56ca975..e8a74bc 100644
--- a/xorg-driver-video-fglrx.spec
+++ b/xorg-driver-video-fglrx.spec
@@ -9,14 +9,36 @@
%if %{without kernel}
%undefine with_dist_kernel
%endif
+
+# The goal here is to have main, userspace, package built once with
+# simple release number, and only rebuild kernel packages with kernel
+# version as part of release number, without the need to bump release
+# with every kernel change.
+%if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
+%{error:kernel and userspace cannot be built at the same time on PLD builders}
+exit 1
+%endif
+
%if "%{_alt_kernel}" != "%{nil}"
+%if 0%{?build_kernels:1}
+%{error:alt_kernel and build_kernels are mutually exclusive}
+exit 1
+%endif
%undefine with_userspace
+%global _build_kernels %{alt_kernel}
+%else
+%global _build_kernels %{?build_kernels:,%{?build_kernels}}
%endif
+
%if %{without userspace}
# nothing to be placed to debuginfo package
%define _enable_debug_packages 0
%endif
+%define kbrs %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo "BuildRequires:kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2" ; done)
+%define kpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%kernel_pkg ; done)
+%define bkpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%build_kernel_pkg ; done)
+
%ifarch %{ix86}
%define arch_sufix %{nil}
%define arch_dir x86
@@ -27,13 +49,13 @@
%define intver 12.104
-%define rel 19
+%define rel 20
%define pname xorg-driver-video-fglrx
Summary: Linux Drivers for AMD/ATI graphics accelerators
Summary(pl.UTF-8): Sterowniki do akceleratorów graficznych AMD/ATI
-Name: %{pname}%{_alt_kernel}
+Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
Version: 13.4
-Release: %{rel}
+Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
Epoch: 1
License: AMD Binary (parts are GPL)
Group: X11
@@ -55,8 +77,8 @@ Patch7: %{pname}-kernel-fpu.patch
Patch8: linux-3.7.patch
Patch9: linux-3.10.patch
URL: http://ati.amd.com/support/drivers/linux/linux-radeon.html
-%{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
-BuildRequires: rpmbuild(macros) >= 1.659
+%{?with_dist_kernel:%{expand:%kbrs}}
+BuildRequires: rpmbuild(macros) >= 1.678
BuildRequires: sed >= 4.0
Requires: %{pname}-libs = %{epoch}:%{version}-%{rel}
Requires: xorg-xserver-server
@@ -164,23 +186,46 @@ zdarzenia systemowe, takie jak ACPI lub hotplug, a następnie
informującą sterownik poprzez interfejs rozszerzeń X, że zaszło
zdarzenie.
-%package -n kernel%{_alt_kernel}-video-firegl
-Summary: ATI kernel module for FireGL support
-Summary(pl.UTF-8): Moduł jądra oferujący wsparcie dla ATI FireGL
-Release: %{rel}@%{_kernel_ver_str}
-License: ATI
-Group: Base/Kernel
-%{?with_dist_kernel:%requires_releq_kernel}
-%if "%{_alt_kernel}" != "%{nil}"
-Provides: kernel-video-firegl = %{epoch}:%{version}-%{rel}@%{_kernel_ver_str}
-%endif
-Requires(post,postun): /sbin/depmod
-
-%description -n kernel%{_alt_kernel}-video-firegl
-ATI kernel module for FireGL support.
-
-%description -n kernel%{_alt_kernel}-video-firegl -l pl.UTF-8
-Moduł jądra oferujący wsparcie dla ATI FireGL.
+%define kernel_pkg()\
+%package -n kernel%{_alt_kernel}-video-firegl\
+Summary: ATI kernel module for FireGL support\
+Summary(pl.UTF-8): Moduł jądra oferujący wsparcie dla ATI FireGL\
+Release: %{rel}@%{_kernel_ver_str}\
+License: ATI\
+Group: Base/Kernel\
+Requires(post,postun): /sbin/depmod\
+%if %{with dist_kernel}\
+%requires_releq_kernel\
+Requires(postun): %releq_kernel\
+%endif\
+Provides: kernel%{_alt_kernel}-video-firegl = %{epoch}:%{version}-%{rel}@%{_kernel_ver_str}\
+\
+%description -n kernel%{_alt_kernel}-video-firegl\
+ATI kernel module for FireGL support.\
+\
+%description -n kernel%{_alt_kernel}-video-firegl -l pl.UTF-8\
+Moduł jądra oferujący wsparcie dla ATI FireGL.\
+\
+%if %{with kernel}\
+%files -n kernel%{_alt_kernel}-video-firegl\
+%defattr(644,root,root,755)\
+/lib/modules/%{_kernel_ver}/misc/*.ko*\
+%endif\
+\
+%post -n kernel%{_alt_kernel}-video-firegl\
+%depmod %{_kernel_ver}\
+\
+%postun -n kernel%{_alt_kernel}-video-firegl\
+%depmod %{_kernel_ver}\
+%{nil}
+
+%define build_kernel_pkg()\
+cp -pf common/lib/modules/fglrx/build_mod/2.6.x/Makefile common/lib/modules/fglrx/build_mod\
+%build_kernel_modules -C common/lib/modules/fglrx/build_mod -m fglrx GCC_VER_MAJ=%{_ccver}\
+%install_kernel_modules -D installed -m common/lib/modules/fglrx/build_mod/fglrx -d misc\
+%{nil}
+
+%{?with_kernel:%{expand:%kpkg}}
%prep
#%setup -q -c -T
@@ -220,18 +265,14 @@ mv common%{_libdir}/{fglrx/fglrx-libGL.so.1.2,libGL.so.1.2}
cp -a arch/%{arch_dir}/etc/* common/etc
%build
-%if %{with kernel}
-cd common/lib/modules/fglrx/build_mod
-cp -pf 2.6.x/Makefile .
-%build_kernel_modules -c -m fglrx GCC_VER_MAJ=%{_ccver}
-cd -
-%endif
+%{?with_kernel:%{expand:%bkpkg}}
%install
rm -rf $RPM_BUILD_ROOT
%if %{with kernel}
-%install_kernel_modules -m common/lib/modules/fglrx/build_mod/fglrx -d misc
+install -d $RPM_BUILD_ROOT
+cp -a installed/* $RPM_BUILD_ROOT
%endif
%if %{with userspace}
@@ -310,12 +351,6 @@ if [ "$1" = "0" ]; then
/sbin/chkconfig --del atieventsd
fi
-%post -n kernel%{_alt_kernel}-video-firegl
-%depmod %{_kernel_ver}
-
-%postun -n kernel%{_alt_kernel}-video-firegl
-%depmod %{_kernel_ver}
-
%if %{with userspace}
%files
%defattr(644,root,root,755)
@@ -390,9 +425,3 @@ fi
%{_sysconfdir}/acpi/events/*
%{_mandir}/man8/atieventsd.8*
%endif
-
-%if %{with kernel}
-%files -n kernel%{_alt_kernel}-video-firegl
-%defattr(644,root,root,755)
-/lib/modules/%{_kernel_ver}/misc/*.ko*
-%endif
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/xorg-driver-video-fglrx.git/commitdiff/4f51afbab5b9fd2b841e2efc9f579af1f8cb63a8
More information about the pld-cvs-commit
mailing list