wok view linux-libre/receipt @ rev 25037

Up glza (0.11.4)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 21 21:38:29 2022 +0000 (23 months ago)
parents 89c8d8b6cf48
children 8b627a0fc33a
line source
1 # SliTaz package receipt.
3 PACKAGE="linux-libre"
4 VERSION="3.18.129-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/ikiwiki/selibre/linux-libre/"
12 WGET_URL="http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/old/gen6/$VERSION/$TARBALL"
14 DEPENDS="kmod"
15 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc \
16 sysfsutils-dev libtool glib-dev libwrap libwrap-dev udev-dev"
18 # What is the latest version available today?
19 current_version()
20 {
21 wget -O - http://linux-libre.fsfla.org/pub/linux-libre/releases/ 2> /dev/null | \
22 sed '/-gnu/!d;s|.*ref="||;s|/".*||' | sed '$!d'
23 }
25 # Rules to configure and make the package.
26 compile_rules()
27 {
28 # SliTaz db
29 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
30 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
31 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
32 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
34 # Apply patches
35 echo "Applying patches..."
36 while read patch_file; do
37 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
38 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
39 if [ -f done.$patch_file ]; then
40 echo "Skipping $patch_file"
41 continue
42 fi
43 echo "Apply $patch_file"
44 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || return 1
45 touch done.$patch_file
46 done <<EOT
47 $PACKAGE-lzma-$VERSION.u
48 $PACKAGE-freeinitrd-$VERSION.u
49 $PACKAGE-efi-$VERSION.u
50 EOT
52 make mrproper
53 cd tools/lguest
54 make $MAKEFLAGS lguest || return 1
55 cd $src
57 # Build bzImage without modules first
58 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
59 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
61 yes '' | make oldconfig
62 make $MAKEFLAGS bzImage || return 1
63 [ -d $DESTDIR ] || mkdir -p $DESTDIR
64 mv arch/x86/boot/bzImage $DESTDIR
65 mv System.map System.map-without-modules
67 # Build bzImage with modules
68 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
69 make oldconfig
70 ln .config $WOK/$PACKAGE/slitaz/config
71 make $MAKEFLAGS bzImage &&
72 make $MAKEFLAGS modules &&
73 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
74 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
75 [ -s arch/x86/boot/bzImage ] || return 1
76 mkdir -p $DESTDIR/boot 2> /dev/null
77 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
79 # Compress all modules.
80 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
81 ln System.map System.map-modules
82 ln Module.symvers Module.symvers-modules
83 }
85 # Rules to gen a SliTaz package suitable for Tazpkg.
86 genpkg_rules()
87 {
88 local path
89 cp -a $install/boot $fs
90 # Compress all modules.
91 #$stuff/gztazmod.sh $install/lib/modules/$VERSION-slitaz
92 path=$fs/lib/modules/$VERSION-slitaz/kernel
93 mkdir -p $path
94 cp -a $install/lib/modules/$VERSION-slitaz/mo* \
95 $fs/lib/modules/$VERSION-slitaz
96 # Get the base modules
97 export src
98 export _pkg
99 mkdir $WOK/$PACKAGE/tmp
100 $stuff/list_modules.sh \
101 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
102 while read module; do
103 dir=$(dirname $module)
104 [ -d $path/$dir ] || mkdir -p $path/$dir
105 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
106 done < $WOK/$PACKAGE/tmp/modules.list
107 # Remove unresolved links
108 rm -f $fs/lib/modules/$VERSION-slitaz/build
109 rm -f $fs/lib/modules/$VERSION-slitaz/source
111 # Pack all packages with a kernel module
112 for i in $(cd $WOK; grep -l '^WANTED="linux-libre"' */receipt); do
113 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
114 cook ${i%/receipt}
115 done
117 # Check and echo any module in kernel .config that's not added to
118 # one of linux-* pkgs
119 export PACKAGE
120 $stuff/check_modules.sh
121 }
123 # Pre and post install commands for Tazpkg.
124 post_install()
125 {
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 true
152 }