wok view linux/receipt @ rev 7388

flam3: fix compile_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Nov 26 10:58:15 2010 +0100 (2010-11-26)
parents db069f80c0a0
children 1bea914df3b9
line source
1 # SliTaz package receipt.
3 PACKAGE="linux"
4 VERSION="2.6.36"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux kernel and modules."
7 DEPENDS="depmod"
8 BUILD_DEPENDS="slitaz-toolchain perl git"
9 MAINTAINER="devel@slitaz.org"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.kernel.org/"
12 WGET_URL="http://www.eu.kernel.org/pub/linux/kernel/v${VERSION:0:3}/$TARBALL"
13 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
19 # this is code to help update the kernel version faster
20 #for i in $(grep -l 'WANTED="linux"' $WOK/*/receipt)
21 #do
22 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
23 #done
24 local _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
25 local AUFSDIR="aufs-${_AUFSVER}"
26 TARBALL=$SOURCES_REPOSITORY/$AUFSDIR.tar.gz
27 if [ -f $TARBALL ]; then
28 tar xzf $TARBALL
29 cd $AUFSDIR && git checkout origin/aufs2
30 cd $WOK/$PACKAGE
31 else
32 # Aufs2 from git repository
33 git clone http://git.c3sl.ufpr.br/pub/scm/aufs/aufs2-standalone.git $AUFSDIR
34 tar czf $TARBALL $AUFSDIR
35 cd $AUFSDIR && git checkout origin/aufs2
36 cd $WOK/$PACKAGE
37 fi
38 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
39 cp -a $AUFSDIR/*.patch $WOK/$PACKAGE/stuff
40 # We need the real GNU patch
41 [ -L /usr/bin/patch ] && tazpkg get-install patch --forced
42 cd $src
43 # SliTaz db
44 [ -d slitaz ] && rm -rf slitaz 2> /dev/null
45 mkdir slitaz
46 echo "$WGET_URL" > slitaz/url
47 cp ../stuff/gztazmod.sh ../stuff/list_modules.sh slitaz
48 cp ../stuff/bootloader.sh slitaz
49 # Apply patches
50 while read patch_file; do
51 echo "$patch_file" >> slitaz/patches
52 cp ../stuff/$patch_file slitaz
53 if [ -f done.$patch_file ]; then
54 echo "Skipping $patch_file"
55 continue
56 fi
57 echo "Apply $patch_file"
58 patch -p1 < slitaz/$patch_file || exit 1
59 touch done.$patch_file
60 done <<EOT
61 $PACKAGE-diff-$VERSION.u
62 $PACKAGE-unlzma-$VERSION.u
63 $PACKAGE-header-$VERSION.u
64 $PACKAGE-freeinitrd-$VERSION.u
65 aufs2-base.patch
66 aufs2-standalone.patch
67 aufs2-module-2.6.36.patch
68 aufs2-2.6.36-fix.patch
69 EOT
70 make mrproper
71 cd Documentation/lguest
72 make lguest || return 1
73 cd ../..
74 cp ../stuff/$PACKAGE-$VERSION-slitaz.config .config
75 make oldconfig
76 ln .config slitaz/config
77 make -j 4 bzImage &&
78 make -j 4 modules &&
79 make INSTALL_MOD_PATH=$PWD/_pkg modules_install &&
80 make INSTALL_HDR_PATH=$PWD/_pkg/usr headers_install &&
81 [ -s arch/x86/boot/bzImage ]
82 # Compress all modules.
83 $WOK/$PACKAGE/stuff/gztazmod.sh $PWD/_pkg/lib/modules/$VERSION-slitaz
84 }
86 # Rules to gen a SliTaz package suitable for Tazpkg.
87 genpkg_rules()
88 {
89 local path
90 mkdir $fs/boot
91 cp -a $src/arch/x86/boot/bzImage \
92 $fs/boot/vmlinuz-$VERSION-slitaz
93 # Compress all modules.
94 #./stuff/gztazmod.sh $_pkg/lib/modules/$VERSION-slitaz
95 path=$fs/lib/modules/$VERSION-slitaz/kernel
96 mkdir -p $path
97 cp -a $_pkg/lib/modules/$VERSION-slitaz/mo* \
98 $fs/lib/modules/$VERSION-slitaz
99 # Get the base modules
100 export src
101 export _pkg
102 $src/slitaz/list_modules.sh \
103 $(cat stuff/modules-$VERSION.list) > $src/modules.list
104 while read module; do
105 dir=$(dirname $module)
106 [ -d $path/$dir ] || mkdir -p $path/$dir
107 cp -a $_pkg/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
108 done < $src/modules.list
109 # Remove unresolved links
110 rm -f $fs/lib/modules/$VERSION-slitaz/build
111 rm -f $fs/lib/modules/$VERSION-slitaz/source
112 # Cook all packages with a kernel module
113 for i in $(cd $WOK; grep -l 'tazwok cook linux$' */receipt)
114 do
115 echo tazwok cook ${i%/receipt}
116 done
117 # Check and echo any module in kernel .config that's not added to
118 # one of linux-* pkgs
119 ./stuff/check_modules.sh
120 }
122 # Pre and post install commands for Tazpkg.
123 post_install()
124 {
125 echo "Processing post-install commands..."
126 chroot "$1/" depmod -a $VERSION-slitaz
127 # GRUB stuff.
128 if [ -f "$1/boot/grub/menu.lst" ]; then
129 root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1`
130 grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1`
131 # Add new kernel entry in case of upgrade for installed system.
132 if ! grep -q $PACKAGE-$VERSION-slitaz $1/boot/grub/menu.lst; then
133 cat >> $1/boot/grub/menu.lst << EOT
135 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
136 $grub_dev
137 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
138 EOT
139 fi
140 # Display information message.
141 cat <<EOT
142 ----
143 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
145 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
146 $grub_dev
147 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
148 ----
149 EOT
150 fi
151 }
153 clean_wok()
154 {
155 #rm -rf aufs2
156 rm stuff/aufs2-base*
157 rm stuff/aufs2-standalone*
158 rm stuff/aufs2-kbuild*
159 rm -rf stuff/tmp
160 }