Sending to Fedora mingw mailing list.
Rich.
On Sun, Feb 05, 2012 at 07:45:59PM +0100, Sylvain wrote:
Hi,
I forward you this mail because you packaged FreeGLUT for win32
through cross-compilation.
I just sent this patch to the developers after cross-compilation broke
in 2.8.0. (I believe the current maintainer works primarily under
windows and doesn't uses the autoconf build system.)
If you think what I did can be improved, feel free to say so to the
list: freeglut-developer(a)lists.sourceforge.net .
Cheers!
- Sylvain
----- Forwarded message from Sylvain <beuc(a)beuc.net> -----
Date: Sun, 5 Feb 2012 19:33:41 +0100
From: Sylvain <beuc(a)beuc.net>
To: freeglut-developer(a)lists.sourceforge.net
Subject: [Freeglut-developer] Mingw cross-compilation
User-Agent: Mutt/1.5.21 (2010-09-15)
Hi,
When working on porting FreeGLUT for Android, I noticed that the
cross-compilation to windows with MinGW32 doesn't work anymore.
It's used among others in the mingw32-freeglut RPM package and I'm
myself a heavy user of cross-compilation when targetting windows.
Attached is a patch. I used Automake conditionals to do the job.
What do you think?
Cheers!
NB: the patch also fixes "make dist" by updating EXTRA_DIST.
--
Sylvain
Index: README.mingw_cross
===================================================================
--- README.mingw_cross (révision 0)
+++ README.mingw_cross (révision 0)
@@ -0,0 +1,24 @@
+Cross-compilation from GNU/Linux (static and shared DLL)
+========================================================
+
+Install MinGW32 and prepare FreeGLUT on Debian/Ubuntu:
+
+ apt-get install mingw32
+ ./configure --host=i586-mingw32msvc --prefix=/freeglut
+
+Install MinGW32 and prepare FreeGLUT on Fedora:
+
+ yum install mingw32-gcc
+ ./configure --host=i686-pc-mingw32 --prefix=/freeglut
+
+Cross-compile!
+
+ make
+ make install DESTDIR=$(pwd)
+
+Everything is in the new freeglut/ directory.
+The .dll is in the freeglut/bin/.
+
+
+Compilation of your own programs is done as usual.
+See README.cygwin_mingw for details.
Index: src/Makefile.am
===================================================================
--- src/Makefile.am (révision 1067)
+++ src/Makefile.am (copie de travail)
@@ -10,7 +10,7 @@
#
noinst_HEADERS = Common/freeglut_internal.h Common/freeglut_teapot_data.h
-EXTRA_DIST = freeglutdll.def
+EXTRA_DIST = Common/freeglutdll.def
#
# Those source files build the freeglut library
@@ -37,23 +37,46 @@
Common/freeglut_structure.c \
Common/freeglut_teapot.c \
Common/freeglut_videoresize.c \
- Common/freeglut_window.c \
- x11/freeglut_cursor_x11.c \
- x11/freeglut_display_x11.c \
- x11/freeglut_ext_x11.c \
- x11/freeglut_gamemode_x11.c \
- x11/freeglut_glutfont_definitions_x11.c \
- x11/freeglut_init_x11.c \
- x11/freeglut_input_devices_x11.c \
- x11/freeglut_joystick_x11.c \
- x11/freeglut_main_x11.c \
- x11/freeglut_menu_x11.c \
- x11/freeglut_spaceball_x11.c \
- x11/freeglut_state_x11.c \
- x11/freeglut_structure_x11.c \
- x11/freeglut_window_x11.c \
- x11/freeglut_xinput_x11.c
+ Common/freeglut_window.c
+if TARGET_HOST_MS_WINDOWS
+lib@LIBRARY@_la_SOURCES += \
+ mswin/freeglut_cursor_mswin.c \
+ mswin/freeglut_display_mswin.c \
+ mswin/freeglut_ext_mswin.c \
+ mswin/freeglut_gamemode_mswin.c \
+ mswin/freeglut_init_mswin.c \
+ mswin/freeglut_input_devices_mswin.c \
+ mswin/freeglut_internal_mswin.h \
+ mswin/freeglut_joystick_mswin.c \
+ mswin/freeglut_main_mswin.c \
+ mswin/freeglut_menu_mswin.c \
+ mswin/freeglut_spaceball_mswin.c \
+ mswin/freeglut_state_mswin.c \
+ mswin/freeglut_structure_mswin.c \
+ mswin/freeglut_window_mswin.c
+endif
+
+if TARGET_HOST_POSIX_X11
+lib@LIBRARY@_la_SOURCES += \
+ x11/freeglut_cursor_x11.c \
+ x11/freeglut_display_x11.c \
+ x11/freeglut_ext_x11.c \
+ x11/freeglut_gamemode_x11.c \
+ x11/freeglut_glutfont_definitions_x11.c \
+ x11/freeglut_init_x11.c \
+ x11/freeglut_input_devices_x11.c \
+ x11/freeglut_internal_x11.h \
+ x11/freeglut_joystick_x11.c \
+ x11/freeglut_main_x11.c \
+ x11/freeglut_menu_x11.c \
+ x11/freeglut_spaceball_x11.c \
+ x11/freeglut_state_x11.c \
+ x11/freeglut_structure_x11.c \
+ x11/freeglut_window_x11.c \
+ x11/freeglut_xinput_x11.c
+endif
+
#
# Additional linker flags
#
Index: configure.ac
===================================================================
--- configure.ac (révision 1067)
+++ configure.ac (copie de travail)
@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT([freeglut library], [2.6.0], [freeglut-bugs(a)lists.sourceforge.net], [freeglut])
+AC_INIT([freeglut library], [2.9.0], [freeglut-bugs(a)lists.sourceforge.net], [freeglut])
AM_INIT_AUTOMAKE
AC_PREREQ([2.56])
AC_CONFIG_SRCDIR([AUTHORS])
@@ -21,21 +21,40 @@
# Checks for libraries.
AC_PATH_XTRA
-if test "x$no_x" = xyes; then
- GL_LIBS="-lopengl32 -lgdi32 -lwinmm"
- LIBXXF86VM=
- LIBXI=
- VERSION_INFO=
- EXPORT_FLAGS="-DFREEGLUT_EXPORTS"
-else
- GL_LIBS="-lGL -lXext -lX11"
- AC_CHECK_LIB([Xxf86vm], [XF86VidModeSwitchToMode])
- AC_CHECK_LIB([Xrandr], [XRRQueryExtension])
- AC_CHECK_LIB([Xi], [XISelectEvents])
- LIBXI=-lXi
- VERSION_INFO="-version-info 12:0:9"
- EXPORT_FLAGS=
-fi
+#if test "x$no_x" = xyes; then
+VERSION_INFO="-version-info 12:0:9"
+AM_CONDITIONAL(TARGET_HOST_MS_WINDOWS, false)
+AM_CONDITIONAL(TARGET_HOST_POSIX_X11, false)
+AM_CONDITIONAL(TARGET_HOST_ANDROID, false)
+case "${host}" in
+ *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+ # Windows+Cygwin/MSYS, MinGW cross-compilation
+ GL_LIBS="-lopengl32 -lgdi32 -lwinmm"
+ LIBXXF86VM=
+ LIBXI=
+ CPPFLAGS="$CPPFLAGS -DFREEGLUT_EXPORTS"
+ AM_CONDITIONAL(TARGET_HOST_MS_WINDOWS, true)
+ ;;
+ *-*-linux-androideabi)
+ # Android
+ # e.g. arm-unknown-linux-androideabi
+ GL_LIBS="-lEGL -lGLESv2"
+ LIBXXF86VM=
+ LIBXI=
+ CPPFLAGS="$CPPFLAGS -DANDROID"
+ AM_CONDITIONAL(TARGET_HOST_ANDROID, true)
+ ;;
+ *)
+ # Unix/X11
+ GL_LIBS="-lGL -lXext -lX11"
+ AC_CHECK_LIB([Xxf86vm], [XF86VidModeSwitchToMode])
+ AC_CHECK_LIB([Xrandr], [XRRQueryExtension])
+ AC_CHECK_LIB([Xi], [XISelectEvents])
+ LIBXI=-lXi
+ AM_CONDITIONAL(TARGET_HOST_POSIX_X11, true)
+ ;;
+esac
+
AC_SUBST([GL_LIBS])
AC_SUBST([LIBXXF86VM])
AC_SUBST([LIBXI])
Index: Makefile.am
===================================================================
--- Makefile.am (révision 1067)
+++ Makefile.am (copie de travail)
@@ -17,39 +17,45 @@
freeglut.mak \
freeglut.rc \
freeglut.spec \
- freeglut.tgt \
- freeglut.wpj \
- freeglut_evc4.vcp \
- freeglut_evc4.vcw \
- freeglut_static.dep \
- freeglut_static.dsp \
- freeglut_static.mak \
- freeglut_static.tgt \
- freeglut_static_vs2008.vcproj \
- freeglut_vs2008.sln \
- freeglut_vs2008.vcproj \
+ VisualStudio/2010/freeglut.vcxproj.filters \
+ VisualStudio/2010/smooth_opengl3/smooth_opengl3.vcxproj.filters \
+ VisualStudio/2010/smooth_opengl3/smooth_opengl3.vcxproj \
+ VisualStudio/2010/One/One.vcxproj \
+ VisualStudio/2010/One/One.vcxproj.filters \
+ VisualStudio/2010/Fractals_random/Fractals_random.vcxproj \
+ VisualStudio/2010/Fractals_random/Fractals_random.vcxproj.filters \
+ VisualStudio/2010/Resizer/Resizer.vcxproj \
+ VisualStudio/2010/Resizer/Resizer.vcxproj.filters \
+ VisualStudio/2010/freeglut.sln \
+ VisualStudio/2010/Lorenz/Lorenz.vcxproj.filters \
+ VisualStudio/2010/Lorenz/Lorenz.vcxproj \
+ VisualStudio/2010/shapes/shapes.vcxproj.filters \
+ VisualStudio/2010/shapes/shapes.vcxproj \
+ VisualStudio/2010/Fractals/Fractals.vcxproj.filters \
+ VisualStudio/2010/Fractals/Fractals.vcxproj \
+ VisualStudio/2010/freeglut.vcxproj \
+ VisualStudio/2010/subwin/subwin.vcxproj.filters \
+ VisualStudio/2010/subwin/subwin.vcxproj \
+ VisualStudio/2010/CallbackMaker/CallbackMaker.vcxproj \
+ VisualStudio/2010/CallbackMaker/CallbackMaker.vcxproj.filters \
+ VisualStudio/2008/smooth_opengl3/smooth_opengl3.vcproj \
+ VisualStudio/2008/One/One.vcproj \
+ VisualStudio/2008/Fractals_random/Fractals_random.vcproj \
+ VisualStudio/2008/Resizer/Resizer.vcproj \
+ VisualStudio/2008/freeglut.sln \
+ VisualStudio/2008/Lorenz/Lorenz.vcproj \
+ VisualStudio/2008/shapes/shapes.vcproj \
+ VisualStudio/2008/Fractals/Fractals.vcproj \
+ VisualStudio/2008/subwin/subwin.vcproj \
+ VisualStudio/2008/CallbackMaker/CallbackMaker.vcproj \
+ VisualStudio/2008/freeglut.vcproj \
progs/demos/CallbackMaker/CallbackMakerStatic.dsp \
- progs/demos/CallbackMaker/CallbackMakerStatic_vs2008.vcproj \
- progs/demos/CallbackMaker/CallbackMaker_vs2008.vcproj \
progs/demos/Fractals/FractalsStatic.dsp \
- progs/demos/Fractals/FractalsStatic_vs2008.vcproj \
- progs/demos/Fractals/Fractals_vs2008.vcproj \
progs/demos/Fractals_random/Fractals_randomStatic.dsp \
- progs/demos/Fractals_random/Fractals_randomStatic_vs2008.vcproj \
- progs/demos/Fractals_random/Fractals_random_vs2008.vcproj \
progs/demos/Lorenz/lorenzStatic.dsp \
- progs/demos/Lorenz/lorenzStatic_vs2008.vcproj \
- progs/demos/Lorenz/lorenz_vs2008.vcproj \
progs/demos/One/oneStatic.dsp \
- progs/demos/One/oneStatic_vs2008.vcproj \
- progs/demos/One/one_vs2008.vcproj \
- progs/demos/demos_vs2008.sln \
progs/demos/shapes/shapesStatic.dsp \
- progs/demos/shapes/shapesStatic_vs2008.vcproj \
- progs/demos/shapes/shapes_vs2008.vcproj \
- progs/demos/smooth_opengl3/smooth_opengl3Static.dsp \
- progs/demos/smooth_opengl3/smooth_opengl3Static_vs2008.vcproj \
- progs/demos/smooth_opengl3/smooth_opengl3_vs2008.vcproj
+ progs/demos/smooth_opengl3/smooth_opengl3Static.dsp
# Thanks to WinDoze, some files in CVS have the "execute" bit set when they
# shouldn't. We could fix this if we had direct access to the CVS repository,
----- End forwarded message -----
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org