[转]Build squashfs tools for Mac OS X

来源:互联网 发布:如何登录淘宝账户 编辑:程序博客网 时间:2024/05/18 21:42

转自:Build squashfs tools for Mac OS X
因为尝试自建android-x86-*.iso的原因 碰到了sfs文件系统 而所搜索到的相关解压/压缩源码均来自于Linux系统 github上有相关开源代码squashfs-tools 但无法在mac上编译 最后天不亡我 找到了这个blog 还是vpn好用啊 更改hosts完全无法满足需求了

以下是完美解:

To squash/unsquash a Linux squashfs filesystem on a Mac, you can build the squashfs tools.

A few modifications of the source are required for OS X:
The FNM_EXTMATCH flag doesn’t exist in the fnmatch library on OS X. This just means that you can’t use glob patterns with mksquashfs.
The constants to figure out how many CPUs the machine has are in the sysctl header instead of the sysinfo header.
The C99 compiler has different semantics for the inline keyword, so inline functions should also be static.
Instead of llistxattr(), lgetxattr(), lsetxattr(), Apple uses a XATTR_NOFOLLOW flag on the non-link equivalent functions.

Here’s a complete download-and-build recipe:

curl -OL http://iweb.dl.sourceforge.net/project/squashfs/squashfs/squashfs4.2/squashfs4.2.tar.gztar xzvf squashfs4.2.tar.gzcd squashfs4.2/squashfs-toolssed -i.orig 's/FNM_EXTMATCH/0/; s/sysinfo.h/sysctl.h/; s/^inline/static inline/' mksquashfs.c unsquashfs.ccat <<END >> xattr.h#define llistxattr(path, list, size) \  (listxattr(path, list, size, XATTR_NOFOLLOW))#define lgetxattr(path, name, value, size) \  (getxattr(path, name, value, size, 0, XATTR_NOFOLLOW))#define lsetxattr(path, name, value, size, flags) \  (setxattr(path, name, value, size, 0, flags | XATTR_NOFOLLOW))ENDmakesudo cp mksquashfs unsquashfs /usr/local/bin
0 0
原创粉丝点击