wok-current view 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 |
line source
1 # SliTaz package receipt.
3 PACKAGE="squashfs"
4 VERSION="3.3"
5 CATEGORY="base-system"
6 SHORT_DESC="Linux squashfs module and 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"
12 BUILD_DEPENDS="zlib-dev patch"
14 # Rules to configure and make the package.
15 compile_rules()
16 {
17 local kver
18 local patch_dir
20 # get kernel version
21 if [ ! -d ../linux/taz ]; then
22 tazwok cook linux
23 fi
24 kver=$(grep "kernel version" ../linux/linux-*/.config)
25 kver=${kver##* }
27 # Select patch according to kernel version
28 patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-${kver%.*}
29 if [ -f ${PACKAGE}${VERSION}/kernel-patches/linux-$kver ]; then
30 patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-$kver
31 fi
32 if [ ! -d $patch_dir ]; then
33 echo "No squashfs patchset for kernel $ker. Abort."
34 return 1
35 fi
36 [ -d _kernel ] && rm -rf _kernel
37 mkdir _kernel
38 cd _kernel
39 ln -s ../../linux/linux-$kver* src
41 # Copy files to be patched in local aera
42 # Do not alter kernel sources !!
43 for i in $(grep ^--- ../$patch_dir/${PACKAGE}${VERSION}-patch | \
44 awk '{ if ($3 != "1970-01-01") print $2 } '); do
45 ( cd src ; tar cf - ${i#*/}) | tar xf -
46 done
48 # Apply squashfs patches in local aera
49 patch -p1 < ../$patch_dir/${PACKAGE}${VERSION}-patch
51 # Move every files in fs/squashfs directory
52 mv include/linux/* fs/squashfs
53 ln -s . fs/squashfs/linux
54 for i in fs/squashfs/*.c fs/squashfs/*.h ; do
55 sed -e 's/#include <\(linux\/squashfs.*\)>.*/#include "\1"/g' > $i.$$ < $i
56 sed -e 's/CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE/3/g' > $i < $i.$$
57 done
59 # Build kernel module
60 make -C src/. SUBDIRS=$(pwd)/fs/squashfs/ CONFIG_SQUASHFS=m modules
61 cd ..
62 [ -d _pkg ] && rm -rf _pkg
63 mkdir -p _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs
64 mkdir -p _pkg/usr/sbin _pkg/sbin
65 cp _kernel/fs/squashfs/squashfs.ko \
66 _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs/squashfs.ko
67 gzip -9 _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs/squashfs.ko
69 # Build user land tools
70 cd ${PACKAGE}${VERSION}/squashfs-tools
71 make
72 cp mksquashfs ../../_pkg/usr/sbin
73 cp unsquashfs ../../_pkg/sbin
74 }
76 # Rules to gen a SliTaz package suitable for Tazpkg.
77 genpkg_rules()
78 {
79 cp -a _pkg/* $fs
80 }
82 # Post install/remove commands for Tazpkg.
83 post_install()
84 {
85 depmod -a
86 }
88 post_remove()
89 {
90 depmod -a
91 }