SPECS: kernel-vanilla.spec - build source in second run as noarch ...

glen glen at pld-linux.org
Mon Feb 11 20:53:27 CET 2008


Author: glen                         Date: Mon Feb 11 19:53:27 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- build source in second run as noarch (plus builder hacks)

---- Files affected:
SPECS:
   kernel-vanilla.spec (1.121 -> 1.122) 

---- Diffs:

================================================================
Index: SPECS/kernel-vanilla.spec
diff -u SPECS/kernel-vanilla.spec:1.121 SPECS/kernel-vanilla.spec:1.122
--- SPECS/kernel-vanilla.spec:1.121	Mon Feb 11 19:56:47 2008
+++ SPECS/kernel-vanilla.spec	Mon Feb 11 20:53:22 2008
@@ -1,7 +1,7 @@
 # $Revision$, $Date$
 #
 # Conditional build:
-%bcond_without	source		# don't build kernel-source package
+%bcond_with	noarch		# build noarch packages
 %bcond_with	verbose		# verbose build (V=1)
 %bcond_with	pae		# build PAE (HIGHMEM64G) support on uniprocessor
 %bcond_with	preempt-nort	# build preemptable no realtime kernel
@@ -12,6 +12,10 @@
 %undefine	with_pae
 %endif
 
+%if "%{_arch}" == "noarch"
+%define		with_noarch	1
+%endif
+
 %define		have_isa	1
 %define		have_oss	1
 %define		have_pcmcia	1
@@ -31,7 +35,7 @@
 
 %define		_basever	2.6.24
 %define		_postver	.2
-%define		_rel		0.1
+%define		_rel		0.2
 
 # for rc kernels basever is the version patch (source1) should be applied to
 #%define		_ver		2.6.20
@@ -40,11 +44,12 @@
 %define		_ver		%{nil}
 %define		_rc			%{nil}
 
+%define		pname	kernel-%{alt_kernel}
 Summary:	The Linux kernel (the core of the Linux operating system)
 Summary(de.UTF-8):	Der Linux-Kernel (Kern des Linux-Betriebssystems)
 Summary(fr.UTF-8):	Le Kernel-Linux (La partie centrale du systeme)
 Summary(pl.UTF-8):	Jądro Linuksa
-Name:		kernel-%{alt_kernel}
+Name:		%{pname}%{?with_noarch:-noarch}
 Version:	%{?_ver:%{_ver}}%{_basever}%{_postver}
 Release:	%{?_rc:%{_rc}}%{_rel}
 Epoch:		3
@@ -92,8 +97,13 @@
 Conflicts:	udev < 1:071
 Conflicts:	util-linux < 2.10o
 Conflicts:	xfsprogs < 2.6.0
-ExclusiveArch:	%{ix86} %{x8664} ppc alpha sparc
 ExclusiveOS:	Linux
+%if %{with noarch}
+BuildArch:	noarch
+ExclusiveArch:	noarch
+%else
+ExclusiveArch:	%{ix86} %{x8664} ppc alpha sparc
+%endif
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %ifarch %{ix86} %{x8664}
@@ -115,7 +125,7 @@
 %define		kernel_release %{version}_%{alt_kernel}-%{_localversion}
 %define		_kernelsrcdir	/usr/src/linux-%{version}_%{alt_kernel}
 
-%define		topdir	%{_builddir}/%{name}-%{version}
+%define		topdir	%{_builddir}/%{pname}-%{version}
 %define		srcdir	%{topdir}/linux-%{_basever}
 %define		objdir	%{topdir}/o
 
@@ -190,7 +200,7 @@
 Summary(de.UTF-8):	DRM Kernel Treiber
 Summary(pl.UTF-8):	Sterowniki DRM
 Group:		Base/Kernel
-Requires:	%{name} = %{epoch}:%{version}-%{release}
+Requires:	%{pname} = %{epoch}:%{version}-%{release}
 Autoreqprov:	no
 
 %description drm
