wok-current view squashfs/receipt @ rev 1939
Up tazlito (1.9)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Dec 26 20:29:14 2008 +0000 (2008-12-26) |
parents | 896e4b9114be |
children | c1610baa4cf4 |
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 # Download a source tarball
16 . /etc/tazwok.conf
17 slitaz_wget()
18 {
19 if [ ! -f $SOURCES_REPOSITORY/$(basename $2) ]; then
20 local here=$(pwd)
21 cd $SOURCES_REPOSITORY
22 wget $1 $2
23 cd $here
24 fi
25 cp $SOURCES_REPOSITORY/$(basename $2) .
26 }
28 # Rules to configure and make the package.
29 compile_rules()
30 {
31 local kver
32 local patch_dir
34 mkdir -p $src
35 cd $src
36 mv ../$PACKAGE$VERSION . 2> /dev/null
37 # get kernel version
38 if [ ! -d $WOK/linux/taz ]; then
39 tazwok cook linux
40 fi
41 kver=$(grep "kernel version" $WOK/linux/linux-*/.config)
42 kver=${kver##* }
44 # Select patch according to kernel version
45 patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-${kver%.*}
46 i=${patch_dir##*.}
47 while [ ! -d ${patch_dir%.*}.$i ]; do
48 [ "$i" = "0" ] && break
49 i=$(($i - 1))
50 done
51 patch_dir=${patch_dir%.*}.$i
52 if [ -d ${PACKAGE}${VERSION}/kernel-patches/linux-$kver ]; then
53 patch_dir=${PACKAGE}${VERSION}/kernel-patches/linux-$kver
54 fi
55 if [ ! -d $patch_dir ]; then
56 echo "No squashfs patchset for kernel $ker. Abort."
57 return 1
58 fi
59 [ -d _kernel ] && rm -rf _kernel
60 mkdir _kernel
61 cd _kernel
62 ln -fs $WOK/linux/linux-$kver* src
64 # Copy files to be patched in local aera
65 # Do not alter kernel sources !!
66 for i in $(grep ^--- ../$patch_dir/${PACKAGE}${VERSION}-patch | \
67 awk '{ if ($3 != "1970-01-01") print $2 } '); do
68 ( cd src ; tar cf - ${i#*/}) | tar xf -
69 done
71 # Apply squashfs patches in local aera
72 #patch -p1 < ../$patch_dir/${PACKAGE}${VERSION}-patch
73 echo "Apply $patch_dir..."
74 awk 'BEGIN { keep=1} /^---/ { keep=(index($0,"/fs/squashfs/") || index($0,"/include/linux/"))} { if (keep) print }' < \
75 ../$patch_dir/${PACKAGE}${VERSION}-patch | patch -p1
77 extra_patch=../stuff/squashfs-patch-${kver%.*}
78 if [ -e ../$extra_patch ]; then
79 echo "Apply $extra_patch..."
80 patch -p1 < ../$extra_patch || return 1
81 fi
83 # Move every files in fs/squashfs directory
84 mv include/linux/* fs/squashfs
85 rmdir include/linux
86 ln -s ../fs/squashfs include/linux
87 ln -s . fs/squashfs/linux
88 for i in fs/squashfs/*.c fs/squashfs/*.h ; do
89 sed -i 's/#include <\(linux\/squashfs.*\)>.*/#include "\1"/g' $i
90 sed -i 's/CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE/3/g' $i
91 done
93 # Apply lzma patches
94 cd ..
95 slitaz_wget -c $SF_MIRROR/sevenzip/lzma457.tar.bz2
96 tar xjf lzma457.tar.bz2
97 SQLZMA=ftp://ftp.slax.org/source/slax/sqlzma/old-versions-unsupported
98 slitaz_wget -c $SQLZMA/sqlzma457-1/sqlzma3.3-457.tar.bz2
99 tar xjf sqlzma3.3-457.tar.bz2
100 rm -f $(grep ^+++ sqlzma1-449.patch | awk '{ print $2 }' | \
101 sed 's|[^/]*/||') 2> /dev/null
102 patch -p1 < sqlzma1-449.patch || return 1
103 patch -p0 << EOT
104 --- _kernel/fs/squashfs/inode.c
105 +++ _kernel/fs/squashfs/inode.c
106 @@ -2153 +2153 @@
107 - printk(KERN_INFO "squashfs: version 3.3-CVS (2008/04/04) "
108 + printk(KERN_INFO "squashfs: version 3.3 (2007/10/31) "
109 @@ -2216 +2216 @@
110 -MODULE_DESCRIPTION("squashfs 3.3, a compressed read-only filesystem");
111 +MODULE_DESCRIPTION("squashfs 3.2-r2-CVS, a compressed read-only filesystem");
113 --- _kernel/fs/squashfs/squashfs_fs_sb.h
114 +++ _kernel/fs/squashfs/squashfs_fs_sb.h
115 @@ -26 +26 @@
116 -#include "linux/squashfs_fs.h"
117 +#include <linux/squashfs_fs.h>
118 EOT
119 ( cd _kernel ; patch -p1 ) < sqlzma2k-3.3.patch || return 1
120 patch -p0 << EOT
121 --- _kernel/fs/squashfs/squashfs_fs_sb.h
122 +++ _kernel/fs/squashfs/squashfs_fs_sb.h
123 @@ -26 +26 @@
124 -#include <linux/squashfs_fs.h>
125 +#include "linux/squashfs_fs.h"
126 EOT
127 cp sq*.h _kernel/fs/squashfs
128 grep -q "sqlzma.h" squashfs3.3/squashfs-tools/mksquashfs.c ||
129 patch -p0 << EOT
130 --- squashfs3.3/squashfs-tools/unsquashfs.c
131 +++ squashfs3.3/squashfs-tools/unsquashfs.c
132 @@ -326,2 +326,3 @@
133 - if((res = uncompress((unsigned char *) block, &bytes,
134 - (const unsigned char *) buffer, c_byte)) != Z_OK) {
135 + res = uncompress((unsigned char *) block, &bytes, (const unsigned char *) buffer, c_byte);
136 +
137 + if(res != Z_OK) {
138 @@ -365,2 +366,3 @@
139 - if((res = uncompress((unsigned char *) block, &bytes,
140 - (const unsigned char *) data, c_byte)) != Z_OK) {
141 + res = uncompress((unsigned char *) block, &bytes, (const unsigned char *) data, c_byte);
142 +
143 + if(res != Z_OK) {
144 EOT
145 grep -q "sqlzma.h" squashfs3.3/squashfs-tools/mksquashfs.c ||
146 patch -p0 < sqlzma2u-3.3.patch || return 1
147 export LzmaC=$PWD/C/Compress/Lzma
148 export LzmaAlone=$PWD/CPP/7zip/Compress/LZMA_Alone
149 export Sqlzma=$PWD/_kernel/fs/squashfs
150 for i in $LzmaC $LzmaAlone ; do
151 make -C $i -f sqlzma.mk || return 1
152 done
153 rm -f $LzmaC/kmod/uncomp.c 2> /dev/null
154 make -C $LzmaC KDir=$PWD/_kernel/src/. -f kmod.mk || return 1
155 cp $LzmaC/kmod/Module.symvers $Sqlzma
157 # Build kernel squashfs module
158 cd _kernel
159 make -C src/. SUBDIRS=$(pwd)/fs/squashfs/ CONFIG_SQUASHFS=m modules || return 1
160 cd ..
161 [ -d _pkg ] && rm -rf _pkg
162 mkdir -p _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs
163 mkdir -p _pkg/usr/sbin _pkg/sbin
164 find . -name "*.ko" | while read module; do
165 lzma e $module _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs/$(basename $module).gz
166 done
168 # Build user land tools
169 cd ${PACKAGE}${VERSION}/squashfs-tools
170 make || return 1
171 cp mksquashfs ../../_pkg/usr/sbin
172 cp unsquashfs ../../_pkg/sbin
173 }
175 # Rules to gen a SliTaz package suitable for Tazpkg.
176 genpkg_rules()
177 {
178 cp -a $_pkg/usr $_pkg/sbin $fs
179 }