Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > 4f3a920ebaa906755b046a698d17e508 > files > 3

kernel-win4lin-2.4.25.5mdk-3-7mdk.src.rpm

%define DISTRO %(awk '{print $1}' /etc/mandrake-release)
%define DISTVER %(awk '{print $4}' /etc/mandrake-release)
Source0: version.sh
%define _kernel %(/bin/bash %{SOURCE0})
%define KERNVER %(echo %_kernel|cut -f1 -d-)
%define W4LIN_EXT 13
%define DISTRO_EXT %(echo %_kernel|cut -f2 -d-)
%define MKIVER 3

%global flavors UP SMP ENTERPRISE _I686_UP_4GB _P3_SMP_64GB

# bump this up if you create new release with the same elsewhere
%define THISREVISION 7mdk

# n or y to build the new mki adapter module
%define MAKEADAPTER y
%define PKGNAME kernel-win4lin-%{KERNVER}.%{DISTRO_EXT}

# These change for smp and bigmem in most cases
%define THISVERSION %{KERNVER}.%{W4LIN_EXT}
%define EXTRAVERSION -%{DISTRO_EXT}
%define CONFIGFILE arch/i386/defconfig

%define PATCHVERSION %{W4LIN_EXT}
%define SOURCELOC /usr/src/linux-%{KERNVER}-%{DISTRO_EXT}
%define BUILDSUB %{PKGNAME}-%{PATCHVERSION}
%define MKIPATCH %{PKGNAME}-%{PATCHVERSION}.patch
%define ADAPTERPATCH mki-adapter.patch

Summary: Kernel for Win4Lin Package
Name: %{PKGNAME}
Version: %{MKIVER}
Release: %{THISREVISION}
Group: System/Kernel and hardware
License: GPL
URL: http://www.netraverse.com/
Source1: win4lin.xpm
Source2: win4lin-loader.tar.bz2
#Source3: installwin4linkernel
Source4: kernel-win4lin.h
Source5: %{MKIPATCH}
Source6: %{ADAPTERPATCH}
BuildRoot: %{_tmppath}/kernel-build-w4l-%{PKGNAME}%{THISVERSION}
BuildRequires: kernel-source ImageMagick
Obsoletes: Kernel-Win4Lin3
Provides: Kernel-Win4Lin3
PreReq: kernel-%{KERNVER}.%{DISTRO_EXT}
PreReq: win4lin-utils >= 3-6mdk
%description
This is a patched version of the linux kernel for use with the Win4Lin package.
It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel.

%package -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT}
Group:   System/Kernel and hardware
License: GPL
Summary: SMP Kernel for Win4Lin Package
URL: http://www.netraverse.com/
Obsoletes: Kernel-Win4Lin3
Provides: Kernel-Win4Lin3
PreReq: kernel-smp-%{KERNVER}.%{DISTRO_EXT}
PreReq: win4lin-utils >= 3-6mdk

%description -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT}
This is a patched version of the linux kernel for use with the Win4Lin package.
It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel for SMP machines

%package -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT}
Group:   System/Kernel and hardware
License: GPL
Summary: Enterprise Kernel for Win4Lin Package
URL: http://www.netraverse.com/
Obsoletes: Kernel-Win4Lin3
Provides: Kernel-Win4Lin3
PreReq: kernel-enterprise-%{KERNVER}.%{DISTRO_EXT}
PreReq: win4lin-utils >= 3-6mdk

%description -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT}
This is a patched version of the linux kernel for use with the Win4Lin package.
It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel for machines
with more than 1GB of memory.

%package -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT}
Group:   System/Kernel and hardware
License: GPL
Summary: i686 4GB Kernel for Win4Lin Package
URL: http://www.netraverse.com/
Obsoletes: Kernel-Win4Lin3
Provides: Kernel-Win4Lin3
PreReq: kernel-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT}
PreReq: win4lin-utils >= 3-6mdk

%description -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT}
This is a patched version of the linux kernel for use with the Win4Lin package.
It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel for machines
with up to 4GB of memory and i686-compatible CPUs

