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