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