Skip to content

Instantly share code, notes, and snippets.

@yinyin
Created November 14, 2012 07:31
Show Gist options
  • Save yinyin/4070822 to your computer and use it in GitHub Desktop.
Save yinyin/4070822 to your computer and use it in GitHub Desktop.
Patch to make squashfs-tool 4.2 built on Mac OS X
diff -rupN squashfs4.2/squashfs-tools/Makefile squashfs4.2-mac/squashfs-tools/Makefile
--- squashfs4.2/squashfs-tools/Makefile 2011-03-01 04:04:15.000000000 +0800
+++ squashfs4.2-mac/squashfs-tools/Makefile 2012-11-14 15:27:31.000000000 +0800
@@ -104,7 +104,7 @@ UNSQUASHFS_OBJS = unsquashfs.o unsquash-
CFLAGS ?= -O2
CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"$(COMP_DEFAULT)\" \
- -Wall
+ -DFNM_EXTMATCH=0 -Wall
LIBS = -lpthread -lm
ifeq ($(GZIP_SUPPORT),1)
diff -rupN squashfs4.2/squashfs-tools/unsquashfs.c squashfs4.2-mac/squashfs-tools/unsquashfs.c
--- squashfs4.2/squashfs-tools/unsquashfs.c 2011-03-01 06:27:06.000000000 +0800
+++ squashfs4.2-mac/squashfs-tools/unsquashfs.c 2012-11-14 15:26:55.000000000 +0800
@@ -29,7 +29,7 @@
#include "compressor.h"
#include "xattr.h"
-#include <sys/sysinfo.h>
+#include <sys/sysctl.h>
#include <sys/types.h>
struct cache *fragment_cache, *data_cache;
diff -rupN squashfs4.2/squashfs-tools/unsquashfs_xattr.c squashfs4.2-mac/squashfs-tools/unsquashfs_xattr.c
--- squashfs4.2/squashfs-tools/unsquashfs_xattr.c 2011-02-11 23:49:24.000000000 +0800
+++ squashfs4.2-mac/squashfs-tools/unsquashfs_xattr.c 2012-11-14 15:28:25.000000000 +0800
@@ -27,6 +27,9 @@
#include <sys/xattr.h>
+#define lsetxattr(f, nam, v, len, flags) (setxattr(f, nam, v, len, flags, XATTR_NOFOLLOW))
+#define lremovexattr(f, nam) removexattr(f, nam, XATTR_NOFOLLOW)
+
extern int root_process;
void write_xattr(char *pathname, unsigned int xattr)
diff -rupN squashfs4.2/squashfs-tools/xattr.c squashfs4.2-mac/squashfs-tools/xattr.c
--- squashfs4.2/squashfs-tools/xattr.c 2011-02-11 23:49:24.000000000 +0800
+++ squashfs4.2-mac/squashfs-tools/xattr.c 2012-11-14 15:14:16.000000000 +0800
@@ -36,6 +36,9 @@
#include <stdlib.h>
#include <sys/xattr.h>
+#define llistxattr(f, buf, len) (listxattr(f, buf, len, XATTR_NOFOLLOW))
+#define lgetxattr(f, nam, buf, len) (getxattr(f, nam, buf, len, 0, XATTR_NOFOLLOW))
+
#include "squashfs_fs.h"
#include "squashfs_swap.h"
#include "mksquashfs.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment