Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > by-pkgid > fd398c0901d5769c813cceac3fb70b62 > files > 8

kernel2.4-marcelo-2.4.25-1mdk.src.rpm

# -*- Mode: rpm-spec -*-
# 	$Id: kernel-2.4.spec,v 1.2 2001/04/05 20:07:18 chmou Exp $	

%define sublevel 25
%define mdkrelease 1

# really deep magic to make things compiled depending of 
# rc & pre patches.  We want to always use the next value.
# if you dont' use it, define it as 0.
%define use_patch 0

# You should not need to touch after this
%define version 2.4.%{sublevel}

# When we are using a pre/rc patch, the tarboll is a sublevel -1
%if %use_patch
%define tar_version 2.4.%(expr %sublevel - 1)
%define extraversion %{use_patch}-%{mdkrelease}mt
%define rpmrelease 0.%{use_patch}.%{mdkrelease}
%else
%define tar_version %version
%define extraversion %{mdkrelease}mt
%define rpmrelease %{mdkrelease}
%endif

%define KVERREL %{version}-%{extraversion}

# build de docs?
%define build_doc 1

%{?_without_doc: %global build_doc 0}

%{?_with_doc: %global build_doc 1}

Summary: The Linux kernel (the core of the Linux operating system).
Name: kernel2.4-marcelo
Version: %{version}
Release: %{rpmrelease}mdk
License: GPL
Group: System/Kernel and hardware
ExclusiveArch: %{ix86} alpha ppc x86_64 sparc sparc64
ExclusiveOS: Linux
URL: http://www.kernel.org/

####################################################################
#
# Sources
#

Source0: ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-%{tar_version}.tar.bz2
Source1: README.kernel-marcelo

Source21: kernel-alpha.config
Source22: kernel-i386.config
Source23: kernel-ppc.config
Source24: kernel-x86_64.config
Source25: kernel-sparc.config
Source26: kernel-sparc64.config

# Patches
#
# Please don't remove this line, sometimes we want to release a linus kernel
# for a prerelease or release candidate
#

%if %use_patch
Patch1: patch-%version-%use_patch.bz2
%endif

#END
####################################################################

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: module-info, kernel = %{version}
Autoreqprov: no
Requires: bootloader-utils
Requires: modutils >= 2.4.3-2mdk
Requires: devfsd
BuildRequires: gcc
Obsoletes: kernel-linus2.4
Provides: kernel-linus2.4
Conflicts: ksymoops < 2.4.9

%if %{build_doc}
# welcome to make htmldocs psdocs pdfdocs
BuildRequires: ghostscript sgml-tools jadetex
BuildRequires: docbook-utils-pdf
# yes, we need both
BuildRequires: docbook-dtd41-sgml docbook-dtd31-sgml
BuildRequires: docbook-style-dsssl
BuildRequires: tetex-dvips tetex-latex transfig 
%endif

%description

The kernel package contains the Linux kernel (vmlinuz), the core of your
Mandrake Linux operating system.  The kernel handles the basic functions
of the operating system:  memory allocation, process allocation, device
input and output, etc.


%package -n kernel-doc-html
Version: %{version}
Release: %{release}
Summary: Various books about the kernel APIs in html format
Group: Books/Computer books

%description -n kernel-doc-html

This packages contains various books about the kernel generated from
the sources.

%package -n kernel-doc-ps
Version: %{version}
Release: %{release}
Summary: Various books about the kernel APIs in ps format
Group: Books/Computer books

%description -n kernel-doc-ps

This packages contains various books about the kernel generated from
the sources.

%package -n kernel-doc-pdf
Version: %{version}
Release: %{release}
Summary: Various books about the kernel APIs in html format
Group: Books/Computer books

%description -n kernel-doc-pdf

This packages contains various books about the kernel generated from
the sources.

#
# End packages - here begins build stage
#
%prep
%setup -q -n linux-%tar_version

%if %use_patch
%patch1 -p1
%endif

# Disable non compiling drivers

