[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] patch for the compilation of evas with MinGW




Hey,

here is a patch that make evas compile with MinGW.
Of course, there is no win32 engine yet. But now, it's possible to test it :)

regards

Vincent Torri
? evas_mingw.diff
Index: configure.in
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/configure.in,v
retrieving revision 1.199
diff -u -r1.199 configure.in
--- configure.in	4 Dec 2006 20:34:29 -0000	1.199
+++ configure.in	3 Jan 2007 19:56:08 -0000
@@ -21,6 +21,14 @@
 AC_SUBST(MODULE_ARCH)
 AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture")
 
+create_shared_lib=""
+case "$host_os" in
+	mingw|mingw32)
+		create_shared_lib="-no-undefined "
+		;;
+esac
+AC_SUBST(create_shared_lib)
+
 if test "x${bindir}" = 'xNONE'; then
   if test "x${prefix}" = "xNONE"; then
     PACKAGE_BIN_DIR="${ac_default_prefix}/bin"
@@ -117,18 +125,24 @@
 ## dlopen
 
 dlopen_libs=""
-AC_CHECK_FUNCS(dlopen, res=yes, res=no)
-if test "x$res" = "xyes"; then
-  AC_CHECK_FUNCS(dladdr, AC_DEFINE(HAVE_DLADDR))
-else
-  AC_CHECK_LIB(dl, dlopen, res=yes, res=no)
-  if test "x$res" = "xyes"; then
-    AC_CHECK_LIB(dl, dladdr, AC_DEFINE(HAVE_DLADDR))
-    dlopen_libs=-ldl
-  else
-    AC_MSG_ERROR(Cannot find dlopen)
-  fi
-fi
+case "$host_os" in
+  mingw|mingw32)
+    AC_CHECK_HEADER(windows.h, [], [AC_MSG_ERROR(Cannot find windows.h)])
+  ;;
+  *)
+    AC_CHECK_FUNCS(dlopen, res=yes, res=no)
+    if test "x$res" = "xyes"; then
+      AC_CHECK_FUNCS(dladdr, AC_DEFINE(HAVE_DLADDR))
+    else
+      AC_CHECK_LIB(dl, dlopen, res=yes, res=no)
+      if test "x$res" = "xyes"; then
+        AC_CHECK_LIB(dl, dladdr, AC_DEFINE(HAVE_DLADDR))
+        dlopen_libs=-ldl
+      else
+        AC_MSG_ERROR(Cannot find dlopen)
+      fi
+    fi
+esac
 AC_SUBST(dlopen_libs)
 
 #####################################################################
@@ -715,6 +729,14 @@
   [ have_jpeg="no" ]
 )
 AC_MSG_CHECKING(whether to enable jpeg image loader)
