make the lzma version kernel version dependent, and only build the one we do need
[openwrt.git] / tools / squashfs4 / patches / 120-cygwin_fixes.patch
1 --- a/squashfs-tools/global.h
2 +++ b/squashfs-tools/global.h
3 @@ -44,6 +44,11 @@ typedef long long squashfs_fragment_inde
4 typedef squashfs_inode_t squashfs_inode;
5 typedef squashfs_block_t squashfs_block;
6
7 +#ifdef __CYGWIN__
8 +#include <sys/termios.h>
9 +#define FNM_EXTMATCH (1 << 5)
10 +#endif
11 +
12 #ifndef FNM_EXTMATCH
13 #define FNM_EXTMATCH 0
14 #endif
15 --- a/squashfs-tools/mksquashfs.c
16 +++ b/squashfs-tools/mksquashfs.c
17 @@ -49,10 +49,12 @@
18 #include <sys/wait.h>
19
20 #ifndef linux
21 +#ifndef __CYGWIN__
22 #define __BYTE_ORDER BYTE_ORDER
23 #define __BIG_ENDIAN BIG_ENDIAN
24 #define __LITTLE_ENDIAN LITTLE_ENDIAN
25 #include <sys/sysctl.h>
26 +#endif /* __CYGWIN__ */
27 #else
28 #include <endian.h>
29 #include <sys/sysinfo.h>
30 @@ -817,6 +819,7 @@ void sigusr1_handler()
31
32 void sigwinch_handler()
33 {
34 +#ifndef __CYGWIN__
35 struct winsize winsize;
36
37 if(ioctl(1, TIOCGWINSZ, &winsize) == -1) {
38 @@ -826,6 +829,9 @@ void sigwinch_handler()
39 columns = 80;
40 } else
41 columns = winsize.ws_col;
42 +#else
43 + columns = 80;
44 +#endif
45 }
46
47
48 @@ -3853,7 +3859,9 @@ void initialise_threads()
49 BAD_ERROR("Failed to set signal mask in intialise_threads\n");
50
51 signal(SIGUSR1, sigusr1_handler);
52 -
53 +#ifdef __CYGWIN__
54 + processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
55 +#else
56 if(processors == -1) {
57 #ifndef linux
58 int mib[2];
59 @@ -3875,6 +3883,7 @@ void initialise_threads()
60 processors = get_nprocs();
61 #endif
62 }
63 +#endif /* __CYGWIN__ */
64
65 if((thread = malloc((2 + processors * 2) * sizeof(pthread_t))) == NULL)
66 BAD_ERROR("Out of memory allocating thread descriptors\n");
67 --- a/squashfs-tools/read_fs.c
68 +++ b/squashfs-tools/read_fs.c
69 @@ -39,9 +39,11 @@ extern unsigned int get_guid(unsigned in
70 #include <sys/mman.h>
71
72 #ifndef linux
73 +#ifndef __CYGWIN__
74 #define __BYTE_ORDER BYTE_ORDER
75 #define __BIG_ENDIAN BIG_ENDIAN
76 #define __LITTLE_ENDIAN LITTLE_ENDIAN
77 +#endif
78 #else
79 #include <endian.h>
80 #endif
81 --- a/squashfs-tools/swap.c
82 +++ b/squashfs-tools/swap.c
83 @@ -20,9 +20,11 @@
84 */
85
86 #ifndef linux
87 +#ifndef __CYGWIN__
88 #define __BYTE_ORDER BYTE_ORDER
89 #define __BIG_ENDIAN BIG_ENDIAN
90 #define __LITTLE_ENDIAN LITTLE_ENDIAN
91 +#endif
92 #else
93 #include <endian.h>
94 #endif
95 --- a/squashfs-tools/unsquashfs.c
96 +++ b/squashfs-tools/unsquashfs.c
97 @@ -112,6 +112,7 @@ void update_progress_bar();
98
99 void sigwinch_handler()
100 {
101 +#ifndef __CYGWIN__
102 struct winsize winsize;
103
104 if(ioctl(1, TIOCGWINSZ, &winsize) == -1) {
105 @@ -121,6 +122,9 @@ void sigwinch_handler()
106 columns = 80;
107 } else
108 columns = winsize.ws_col;
109 +#else
110 + columns = 80;
111 +#endif
112 }
113
114
115 @@ -1787,7 +1791,9 @@ void initialise_threads(int fragment_buf
116 if(sigprocmask(SIG_BLOCK, &sigmask, &old_mask) == -1)
117 EXIT_UNSQUASH("Failed to set signal mask in intialise_threads"
118 "\n");
119 -
120 +#ifdef __CYGWIN__
121 + processors = atoi(getenv("NUMBER_OF_PROCESSORS"));
122 +#else
123 if(processors == -1) {
124 #ifndef linux
125 int mib[2];
126 @@ -1809,6 +1815,7 @@ void initialise_threads(int fragment_buf
127 processors = get_nprocs();
128 #endif
129 }
130 +#endif /* __CYGWIN__ */
131
132 if((thread = malloc((3 + processors) * sizeof(pthread_t))) == NULL)
133 EXIT_UNSQUASH("Out of memory allocating thread descriptors\n");
134 --- a/squashfs-tools/unsquashfs.h
135 +++ b/squashfs-tools/unsquashfs.h
136 @@ -45,10 +45,12 @@
137 #include <sys/time.h>
138
139 #ifndef linux
140 +#ifndef __CYGWIN__
141 #define __BYTE_ORDER BYTE_ORDER
142 #define __BIG_ENDIAN BIG_ENDIAN
143 #define __LITTLE_ENDIAN LITTLE_ENDIAN
144 #include <sys/sysctl.h>
145 +#endif /* __CYGWIN__ */
146 #else
147 #include <endian.h>
148 #include <sys/sysinfo.h>
This page took 0.052223 seconds and 5 git commands to generate.