Mail Archives: cygwin/2004/12/01/19:45:35
--------------040500040904080404010602
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Laurent ROCHER schrieb:
> Win32::GUI version 1.0 is availlable at Sourceforge.
Sorry that I touched cygwin too late, but I did it at last.
After 0.503 the last time, back in 2000.
All samples work, but I didn't check the latest enhancements, esp.
ImageList.
Attached are the needed fixes for cygwin:
ToolTip.xs should be renamed to Tooltip.xs. (It matters!)
Makefile_m.PL can be safely removed. I've put the mingw stuff back in.
I've added a small cygwin.c for a missing function, and add a small stub
lib (currently called libcomctl-cyg.a) dynamically.
I don't check if future versions of -lcomctl32 already define this.
itoa
ImageList_Duplicate AT 4
ImageList_DrawIndirect AT 4
ImageList_Copy AT 20
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/
--------------040500040904080404010602
Content-Type: text/plain;
name="Win32-GUI-1.0-cygwin.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Win32-GUI-1.0-cygwin.patch"
--- ./GUI.h.orig 2004-05-08 19:31:22.000000000 +0100
+++ ./GUI.h 2004-12-01 23:44:10.469054500 +0100
@@ -37,6 +37,11 @@
extern "C" {
#endif
+#ifdef __CYGWIN__
+/* This is no strict ANSI definition, and not in newlib */
+char* itoa (int, char*, int);
+#endif
+
/* we want manage context if possible, See perlguts */
#if defined(PERL_IMPLICIT_CONTEXT)
#define PERL_NO_GET_CONTEXT
@@ -656,7 +661,7 @@
int MonthCal_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam);
// MinGW patch
-#ifdef __MINGW__
+#if defined(__MINGW__) || defined(__CYGWIN__)
#define WNDPROC_CAST WNDPROC
#ifndef HDHITTESTINFO
#define HDHITTESTINFO HD_HITTESTINFO
@@ -728,3 +733,5 @@
#else
#define WNDPROC_CAST FARPROC
#endif
+
+}
--- ./GUI_MessageLoops.cpp.orig 2004-09-29 23:17:56.000000000 +0100
+++ ./GUI_MessageLoops.cpp 2004-12-01 21:49:14.750304500 +0100
@@ -176,7 +176,7 @@
SwitchBit(perlud->dwPlStyle, PERLWIN32GUI_CUSTOMCLASS, 1); // Set Custom class flag
// Search for an extend MsgLoop procedure (-extends option in RegisterClassEx)
- perlud->WndProc = (WNDPROC) GetDefClassProc (NOTXSCALL ((CREATESTRUCT *) lParam)->lpszClass);
+ perlud->WndProc = (WNDPROC_CAST) GetDefClassProc (NOTXSCALL ((CREATESTRUCT *) lParam)->lpszClass);
if (perlud->WndProc) {
return CallWindowProc((WNDPROC_CAST) perlud->WndProc, hwnd, uMsg, wParam, lParam);
}
@@ -658,7 +658,7 @@
SetWindowLong(hwnd, GWL_USERDATA, (long) perlud);
SwitchBit(perlud->dwPlStyle, PERLWIN32GUI_CUSTOMCLASS, 1); // Set Custom class flag
SwitchBit(perlud->dwPlStyle, PERLWIN32GUI_MDIFRAME , 1); // Set MDI Frame flag
- perlud->WndProc = (WNDPROC) DefMDIFrameLoop; // Set DefFrameProc
+ perlud->WndProc = (WNDPROC_CAST) DefMDIFrameLoop; // Set DefFrameProc
if (perlud->WndProc) {
return CallWindowProc((WNDPROC_CAST) perlud->WndProc, hwnd, uMsg, wParam, lParam);
@@ -739,7 +739,7 @@
SetWindowLong(hwnd, GWL_USERDATA, (long) perlud);
SwitchBit(perlud->dwPlStyle, PERLWIN32GUI_CUSTOMCLASS, 1); // Set Custom class flag
SwitchBit(perlud->dwPlStyle, PERLWIN32GUI_MDICHILD , 1); // Set MDI Frame flag
- perlud->WndProc = (WNDPROC) DefMDIChildLoop; // Set DefMDIChildProc
+ perlud->WndProc = (WNDPROC_CAST) DefMDIChildLoop; // Set DefMDIChildProc
perlud->dwData = (DWORD) hwnd; // For fast hwnd acces (Activate/Deactivate)
if (perlud->WndProc) {
return CallWindowProc((WNDPROC_CAST) perlud->WndProc, hwnd, uMsg, wParam, lParam);
@@ -776,7 +776,7 @@
SwitchBit(perlud->dwPlStyle, PERLWIN32GUI_CUSTOMCLASS, 1); // Set Custom class flag
// Search for an extend MsgLoop procedure (-extends option in RegisterClassEx)
- perlud->WndProc = (WNDPROC) GetDefClassProc (NOTXSCALL ((CREATESTRUCT *) lParam)->lpszClass);
+ perlud->WndProc = (WNDPROC_CAST) GetDefClassProc (NOTXSCALL ((CREATESTRUCT *) lParam)->lpszClass);
if (perlud->WndProc) {
return CallWindowProc((WNDPROC_CAST) perlud->WndProc, hwnd, uMsg, wParam, lParam);
}
@@ -966,7 +966,7 @@
SwitchBit(perlud->dwPlStyle, PERLWIN32GUI_CONTAINER , 1); // Set Container flag
// Search for an extend MsgLoop procedure (-extends option in RegisterClassEx)
- perlud->WndProc = (WNDPROC) GetDefClassProc (NOTXSCALL ((CREATESTRUCT *) lParam)->lpszClass);
+ perlud->WndProc = (WNDPROC_CAST) GetDefClassProc (NOTXSCALL ((CREATESTRUCT *) lParam)->lpszClass);
if (perlud->WndProc) {
return CallWindowProc((WNDPROC_CAST) perlud->WndProc, hwnd, uMsg, wParam, lParam);
}
@@ -1003,7 +1003,7 @@
SwitchBit(perlud->dwPlStyle, PERLWIN32GUI_CUSTOMCLASS, 1); // Set Custom class flag
// Search for an extend MsgLoop procedure (-extends option in RegisterClassEx)
- perlud->WndProc = (WNDPROC) GetDefClassProc (NOTXSCALL ((CREATESTRUCT *) lParam)->lpszClass);
+ perlud->WndProc = (WNDPROC_CAST) GetDefClassProc (NOTXSCALL ((CREATESTRUCT *) lParam)->lpszClass);
if (perlud->WndProc) {
return CallWindowProc((WNDPROC_CAST) perlud->WndProc, hwnd, uMsg, wParam, lParam);
}
--- ./MANIFEST.orig 2004-03-22 19:23:16.000000000 +0100
+++ ./MANIFEST 2004-12-01 22:59:02.469054500 +0100
@@ -29,7 +29,7 @@
TabStrip.xs
Textfield.xs
Toolbar.xs
-ToolTip.xs
+Tooltip.xs
Trackbar.xs
TreeView.xs
UpDown.xs
--- ./Makefile.PL.orig 2004-09-29 22:59:46.000000000 +0100
+++ ./Makefile.PL 2004-12-02 00:45:56.094054500 +0100
@@ -1,17 +1,17 @@
use ExtUtils::MakeMaker;
use Config;
-$USERESOURCE = 0;
+$USERESOURCE = 1;
foreach (@ARGV) {
if(/USERESOURCE=0/) {
$USERESOURCE = -1;
- undef $_;
- last;
+ } elsif(/USERESOURCE=1/) {
+ $USERESOURCE = 1;
}
}
-if($USERESOURCE == -1) {
+if ($USERESOURCE == -1) {
$USERESOURCE = 0;
} else {
if($Config{'cc'} =~ /^cl(\.exe)?/i) {
@@ -72,8 +72,7 @@
GUI_Events
);
-$c_ext = ($^O eq "cygwin") ? "c" : "cpp";
-
+$c_ext = "cpp"; # Note: mingw and cygwin do fine with cpp
@arg_c = ();
$arg_object = "";
@@ -91,11 +90,10 @@
$arg_object .= ' ' . $_ . $Config{'obj_ext'};
}
-
%MakefileArgs = (
'NAME' => 'Win32::GUI',
'VERSION_FROM' => 'GUI.pm',
- 'LIBS' => ( ($^O eq "cygwin") ? '-lcomctl32' : 'comctl32.lib' ),
+ 'LIBS' => ['comctl32.lib'],
'PM' => {
'GUI.pm' => '$(INST_LIBDIR)/GUI.pm',
'BitmapInline.pm' => '$(INST_LIBDIR)/GUI/BitmapInline.pm',
@@ -106,8 +104,6 @@
'OBJECT' => $arg_object,
'DL_FUNCS' => { 'Win32::GUI' => [ @arg_dl_funcs ] },
- ($^O eq "cygwin") ? ( 'DEFINE' => '-UWIN32' ) : (),
-
'dist' => {
ZIP => 'zip',
ZIPFLAGS => '-r9',
@@ -116,10 +112,16 @@
'AUTHOR' => 'Aldo Calpini <dada AT perl DOT it>',
'ABSTRACT' => 'Perl-Win32 Graphical User Interface Extension',
)),
-
);
-
+if ($^O eq "cygwin") {
+ $MakefileArgs{'LIBS'} = ['-L/usr/lib/w32api -lcomctl32 -lcomdlg32 -luser32 -lgdi32'];
+ $MakefileArgs{'DEFINE'} = '-UWIN32';
+} elsif ($^O eq "mingw") {
+ $MakefileArgs{'LIBS'} = ['-lcomctl32'];
+ $MakefileArgs{'DEFINE'} = '-D__MINGW__'; # isn't that used automatically?
+# $MakefileArgs{'CCFLAGS'} = '-mno-cygwin'; # might be needed to force on cygwin
+}
$MakefileArgs{'LDFROM'} = '$(OBJECT) GUI.res' if $USERESOURCE;
WriteMakefile( %MakefileArgs );
@@ -129,17 +131,20 @@
package MY;
sub xs_c {
-($^O eq 'cygwin') ?
- shift->SUPER::xs_c(@_)
-:
- '
-.xs.cpp:
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.cpp
-';
+ my $inherited = shift->SUPER::xs_c(@_);
+ $inherited =~ s/\.c/.cpp/g;
+ return $inherited;
+}
+
+sub xs_o {
+ my $inherited = shift->SUPER::xs_o(@_);
+ $inherited =~ s/\.c$/.cpp/mg;
+ return $inherited;
}
-sub constants {
- my $inherited = shift->SUPER::constants(@_);
+sub special_targets {
+ my $inherited = shift->SUPER::special_targets(@_);
+ $inherited =~ s/\.SUFFIXES: \.xs \.c \.C \.cpp/.SUFFIXES: .xs .cpp .c .C/;
if($main::USERESOURCE) {
$inherited =~ s/\.SUFFIXES([^\n]+)\n/\.SUFFIXES$1 .rc .res\n/;
}
@@ -148,8 +153,12 @@
sub c_o {
my $inherited = shift->SUPER::c_o(@_);
- if($main::USERESOURCE) {
+ if ($main::USERESOURCE) {
+ if ($Config{'cc'} =~ /^cl(\.exe)?/i) {
$inherited .= "\nGUI.res:\n\trc.exe /l 0x409 /fo\"GUI.res\" GUI.rc\n\n";
+ } else {
+ $inherited .= "\nGUI.res:\n\twindres -O coff -i GUI.rc -o GUI.res\n\n";
+ }
}
return $inherited;
}
@@ -161,3 +170,31 @@
}
return $inherited;
}
+
+sub postamble {
+ if ($^O eq "cygwin") {
+ # cygwin' stubs miss these definitions
+ '
+comctl32.def:
+ @echo "LIBRARY COMCTL32.DLL" >$@
+ @echo "EXPORTS" >$@
+ @echo "ImageList_Duplicate AT 4" >$@
+ @echo "ImageList_DrawIndirect AT 4" >$@
+ @echo "ImageList_Copy AT 20" >$@
+
+libcomctl-cyg.a: comctl32.def cygwin.o
+ dlltool -k --output-lib libcomctl-cyg.a --def comctl32.def
+ ar r libcomctl-cyg.a cygwin.o
+'
+ }
+}
+
+sub const_loadlibs {
+ my $inherited = shift->SUPER::const_loadlibs(@_);
+ if ($^O eq "cygwin") {
+ $inherited =~ s/(EXTRALIBS.*)\n/$1 -L. -lcomctl-cyg\n/;
+ $inherited =~ s/(LDLOADLIBS.*)\n/$1 -L. -lcomctl-cyg\n/;
+ }
+ return $inherited;
+}
+
--- ./cygwin.c.orig 2004-12-02 00:40:49.890929000 +0100
+++ ./cygwin.c 2004-12-02 00:33:10.890929500 +0100
@@ -0,0 +1,22 @@
+/* missing definitions for cygwin:
+ itoa
+
+ and this .def file:
+ LIBRARY COMCTL32.DLL
+ EXPORTS
+ ImageList_Duplicate AT 4
+ ImageList_DrawIndirect AT 4
+ ImageList_Copy AT 20
+*/
+
+#ifdef __CYGWIN__
+char* itoa (int value, char * buffer, int radix);
+
+/* This is no strict ANSI definition, and not in newlib */
+#include <stdio.h>
+char* itoa (int value, char * buffer, int radix) {
+ if (sprintf(buffer, "%d", value)) return buffer;
+ else return NULL;
+}
+
+#endif
--------------040500040904080404010602
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--------------040500040904080404010602--
- Raw text -