@@ -207,7 +217,7 @@
 Summary(de.UTF-8):	PCMCIA Module
 Summary(pl.UTF-8):	Moduły PCMCIA
 Group:		Base/Kernel
-Requires:	%{name} = %{epoch}:%{version}-%{release}
+Requires:	%{pname} = %{epoch}:%{version}-%{release}
 Conflicts:	pcmcia-cs < 3.1.21
 Conflicts:	pcmciautils < 004
 Autoreqprov:	no
@@ -226,7 +236,7 @@
 Summary(de.UTF-8):	ALSA Kernel Module
 Summary(pl.UTF-8):	Sterowniki dźwięku ALSA
 Group:		Base/Kernel
-Requires:	%{name} = %{epoch}:%{version}-%{release}
+Requires:	%{pname} = %{epoch}:%{version}-%{release}
 Autoreqprov:	no
 
 %description sound-alsa
@@ -243,7 +253,7 @@
 Summary(de.UTF-8):	OSS Kernel Module
 Summary(pl.UTF-8):	Sterowniki dźwięku OSS
 Group:		Base/Kernel
-Requires:	%{name} = %{epoch}:%{version}-%{release}
+Requires:	%{pname} = %{epoch}:%{version}-%{release}
 Autoreqprov:	no
 
 %description sound-oss
@@ -260,66 +270,66 @@
 Group:		Development/Building
 Autoreqprov:	no
 
-%description module-build
+%description config
 Kernel config and module symvers.
 
-%package headers
+%package -n %{pname}-headers
 Summary:	Header files for the Linux kernel
 Summary(de.UTF-8):	Header Dateien für den Linux-Kernel
 Summary(pl.UTF-8):	Pliki nagłówkowe jądra Linuksa
 Group:		Development/Building
 Autoreqprov:	no
 
-%description headers
+%description -n %{pname}-headers
 These are the C header files for the Linux kernel, which define
 structures and constants that are needed when rebuilding the kernel or
 building kernel modules.
 
-%description headers -l de.UTF-8
+%description -n %{pname}-headers -l de.UTF-8
 Dies sind die C Header Dateien für den Linux-Kernel, die definierte
 Strukturen und Konstante beinhalten die beim rekompilieren des Kernels
 oder bei Kernel Modul kompilationen gebraucht werden.
 
-%description headers -l pl.UTF-8
+%description -n %{pname}-headers -l pl.UTF-8
 Pakiet zawiera pliki nagłówkowe jądra, niezbędne do rekompilacji jądra
 oraz budowania modułów jądra.
 
-%package module-build
+%package -n %{pname}-module-build
 Summary:	Development files for building kernel modules
 Summary(de.UTF-8):	Development Dateien die beim Kernel Modul kompilationen gebraucht werden
 Summary(pl.UTF-8):	Pliki służące do budowania modułów jądra
 Group:		Development/Building
-Requires:	%{name}-headers = %{epoch}:%{version}-%{release}
-Requires:	%{name}-config = %{epoch}:%{version}-%{release}
+Requires:	%{pname}-headers = %{epoch}:%{version}-%{release}
+Requires:	%{pname}-config = %{epoch}:%{version}-%{release}
 Autoreqprov:	no
 
-%description module-build
+%description -n %{pname}-module-build
 Development files from kernel source tree needed to build Linux kernel
 modules from external packages.
 
-%description module-build -l de.UTF-8
+%description -n %{pname}-module-build -l de.UTF-8
 Development Dateien des Linux-Kernels die beim kompilieren externer
 Kernel Module gebraucht werden.
 
-%description module-build -l pl.UTF-8
+%description -n %{pname}-module-build -l pl.UTF-8
 Pliki ze drzewa źródeł jądra potrzebne do budowania modułów jądra
 Linuksa z zewnętrznych pakietów.
 
-%package source
+%package -n %{pname}-source
 Summary:	Kernel source tree
 Summary(de.UTF-8):	Der Kernel Quelltext
 Summary(pl.UTF-8):	Kod źródłowy jądra Linuksa
 Group:		Development/Building
