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