squashfs-tools indeed can be compiled for Cygwin (after some modifications). The compile issues are related to
- sysctl: finding the number of CPUs
- detecting the number of columns for the progress bar
I've generated a patch against squashfs3.4, and I'm attaching it here.
Save the patch into the squashfs-tools directory as patch.txt and run the following command:
patch -p2 < patch.txt
Note: You should be at a Cygwin prompt, and should have installed "patch" in your Cygwin.
Index: squashfs3.4/squashfs-tools/unsquashfs.c
===================================================================
--- squashfs3.4/squashfs-tools/unsquashfs.c (revision 4)
+++ squashfs3.4/squashfs-tools/unsquashfs.c (revision 7)
@@ -49,9 +49,11 @@
#include <sys/time.h>
#ifndef linux
+#ifndef __CYGWIN__
#define __BYTE_ORDER BYTE_ORDER
#define __BIG_ENDIAN BIG_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#endif /* __CYGWIN__ */
#else
#include <endian.h>
#endif
@@ -2411,6 +2413,9 @@
if(sigprocmask(SIG_BLOCK, &sigmask, &old_mask) == -1)
EXIT_UNSQUASH("Failed to set signal mask in intialise_threads\n");
+#ifdef __CYGWIN__
+ processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
+#else /* __CYGWIN__ */
if(processors == -1) {
#ifndef linux
int mib[2];
@@ -2431,6 +2436,7 @@
processors = get_nprocs();
#endif
}
+#endif /* __CYGWIN__ */
if((thread = malloc((3 + processors) * sizeof(pthread_t))) == NULL)
EXIT_UNSQUASH("Out of memory allocating thread descriptors\n");
Index: squashfs3.4/squashfs-tools/read_fs.c
===================================================================
--- squashfs3.4/squashfs-tools/read_fs.c (revision 4)
+++ squashfs3.4/squashfs-tools/read_fs.c (revision 7)
@@ -36,9 +36,11 @@
#include <sys/mman.h>
#ifndef linux
+#ifndef __CYGWIN__
#define __BYTE_ORDER BYTE_ORDER
#define __BIG_ENDIAN BIG_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#endif /* __CYGWIN__ */
#else
#include <endian.h>
#endif
Index: squashfs3.4/squashfs-tools/global.h
===================================================================
--- squashfs3.4/squashfs-tools/global.h (revision 4)
+++ squashfs3.4/squashfs-tools/global.h (revision 7)
@@ -71,4 +71,9 @@
typedef squashfs_inode_t squashfs_inode;
typedef squashfs_block_t squashfs_block;
+#ifdef __CYGWIN__
+#include <sys/termios.h>
+#define FNM_EXTMATCH (1 << 5)
#endif
+
+#endif
\ No newline at end of file
Index: squashfs3.4/squashfs-tools/mksquashfs.c
===================================================================
--- squashfs3.4/squashfs-tools/mksquashfs.c (revision 4)
+++ squashfs3.4/squashfs-tools/mksquashfs.c (revision 7)
@@ -49,10 +49,12 @@
#include <fnmatch.h>
#ifndef linux
+#ifndef __CYGWIN__
#define __BYTE_ORDER BYTE_ORDER
#define __BIG_ENDIAN BIG_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#include <sys/sysctl.h>
+#endif /* __CYGWIN__ */
#else
#include <endian.h>
#include <sys/sysinfo.h>
@@ -3161,6 +3163,9 @@
signal(SIGUSR1, sigusr1_handler);
+#ifdef __CYGWIN__
+ processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
+#else
if(processors == -1) {
#ifndef linux
int mib[2];
@@ -3181,6 +3186,7 @@
processors = get_nprocs();
#endif
}
+#endif /* __CYGWIN__ */
if((thread = malloc((2 + processors * 2) * sizeof(pthread_t))) == NULL)
BAD_ERROR("Out of memory allocating thread descriptors\n");
I've edited the patch to remove some redundant changes.