wok-current annotate squashfs/receipt @ rev 2704

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