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