wok view linux-libre/receipt @ rev 19797

linux-libre: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 24 11:29:24 2017 +0100 (2017-02-24)
parents 6fab3264ba87
children 10c74e95b062
line source
1 # SliTaz package receipt.
3 PACKAGE="linux-libre"
4 VERSION="2.6.37-gnu"
5 CATEGORY="base-system"
6 SHORT_DESC="The Linux Libre kernel and modules."
7 MAINTAINER="gokhlayeh@slitaz.org"
8 LICENSE="GPL2"
9 PROVIDE="linux"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
12 WGET_URL="http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/$VERSION/$TARBALL"
13 CONFIG_FILES="/lib/modules/$VERSION-slitaz/modules.dep"
15 DEPENDS="depmod"
16 BUILD_DEPENDS="slitaz-toolchain perl git lzma patch aufs"
18 # Rules to configure and make the package.
19 compile_rules()
20 {
21 # this is code to help update the kernel version faster
22 #for i in $(grep -l 'WANTED="linux-libre"' $WOK/*/receipt)
23 #do
24 # sed -i 's|VERSION="OLDVERSION"|VERSION="NEWVERSION"|g' $i
25 #done
27 [ ! -x /usr/bin/cook ] && report open-bloc
29 # Check for Aufs and cook it if unbuilt.
30 echo "Checking for Aufs packages..."
31 _AUFSVER=`grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
32 if [ ! -x /usr/bin/cook ]; then
33 # We only need aufs source. Also cooking now is a bad idea since it
34 # needs linux-module-headers.
35 AUFSDIR=$WOK/aufs/aufs-${_AUFSVER}
36 [ -d "$AUFSDIR" ] && rm -rf $AUFSDIR
37 tazwok get-src aufs --target=$AUFSDIR || { report close-bloc; return 1; }
38 fi
40 echo "Copying Aufs files and patches..."
41 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
42 cp -a $AUFSDIR/*.patch $stuff
44 # SliTaz db
45 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
46 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
47 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
48 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
50 # Apply patches
51 echo "Applying patches..."
52 while read patch_file; do
53 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
54 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
55 if [ -f done.$patch_file ]; then
56 echo "Skipping $patch_file"
57 continue
58 fi
59 echo "Apply $patch_file"
60 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || { report close-bloc; return 1; }
61 touch done.$patch_file
62 done <<EOT
63 $PACKAGE-diff-$VERSION.u
64 $PACKAGE-header-$VERSION.u
65 $PACKAGE-freeinitrd-$VERSION.u
66 aufs2-base.patch
67 aufs2-standalone.patch
68 001-squashfs-decompressors-add-xz-decompressor-module.patch
69 002-squashfs-decompressors-add-boot-time-xz-support.patch
70 003-squashfs-x86-support-xz-compressed-kernel.patch
71 004-squashfs-add-xz-compression-support.patch
72 005-squashfs-add-xz-compression-configuration-option.patch
73 EOT
75 [ ! -x /usr/bin/cook ] && report step "Make kernel proper and then build lguest"
77 make mrproper
78 cd Documentation/lguest
79 make $MAKEFLAGS lguest || { report close-bloc; return 1; }
80 cd $src
82 [ ! -x /usr/bin/cook ] && report step "Make bzImage without modules first"
84 # Build bzImage without modules first
85 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
86 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
88 # We can't keep every driver in staging
89 sed -i -e 's/^CONFIG_RTL8192/#&/' \
90 -e 's/^CONFIG_R8187SE/#&/' \
91 -e 's/^CONFIG_RT2870/#&/' .config
92 yes '' | make oldconfig
93 make $MAKEFLAGS bzImage || { report close-bloc; return 1; }
94 [ -d $DESTDIR ] || mkdir -p $DESTDIR
95 mv arch/x86/boot/bzImage $DESTDIR
96 mv System.map System.map-without-modules
98 [ ! -x /usr/bin/cook ] && report step "Now build bzImage with modules"
100 # Build bzImage with modules
101 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
102 make oldconfig
103 ln .config $WOK/$PACKAGE/slitaz/config
104 make $MAKEFLAGS bzImage &&
105 make $MAKEFLAGS modules &&
106 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
107 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
108 [ -s arch/x86/boot/bzImage ] || { report close-bloc; return 1; }
109 mkdir -p $DESTDIR/boot 2> /dev/null
110 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
112 [ ! -x /usr/bin/cook ] && report step "Compressing all modules"
114 # Compress all modules.
115 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
116 ln System.map System.map-modules
117 ln Module.symvers Module.symvers-modules
119 if [ ! -x /usr/bin/cook ]; then
120 report close-bloc
121 fi
122 }
124 # Rules to gen a SliTaz package suitable for Tazpkg.
125 genpkg_rules()
126 {
127 local path
128 cp -a $install/boot $fs
129 # Compress all modules.
130 #$stuff/gztazmod.sh $install/lib/modules/$VERSION-slitaz
131 path=$fs/lib/modules/$VERSION-slitaz/kernel
132 mkdir -p $path
133 cp -a $install/lib/modules/$VERSION-slitaz/mo* \
134 $fs/lib/modules/$VERSION-slitaz
135 # Get the base modules
136 export src
137 export _pkg
138 mkdir $WOK/$PACKAGE/tmp
139 $stuff/list_modules.sh \
140 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
141 while read module; do
142 dir=$(dirname $module)
143 [ -d $path/$dir ] || mkdir -p $path/$dir
144 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
145 done < $WOK/$PACKAGE/tmp/modules.list
146 # Remove unresolved links
147 rm -f $fs/lib/modules/$VERSION-slitaz/build
148 rm -f $fs/lib/modules/$VERSION-slitaz/source
150 # Pack all packages with a kernel module
151 for i in $(cd $WOK; grep -l '^WANTED="linux-libre"' */receipt); do
152 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
153 cook ${i%/receipt}
154 done
156 # Check and echo any module in kernel .config that's not added to
157 # one of linux-* pkgs
158 export PACKAGE
159 $stuff/check_modules.sh
160 }
162 # Pre and post install commands for Tazpkg.
163 post_install()
164 {
165 chroot "$1/" depmod -a $VERSION-slitaz
166 # GRUB stuff.
167 if [ -f "$1/boot/grub/menu.lst" ]; then
168 root_dev=$(cat "$1/boot/grub/menu.lst" | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1)
169 grub_dev=$(cat "$1/boot/grub/menu.lst" | grep "root (" | head -n 1)
170 # Add new kernel entry in case of upgrade for installed system.
171 if ! grep -q $PACKAGE-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
172 cat >> "$1/boot/grub/menu.lst" <<EOT
174 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
175 $grub_dev
176 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
177 EOT
178 fi
179 # Display information message.
180 cat <<EOT
181 ----
182 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
184 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
185 $grub_dev
186 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
187 ----
188 EOT
189 fi
190 true
191 }