-Requires:	%{name}-module-build = %{epoch}:%{version}-%{release}
+Requires:	%{pname}-module-build = %{epoch}:%{version}-%{release}
 Autoreqprov:	no
 
-%description source
+%description -n %{pname}-source
 This is the source code for the Linux kernel. It is required to build
 most C programs as they depend on constants defined in here. You can
 also build a custom kernel that is better tuned to your particular
 hardware.
 
-%description source -l de.UTF-8
+%description -n %{pname}-source -l de.UTF-8
 Das Kernel-Source-Packet enthält den source code (C/Assembler-Code)
 des Linux-Kernels. Die Source-Dateien werden gebraucht, um viele
 C-Programme zu kompilieren, da sie auf Konstanten zurückgreifen, die
@@ -327,7 +337,7 @@
 benutzt werden, um einen Kernel zu kompilieren, der besser auf Ihre
 Hardware ausgerichtet ist.
 
-%description source -l fr.UTF-8
+%description -n %{pname}-source -l fr.UTF-8
 Le package pour le kernel-source contient le code source pour le noyau
 linux. Ces sources sont nécessaires pour compiler la plupart des
 programmes C, car il dépend de constantes définies dans le code
@@ -335,30 +345,30 @@
 personnalisé pour avoir de meilleures performances sur des matériels
 particuliers.
 
-%description source -l pl.UTF-8
+%description -n %{pname}-source -l pl.UTF-8
 Pakiet zawiera kod źródłowy jądra systemu.
 
-%package doc
+%package -n %{pname}-doc
 Summary:	Kernel documentation
 Summary(de.UTF-8):	Kernel Dokumentation
 Summary(pl.UTF-8):	Dokumentacja do jądra Linuksa
 Group:		Documentation
 Autoreqprov:	no
 
-%description doc
+%description -n %{pname}-doc
 This is the documentation for the Linux kernel, as found in
 Documentation directory.
 
-%description doc -l de.UTF-8
+%description -n %{pname}-doc -l de.UTF-8
 Dies ist die Kernel Dokumentation wie sie im 'Documentation'
 Verzeichniss vorgefunden werden kann.
 
-%description doc -l pl.UTF-8
+%description -n %{pname}-doc -l pl.UTF-8
 Pakiet zawiera dokumentację do jądra Linuksa pochodzącą z katalogu
 Documentation.
 
 %prep
-%setup -qc
+%setup -qc -n %{pname}-%{version}
 install -d o/scripts
 ln -s %{SOURCE2} o/scripts/kernel-module-build.pl
 ln -s %{SOURCE3} o/scripts/kernel-config.py
@@ -381,6 +391,7 @@
 # cleanup backups after patching
 find '(' -name '*~' -o -name '*.orig' -o -name '.gitignore' ')' -print0 | xargs -0 -r -l512 rm -f
 
+%if %{without noarch}
 %build
 cat > multiarch.make <<'EOF'
 # generated by %{name}.spec
@@ -460,11 +471,15 @@
 
 # build kernel
 %{__make} all
+%endif # noarch
 
 %install
 rm -rf $RPM_BUILD_ROOT
+# needed for arch and noarch builds (exclude list)
+install -d $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux
+cp -a %{objdir}/include/linux/autoconf.h $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux/autoconf-dist.h
 
-# /lib/modules
+%if %{without noarch}
 %{__make} %{MakeOpts} %{!?with_verbose:-s} modules_install \
 	-C %{objdir} \
 	%{?with_verbose:V=1} \
@@ -473,6 +488,8 @@
 	KERNELRELEASE=%{kernel_release}
 
 mkdir $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/misc
+rm -f $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/build
+rm -f $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/source
 
 # /boot
 install -d $RPM_BUILD_ROOT/boot
@@ -508,8 +525,12 @@
 install -d $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{kernel_release}
 
 # /usr/src/linux
