wok view squashfs/receipt @ rev 2921

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