OptionDisable() {
	feature=$1
	file=.config

	cp -f $file config.tmp
	echo "Disabling option $feature"
	OPT="CONFIG_$feature" perl -e 'my $a = $ENV{'OPT'}; while (<>) {if (/^$a=/) {print "# $a is not defined\n"; next;} print;}' \
	    < config.tmp > $file
	rm -f config.tmp
}

install -m 644 %SOURCE1 .

# install the config files for all the archs

install -m 644 %SOURCE21 .config
make -s ARCH=alpha oldconfig
install -m 644 .config arch/alpha/defconfig

install -m 644 %SOURCE22 .config
make -s ARCH=i386 oldconfig
install -m 644 .config arch/i386/defconfig

install -m 644 %SOURCE23 .config
make -s ARCH=ppc oldconfig
install -m 644 .config arch/ppc/defconfig

install -m 644 %SOURCE24 .config
make -s ARCH=x86_64 oldconfig
install -m 644 .config arch/x86_64/defconfig

install -m 644 %SOURCE25 .config
make -s ARCH=sparc oldconfig
install -m 644 .config arch/sparc/defconfig

install -m 644 %SOURCE26 .config
make -s ARCH=sparc64 oldconfig
install -m 644 .config arch/sparc64/defconfig

###
### build
###

%build

# Common target directories
%define _bootdir /boot
%define _modulesdir /lib/modules
%define _htmldir /usr/share/doc/kernel-html
%define _pdfdir /usr/share/doc/kernel-pdf
%define _psdir /usr/share/doc/kernel-ps

# Directories definition needed for building
%define target_boot %{buildroot}%{_bootdir}
%define target_modules %{buildroot}%{_modulesdir}
%define target_html %{buildroot}%{_htmldir}
%define target_pdf %{buildroot}%{_pdfdir}
%define target_ps %{buildroot}%{_psdir}

# Don't use %make for anything except bzImage or modules
# Makefiles are not -j safe

DependKernel() {
	flavour=$1
	echo "Make dep for kernel $flavour"
	make -s mrproper

	# it is safest that trusting in defconfig
	cp arch/%{_arch}/defconfig .config

	# make sure ETXRAVERSION says what we want it to say
	if [ "$flavour" = "up" ]; then
		ext=%extraversion
	else
		ext=%extraversion$flavour
	fi

	# make sure ETXRAVERSION says what we want it to say
	perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -$ext/" Makefile
	make -s oldconfig
	make -s dep
}


%ifarch alpha
%define target boot
%endif    

%ifarch ppc sparc sparc64
%define target vmlinux
%endif

%ifarch %{ix86} x86_64
%define target bzImage
%endif

CreateKernel() {
	flavour=$1
	echo "Create kernel version: %{KVERREL} flavour: $flavour"
	DependKernel $flavour
	%make %target modules
}

###
# DO it...
###

# Make new ARCH config files if we don't have them.
CreateKernel up

# don't do it before CreateKernel, or make mrproper will eat them.
# don't put here %make, as there is not propers dependencies
# do this first, as sgml tools fail/change a lot
%if %build_doc
make htmldocs psdocs pdfdocs
%endif

###
### install
###
%install

rm -rf %{buildroot}

