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