%package -n kernel-win4lin-p3-smp-64GB-%{KERNVER}.%{DISTRO_EXT}
Group:   System/Kernel and hardware
License: GPL
Summary: P3 64GB Kernel for Win4Lin Package
URL: http://www.netraverse.com/
Obsoletes: Kernel-Win4Lin3
Provides: Kernel-Win4Lin3
PreReq: kernel-p3-smp-64GB-%{KERNVER}.%{DISTRO_EXT}
PreReq: win4lin-utils >= 3-6mdk

%description -n kernel-win4lin-p3-smp-64GB-%{KERNVER}.%{DISTRO_EXT}
This is a patched version of the linux kernel for use with the Win4Lin package.
It is based on the %{DISTRO} %{DISTVER} linux %{KERNVER} kernel for machines
with up to 64GB of memory and Pentium III-compatible processors.
%package -n win4lin-utils
Group:   System/Kernel and hardware
License: GPL
Summary: Bootloader configuration scripts for Win4Lin Kernels

%description -n win4lin-utils
This package is a version of Mandrake's installkernel script tailored for
Win4Lin kernels, and menu entries for the win4lin tools.

%prep
%setup -q -c -T

# you MUST have the appropriate sources installed !
if [ ! -e %{SOURCELOC} ]
then
  echo "You must have the kernel sources installed for this rpm to build!"
  echo %{SOURCELOC}" does not exist"
  exit 1
fi

mkdir dist

%build
for i in %{flavors}
do
  if [ ! -e dist/bzImage-${i} ]
  then
  cp -a %{SOURCELOC} . ||: # Seems kernel team will never make a fully-readable kernel
  pushd linux-%{KERNVER}-%{DISTRO_EXT}
  chmod u+rw * -R
  make distclean
  perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{EXTRAVERSION}/" Makefile
  j=`echo $i|tr [:upper:] [:lower:]|sed -e 's/gb/GB/g;s/_/-/g'`
  if [ "$j" = "up" ]
  then cp %{CONFIGFILE} .config; j=""
  elif [ "$j" = "-i686-up-4GB" -o "$j" = "-p3-smp-64GB" ]
  then cp %{CONFIGFILE}$j .config
  else cp %{CONFIGFILE}-$j .config
  fi
  make oldconfig
  %make -s dep
  patch -p1 -b -z .win4lin < %{SOURCE5} 
  patch -p1 -b -z .mki < %{SOURCE6}
  perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{EXTRAVERSION}${j}/" Makefile
  echo y | make oldconfig
  make -s clean
  %make -s bzImage
  mv arch/i386/boot/bzImage ../dist/bzImage-${i}
  mv System.map ../dist/System.map-${i}

  if [ %{MAKEADAPTER} = y ]
  then
    KERN_SRC_PATH=`pwd`
    pushd arch/i386/mki-adapter
    make force KERN_SRC=$KERN_SRC_PATH \
    KERNELRELEASE=%{KERNVER}-%{DISTRO_EXT}${j}
    # Don't let 'make clean' delete our modules
    mv %{KERNVER}-%{DISTRO_EXT}${j}/mki-adapter.o ../../../../dist/mki-adapter.o-${i}
    popd
  fi
  popd
  rm -Rf linux-%{KERNVER}-%{DISTRO_EXT}
  fi
done

%install
rm -fr $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_lib}
mkdir -p $RPM_BUILD_ROOT/boot
mkdir -p $RPM_BUILD_ROOT%{_prefix}src
mkdir -p $RPM_BUILD_ROOT%{_sbindir}

for i in %{flavors}
do
  j=`echo $i|tr [:upper:] [:lower:]|sed -e 's/gb/GB/g;s/_/-/g'`
  [ "$j" == "up" ] && j=""

  cp dist/bzImage-$i $RPM_BUILD_ROOT/boot/win4lin-%{KERNVER}%{EXTRAVERSION}${j}
  cp dist/System.map-${i} $RPM_BUILD_ROOT/boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${j}

  if [ %{MAKEADAPTER} = y ]
  then 
    UNAMER=%{KERNVER}%{EXTRAVERSION}${j}; export UNAMER
    mkdir -p $RPM_BUILD_ROOT/%{_lib}/modules/${UNAMER}/kernel/arch/i386/mki-adapter
    mkdir -p $RPM_BUILD_ROOT/%{_lib}/modules/${UNAMER}/misc
    cp dist/mki-adapter.o-${i} \
     $RPM_BUILD_ROOT/%{_lib}/modules/${UNAMER}/kernel/arch/i386/mki-adapter/mki-adapter.o
    ln -s ../kernel/arch/i386/mki-adapter/mki-adapter.o $RPM_BUILD_ROOT/%{_lib}/modules/${UNAMER}/misc/.
  fi
