wok-4.x annotate squashfs/receipt @ rev 1543

smbclient: fix build tree
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Oct 11 14:06:07 2008 +0000 (2008-10-11)
parents b4ca1619acb9
children ca15fff92039
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@909 6 SHORT_DESC="Linux squashfs 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@909 11 DEPENDS="zlib squashfs-module"
pascal@1543 12 BUILD_DEPENDS="zlib-dev patch lzma"
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@1543 20 mkdir -p $src
pascal@1543 21 cd $src
pascal@1543 22 mv ../$PACKAGE$VERSION .
pascal@236 23 # get kernel version
pascal@1452 24 if [ ! -d $WOK/linux/taz ]; then
pascal@242 25 tazwok cook linux
pascal@242 26 fi
pascal@1452 27 kver=$(grep "kernel version" $WOK/linux/linux-*/.config)
pascal@236 28 kver=${kver##* }
pascal@236 29
pascal@236 30 # Select patch according to kernel version
pascal@236 31 patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-${kver%.*}
pascal@909 32 i=${patch_dir##*.}
pascal@909 33 while [ ! -d ${patch_dir%.*}.$i ]; do
pascal@909 34 [ "$i" = "0" ] && break
pascal@909 35 i=$(($i - 1))
pascal@909 36 done
pascal@909 37 patch_dir=${patch_dir%.*}.$i
pascal@909 38 if [ -d ${PACKAGE}${VERSION}/kernel-patches/linux-$kver ]; then
pascal@240 39 patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-$kver
pascal@236 40 fi
pascal@240 41 if [ ! -d $patch_dir ]; then
pascal@240 42 echo "No squashfs patchset for kernel $ker. Abort."
pascal@240 43 return 1
pascal@240 44 fi
pascal@236 45 [ -d _kernel ] && rm -rf _kernel
pascal@236 46 mkdir _kernel
pascal@236 47 cd _kernel
pascal@1543 48 ln -fs $WOK/linux/linux-$kver* src
pascal@236 49
pascal@236 50 # Copy files to be patched in local aera
pascal@236 51 # Do not alter kernel sources !!
pascal@236 52 for i in $(grep ^--- ../$patch_dir/${PACKAGE}${VERSION}-patch | \
pascal@236 53 awk '{ if ($3 != "1970-01-01") print $2 } '); do
pascal@236 54 ( cd src ; tar cf - ${i#*/}) | tar xf -
pascal@236 55 done
pascal@236 56
pascal@236 57 # Apply squashfs patches in local aera
pascal@909 58 #patch -p1 < ../$patch_dir/${PACKAGE}${VERSION}-patch
pascal@909 59 echo "Apply $patch_dir..."
pascal@909 60 awk 'BEGIN { keep=1} /^---/ { keep=(index($0,"/fs/squashfs/") || index($0,"/include/linux/"))} { if (keep) print }' < \
pascal@909 61 ../$patch_dir/${PACKAGE}${VERSION}-patch | patch -p1
pascal@909 62
pascal@1543 63 extra_patch=../stuff/squashfs-patch-${kver%.*}
pascal@909 64 if [ -e ../$extra_patch ]; then
pascal@909 65 echo "Apply $extra_patch..."
pascal@909 66 patch -p1 < ../$extra_patch || return 1
pascal@909 67 fi
pascal@236 68
pascal@236 69 # Move every files in fs/squashfs directory
pascal@240 70 mv include/linux/* fs/squashfs
pascal@240 71 ln -s . fs/squashfs/linux
pascal@240 72 for i in fs/squashfs/*.c fs/squashfs/*.h ; do
pascal@240 73 sed -e 's/#include <\(linux\/squashfs.*\)>.*/#include "\1"/g' > $i.$$ < $i
pascal@240 74 sed -e 's/CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE/3/g' > $i < $i.$$
pascal@240 75 done
pascal@236 76
pascal@909 77 # Apply lzma patches
pascal@909 78 # echo "Apply stuff/lzma.u.."
pascal@1543 79 # patch -p0 < ../../stuff/lzma.u || return 1
pascal@909 80
pascal@236 81 # Build kernel module
pascal@1452 82 make -C src/. SUBDIRS=$(pwd)/fs/squashfs/ CONFIG_SQUASHFS=m modules || return 1
pascal@236 83 cd ..
pascal@236 84 [ -d _pkg ] && rm -rf _pkg
pascal@247 85 mkdir -p _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs
pascal@247 86 mkdir -p _pkg/usr/sbin _pkg/sbin
pascal@1543 87 lzma e _kernel/fs/squashfs/squashfs.ko \
pascal@1543 88 _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs/squashfs.ko.gz
pascal@236 89
pascal@236 90 # Build user land tools
pascal@236 91 cd ${PACKAGE}${VERSION}/squashfs-tools
pascal@1452 92 make || return 1
pascal@247 93 cp mksquashfs ../../_pkg/usr/sbin
pascal@247 94 cp unsquashfs ../../_pkg/sbin
pascal@236 95 }
pascal@236 96
pascal@236 97 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@236 98 genpkg_rules()
pascal@236 99 {
pascal@1543 100 cp -a $_pkg/usr $_pkg/sbin $fs
pascal@236 101 }