squashfs: new package
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 1 Mar 2010 23:14:33 +0000 (00:14 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 9 Apr 2010 09:03:54 +0000 (11:03 +0200)
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/Config.in
package/squashfs/Config.in [new file with mode: 0644]
package/squashfs/squashfs-4.0-build-system-fix.patch [new file with mode: 0644]
package/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch [new file with mode: 0644]
package/squashfs/squashfs.mk [new file with mode: 0644]
target/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch [deleted file]

index 5a7bf278943a4cd59c06ad2b4d02a872300b467b..a742063101d70fe48e1fa5018a085476b6a83247 100644 (file)
@@ -187,6 +187,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 source "package/sfdisk/Config.in"
 endif
 source "package/smartmontools/Config.in"
+source "package/squashfs/Config.in"
 source "package/sshfs/Config.in"
 source "package/sysstat/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
diff --git a/package/squashfs/Config.in b/package/squashfs/Config.in
new file mode 100644 (file)
index 0000000..3080cc3
--- /dev/null
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_SQUASHFS
+       bool "squashfs"
+       help
+         Tools to generate SquashFS filesystems.
+
+         http://squashfs.sourceforge.net/
diff --git a/package/squashfs/squashfs-4.0-build-system-fix.patch b/package/squashfs/squashfs-4.0-build-system-fix.patch
new file mode 100644 (file)
index 0000000..9db208b
--- /dev/null
@@ -0,0 +1,60 @@
+Index: a/squashfs-tools/Makefile
+===================================================================
+--- a/squashfs-tools.orig/Makefile     2009-04-19 01:47:43.000000000 +0200
++++ b/squashfs-tools/Makefile  2009-04-19 01:52:36.000000000 +0200
+@@ -1,36 +1,48 @@
+ INSTALL_DIR = /usr/local/bin
+ INCLUDEDIR = .
++CFLAGS_R = -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++LIBS = -lz -lpthread
+ CFLAGS := -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -O2
+ all: mksquashfs unsquashfs
+ mksquashfs: mksquashfs.o read_fs.o sort.o swap.o pseudo.o
+-      $(CC) mksquashfs.o read_fs.o sort.o swap.o pseudo.o -lz -lpthread -lm -o $@
++      $(CC) $(LDFLAGS) mksquashfs.o read_fs.o sort.o swap.o pseudo.o -lz -lpthread -lm -o $@
+ mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h squashfs_swap.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+ read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h squashfs_swap.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+ sort.o: sort.c squashfs_fs.h global.h sort.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+ swap.o: swap.c Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+ pseudo.o: pseudo.c pseudo.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+ unsquashfs: unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o
+-      $(CC) unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o -lz -lpthread -lm -o $@
++      $(CC) $(LDFLAGS) unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o -lz -lpthread -lm -o $@
+-unsquashfs.o: unsquashfs.h unsquashfs.c squashfs_fs.h squashfs_swap.h squashfs_compat.h global.h Makefile
++unsquashfs.o: unsquashfs.c unsquashfs.h squashfs_fs.h squashfs_swap.h squashfs_compat.h global.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+-unsquash-1.o: unsquashfs.h unsquash-1.c squashfs_fs.h squashfs_compat.h global.h Makefile
++unsquash-1.o: unsquash-1.c unsquashfs.h squashfs_fs.h squashfs_compat.h global.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+-unsquash-2.o: unsquashfs.h unsquash-2.c unsquashfs.h squashfs_fs.h squashfs_compat.h global.h Makefile
++unsquash-2.o: unsquash-2.c unsquashfs.h unsquashfs.h squashfs_fs.h squashfs_compat.h global.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+-unsquash-3.o: unsquashfs.h unsquash-3.c squashfs_fs.h squashfs_compat.h global.h Makefile
++unsquash-3.o: unsquash-3.c unsquashfs.h squashfs_fs.h squashfs_compat.h global.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+-unsquash-4.o: unsquashfs.h unsquash-4.c squashfs_fs.h squashfs_swap.h global.h Makefile
++unsquash-4.o: unsquash-4.c unsquashfs.h squashfs_fs.h squashfs_swap.h global.h Makefile
++      $(CC) $(CFLAGS_R) $(CFLAGS) -c -o $@ $<
+ clean:
+       -rm -f *.o mksquashfs unsquashfs
diff --git a/package/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch b/package/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch
new file mode 100644 (file)
index 0000000..7f8e8e0
--- /dev/null
@@ -0,0 +1,41 @@
+[PATCH]: fix mksquashfs race condition
+
+See http://thread.gmane.org/gmane.comp.file-systems.squashfs.devel/76
+for details.
+---
+ squashfs-tools/mksquashfs.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Index: squashfs4.0/squashfs-tools/mksquashfs.c
+===================================================================
+--- squashfs4.0.orig/squashfs-tools/mksquashfs.c
++++ squashfs4.0/squashfs-tools/mksquashfs.c
+@@ -1733,8 +1733,8 @@ void unlock_fragments()
+               entry->buffer->block = bytes;
+               bytes += compressed_size;
+               fragments_outstanding --;
+-              pthread_mutex_unlock(&fragment_mutex);
+               queue_put(to_writer, entry->buffer);
++              pthread_mutex_unlock(&fragment_mutex);
+               pthread_mutex_lock(&fragment_mutex);
+               TRACE("fragment_locked writing fragment %d, compressed size %d"
+                       "\n", entry->fragment, compressed_size);
+@@ -2426,8 +2426,8 @@ void *frag_deflator(void *arg)
+                       write_buffer->block = bytes;
+                       bytes += compressed_size;
+                       fragments_outstanding --;
+-                      pthread_mutex_unlock(&fragment_mutex);
+                       queue_put(to_writer, write_buffer);
++                      pthread_mutex_unlock(&fragment_mutex);
+                       TRACE("Writing fragment %lld, uncompressed size %d, "
+                               "compressed size %d\n", file_buffer->block,
+                               file_buffer->size, compressed_size);
+@@ -4137,7 +4137,7 @@ void read_recovery_data(char *recovery_f
+ #define VERSION() \
+-      printf("mksquashfs version 4.0 (2009/04/05)\n");\
++      printf("mksquashfs version 4.0-test (2009/04/05)\n");\
+       printf("copyright (C) 2009 Phillip Lougher <phillip@lougher.demon.co.uk>\n\n"); \
+       printf("This program is free software; you can redistribute it and/or\n");\
+       printf("modify it under the terms of the GNU General Public License\n");\
diff --git a/package/squashfs/squashfs.mk b/package/squashfs/squashfs.mk
new file mode 100644 (file)
index 0000000..ab05b06
--- /dev/null
@@ -0,0 +1,30 @@
+SQUASHFS_VERSION=4.0
+SQUASHFS_SOURCE=squashfs$(SQUASHFS_VERSION).tar.gz
+SQUASHFS_SITE=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/squashfs
+
+SQUASHFS_DEPENDENCIES = zlib
+HOST_SQUASHFS_DEPENDENCIES = host-zlib
+
+define SQUASHFS_BUILD_CMDS
+ $(TARGET_MAKE_ENV) $(MAKE)    \
+   CC="$(TARGET_CC)"           \
+   CFLAGS="$(TARGET_CFLAGS)"   \
+   LDFLAGS="$(TARGET_LDFLAGS)" \
+   -C $(@D)/squashfs-tools/
+endef
+
+define SQUASHFS_INSTALL_TARGET_CMDS
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/squashfs-tools/ INSTALL_DIR=$(TARGET_DIR)/usr/bin install
+endef
+
+define HOST_SQUASHFS_BUILD_CMDS
+ $(HOST_MAKE_ENV) $(MAKE) -C $(@D)/squashfs-tools/
+endef
+
+define HOST_SQUASHFS_INSTALL_CMDS
+ $(HOST_MAKE_ENV) $(MAKE) -C $(@D)/squashfs-tools/ INSTALL_DIR=$(HOST_DIR)/usr/bin install
+endef
+
+$(eval $(call GENTARGETS,package,squashfs))
+$(eval $(call GENTARGETS,package,squashfs,host))
+
diff --git a/target/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch b/target/squashfs/squashfs-4.0-mksquashfs-race-condition-fix.patch
deleted file mode 100644 (file)
index 7f8e8e0..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-[PATCH]: fix mksquashfs race condition
-
-See http://thread.gmane.org/gmane.comp.file-systems.squashfs.devel/76
-for details.
----
- squashfs-tools/mksquashfs.c |    6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-Index: squashfs4.0/squashfs-tools/mksquashfs.c
-===================================================================
---- squashfs4.0.orig/squashfs-tools/mksquashfs.c
-+++ squashfs4.0/squashfs-tools/mksquashfs.c
-@@ -1733,8 +1733,8 @@ void unlock_fragments()
-               entry->buffer->block = bytes;
-               bytes += compressed_size;
-               fragments_outstanding --;
--              pthread_mutex_unlock(&fragment_mutex);
-               queue_put(to_writer, entry->buffer);
-+              pthread_mutex_unlock(&fragment_mutex);
-               pthread_mutex_lock(&fragment_mutex);
-               TRACE("fragment_locked writing fragment %d, compressed size %d"
-                       "\n", entry->fragment, compressed_size);
-@@ -2426,8 +2426,8 @@ void *frag_deflator(void *arg)
-                       write_buffer->block = bytes;
-                       bytes += compressed_size;
-                       fragments_outstanding --;
--                      pthread_mutex_unlock(&fragment_mutex);
-                       queue_put(to_writer, write_buffer);
-+                      pthread_mutex_unlock(&fragment_mutex);
-                       TRACE("Writing fragment %lld, uncompressed size %d, "
-                               "compressed size %d\n", file_buffer->block,
-                               file_buffer->size, compressed_size);
-@@ -4137,7 +4137,7 @@ void read_recovery_data(char *recovery_f
- #define VERSION() \
--      printf("mksquashfs version 4.0 (2009/04/05)\n");\
-+      printf("mksquashfs version 4.0-test (2009/04/05)\n");\
-       printf("copyright (C) 2009 Phillip Lougher <phillip@lougher.demon.co.uk>\n\n"); \
-       printf("This program is free software; you can redistribute it and/or\n");\
-       printf("modify it under the terms of the GNU General Public License\n");\