-install -d $RPM_BUILD_ROOT%{_kernelsrcdir}
+# maybe package these to -module-build, then -headers could be noarch
+cp -a %{objdir}/Module.symvers $RPM_BUILD_ROOT%{_kernelsrcdir}/Module.symvers-dist
+cp -a %{objdir}/.config $RPM_BUILD_ROOT%{_kernelsrcdir}/config-dist
+%endif # arch dependant
 
+%if %{with noarch}
 # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
 if cp -al %{srcdir}/COPYING $RPM_BUILD_ROOT/COPYING 2>/dev/null; then
 	l=l
@@ -517,12 +538,11 @@
 fi
 cp -a$l %{srcdir}/* $RPM_BUILD_ROOT%{_kernelsrcdir}
 
-ln -nfs %{_kernelsrcdir} $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/build
-ln -nfs %{_kernelsrcdir} $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/source
-
-cp -a %{objdir}/Module.symvers $RPM_BUILD_ROOT%{_kernelsrcdir}/Module.symvers-dist
-cp -a %{objdir}/.config $RPM_BUILD_ROOT%{_kernelsrcdir}/config-dist
+install -d $RPM_BUILD_ROOT/lib/modules/%{kernel_release}
+ln -s %{_kernelsrcdir} $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/build
+ln -s %{_kernelsrcdir} $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/source
 cp -a %{SOURCE6} $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux/config.h
+%endif # arch independant
 
 # collect module-build files and directories
 # Usage: kernel-module-build.pl $rpmdir $fileoutdir
@@ -601,11 +621,11 @@
 %postun sound-oss
 %depmod %{kernel_release}
 
-%post headers
+%post -n %{pname}-headers
 rm -f %{_prefix}/src/linux-%{alt_kernel}
 ln -snf %{basename:%{_kernelsrcdir}} %{_prefix}/src/linux-%{alt_kernel}
 
-%postun headers
+%postun -n %{pname}-headers
 if [ "$1" = "0" ]; then
 	if [ -L %{_prefix}/src/linux-%{alt_kernel} ]; then
 		if [ "$(readlink %{_prefix}/src/linux-%{alt_kernel})" = "linux-%{version}_%{alt_kernel}" ]; then
@@ -614,6 +634,7 @@
 	fi
 fi
 
+%if %{without noarch}
 %files
 %defattr(644,root,root,755)
 %ifarch sparc sparc64
@@ -712,13 +733,17 @@
 %defattr(644,root,root,755)
 %{_kernelsrcdir}/config-dist
 %{_kernelsrcdir}/Module.symvers-dist
+%{_kernelsrcdir}/include/linux/autoconf-dist.h
+%endif # noarch package
 
-%files headers
+%if %{with noarch}
+%files -n %{pname}-headers
 %defattr(644,root,root,755)
 %dir %{_kernelsrcdir}
 %{_kernelsrcdir}/include
+%exclude %{_kernelsrcdir}/include/linux/autoconf-dist.h
 
-%files module-build -f aux_files
+%files -n %{pname}-module-build -f aux_files
 %defattr(644,root,root,755)
 %{_kernelsrcdir}/Kbuild
 %{_kernelsrcdir}/arch/*/kernel/asm-offsets*
@@ -737,12 +762,11 @@
 /lib/modules/%{kernel_release}/build
 /lib/modules/%{kernel_release}/source
 
-%files doc
+%files -n %{pname}-doc
 %defattr(644,root,root,755)
 %{_kernelsrcdir}/Documentation
 
-%if %{with source}
-%files source -f aux_files_exc
+%files -n %{pname}-source -f aux_files_exc
 %defattr(644,root,root,755)
 %{_kernelsrcdir}/arch/*/[!Mk]*
 %{_kernelsrcdir}/arch/*/kernel/[!M]*
@@ -785,6 +809,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.122  2008-02-11 19:53:22  glen
+- build source in second run as noarch (plus builder hacks)
+
 Revision 1.121  2008-02-11 18:56:47  glen
 - put .config and Module.symvers to -config (arch specific)
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/kernel-vanilla.spec?r1=1.121&r2=1.122&f=u



More information about the pld-cvs-commit mailing list