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