Hi,

is is just a proof of concept patch other Cygwin users might
need to get a little bit further in the process of using OpenWrt 
on Windows. I'll send it as reference and for comments.

The tar pipe Bug in Cygwin is really annoying. The pipe fails 
differently each time I configure gcc. Better suggestions are
welcome.

Any Cygwin users there?

Signed-off-by: Waldemar Brodkorb <m...@waldemar-brodkorb.de>

Index: include/prereq-build.mk
===================================================================
--- include/prereq-build.mk     (Revision 35158)
+++ include/prereq-build.mk     (Arbeitskopie)
@@ -94,7 +94,7 @@
 
 define Require/ncurses
        echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
-               gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses
+               gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses 
-I/usr/include/ncurses
 endef
 
 $(eval $(call Require,ncurses, \
Index: scripts/patch-specs.sh
===================================================================
--- scripts/patch-specs.sh      (Revision 35158)
+++ scripts/patch-specs.sh      (Arbeitskopie)
@@ -11,7 +11,7 @@
 
 echo -n "Locating cpp ... "
 for bin in bin usr/bin usr/local/bin; do
-       for cmd in "$DIR/$bin/"*-cpp; do
+       for cmd in "$DIR/$bin/"*-cpp*; do
                if [ -x "$cmd" ]; then
                        echo "$cmd"
                        CPP="$cmd"
Index: toolchain/gcc/patches/4.6-linaro/110-cygwin-broken-tar.patch
===================================================================
--- toolchain/gcc/patches/4.6-linaro/110-cygwin-broken-tar.patch        
(Revision 0)
+++ toolchain/gcc/patches/4.6-linaro/110-cygwin-broken-tar.patch        
(Arbeitskopie)
@@ -0,0 +1,14 @@
+diff -Nur gcc-linaro-4.6-2012.12.orig/configure 
gcc-linaro-4.6-2012.12/configure
+--- gcc-linaro-4.6-2012.12.orig/configure      2012-12-12 18:05:23.000000000 
+0100
++++ gcc-linaro-4.6-2012.12/configure   2013-03-11 17:03:09.325599100 +0100
+@@ -6851,7 +6851,9 @@
+ 
+     # Copy the directory, assuming we have tar.
+     # FIXME: Should we use B in the second tar?  Not all systems support it.
+-    (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
++    # Cygwin fails here silently
++    # (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
++    cp -Rp $1 $2
+ 
+     # It is the responsibility of the user to correctly adjust all
+     # symlinks.  If somebody can figure out how to handle them correctly
Index: tools/e2fsprogs/Makefile
===================================================================
--- tools/e2fsprogs/Makefile    (Revision 35158)
+++ tools/e2fsprogs/Makefile    (Arbeitskopie)
@@ -8,8 +8,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=e2fsprogs
-PKG_VERSION:=1.42.4
-PKG_MD5SUM:=b6e296f210d642361b7394437ff0f318
+PKG_VERSION:=1.42.7
+PKG_MD5SUM:=a1ec22ef003688dae9f76c74881b22b9
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
Index: tools/e2fsprogs/patches/003-cygwin-fixes.patch
===================================================================
--- tools/e2fsprogs/patches/003-cygwin-fixes.patch      (Revision 0)
+++ tools/e2fsprogs/patches/003-cygwin-fixes.patch      (Arbeitskopie)
@@ -0,0 +1,26 @@
+diff -Nur e2fsprogs-1.42.7.orig/lib/ext2fs/getsize.c 
e2fsprogs-1.42.7/lib/ext2fs/getsize.c
+--- e2fsprogs-1.42.7.orig/lib/ext2fs/getsize.c 2012-11-30 03:40:18.000000000 
+0100
++++ e2fsprogs-1.42.7/lib/ext2fs/getsize.c      2013-03-06 10:26:57.902747800 
+0100
+@@ -70,8 +70,8 @@
+ #define HAVE_GET_FILE_SIZE_EX 1
+ #endif
+ 
+-errcode_t ext2fs_get_device_size(const char *file, int blocksize,
+-                               blk_t *retblocks)
++errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
++                               blk64_t *retblocks)
+ {
+       HANDLE dev;
+       PARTITION_INFORMATION pi;
+diff -Nur e2fsprogs-1.42.7.orig/misc/Makefile.in 
e2fsprogs-1.42.7/misc/Makefile.in
+--- e2fsprogs-1.42.7.orig/misc/Makefile.in     2013-01-16 20:16:50.000000000 
+0100
++++ e2fsprogs-1.42.7/misc/Makefile.in  2013-03-06 10:27:36.824622800 +0100
+@@ -429,7 +429,7 @@
+               $(DESTDIR)$(root_sbindir) $(DESTDIR)$(bindir) \
+               $(DESTDIR)$(man1dir) $(DESTDIR)$(man8dir) \
+               $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) \
+-              $(DESTDIR)$(libdir) $(DESTDIR)/$(root_sysconfdir)
++              $(DESTDIR)$(libdir) $(DESTDIR)$(root_sysconfdir)
+ 
+ install: all $(SMANPAGES) $(UMANPAGES) installdirs
+       $(Q) for i in $(SPROGS); do \
Index: tools/include/getline.h
===================================================================
--- tools/include/getline.h     (Revision 35158)
+++ tools/include/getline.h     (Arbeitskopie)
@@ -32,7 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#if !defined(__linux__) && !(defined(__APPLE__) && __DARWIN_C_LEVEL >= 200809L)
+#if !defined(__linux__) && !defined(__CYGWIN__) && !(defined(__APPLE__) && 
__DARWIN_C_LEVEL >= 200809L)
 /*
  * Emulate glibc getline() via BSD fgetln().
  * Note that outsize is not changed unless memory is allocated.
Index: tools/mkimage/patches/050-cygwin_fixes.patch
===================================================================
--- tools/mkimage/patches/050-cygwin_fixes.patch        (Revision 0)
+++ tools/mkimage/patches/050-cygwin_fixes.patch        (Arbeitskopie)
@@ -0,0 +1,16 @@
+diff -Nur u-boot-2012.04.01.orig/config.mk u-boot-2012.04.01/config.mk
+--- u-boot-2012.04.01.orig/config.mk   2012-04-25 15:22:50.000000000 +0200
++++ u-boot-2012.04.01/config.mk        2013-03-06 16:20:18.569930500 +0100
+@@ -91,9 +91,9 @@
+ HOSTCC                = gcc
+ endif
+ 
+-ifeq ($(HOSTOS),cygwin)
+-HOSTCFLAGS    += -ansi
+-endif
++#ifeq ($(HOSTOS),cygwin)
++#HOSTCFLAGS   += -ansi
++#endif
+ 
+ # We build some files with extra pedantic flags to try to minimize things
+ # that won't build on some weird host compiler -- though there are lots of
Index: tools/mtd-utils/Makefile
===================================================================
--- tools/mtd-utils/Makefile    (Revision 35158)
+++ tools/mtd-utils/Makefile    (Arbeitskopie)
@@ -23,7 +23,7 @@
 HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs
 CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) 
-L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT
 ifneq ($(HOST_OS),Linux)
-CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include getline.h -include 
endian.h -I$(CURDIR)/include -include fls.h
+CFLAGS += -Dloff_t=off_t -include getline.h -include endian.h 
-I$(CURDIR)/include -include fls.h
 endif
 
 MTD_MAKEOPTS = \
Index: tools/mtd-utils/patches/121-more_cygwin_fixes.patch
===================================================================
--- tools/mtd-utils/patches/121-more_cygwin_fixes.patch (Revision 0)
+++ tools/mtd-utils/patches/121-more_cygwin_fixes.patch (Arbeitskopie)
@@ -0,0 +1,30 @@
+diff -Nur mtd-utils-1.4.5.orig/lib/libmtd.c mtd-utils-1.4.5/lib/libmtd.c
+--- mtd-utils-1.4.5.orig/lib/libmtd.c  2013-01-14 18:34:23.000000000 +0100
++++ mtd-utils-1.4.5/lib/libmtd.c       2013-03-06 15:17:17.639925000 +0100
+@@ -30,7 +30,11 @@
+ #include <dirent.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#ifdef __CYGWIN__
++#include <cygwin/ioctl.h>
++#else
+ #include <sys/ioctl.h>
++#endif
+ #include <inttypes.h>
+ 
+ #include <mtd/mtd-user.h>
+diff -Nur mtd-utils-1.4.5.orig/lib/libmtd_legacy.c 
mtd-utils-1.4.5/lib/libmtd_legacy.c
+--- mtd-utils-1.4.5.orig/lib/libmtd_legacy.c   2013-01-14 18:34:23.000000000 
+0100
++++ mtd-utils-1.4.5/lib/libmtd_legacy.c        2013-03-06 15:17:30.108675000 
+0100
+@@ -30,7 +30,11 @@
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#ifdef __CYGWIN__
++#include <cygwin/ioctl.h>
++#else
+ #include <sys/ioctl.h>
++#endif
+ #include <mtd/mtd-user.h>
+ 
+ #include <libmtd.h>
Index: tools/pkg-config/Makefile
===================================================================
--- tools/pkg-config/Makefile   (Revision 35158)
+++ tools/pkg-config/Makefile   (Arbeitskopie)
@@ -17,6 +17,7 @@
 
 include $(INCLUDE_DIR)/host-build.mk
 
+HOST_CONFIGURE_ARGS += --with-internal-glib
 HOST_LDFLAGS += $(HOST_STATIC_LINKING)
 
 define Host/Install

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to