wok annotate linux-libre/receipt @ rev 24476

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 18 09:29:30 2022 +0000 (2022-02-18)
parents 324b3fa82b76
children bd7510903310
rev   line source
gokhlayeh@9257 1 # SliTaz package receipt.
gokhlayeh@9257 2
gokhlayeh@9257 3 PACKAGE="linux-libre"
pascal@20604 4 VERSION="3.18.129-gnu"
gokhlayeh@9257 5 CATEGORY="base-system"
gokhlayeh@9257 6 SHORT_DESC="The Linux Libre kernel and modules."
gokhlayeh@9257 7 MAINTAINER="gokhlayeh@slitaz.org"
pascal@14657 8 LICENSE="GPL2"
gokhlayeh@9257 9 PROVIDE="linux"
pascal@14201 10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
pascal@24051 11 WEB_SITE="http://www.fsfla.org/ikiwiki/selibre/linux-libre/"
gokhlayeh@9257 12 WGET_URL="http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/$VERSION/$TARBALL"
gokhlayeh@9257 13
pascal@20604 14 DEPENDS="kmod"
pascal@20604 15 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod bc \
pascal@20604 16 sysfsutils-dev libtool glib-dev libwrap libwrap-dev udev-dev"
slaxemulator@10638 17
pascal@24476 18 # What is the latest version available today?
pascal@24051 19 current_version()
pascal@24051 20 {
pascal@24051 21 wget -O - http://linux-libre.fsfla.org/pub/linux-libre/releases/ 2> /dev/null | \
pascal@24051 22 sed '/-gnu/!d;s|.*ref="||;s|/".*||' | sed '$!d'
pascal@24051 23 }
pascal@24051 24
gokhlayeh@9257 25 # Rules to configure and make the package.
gokhlayeh@9257 26 compile_rules()
gokhlayeh@9257 27 {
gokhlayeh@9257 28 # SliTaz db
gokhlayeh@11396 29 rm -rf $WOK/$PACKAGE/slitaz && mkdir $WOK/$PACKAGE/slitaz
slaxemulator@9337 30 echo "$WGET_URL" > $WOK/$PACKAGE/slitaz/url
gokhlayeh@9257 31 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/slitaz
gokhlayeh@9257 32 cp $stuff/bootloader.sh $WOK/$PACKAGE/slitaz
slaxemulator@10638 33
gokhlayeh@9257 34 # Apply patches
gokhlayeh@11396 35 echo "Applying patches..."
gokhlayeh@9257 36 while read patch_file; do
gokhlayeh@9257 37 echo "$patch_file" >> $WOK/$PACKAGE/slitaz/patches
gokhlayeh@9257 38 cp $stuff/$patch_file $WOK/$PACKAGE/slitaz
gokhlayeh@9257 39 if [ -f done.$patch_file ]; then
gokhlayeh@9257 40 echo "Skipping $patch_file"
gokhlayeh@9257 41 continue
gokhlayeh@9257 42 fi
gokhlayeh@9257 43 echo "Apply $patch_file"
pascal@20604 44 patch -p1 < $WOK/$PACKAGE/slitaz/$patch_file || return 1
gokhlayeh@9257 45 touch done.$patch_file
gokhlayeh@9257 46 done <<EOT
pascal@20604 47 $PACKAGE-lzma-$VERSION.u
gokhlayeh@9257 48 $PACKAGE-freeinitrd-$VERSION.u
pascal@20626 49 $PACKAGE-efi-$VERSION.u
gokhlayeh@9257 50 EOT
gokhlayeh@11396 51
gokhlayeh@9257 52 make mrproper
pascal@20604 53 cd tools/lguest
pascal@20604 54 make $MAKEFLAGS lguest || return 1
gokhlayeh@9257 55 cd $src
gokhlayeh@9257 56
gokhlayeh@9257 57 # Build bzImage without modules first
gokhlayeh@9257 58 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
gokhlayeh@9257 59 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
al@18741 60
gokhlayeh@9257 61 yes '' | make oldconfig
pascal@20604 62 make $MAKEFLAGS bzImage || return 1
pascal@15602 63 [ -d $DESTDIR ] || mkdir -p $DESTDIR
pascal@15602 64 mv arch/x86/boot/bzImage $DESTDIR
gokhlayeh@9257 65 mv System.map System.map-without-modules
gokhlayeh@9257 66
gokhlayeh@9257 67 # Build bzImage with modules
gokhlayeh@9257 68 cp -f $stuff/$PACKAGE-$VERSION-slitaz.config .config
gokhlayeh@9257 69 make oldconfig
gokhlayeh@9257 70 ln .config $WOK/$PACKAGE/slitaz/config
gokhlayeh@11396 71 make $MAKEFLAGS bzImage &&
gokhlayeh@11396 72 make $MAKEFLAGS modules &&
pascal@15602 73 make INSTALL_MOD_PATH=$DESTDIR modules_install &&
pascal@15602 74 make INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
pascal@20604 75 [ -s arch/x86/boot/bzImage ] || return 1
pascal@15602 76 mkdir -p $DESTDIR/boot 2> /dev/null
pascal@15602 77 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
al@18741 78
gokhlayeh@9257 79 # Compress all modules.
pascal@15602 80 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
gokhlayeh@9257 81 ln System.map System.map-modules
gokhlayeh@9257 82 ln Module.symvers Module.symvers-modules
gokhlayeh@9257 83 }
gokhlayeh@9257 84
gokhlayeh@9257 85 # Rules to gen a SliTaz package suitable for Tazpkg.
gokhlayeh@9257 86 genpkg_rules()
gokhlayeh@9257 87 {
al@18741 88 local path
al@18741 89 cp -a $install/boot $fs
al@18741 90 # Compress all modules.
al@18741 91 #$stuff/gztazmod.sh $install/lib/modules/$VERSION-slitaz
al@18741 92 path=$fs/lib/modules/$VERSION-slitaz/kernel
al@18741 93 mkdir -p $path
al@18741 94 cp -a $install/lib/modules/$VERSION-slitaz/mo* \
gokhlayeh@9257 95 $fs/lib/modules/$VERSION-slitaz
al@18741 96 # Get the base modules
al@18741 97 export src
al@18741 98 export _pkg
al@18741 99 mkdir $WOK/$PACKAGE/tmp
al@18741 100 $stuff/list_modules.sh \
gokhlayeh@11396 101 $(cat stuff/modules-$VERSION.list) > $WOK/$PACKAGE/tmp/modules.list
al@18741 102 while read module; do
al@18741 103 dir=$(dirname $module)
al@18741 104 [ -d $path/$dir ] || mkdir -p $path/$dir
al@18741 105 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
al@18741 106 done < $WOK/$PACKAGE/tmp/modules.list
al@18741 107 # Remove unresolved links
al@18741 108 rm -f $fs/lib/modules/$VERSION-slitaz/build
al@18741 109 rm -f $fs/lib/modules/$VERSION-slitaz/source
pascal@17733 110
al@18741 111 # Pack all packages with a kernel module
al@18741 112 for i in $(cd $WOK; grep -l '^WANTED="linux-libre"' */receipt); do
al@18741 113 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
al@18741 114 cook ${i%/receipt}
al@18741 115 done
al@18741 116
al@18741 117 # Check and echo any module in kernel .config that's not added to
al@18741 118 # one of linux-* pkgs
al@18741 119 export PACKAGE
al@18741 120 $stuff/check_modules.sh
gokhlayeh@9257 121 }
gokhlayeh@9257 122
gokhlayeh@9257 123 # Pre and post install commands for Tazpkg.
gokhlayeh@9257 124 post_install()
gokhlayeh@9257 125 {
al@18741 126 chroot "$1/" depmod -a $VERSION-slitaz
al@18741 127 # GRUB stuff.
al@18741 128 if [ -f "$1/boot/grub/menu.lst" ]; then
al@18741 129 root_dev=$(cat "$1/boot/grub/menu.lst" | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1)
al@18741 130 grub_dev=$(cat "$1/boot/grub/menu.lst" | grep "root (" | head -n 1)
gokhlayeh@9257 131 # Add new kernel entry in case of upgrade for installed system.
pascal@18730 132 if ! grep -q $PACKAGE-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
al@18741 133 cat >> "$1/boot/grub/menu.lst" <<EOT
gokhlayeh@9257 134
gokhlayeh@9257 135 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
gokhlayeh@9257 136 $grub_dev
gokhlayeh@9257 137 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
gokhlayeh@9257 138 EOT
gokhlayeh@9257 139 fi
gokhlayeh@9257 140 # Display information message.
al@18741 141 cat <<EOT
gokhlayeh@9257 142 ----
gokhlayeh@9257 143 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
gokhlayeh@9257 144
gokhlayeh@9257 145 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
gokhlayeh@9257 146 $grub_dev
gokhlayeh@9257 147 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
gokhlayeh@9257 148 ----
gokhlayeh@9257 149 EOT
al@18741 150 fi
al@18741 151 true
gokhlayeh@9257 152 }