SPECS: kernel-vanilla.spec - move the pykconfig to local Makefile ...

glen glen at pld-linux.org
Wed Jan 30 01:24:57 CET 2008


Author: glen                         Date: Wed Jan 30 00:24:57 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- move the pykconfig to local Makefile for better dependency

---- Files affected:
SPECS:
   kernel-vanilla.spec (1.84 -> 1.85) 

---- Diffs:

================================================================
Index: SPECS/kernel-vanilla.spec
diff -u SPECS/kernel-vanilla.spec:1.84 SPECS/kernel-vanilla.spec:1.85
--- SPECS/kernel-vanilla.spec:1.84	Wed Jan 30 01:21:26 2008
+++ SPECS/kernel-vanilla.spec	Wed Jan 30 01:24:51 2008
@@ -67,8 +67,6 @@
 Source40:	kernel-vanilla-preempt-nort.config
 Source41:	kernel-vanilla-no-preempt-nort.config
 
-Patch0:		kernel-pykconfig.patch
-
 URL:		http://www.kernel.org/
 BuildRequires:	binutils >= 3:2.14.90.0.7
 %ifarch sparc sparc64
@@ -355,8 +353,12 @@
 
 %prep
 %setup -qc
-cd linux-%{_basever}
+install -d o/scripts
+ln -s %{SOURCE6} o/scripts/kernel-config.py
+ln -s %{SOURCE7} o/scripts/kernel-config-update.py
+ln -s %{SOURCE2} o/scripts/kernel-module-build.pl
 
+cd linux-%{_basever}
 %if "%{_postver}" != "%{nil}"
 %{__bzip2} -dc %{SOURCE1} | %{__patch} -p1 -s
 %endif
@@ -370,33 +372,58 @@
 # Fix EXTRAVERSION in main Makefile
 sed -i 's#EXTRAVERSION =.*#EXTRAVERSION = %{_postver}_%{alt_kernel}#g' Makefile
 
-%patch0 -p1
+%build
+cat > Makefile <<'EOF'
+# Makefile generated by %{name}.spec
+srctree := %{_builddir}/%{name}-%{version}/linux-%{_basever}
+objtree := %{objdir}
+SRCARCH := %{target_arch_dir}
+ARCH	:= %{_target_base_arch}
+CONFIGS :=
+Q		:= %{!?with_verbose:@}
+
+CONFIGS += %{_sourcedir}/kernel-vanilla-multiarch.conf
+%if %{with preempt-nort}
+CONFIGS += %{_sourcedir}/kernel-vanilla-preempt-nort.config
+%else
+CONFIGS += %{_sourcedir}/kernel-vanilla-no-preempt-nort.config
+%endif
 
-sed -i -e '/select INPUT/d' net/bluetooth/hidp/Kconfig
+# config where we ignore timestamps
+CONFIG_NODEP += %{objdir}/pykconfig.conf
 
-# remove unwanted files after patching (if any)
-find . '(' -name '*~' -o -name '*.orig' -o -name '.gitignore' ')' -print0 | xargs -0 -r -l512 rm -f
+all modules_install mrproper:
+	$(Q)$(MAKE) -C $(srctree) %{MakeOpts} $<
 
-ln -s %{SOURCE6} scripts/kernel-config.py
-ln -s %{SOURCE7} scripts/kernel-config-update.py
-ln -s %{SOURCE2} scripts/kernel-module-build.pl
+pykconfig: $(objtree)/.config.conf
+	@echo 'pykconfig is up to date'
 
-%build
-cd linux-%{_basever}
-install -d %{objdir}
+$(objtree)/.config.conf: $(srctree)/arch/$(SRCARCH)/defconfig
+	@echo '  kernel-config-update.py $(ARCH) arch/$(SRCARCH)/defconfig.conf $< > $@'
+	$(Q)$(objtree)/scripts/kernel-config-update.py $(ARCH) $(srctree)/arch/$(SRCARCH)/defconfig.conf $< > .config.conf.tmp
+	$(Q)mv .config.conf.tmp $@
 
-# produce kernel-config.py format config for arch/ARCH/defconfig.conf
-pykconfig() {
-	set -x
-	cat $RPM_SOURCE_DIR/kernel-vanilla-multiarch.conf
+$(srctree)/arch/$(SRCARCH)/defconfig: $(srctree)/arch/$(SRCARCH)/defconfig.conf
+	@echo '  kernel-config.py $(ARCH) arch/$(SRCARCH)/defconfig.conf arch/$(SRCARCH)/defconfig'
+	$(Q)> .defconfig.tmp
+	$(Q)$(objtree)/scripts/kernel-config.py $(ARCH) $(srctree)/arch/$(SRCARCH)/defconfig.conf .defconfig.tmp
+	$(Q)mv .defconfig.tmp $(srctree)/arch/$(SRCARCH)/defconfig
+	$(Q)ln -sf $(srctree)/arch/$(SRCARCH)/defconfig .config
 
-	echo '# preempt config'
-	%if %{with preempt-nort}
-	cat $RPM_SOURCE_DIR/kernel-vanilla-preempt-nort.config
-	%else
-	cat $RPM_SOURCE_DIR/kernel-vanilla-no-preempt-nort.config
-	%endif
+$(srctree)/arch/$(SRCARCH)/defconfig.conf: $(CONFIGS) $(objtree)/defconfig-nodep.conf
+	$(Q)cat $^ > $@
+
+$(objtree)/defconfig-nodep.conf: $(CONFIG_NODEP)
+	$(Q)if [ -f $@ ] && cmp -s $< $@; then \
+		echo '  cat $< > $@'; \
+		cat $< > $@; \
+	fi
+EOF
 
+# update config at spec time
+# if you have config file, add it to above Makefile
+pykconfig() {
+	set -x
 	echo '# %{name}.spec overrides'
 	echo 'LOCALVERSION="-%{_localversion}"'
 
@@ -439,19 +466,12 @@
 %endif
 }
 
-# build config
-pykconfig > .defconfig.tmp.conf
-o=arch/%{target_arch_dir}/defconfig.conf
-if [ -f $o ] && cmp -s .defconfig.tmp.conf $o; then
-	rm -f .defconfig.tmp.conf
-else
-	mv .defconfig.tmp.conf $o
-fi
-chmod +x scripts/kernel-config.py
-%{__make} %{MakeOpts} pykconfig
+# generate .config and .config.conf
+pykconfig > %{objdir}/pykconfig.conf
+%{__make} pykconfig
 
 # build kernel
-%{__make} %{MakeOpts}
+%{__make} all
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -508,14 +528,13 @@
 # Usage: kernel-module-build.pl $rpmdir $fileoutdir
 fileoutdir=$(pwd)
 cd $RPM_BUILD_ROOT%{_kernelsrcdir}
-./scripts/kernel-module-build.pl %{_kernelsrcdir} $fileoutdir
+%{objtree}/scripts/kernel-module-build.pl %{_kernelsrcdir} $fileoutdir
 cd -
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %preun
-rm -f /lib/modules/%{kernel_release}/modules.*
 if [ -x /sbin/new-kernel-pkg ]; then
 	/sbin/new-kernel-pkg --remove %{kernel_release}
 fi
@@ -758,6 +777,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.85  2008-01-30 00:24:51  glen
+- move the pykconfig to local Makefile for better dependency
+
 Revision 1.84  2008-01-30 00:21:26  glen
 - update install part to take files from objdir
 
================================================================

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



More information about the pld-cvs-commit mailing list