wok view squashfs/receipt @ rev 1882

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