%if %build_doc
install -d %{target_ps}
cp -a Documentation/DocBook/*\.ps %{target_ps}
install -d %{target_pdf}
cp -a Documentation/DocBook/*\.pdf %{target_pdf}
install -d %{target_html}
pushd Documentation/DocBook
find * -type d -exec cp -a {} %{target_html}/{} \;
popd
%endif

## Start installing stuff
install -d %{target_boot}
install -m 644 System.map %{target_boot}/System.map-%KVERREL
install -m 644 .config %{target_boot}/config-%KVERREL

%ifarch alpha
cp -f arch/alpha/boot/vmlinux.gz %{target_boot}/vmlinuz-%KVERREL
%endif
%ifarch ppc sparc sparc64
cp -f vmlinux %{target_boot}/vmlinuz-%KVERREL
%endif
%ifarch %{ix86}
cp -f arch/i386/boot/bzImage %{target_boot}/vmlinuz-%KVERREL
%endif
%ifarch x86_64
cp -f arch/x86_64/boot/bzImage %{target_boot}/vmlinuz-%KVERREL
%endif


# modules
install -d %{target_modules}/%KVERREL
%make INSTALL_MOD_PATH=%{buildroot} KERNELRELEASE=%KVERREL modules_install 
# we don't want build dir
rm -f %{target_modules}/%KVERREL/build

echo "GZIPPING Modules"
find %{target_modules} -type f -name '*.o'|xargs gzip -9f
for i in $(find %{target_modules} -type l -name '*.o');do
    link=$(perl -e 'print readlink shift, "\n"' $i)
    ln -s $link.gz $i.gz
    rm -f $i
done
# we want nice modules.dep files, and we need to regenerate them due to 
# the compression (change date)
/sbin/depmod -u -ae -b %{buildroot} -r -F %{target_boot}/System.map-%KVERREL %KVERREL

###
### clean
###

%clean
rm -rf %{buildroot}

###
### scripts
###

# do this for upgrades...in case the old modules get removed we have
# loopback in the kernel so that mkinitrd will work.
%preun
/sbin/installkernel -a -R -c %{KVERREL}
exit 0

%post
/sbin/installkernel -a -c %{KVERREL}

%postun
/sbin/kernel_remove_initrd %{KVERREL}

###
### file lists
###

%files
%defattr(-,root,root)
%doc README.kernel-marcelo
%{_bootdir}/config-%{KVERREL}
%{_bootdir}/vmlinuz-%{KVERREL}
%{_bootdir}/System.map-%{KVERREL}
%dir %{_modulesdir}/%{KVERREL}
%{_modulesdir}/%{KVERREL}/kernel
%{_modulesdir}/%{KVERREL}/pcmcia
%{_modulesdir}/%{KVERREL}/modules.*

%if %build_doc

%files -n kernel-doc-html
%defattr(-,root,root)
%doc %{_htmldir}

%files -n kernel-doc-pdf
%defattr(-,root,root)
%doc %{_pdfdir}

%files -n kernel-doc-ps
%defattr(-,root,root)
%doc %{_psdir}

#endif build_doc	
%endif

%changelog
* Mon Jan 26 2004 Juan Quintela <quintela@mandrakesoft.com> 2.4.25-0.pre7.1mdk
- 2.4.25-4pre7.

* Sat Jan 10 2004 Juan Quintela <quintela@mandrakesoft.com> 2.4.25-0.pre4.1mdk
- 2.4.25-pre4.

* Sat Jan 10 2004 Juan Quintela <quintela@mandrakesoft.com> 2.4.24-1mdk
- 2.4.24.

* Thu Jan  1 2004 Juan Quintela <quintela@mandrakesoft.com> 2.4.24-0.pre3.1mdk
- 2.4.24-pre3.

* Sat Nov 29 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.23-1mdk
- 2.4.23.

* Thu Nov 13 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.23-0.rc1.1mdk
- 2.4.23-rc1.

* Thu Oct  2 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.23-0.pre6.1mdk
- 2.4.23-pre6.
- %%dir modules dir.

* Mon Aug 25 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.22-0.rc3.1mdk
- 2.4.22-rc3.

* Thu Aug 21 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.22-0.rc2.2mdk
- depend on bootloader-utils.

* Wed Aug 13 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.22-0.rc2.1mdk
- change %%pre/%%post for new kernel-utils.
- depend on kernel-utils 0.5.

* Fri Aug  8 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.22-0.rc1.1mdk
- 2.4.22-rc1.

* Thu Jul 31 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.22-0.pre9.1mdk
- 2.4.22-pre9.

* Sat Jun 14 2003 Juan Quintela <quintela@trasno.org> 2.4.21-1mdk
- 2.4.21 final.

* Thu May 29 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.21-0.rc6.1mdk
- 2.4.21-rc6.

* Wed May 28 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.21-0.rc5.1mdk
- 2.4.21-rc5.

* Wed Apr 23 2003 Juan Quintela <quintela@mandrakesoft.com> 2.4.21-0.rc1.2mdk
- based on kernel-linus2.4.spec.
- 2.4.21-rc1.


# Local Variables:
# rpm-spec-insert-changelog-version-with-shell: t
# End: