wok-current view linux-libre/receipt @ rev 24056
Up zstd (1.5.0)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jun 08 09:29:15 2021 +0000 (2021-06-08) |
parents | 0f7e6289846d |
children | 89c8d8b6cf48 |
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/$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 current_version()
19 {
20 wget -O - http://linux-libre.fsfla.org/pub/linux-libre/releases/ 2> /dev/null | \
21 sed '/-gnu/!d;s|.*ref="||;s|/".*||' | sed '$!d'
22 }
24 # Rules to configure and make the package.
25 compile_rules()
26 {
27 # SliTaz db
28 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
29 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
30 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
31 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
33 # Apply patches
34 echo "Applying patches..."
35 while read patch_file; do
36 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
37 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
38 if [ -f done.$patch_file ]; then
39 echo "Skipping $patch_file"
40 continue
41 fi
42 echo "Apply $patch_file"
43 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || return 1
44 touch done.$patch_file
45 done <<EOT
46 $PACKAGE-lzma-$VERSION.u
47 $PACKAGE-freeinitrd-$VERSION.u
48 $PACKAGE-efi-$VERSION.u
49 EOT
51 make mrproper
52 cd tools/lguest
53 make $MAKEFLAGS lguest || return 1
54 cd $src
56 # Build bzImage without modules first
57 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
58 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
60 yes '' | make oldconfig
61 make $MAKEFLAGS bzImage || return 1
62 [ -d $DESTDIR ] || mkdir -p $DESTDIR
63 mv arch/x86/boot/bzImage $DESTDIR
64 mv System.map System.map-without-modules
66 # Build bzImage with modules
67 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
68 make oldconfig
69 ln .config $WOK/$PACKAGE/slitaz/config
70 make $MAKEFLAGS bzImage &&
71 make $MAKEFLAGS modules &&
72 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
73 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
74 [ -s arch/x86/boot/bzImage ] || return 1
75 mkdir -p $DESTDIR/boot 2> /dev/null
76 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
78 # Compress all modules.
79 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
80 ln System.map System.map-modules
81 ln Module.symvers Module.symvers-modules
82 }
84 # Rules to gen a SliTaz package suitable for Tazpkg.
85 genpkg_rules()
86 {
87 local path
88 cp -a $install/boot $fs
89 # Compress all modules.
90 #$stuff/gztazmod.sh $install/lib/modules/$VERSION-slitaz
91 path=$fs/lib/modules/$VERSION-slitaz/kernel
92 mkdir -p $path
93 cp -a $install/lib/modules/$VERSION-slitaz/mo* \
94 $fs/lib/modules/$VERSION-slitaz
95 # Get the base modules
96 export src
97 export _pkg
98 mkdir $WOK/$PACKAGE/tmp
99 $stuff/list_modules.sh \
100 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
101 while read module; do
102 dir=$(dirname $module)
103 [ -d $path/$dir ] || mkdir -p $path/$dir
104 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
105 done < $WOK/$PACKAGE/tmp/modules.list
106 # Remove unresolved links
107 rm -f $fs/lib/modules/$VERSION-slitaz/build
108 rm -f $fs/lib/modules/$VERSION-slitaz/source
110 # Pack all packages with a kernel module
111 for i in $(cd $WOK; grep -l '^WANTED="linux-libre"' */receipt); do
112 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
113 cook ${i%/receipt}
114 done
116 # Check and echo any module in kernel .config that's not added to
117 # one of linux-* pkgs
118 export PACKAGE
119 $stuff/check_modules.sh
120 }
122 # Pre and post install commands for Tazpkg.
123 post_install()
124 {
125 chroot "$1/" depmod -a $VERSION-slitaz
126 # GRUB stuff.
127 if [ -f "$1/boot/grub/menu.lst" ]; then
128 root_dev=$(cat "$1/boot/grub/menu.lst" | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1)
129 grub_dev=$(cat "$1/boot/grub/menu.lst" | grep "root (" | head -n 1)
130 # Add new kernel entry in case of upgrade for installed system.
131 if ! grep -q $PACKAGE-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
132 cat >> "$1/boot/grub/menu.lst" <<EOT
134 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
135 $grub_dev
136 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
137 EOT
138 fi
139 # Display information message.
140 cat <<EOT
141 ----
142 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
144 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
145 $grub_dev
146 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
147 ----
148 EOT
149 fi
150 true
151 }