wok annotate squashfs/receipt @ rev 315

Squashfs: build needs gnu patch
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Mar 03 21:57:01 2008 +0000 (2008-03-03)
parents 3bac1508116b
children cd99ec381938
rev   line source
pascal@236 1 # SliTaz package receipt.
pascal@236 2
pascal@236 3 PACKAGE="squashfs"
pascal@236 4 VERSION="3.3"
pascal@236 5 CATEGORY="base-system"
pascal@236 6 SHORT_DESC="Linux squashfs module and userland tools."
pascal@236 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@236 8 WEB_SITE="http://$PACKAGE.sourceforge.net/"
pascal@236 9 TARBALL="squashfs$VERSION.tgz"
pascal@236 10 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
pascal@236 11 DEPENDS="zlib"
pascal@315 12 BUILD_DEPENDS="zlib-dev patch"
pascal@236 13
pascal@236 14 # Rules to configure and make the package.
pascal@236 15 compile_rules()
pascal@236 16 {
pascal@236 17 local kver
pascal@236 18 local patch_dir
pascal@236 19
pascal@236 20 # get kernel version
pascal@242 21 if [ ! -d ../linux/taz ]; then
pascal@242 22 tazwok cook linux
pascal@242 23 fi
pascal@236 24 kver=$(grep "kernel version" ../linux/linux-*/.config)
pascal@236 25 kver=${kver##* }
pascal@236 26
pascal@236 27 # Select patch according to kernel version
pascal@236 28 patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-${kver%.*}
pascal@236 29 if [ -f ${PACKAGE}${VERSION}/kernel-patches/linux-$kver ]; then
pascal@240 30 patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-$kver
pascal@236 31 fi
pascal@240 32 if [ ! -d $patch_dir ]; then
pascal@240 33 echo "No squashfs patchset for kernel $ker. Abort."
pascal@240 34 return 1
pascal@240 35 fi
pascal@236 36 [ -d _kernel ] && rm -rf _kernel
pascal@236 37 mkdir _kernel
pascal@236 38 cd _kernel
pascal@236 39 ln -s ../../linux/linux-$kver* src
pascal@236 40
pascal@236 41 # Copy files to be patched in local aera
pascal@236 42 # Do not alter kernel sources !!
pascal@236 43 for i in $(grep ^--- ../$patch_dir/${PACKAGE}${VERSION}-patch | \
pascal@236 44 awk '{ if ($3 != "1970-01-01") print $2 } '); do
pascal@236 45 ( cd src ; tar cf - ${i#*/}) | tar xf -
pascal@236 46 done
pascal@236 47
pascal@236 48 # Apply squashfs patches in local aera
pascal@304 49 patch -p1 < ../$patch_dir/${PACKAGE}${VERSION}-patch
pascal@236 50
pascal@236 51 # Move every files in fs/squashfs directory
pascal@240 52 mv include/linux/* fs/squashfs
pascal@240 53 ln -s . fs/squashfs/linux
pascal@240 54 for i in fs/squashfs/*.c fs/squashfs/*.h ; do
pascal@240 55 sed -e 's/#include <\(linux\/squashfs.*\)>.*/#include "\1"/g' > $i.$$ < $i
pascal@240 56 sed -e 's/CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE/3/g' > $i < $i.$$
pascal@240 57 done
pascal@236 58
pascal@236 59 # Build kernel module
pascal@240 60 make -C src/. SUBDIRS=$(pwd)/fs/squashfs/ CONFIG_SQUASHFS=m modules
pascal@236 61 cd ..
pascal@236 62 [ -d _pkg ] && rm -rf _pkg
pascal@247 63 mkdir -p _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs
pascal@247 64 mkdir -p _pkg/usr/sbin _pkg/sbin
pascal@236 65 cp _kernel/fs/squashfs/squashfs.ko \
pascal@236 66 _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs/squashfs.ko
pascal@236 67 gzip -9 _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs/squashfs.ko
pascal@236 68
pascal@236 69 # Build user land tools
pascal@236 70 cd ${PACKAGE}${VERSION}/squashfs-tools
pascal@236 71 make
pascal@247 72 cp mksquashfs ../../_pkg/usr/sbin
pascal@247 73 cp unsquashfs ../../_pkg/sbin
pascal@236 74 }
pascal@236 75
pascal@236 76 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@236 77 genpkg_rules()
pascal@236 78 {
pascal@236 79 cp -a _pkg/* $fs
pascal@236 80 }
pascal@236 81
pascal@242 82 # Post install/remove commands for Tazpkg.
pascal@236 83 post_install()
pascal@236 84 {
pascal@236 85 depmod -a
pascal@236 86 }
pascal@242 87
pascal@242 88 post_remove()
pascal@242 89 {
pascal@242 90 depmod -a
pascal@242 91 }