patches/PDCurses/3.4/mingw32_cross_compile.patch
author Johannes Stezenbach <js@sig21.net>
Tue Oct 30 00:22:25 2012 +0000 (2012-10-30)
changeset 3097 5c67476c7342
permissions -rw-r--r--
scripts/functions: fix endless loop in debug-shell with IO redirection

CT_DEBUG_INTERACTIVE is disabled when stdin, stdout or
stderr are redirected, but the check is only done at
the start of the build and doesn't catch when individual
build commands use redirection. When stdin is redirected
it will cause the debug shell to exit immediately, causing
and endless loop. Thus, save the stdin/our/err file handles
and restore them before invoking the debug shell.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Message-Id: <20121030102225.GA8303@sig21.net>
Patchwork-Id: 195409
     1 --- PDCurses-3.4.orig/win32/mingwin32.mak	2009-11-02 13:50:11.000000000 +0100
     2 +++ PDCurses-3.4/win32/mingwin32.mak	2009-11-02 13:53:43.000000000 +0100
     3 @@ -18,7 +18,7 @@
     4 
     5  PDCURSES_WIN_H	= $(osdir)/pdcwin.h
     6 
     7 -CC		= gcc
     8 +CC		= $(CROSS_COMPILE)gcc
     9 
    10  ifeq ($(DEBUG),Y)
    11  	CFLAGS  = -g -Wall -DPDCDEBUG
    12 @@ -30,8 +30,8 @@
    13 
    14  CFLAGS += -I$(PDCURSES_SRCDIR)
    15 
    16 -BASEDEF		= $(PDCURSES_SRCDIR)\exp-base.def
    17 -WIDEDEF		= $(PDCURSES_SRCDIR)\exp-wide.def
    18 +BASEDEF		= $(PDCURSES_SRCDIR)/exp-base.def
    19 +WIDEDEF		= $(PDCURSES_SRCDIR)/exp-wide.def
    20 
    21  DEFDEPS		= $(BASEDEF)
    22 
    23 @@ -46,17 +46,17 @@
    24 
    25  DEFFILE		= pdcurses.def
    26 
    27 -LINK		= gcc
    28 +LINK		= $(CROSS_COMPILE)gcc
    29 
    30  ifeq ($(DLL),Y)
    31  	CFLAGS += -DPDC_DLL_BUILD
    32 -	LIBEXE = gcc $(DEFFILE)
    33 +	LIBEXE = $(CROSS_COMPILE)gcc $(DEFFILE)
    34  	LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o
    35  	LIBCURSES = pdcurses.dll
    36  	LIBDEPS = $(LIBOBJS) $(PDCOBJS) $(DEFFILE)
    37  	CLEAN = $(LIBCURSES) *.a $(DEFFILE)
    38  else
    39 -	LIBEXE = ar
    40 +	LIBEXE = $(CROSS_COMPILE)ar
    41  	LIBFLAGS = rcv
    42  	LIBCURSES = pdcurses.a
    43  	LIBDEPS = $(LIBOBJS) $(PDCOBJS)
    44 @@ -70,24 +70,24 @@
    45  libs:	$(LIBCURSES)
    46 
    47  clean:
    48 -	-del *.o
    49 -	-del *.exe
    50 -	-del $(CLEAN)
    51 +	-rm *.o
    52 +	-rm *.exe
    53 +	-rm $(CLEAN)
    54 
    55  demos:	$(DEMOS)
    56 -	strip *.exe
    57 +	$(CROSS_COMPILE)strip *.exe
    58 
    59  $(DEFFILE): $(DEFDEPS)
    60  	echo LIBRARY pdcurses > $@
    61  	echo EXPORTS >> $@
    62 -	type $(BASEDEF) >> $@
    63 +	cat $(BASEDEF) >> $@
    64  ifeq ($(WIDE),Y)
    65 -	type $(WIDEDEF) >> $@
    66 +	cat $(WIDEDEF) >> $@
    67  endif
    68 
    69  $(LIBCURSES) : $(LIBDEPS)
    70  	$(LIBEXE) $(LIBFLAGS) $@ $?
    71 -	-copy pdcurses.a panel.a
    72 +	-cp pdcurses.a panel.a
    73 
    74  $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
    75  $(PDCOBJS) : $(PDCURSES_WIN_H)
    76 --- PDCurses-3.4.orig/curses.h	2009-11-03 14:12:18.000000000 +0100
    77 +++ PDCurses-3.4./curses.h	2009-11-03 14:14:09.000000000 +0100
    78 @@ -82,7 +82,9 @@
    79   *
    80   */
    81 
    82 +#ifndef __bool_true_false_are_defined
    83  typedef unsigned char bool;    /* PDCurses Boolean type */
    84 +#endif
    85 
    86  #ifdef CHTYPE_LONG
    87  # if _LP64