wok-6.x view linux-libre/receipt @ rev 25506
memtest, pack: cleanup
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Feb 09 16:28:01 2023 +0000 (21 months ago) |
parents | bd7510903310 |
children |
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.vcdiff"
11 WEB_SITE="http://www.fsfla.org/ikiwiki/selibre/linux-libre/"
12 WGET_URL="http://linux-libre.fsfla.org/pub/linux-libre/releases/old/gen6/$VERSION/$TARBALL"
13 EXTRA_SOURCE_FILES="https://mirrors.edge.kernel.org/pub/linux/kernel/v${VERSION%%.*}.x/linux-${VERSION%-gnu}.tar.xz"
15 DEPENDS="kmod"
16 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc \
17 sysfsutils-dev libtool glib-dev libwrap libwrap-dev udev-dev xdelta"
19 # What is the latest version available today?
20 current_version()
21 {
22 wget -O - http://linux-libre.fsfla.org/pub/linux-libre/releases/ 2> /dev/null | \
23 sed '/-gnu/!d;s|.*ref="||;s|/".*||' | sed '$!d'
24 }
26 # Rules to configure and make the package.
27 compile_rules()
28 {
29 [ -s "$SOURCES_REPOSITORY/$(basename $EXTRA_SOURCE_FILES)" ] ||
30 busybox wget -P "$SOURCES_REPOSITORY/" "$EXTRA_SOURCE_FILES"
31 xzcat < $SOURCES_REPOSITORY//$(basename $EXTRA_SOURCE_FILES) > $(basename $EXTRA_SOURCE_FILES .xz)
32 xdelta3 -d $TARBALL
33 tar xf ${TARBALL/vcdiff/tar}
34 mv linux-*/* .
36 # SliTaz db
37 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
38 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
39 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
40 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
42 # Apply patches
43 echo "Applying patches..."
44 while read patch_file; do
45 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
46 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
47 if [ -f done.$patch_file ]; then
48 echo "Skipping $patch_file"
49 continue
50 fi
51 echo "Apply $patch_file"
52 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || return 1
53 touch done.$patch_file
54 done <<EOT
55 $PACKAGE-lzma-$VERSION.u
56 $PACKAGE-freeinitrd-$VERSION.u
57 $PACKAGE-efi-$VERSION.u
58 EOT
60 make mrproper
61 cd tools/lguest
62 make $MAKEFLAGS lguest || return 1
63 cd $src
65 # Build bzImage without modules first
66 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
67 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
69 yes '' | make oldconfig
70 make $MAKEFLAGS bzImage || return 1
71 [ -d $DESTDIR ] || mkdir -p $DESTDIR
72 mv arch/x86/boot/bzImage $DESTDIR
73 mv System.map System.map-without-modules
75 # Build bzImage with modules
76 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
77 make oldconfig
78 ln .config $WOK/$PACKAGE/slitaz/config
79 make $MAKEFLAGS bzImage &&
80 make $MAKEFLAGS modules &&
81 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
82 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
83 [ -s arch/x86/boot/bzImage ] || return 1
84 mkdir -p $DESTDIR/boot 2> /dev/null
85 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
87 # Compress all modules.
88 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
89 ln System.map System.map-modules
90 ln Module.symvers Module.symvers-modules
91 }
93 # Rules to gen a SliTaz package suitable for Tazpkg.
94 genpkg_rules()
95 {
96 local path
97 cp -a $install/boot $fs
98 # Compress all modules.
99 #$stuff/gztazmod.sh $install/lib/modules/$VERSION-slitaz
100 path=$fs/lib/modules/$VERSION-slitaz/kernel
101 mkdir -p $path
102 cp -a $install/lib/modules/$VERSION-slitaz/mo* \
103 $fs/lib/modules/$VERSION-slitaz
104 # Get the base modules
105 export src
106 export _pkg
107 mkdir $WOK/$PACKAGE/tmp
108 $stuff/list_modules.sh \
109 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
110 while read module; do
111 dir=$(dirname $module)
112 [ -d $path/$dir ] || mkdir -p $path/$dir
113 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
114 done < $WOK/$PACKAGE/tmp/modules.list
115 # Remove unresolved links
116 rm -f $fs/lib/modules/$VERSION-slitaz/build
117 rm -f $fs/lib/modules/$VERSION-slitaz/source
119 # Pack all packages with a kernel module
120 for i in $(cd $WOK; grep -l '^WANTED="linux-libre"' */receipt); do
121 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
122 cook ${i%/receipt}
123 done
125 # Check and echo any module in kernel .config that's not added to
126 # one of linux-* pkgs
127 export PACKAGE
128 $stuff/check_modules.sh
129 }
131 # Pre and post install commands for Tazpkg.
132 post_install()
133 {
134 chroot "$1/" depmod -a $VERSION-slitaz
135 # GRUB stuff.
136 if [ -f "$1/boot/grub/menu.lst" ]; then
137 root_dev=$(cat "$1/boot/grub/menu.lst" | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1)
138 grub_dev=$(cat "$1/boot/grub/menu.lst" | grep "root (" | head -n 1)
139 # Add new kernel entry in case of upgrade for installed system.
140 if ! grep -q $PACKAGE-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
141 cat >> "$1/boot/grub/menu.lst" <<EOT
143 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
144 $grub_dev
145 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
146 EOT
147 fi
148 # Display information message.
149 cat <<EOT
150 ----
151 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
153 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
154 $grub_dev
155 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
156 ----
157 EOT
158 fi
159 true
160 }