aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2010-02-26 08:36:38 +0100
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2010-02-26 08:52:22 +0100
commitbe8a104c3cd65190e32aebcbc8430fb23c42361f (patch)
tree1e6f400f87f7005c7a3cf381669dd36c174d30de
parentc4ba3fdae5a576ed26815a3ef637614b2017fc18 (diff)
downloadbuildroot-novena-be8a104c3cd65190e32aebcbc8430fb23c42361f.tar.gz
buildroot-novena-be8a104c3cd65190e32aebcbc8430fb23c42361f.zip
squashfs: pass CFLAGS/LDFLAGS and add host-zlib dependency
Squashfs depends on host-zlib, so we add this as a dependency. As host-zlib is installed in $(HOST_DIR), we must pass $(HOST_CFLAGS) and $(HOST_LDFLAGS). Unfortunately, if we pass CFLAGS=$(HOST_CFLAGS), we override the CFLAGS defined in the Makefile, and the build fails. Therefore, we borrow a patch from OpenEmbedded to fix this problem. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--target/squashfs/squashfs-4.0-build-system-fix.patch65
-rw-r--r--target/squashfs/squashfsroot.mk4
2 files changed, 67 insertions, 2 deletions
diff --git a/target/squashfs/squashfs-4.0-build-system-fix.patch b/target/squashfs/squashfs-4.0-build-system-fix.patch
new file mode 100644
index 000000000..7ba0ab94a
--- /dev/null
+++ b/target/squashfs/squashfs-4.0-build-system-fix.patch
@@ -0,0 +1,65 @@
+Fix the build system so that CFLAGS can be overriden on the command
+line to pass additionnal -I options.
+
+Patch borrowed from OpenEmbedded.
+
+Index: squashfs-4.0/squashfs-tools/Makefile
+===================================================================
+--- squashfs-4.0.orig/squashfs-tools.orig/Makefile 2009-04-19 01:47:43.000000000 +0200
++++ squashfs-4.0/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/target/squashfs/squashfsroot.mk b/target/squashfs/squashfsroot.mk
index ebb0cd2bd..63adc5c36 100644
--- a/target/squashfs/squashfsroot.mk
+++ b/target/squashfs/squashfsroot.mk
@@ -18,9 +18,9 @@ $(SQUASHFS_DIR)/.unpacked: $(DL_DIR)/$(SQUASHFS_SOURCE) #$(SQUASHFS_PATCH)
touch $@
$(SQUASHFS_DIR)/squashfs-tools/mksquashfs: $(SQUASHFS_DIR)/.unpacked
- $(MAKE) -C $(SQUASHFS_DIR)/squashfs-tools
+ $(MAKE) CFLAGS="$(HOST_CFLAGS)" LDFLAGS="$(HOST_LDFLAGS)" -C $(SQUASHFS_DIR)/squashfs-tools
-squashfs: $(SQUASHFS_DIR)/squashfs-tools/mksquashfs
+squashfs: host-zlib $(SQUASHFS_DIR)/squashfs-tools/mksquashfs
squashfs-source: $(DL_DIR)/$(SQUASHFS_SOURCE)