done

#win4lin-loader
mkdir -p %{buildroot}/%{_datadir}/
tar -C %{buildroot}/%{_datadir} -xjf %{SOURCE2}
mkdir -p %{buildroot}/sbin
mv -f %{buildroot}/%{_datadir}/win4lin-loader/installwin4linkernel %{buildroot}/sbin

#Menu entries:
mkdir -p $RPM_BUILD_ROOT%{_menudir}
cat << EOF > $RPM_BUILD_ROOT%{_menudir}/win4lin-utils
?package(win4lin-utils):command="winsetup" icon="win4lin.png" \
needs="x11" section="Configuration/Other" title="Win4Lin" \
longtitle="Win4Lin Configuration"
?package(win4lin-utils):command="win" icon="win4lin.png" \
needs="x11" section="Applications/Emulators/" title="Win4Lin" \
longtitle="Win4Lin"
?package(win4lin-utils):command="fwin" icon="win4lin.png" \
needs="x11" section="Applications/Emulators/" title="Win4Lin full-screen" \
longtitle="Win4Lin in a new X server (full screen)"
EOF

#icons:
mkdir -p %{buildroot}/{%{_miconsdir},%{_liconsdir}}
convert -resize 16x16 %{SOURCE1} %{buildroot}/%{_miconsdir}/win4lin.png
convert -resize 32x32 %{SOURCE1} %{buildroot}/%{_iconsdir}/win4lin.png
convert -resize 48x48 %{SOURCE1} %{buildroot}/%{_liconsdir}/win4lin.png

%clean
rm -Rf %buildroot

%post
depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION} %{KERNVER}%{EXTRAVERSION} >/dev/null 2>&1
if [ -x /sbin/installwin4linkernel ];then
modprobe loop
  /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION} /boot/win4lin-%{KERNVER}%{EXTRAVERSION} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}
fi

%post -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT}
flavor="smp"
depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %{KERNVER}%{EXTRAVERSION}${flavor} >/dev/null 2>&1
if [ -x /sbin/installwin4linkernel ];then
modprobe loop
  /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor}
fi

%post -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT}
flavor="enterprise"
depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %{KERNVER}%{EXTRAVERSION}${flavor} >/dev/null 2>&1
if [ -x /sbin/installwin4linkernel ];then
modprobe loop
  /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor}
fi

%post -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT}
flavor="-i686-up-4GB"
depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %{KERNVER}%{EXTRAVERSION}${flavor} >/dev/null 2>&1
if [ -x /sbin/installwin4linkernel ];then
modprobe loop
  /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor}
fi

%post -n kernel-win4lin-p3-smp-64GB-%{KERNVER}.%{DISTRO_EXT}
flavor="-p3-smp-64GB"
depmod -a -F /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} %{KERNVER}%{EXTRAVERSION}${flavor} >/dev/null 2>&1
if [ -x /sbin/installwin4linkernel ];then
modprobe loop
  /sbin/installwin4linkernel -a -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor}
fi

%post -n win4lin-utils
%{update_menus}

%preun
/sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION} /boot/win4lin-%{KERNVER}%{EXTRAVERSION} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}

%preun -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT}
flavor="smp"
/sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor}

%preun -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT}
flavor="enterprise"
/sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor}

%preun -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT}
flavor="-i686-up-4GB"
/sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor}

%preun -n kernel-win4lin-p3-smp-64GB-%{KERNVER}.%{DISTRO_EXT}
flavor="-p3-smp-64GB"
/sbin/installwin4linkernel -a -R -c %{KERNVER}%{EXTRAVERSION}${flavor} /boot/win4lin-%{KERNVER}%{EXTRAVERSION}${flavor} /boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}${flavor}