+dnl Windows has no sigsetjmp function, nor equivalent.
+dnl So we disable the jpeg saver.
+have_jpeg_saver="yes"
+case "$host_os" in
+   mingw|mingw32)
+   have_jpeg_saver="no"
+   ;;
+esac
 AC_ARG_ENABLE(image-loader-jpeg, 
   [  --enable-image-loader-jpeg      enable JPEG image loader], [
       if test x"$enableval" = x"yes" ; then
@@ -741,6 +763,7 @@
 fi
 
 AM_CONDITIONAL(BUILD_LOADER_JPEG, test x$have_jpeg = xyes)
+AM_CONDITIONAL(BUILD_SAVER_JPEG, test x$have_jpeg_saver = xyes)
 
 #######################################
 ## EET
Index: src/lib/Evas.h
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/lib/Evas.h,v
retrieving revision 1.95
diff -u -r1.95 Evas.h
--- src/lib/Evas.h	17 Dec 2006 15:48:50 -0000	1.95
+++ src/lib/Evas.h	3 Jan 2007 19:56:10 -0000
@@ -4,7 +4,7 @@
 #ifdef EAPI
 #undef EAPI
 #endif
-#ifdef WIN32
+#ifdef _MSC_VER
 # ifdef BUILDING_DLL
 #  define EAPI __declspec(dllexport)
 # else
Index: src/lib/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/lib/Makefile.am,v
retrieving revision 1.22
diff -u -r1.22 Makefile.am
--- src/lib/Makefile.am	28 Oct 2006 03:02:21 -0000	1.22
+++ src/lib/Makefile.am	3 Jan 2007 19:56:10 -0000
@@ -40,4 +40,4 @@
 			  file/libevas_file.la \
 			  imaging/libevas_imaging.la \
 			  engines/common/libevas_engine_common.la 
-libevas_la_LDFLAGS      = -version-info 1:0:0
+libevas_la_LDFLAGS      = @create_shared_lib@ -version-info 1:0:0
Index: src/lib/file/evas_module.c
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/lib/file/evas_module.c,v
retrieving revision 1.20
diff -u -r1.20 evas_module.c
--- src/lib/file/evas_module.c	18 Sep 2006 09:47:34 -0000	1.20
+++ src/lib/file/evas_module.c	3 Jan 2007 19:56:11 -0000
@@ -11,11 +11,86 @@
 #endif
 
 #include <dirent.h>	/* DIR, dirent */
+#ifdef _WIN32
+#include <windows.h>
+#include <stdlib.h>
+#include <stdio.h>
+#else
 #include <dlfcn.h> 	/* dlopen,dlclose,etc */
+#endif
 
 #include <evas_common.h>
 #include <evas_private.h>
 
+/* FIXME: that hack is a temporary one. That code will be in MinGW soon */
+#ifdef _WIN32
+
+#define RTLD_LAZY 1 /* lazy function call binding */
+#define RTLD_NOW 2 /* immediate function call binding */
+#define RTLD_GLOBAL 4 /* symbols in this dlopen'ed obj are visible
+			 to other dlopen'ed objs */
+
+static char *dlerr_ptr;
+static char dlerr_data[80];
+
+void *dlopen (const char *file, int mode)
+{
+  HMODULE hmodule;
+
+  hmodule = LoadLibrary(file);
+  if (hmodule == NULL) {
+    int error;
+
+    error = GetLastError();
+    sprintf(dlerr_data, "LoadLibraryEx returned %d.", error);
+    dlerr_ptr = dlerr_data;
+  }
+  return hmodule;
+}
+
+int dlclose (void *handle)
+{
+  if (FreeLibrary(handle)) {
+    return 0;
+  }
+  else {
+    int error;
+
+    error = GetLastError();
+    sprintf(dlerr_data, "FreeLibrary returned %d.", error);
+    dlerr_ptr = dlerr_data;
+    return -1;
+  }
+}
+
+void *dlsym (void *handle, const char *name)
+{
+  FARPROC fp;
+
+  fp = GetProcAddress(handle, name);
+  if (fp == NULL) {
+    int error;
+
+    error = GetLastError();
+    sprintf(dlerr_data, "GetProcAddress returned %d.", error);
+    dlerr_ptr = dlerr_data;
+  }
+  return fp;
+}
+
+char *dlerror (void)
+{
+  if (dlerr_ptr != NULL) {
+    dlerr_ptr = NULL;
+    return dlerr_data;
+  }
+  else {
+    return NULL;
+  }
+}
+
+#endif /* _WIN32 */
+
 Evas_List *evas_modules = NULL;
 static Evas_List *evas_module_paths = NULL;
 
Index: src/modules/engines/buffer/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/engines/buffer/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- src/modules/engines/buffer/Makefile.am	2 Mar 2006 08:06:09 -0000	1.4
+++ src/modules/engines/buffer/Makefile.am	3 Jan 2007 19:56:11 -0000
@@ -15,7 +15,7 @@
 evas_outbuf.c
 
 module_la_LIBADD = $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS =  -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS =  @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
 include_HEADERS = Evas_Engine_Buffer.h
Index: src/modules/loaders/edb/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/loaders/edb/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/loaders/edb/Makefile.am	17 Jan 2006 03:47:39 -0000	1.2
+++ src/modules/loaders/edb/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_load_edb.c
 
 module_la_LIBADD       = @edb_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/loaders/eet/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/loaders/eet/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/loaders/eet/Makefile.am	17 Jan 2006 03:47:39 -0000	1.2
+++ src/modules/loaders/eet/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_load_eet.c
 
 module_la_LIBADD       = @eet_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/loaders/gif/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/loaders/gif/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- src/modules/loaders/gif/Makefile.am	8 Apr 2006 12:21:15 -0000	1.1
+++ src/modules/loaders/gif/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_load_gif.c
 
 module_la_LIBADD       = @gif_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/loaders/jpeg/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/loaders/jpeg/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/loaders/jpeg/Makefile.am	17 Jan 2006 03:47:40 -0000	1.2
+++ src/modules/loaders/jpeg/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_load_jpeg.c
 
 module_la_LIBADD       = @jpeg_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/loaders/png/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/loaders/png/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/loaders/png/Makefile.am	17 Jan 2006 03:47:40 -0000	1.2
+++ src/modules/loaders/png/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_load_png.c
 
 module_la_LIBADD       = @png_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/loaders/svg/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/loaders/svg/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- src/modules/loaders/svg/Makefile.am	17 Aug 2006 14:11:59 -0000	1.1
+++ src/modules/loaders/svg/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_load_svg.c
 
 module_la_LIBADD       = @svg_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/loaders/tiff/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/loaders/tiff/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- src/modules/loaders/tiff/Makefile.am	9 Apr 2006 00:09:52 -0000	1.1
+++ src/modules/loaders/tiff/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_load_tiff.c
 
 module_la_LIBADD       = @tiff_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/loaders/xpm/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/loaders/xpm/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- src/modules/loaders/xpm/Makefile.am	12 Aug 2006 09:16:30 -0000	1.1
+++ src/modules/loaders/xpm/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_load_xpm.c
 
 module_la_LIBADD       = $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/savers/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/savers/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/savers/Makefile.am	10 Apr 2006 07:26:45 -0000	1.2
+++ src/modules/savers/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -8,7 +8,7 @@
 eet_subdir = eet
 endif
 
-if BUILD_LOADER_JPEG
+if BUILD_SAVER_JPEG
 jpeg_subdir = jpeg
 endif
 
Index: src/modules/savers/edb/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/savers/edb/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/savers/edb/Makefile.am	17 Jan 2006 03:47:40 -0000	1.2
+++ src/modules/savers/edb/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_save_edb.c
 
 module_la_LIBADD       = @edb_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/savers/eet/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/savers/eet/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/savers/eet/Makefile.am	17 Jan 2006 03:47:40 -0000	1.2
+++ src/modules/savers/eet/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_save_eet.c
 
 module_la_LIBADD       = @eet_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/savers/jpeg/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/savers/jpeg/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/savers/jpeg/Makefile.am	17 Jan 2006 03:47:40 -0000	1.2
+++ src/modules/savers/jpeg/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_save_jpeg.c
 
 module_la_LIBADD       = @jpeg_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/savers/png/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/savers/png/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- src/modules/savers/png/Makefile.am	17 Jan 2006 03:47:40 -0000	1.2
+++ src/modules/savers/png/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_save_png.c
 
 module_la_LIBADD       = @png_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h
 
Index: src/modules/savers/tiff/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/libs/evas/src/modules/savers/tiff/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- src/modules/savers/tiff/Makefile.am	10 Apr 2006 07:26:45 -0000	1.1
+++ src/modules/savers/tiff/Makefile.am	3 Jan 2007 19:56:12 -0000
@@ -17,7 +17,7 @@
 module_la_SOURCES      = evas_image_save_tiff.c
 
 module_la_LIBADD       = @tiff_libs@ $(top_builddir)/src/lib/libevas.la
-module_la_LDFLAGS      = -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
+module_la_LDFLAGS      = @create_shared_lib@ -module -avoid-version -L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
 
 module_la_DEPENDENCIES = $(top_builddir)/config.h