wok-6.x rev 1930

Squashfs: add lzma support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Dec 24 17:02:24 2008 +0000 (2008-12-24)
parents fe3b7cbf1a7f
children 60e0be516392
files squashfs/receipt
line diff
     1.1 --- a/squashfs/receipt	Wed Dec 24 14:55:29 2008 +0100
     1.2 +++ b/squashfs/receipt	Wed Dec 24 17:02:24 2008 +0000
     1.3 @@ -12,6 +12,19 @@
     1.4  BUILD_DEPENDS="zlib-dev patch lzma"
     1.5  PROVIDE="cromfs-or-squashfs"
     1.6  
     1.7 +# Download a source tarball
     1.8 +. /etc/tazwok.conf
     1.9 +slitaz_wget()
    1.10 +{
    1.11 +	if [ ! -f $SOURCES_REPOSITORY/$(basename $2) ]; then
    1.12 +		local here=$(pwd)
    1.13 +		cd $SOURCES_REPOSITORY
    1.14 +		wget $1 $2
    1.15 +		cd $here
    1.16 +	fi
    1.17 +	cp $SOURCES_REPOSITORY/$(basename $2) .
    1.18 +}
    1.19 +
    1.20  # Rules to configure and make the package.
    1.21  compile_rules()
    1.22  {
    1.23 @@ -20,7 +33,7 @@
    1.24  
    1.25  	mkdir -p $src
    1.26  	cd $src
    1.27 -	mv ../$PACKAGE$VERSION .
    1.28 +	mv ../$PACKAGE$VERSION . 2> /dev/null
    1.29  	# get kernel version
    1.30  	if [ ! -d $WOK/linux/taz ]; then
    1.31  		tazwok cook linux
    1.32 @@ -69,24 +82,88 @@
    1.33  
    1.34  	# Move every files in fs/squashfs directory
    1.35  	mv include/linux/* fs/squashfs
    1.36 +	rmdir include/linux
    1.37 +	ln -s ../fs/squashfs include/linux
    1.38  	ln -s . fs/squashfs/linux
    1.39  	for i in fs/squashfs/*.c fs/squashfs/*.h ; do
    1.40 -		sed -e 's/#include <\(linux\/squashfs.*\)>.*/#include "\1"/g' > $i.$$ < $i
    1.41 -		sed -e 's/CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE/3/g' > $i < $i.$$
    1.42 +		sed -i 's/#include <\(linux\/squashfs.*\)>.*/#include "\1"/g' $i
    1.43 +		sed -i 's/CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE/3/g' $i
    1.44  	done
    1.45  	
    1.46  	# Apply lzma patches
    1.47 -#	echo "Apply stuff/lzma.u.."
    1.48 -#	patch -p0 < ../../stuff/lzma.u || return 1
    1.49 +	cd ..
    1.50 +	slitaz_wget -c $SF_MIRROR/sevenzip/lzma457.tar.bz2
    1.51 +	tar xjf lzma457.tar.bz2
    1.52 +	SQLZMA=ftp://ftp.slax.org/source/slax/sqlzma/old-versions-unsupported
    1.53 +	slitaz_wget -c $SQLZMA/sqlzma457-1/sqlzma3.3-457.tar.bz2
    1.54 +	rm -f $(grep ^+++ sqlzma1-449.patch | awk '{ print $2 }' | \
    1.55 +		sed 's|[^/]*/||') 2> /dev/null
    1.56 +	tar xjf sqlzma3.3-457.tar.bz2
    1.57 +	patch -p1 < sqlzma1-449.patch || return 1
    1.58 +	patch -p0 << EOT
    1.59 +--- _kernel/fs/squashfs/inode.c
    1.60 ++++ _kernel/fs/squashfs/inode.c
    1.61 +@@ -2153 +2153 @@
    1.62 +-	printk(KERN_INFO "squashfs: version 3.3-CVS (2008/04/04) "
    1.63 ++	printk(KERN_INFO "squashfs: version 3.3 (2007/10/31) "
    1.64 +@@ -2216 +2216 @@
    1.65 +-MODULE_DESCRIPTION("squashfs 3.3, a compressed read-only filesystem");
    1.66 ++MODULE_DESCRIPTION("squashfs 3.2-r2-CVS, a compressed read-only filesystem");
    1.67 +
    1.68 +--- _kernel/fs/squashfs/squashfs_fs_sb.h
    1.69 ++++ _kernel/fs/squashfs/squashfs_fs_sb.h
    1.70 +@@ -26 +26 @@
    1.71 +-#include "linux/squashfs_fs.h"
    1.72 ++#include <linux/squashfs_fs.h>
    1.73 +EOT
    1.74 +	( cd _kernel ; patch -p1 ) < sqlzma2k-3.3.patch || return 1
    1.75 +	patch -p0 << EOT
    1.76 +--- _kernel/fs/squashfs/squashfs_fs_sb.h
    1.77 ++++ _kernel/fs/squashfs/squashfs_fs_sb.h
    1.78 +@@ -26 +26 @@
    1.79 +-#include <linux/squashfs_fs.h>
    1.80 ++#include "linux/squashfs_fs.h"
    1.81 +EOT
    1.82 +	cp sq*.h _kernel/fs/squashfs
    1.83 +	grep -q "sqlzma.h" squashfs3.3/squashfs-tools/mksquashfs.c ||
    1.84 +	patch -p0 << EOT
    1.85 +--- squashfs3.3/squashfs-tools/unsquashfs.c
    1.86 ++++ squashfs3.3/squashfs-tools/unsquashfs.c
    1.87 +@@ -326,2 +326,3 @@
    1.88 +-		if((res = uncompress((unsigned char *) block, &bytes,
    1.89 +-		(const unsigned char *) buffer, c_byte)) != Z_OK) {
    1.90 ++		res = uncompress((unsigned char *) block, &bytes, (const unsigned char *) buffer, c_byte);
    1.91 ++
    1.92 ++		if(res != Z_OK) {
    1.93 +@@ -365,2 +366,3 @@
    1.94 +-		if((res = uncompress((unsigned char *) block, &bytes,
    1.95 +-		(const unsigned char *) data, c_byte)) != Z_OK) {
    1.96 ++		res = uncompress((unsigned char *) block, &bytes, (const unsigned char *) data, c_byte);
    1.97 ++
    1.98 ++		if(res != Z_OK) {
    1.99 +EOT
   1.100 +	grep -q "sqlzma.h" squashfs3.3/squashfs-tools/mksquashfs.c ||
   1.101 +	patch -p0 < sqlzma2u-3.3.patch || return 1
   1.102 +	export LzmaC=$PWD/C/Compress/Lzma
   1.103 +	export LzmaAlone=$PWD/CPP/7zip/Compress/LZMA_Alone
   1.104 +	export Sqlzma=$PWD/_kernel/fs/squashfs
   1.105 +	for i in $LzmaC $LzmaAlone ; do
   1.106 +		make -C $i -f sqlzma.mk || return 1
   1.107 +	done
   1.108 +	rm -f $LzmaC/kmod/uncomp.c 2> /dev/null
   1.109 +	make -C $LzmaC KDir=$PWD/_kernel/src/. -f kmod.mk || return 1
   1.110 +	cp $LzmaC/kmod/Module.symvers $Sqlzma
   1.111  	
   1.112 -	# Build kernel module
   1.113 +	# Build kernel squashfs module
   1.114 +	cd _kernel
   1.115  	make -C src/. SUBDIRS=$(pwd)/fs/squashfs/ CONFIG_SQUASHFS=m modules || return 1
   1.116  	cd ..
   1.117  	[ -d _pkg ] && rm -rf _pkg
   1.118  	mkdir -p _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs
   1.119  	mkdir -p _pkg/usr/sbin _pkg/sbin
   1.120 -	lzma e _kernel/fs/squashfs/squashfs.ko \
   1.121 -        	_pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs/squashfs.ko.gz
   1.122 +	find . -name "*.ko" | while read module; do
   1.123 +		lzma e $module _pkg/lib/modules/$kver-slitaz/kernel/fs/squashfs/$(basename $module).gz
   1.124 +	done
   1.125  
   1.126  	# Build user land tools
   1.127  	cd ${PACKAGE}${VERSION}/squashfs-tools