%postun
depmod -a  %{KERNVER}%{EXTRAVERSION} >/dev/null 2>&1

%postun -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT}
depmod -a  %{KERNVER}%{EXTRAVERSION}smp >/dev/null 2>&1

%postun -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT}
depmod -a  %{KERNVER}%{EXTRAVERSION}enterprise >/dev/null 2>&1

%postun -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT}
depmod -a  %{KERNVER}%{EXTRAVERSION}i686-up-4GB >/dev/null 2>&1

%postun -n kernel-win4lin-p3-smp-64GB-%{KERNVER}.%{DISTRO_EXT}
depmod -a  %{KERNVER}%{EXTRAVERSION}p3-smp-64GB >/dev/null 2>&1

%postun -n win4lin-utils
%{clean_menus}

%files
%defattr(-,root,root)
/boot/win4lin-%{KERNVER}%{EXTRAVERSION}
/boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}/kernel/arch/*/mki-adapter
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}/misc/mki-adapter.o

%files -n kernel-win4lin-smp-%{KERNVER}.%{DISTRO_EXT}
%defattr(-,root,root)
/boot/win4lin-%{KERNVER}%{EXTRAVERSION}smp
/boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}smp
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}smp/kernel/arch/*/mki-adapter
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}smp/misc/mki-adapter.o

%files -n kernel-win4lin-enterprise-%{KERNVER}.%{DISTRO_EXT}
%defattr(-,root,root)
/boot/win4lin-%{KERNVER}%{EXTRAVERSION}enterprise
/boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}enterprise
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}enterprise/kernel/arch/*/mki-adapter
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}enterprise/misc/mki-adapter.o

%files -n kernel-win4lin-i686-up-4GB-%{KERNVER}.%{DISTRO_EXT}
%defattr(-,root,root)
/boot/win4lin-%{KERNVER}%{EXTRAVERSION}-i686-up-4GB
/boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}-i686-up-4GB
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}-i686-up-4GB/kernel/arch/*/mki-adapter
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}-i686-up-4GB/misc/mki-adapter.o

%files -n kernel-win4lin-p3-smp-64GB-%{KERNVER}.%{DISTRO_EXT}
%defattr(-,root,root)
/boot/win4lin-%{KERNVER}%{EXTRAVERSION}-p3-smp-64GB
/boot/System.map.win4lin-%{KERNVER}%{EXTRAVERSION}-p3-smp-64GB
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}-p3-smp-64GB/kernel/arch/*/mki-adapter
/%{_lib}/modules/%{KERNVER}-%{DISTRO_EXT}-p3-smp-64GB/misc/mki-adapter.o

%files -n win4lin-utils
%defattr(-,root,root)
%attr(755,root,root) /sbin/installwin4linkernel
%{_datadir}/win4lin-loader
%{_menudir}/win4lin-utils
%{_miconsdir}/win4lin.png
%{_iconsdir}/win4lin.png
%{_liconsdir}/win4lin.png

%changelog
* Mon Jun 21 2004 Frederic Crozat <fcrozat@mandrakesoft.com> 3-7mdk
- New version of mki_adapter
- Fix patch with RH9 version for TLS support
- Rebuild for new kernel

* Tue Oct 28 2003 Buchan Milne <bgmilne@linux-mandrake.com> 3-6mdk
- Build for more flavours
- Sync with bootloader-utils

* Fri Sep 19 2003 Buchan Milne <bgmilne@linux-mandrake.com> 3-5mdk
- Rebuild for new kernel

* Sun Sep 16 2003 Buchan Milne <bgmilne@cae.co.za> 3-4mdk
- Fix bad initrd message

* Sun Jun 29 2003 Buchan Milne <bgmilne@cae.co.za> 3-3mdk
- Really fix smp and enterprise kernels
- Cleanups

* Fri Jun 06 2003 Buchan Milne <bgmilne@cae.co.za> 3-2mdk
- fix bootloader scripts (win4lin-utils package)
- Preserve System.map between builds (try to make smp and enterprise boot ..)
- Add menus for win4lin
- Fix kernel-source version-detection (allows multiple kernel-source packages)

* Thu May 08 2003 Buchan Milne <bgmilne@cae.co.za> 3-1mdk
- First Mandrake package