wok-4.x view squashfs/receipt @ rev 2553

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