Commit f2c42c94 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

Similar additions for Win32 as in the other libgimp*/Makefile.am files:

2002-12-23  Tor Lillqvist  <tml@iki.fi>

	* libgimpwidgets/Makefile.am: Similar additions for Win32 as in
	the other libgimp*/Makefile.am files: Use -no-undefined. Use the
	.def file. Produce MS style import library if possible. Install
	and uninstall import libraries.
	(AM_CPPFLAGS) Define LT_RELEASE and LT_CURRENT_MINUS_AGE.
	(libgimpwidgets_1_3_la_sources) Include libgimp-glue.c

	* libgimpwidgets/libgimp-glue.c: Bypass whole file unless Win32.
	(dynamic_resolve): Try both the libtool style DLL name and Hans
	Breuer's naming scheme.
	(gimp_*) Replace duplicated code snippets with calls of a
	preprocessor macro.
parent 94a198e5
......@@ -15,6 +15,19 @@
* libgimpmodule/Makefile.am (INCLUDES): Add GMODULE_CFLAGS.
(LIBADD): Add GMODULE_LIBS.
* libgimpwidgets/Makefile.am: Similar additions for Win32 as in
the other libgimp*/Makefile.am files: Use -no-undefined. Use the
.def file. Produce MS style import library if possible. Install
and uninstall import libraries.
(AM_CPPFLAGS) Define LT_RELEASE and LT_CURRENT_MINUS_AGE.
(libgimpwidgets_1_3_la_sources) Include libgimp-glue.c
* libgimpwidgets/libgimp-glue.c: Bypass whole file unless Win32.
(dynamic_resolve): Try both the libtool style DLL name and Hans
Breuer's naming scheme.
(gimp_*) Replace duplicated code snippets with calls of a
preprocessor macro.
2002-12-21 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/imagemap/imap_csim.l: add "<string.h> to remove warning.
......
## Process this file with automake to produce Makefile.in
if PLATFORM_WIN32
no_undefined = -no-undefined
conditional_libgimpcolor_la = ../libgimpcolor/libgimpcolor-1.3.la
endif
if PLATFORM_WIN32
else
libm = -lm
endif
if OS_WIN32
gimpwidgets_def = gimpwidgets.def
libgimpwidgets_export_symbols = -export-symbols gimpwidgets.def
install-libtool-import-lib:
$(INSTALL) .libs/libgimpwidgets-1.3.dll.a $(DESTDIR)$(libdir)
uninstall-libtool-import-lib:
-rm $(DESTDIR)$(libdir)/libgimpwidgets-1.3.dll.a
else
install-libtool-import-lib:
uninstall-libtool-import-lib:
endif
if MS_LIB_AVAILABLE
noinst_DATA = gimpwidgets-1.3.lib
install-ms-lib:
$(INSTALL) gimpwidgets-1.3.lib $(DESTDIR)$(libdir)
uninstall-ms-lib:
-rm $(DESTDIR)$(libdir)/gimpwidgets-1.3.lib
gimpwidgets-1.3.lib: gimpwidgets.def
lib -name:libgimpwidgets-1.3-@LT_CURRENT_MINUS_AGE@.dll -def:gimpwidgets.def -out:$@
else
install-ms-lib:
uninstall-ms-lib:
endif
libgimpwidgetsincludedir = $(includedir)/gimp-$(LT_RELEASE)/libgimpwidgets
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"LibGimpWidgets\" \
-DLT_RELEASE=\"@LT_RELEASE@\" \
-DLT_CURRENT_MINUS_AGE=\"@LT_CURRENT_MINUS_AGE@\" \
@GIMP_THREAD_FLAGS@
INCLUDES = \
......@@ -58,7 +101,8 @@ libgimpwidgets_1_3_la_sources = \
gimpstock.c \
gimpstock.h \
gimpunitmenu.c \
gimpunitmenu.h
gimpunitmenu.h \
libgimp-glue.c
libgimpwidgets_1_3_la_built_sources = \
gimpwidgetsmarshal.c \
......@@ -67,8 +111,6 @@ libgimpwidgets_1_3_la_built_sources = \
libgimpwidgets_1_3_la_extra_sources = gimpwidgetsmarshal.list
EXTRA_DIST = \
makefile.mingw \
makefile.mingw.in \
makefile.msc \
gimpwidgets.def \
$(libgimpwidgets_1_3_la_extra_sources)
......@@ -103,9 +145,13 @@ libgimpwidgetsinclude_HEADERS = \
gimpunitmenu.h
libgimpwidgets_1_3_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
$(no_undefined) \
$(libgimpwidgets_export_symbols)
libgimpwidgets_1_3_la_LIBADD = $(conditional_libgimpcolor_la) $(GTK_LIBS) $(libm)
libgimpwidgets_1_3_la_LIBADD = $(GLIB_LIBS) -lm
libgimpwidgets_1_3_la_DEPENDENCIES = $(gimpwidgets_def)
#
# rules to generate built sources
......@@ -125,3 +171,6 @@ $(srcdir)/gimpwidgetsmarshal.c: $(srcdir)/gimpwidgetsmarshal.h
&& cp xgen-gwmc $(@F) \
&& rm -f xgen-gwmc xgen-gwmc~
install-data-local: install-ms-lib install-libtool-import-lib
uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
......@@ -23,7 +23,7 @@
/*
* Supports dynamic linking at run-time against
* libgimp (if used by a plug-in, or gimp.exe
* if used by itself)
* if used by gimp.exe itself)
*
gimp_palette_get_background
......@@ -42,6 +42,8 @@ gimp_unit_get_symbol
#include <glib.h>
#ifdef G_OS_WIN32 /* Bypass whole file otherwise */
#include "libgimpcolor/gimpcolortypes.h"
#include "libgimpbase/gimpbasetypes.h"
#include "libgimpbase/gimpunit.h"
......@@ -55,13 +57,15 @@ gimp_unit_get_symbol
#include <windows.h>
typedef int voidish;
/* function pointer prototypes */
typedef gboolean (* PFN_QueryColor) (GimpRGB *color);
typedef gchar* (* PFN_GetUnitStr) (GimpUnit);
typedef gdouble (* PFN_GetUnitInt) (GimpUnit);
typedef gdouble (* PFN_GetUnitDouble) (GimpUnit);
typedef gint (* PFN_GetNumber) (void);
typedef void (* PFN_Help) (const char*);
typedef voidish (* PFN_Help) (const char*);
static FARPROC
dynamic_resolve (const gchar* name, HMODULE* hMod)
......@@ -74,7 +78,11 @@ dynamic_resolve (const gchar* name, HMODULE* hMod)
if (!fn)
{
*hMod = LoadLibrary ("gimp-1.3.dll");
/* First try the libtool style name */
*hMod = LoadLibrary ("libgimp-" LT_RELEASE "-" LT_CURRENT_MINUS_AGE ".dll");
/* If that didn't work, try the name style used by Hans Breuer */
if (!hMod)
*hMod = LoadLibrary ("gimp-1.3.dll");
fn = GetProcAddress (*hMod, name);
}
......@@ -84,154 +92,41 @@ dynamic_resolve (const gchar* name, HMODULE* hMod)
return fn;
}
gboolean
gimp_palette_get_foreground (GimpRGB *color)
{
HMODULE h = NULL;
gboolean ret = FALSE;
PFN_QueryColor fn = (PFN_QueryColor) dynamic_resolve ("gimp_palette_get_foreground", &h);
if (fn)
ret = fn (color);
if (h)
FreeLibrary (h);
return ret;
#define ENTRY(type, name, parlist, defaultval, fntype, arglist) \
type \
name parlist \
{ \
HMODULE h = NULL; \
type ret = defaultval; \
fntype fn = (fntype) dynamic_resolve (#name, &h); \
if (fn) \
ret = fn arglist; \
\
if (h) \
FreeLibrary (h); \
return ret; \
}
gboolean
gimp_palette_get_background (GimpRGB *color)
{
HMODULE h = NULL;
gboolean ret = FALSE;
PFN_QueryColor fn = (PFN_QueryColor) dynamic_resolve ("gimp_palette_get_background", &h);
if (fn)
ret = fn (color);
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (gboolean, gimp_palette_get_foreground, (GimpRGB *color), FALSE, PFN_QueryColor, (color));
void
gimp_standard_help_func (const gchar *help_data)
{
HMODULE h = NULL;
PFN_Help fn = (PFN_Help) dynamic_resolve ("gimp_standard_help_func", &h);
if (fn)
fn (help_data);
ENTRY (gboolean, gimp_palette_get_background, (GimpRGB *color), FALSE, PFN_QueryColor, (color));
if (h)
FreeLibrary (h);
}
ENTRY (voidish, gimp_standard_help_func, (const gchar *help_data), 0, PFN_Help, (help_data));
const gchar *
gimp_unit_get_abbreviation (GimpUnit unit)
{
HMODULE h = NULL;
gchar* ret = NULL;
PFN_GetUnitStr fn = (PFN_GetUnitStr) dynamic_resolve ("gimp_unit_get_abbreviation", &h);
if (fn)
ret = fn (unit);
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (const gchar *, gimp_unit_get_abbreviation, (GimpUnit unit), NULL, PFN_GetUnitStr, (unit));
const gchar *
gimp_unit_get_singular (GimpUnit unit)
{
HMODULE h = NULL;
gchar* ret = NULL;
PFN_GetUnitStr fn = (PFN_GetUnitStr) dynamic_resolve ("gimp_unit_get_singular", &h);
if (fn)
ret = fn (unit);
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (const gchar *, gimp_unit_get_singular, (GimpUnit unit), NULL, PFN_GetUnitStr, (unit));
const gchar *
gimp_unit_get_plural (GimpUnit unit)
{
HMODULE h = NULL;
gchar* ret = NULL;
PFN_GetUnitStr fn = (PFN_GetUnitStr) dynamic_resolve ("gimp_unit_get_plural", &h);
if (fn)
ret = fn (unit);
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (const gchar *, gimp_unit_get_plural, (GimpUnit unit), NULL, PFN_GetUnitStr, (unit));
gint
gimp_unit_get_digits (GimpUnit unit)
{
HMODULE h = NULL;
gint ret = 0;
PFN_GetUnitInt fn = (PFN_GetUnitInt) dynamic_resolve ("gimp_unit_get_digits", &h);
if (fn)
ret = fn (unit);
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (gint, gimp_unit_get_digits, (GimpUnit unit), 0, PFN_GetUnitInt, (unit));
gdouble
gimp_unit_get_factor (GimpUnit unit)
{
HMODULE h = NULL;
gdouble ret = 0.0;
PFN_GetUnitDouble fn = (PFN_GetUnitDouble) dynamic_resolve ("gimp_unit_get_factor", &h);
if (fn)
ret = fn (unit);
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (gdouble, gimp_unit_get_factor, (GimpUnit unit), 0., PFN_GetUnitDouble, (unit));
gint
gimp_unit_get_number_of_built_in_units (void)
{
HMODULE h = NULL;
gint ret = 0;
PFN_GetNumber fn = (PFN_GetNumber) dynamic_resolve ("gimp_unit_get_number_of_built_in_units", &h);
if (fn)
ret = fn ();
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (gint, gimp_unit_get_number_of_built_in_units, (void), 0, PFN_GetNumber, ());
gint
gimp_unit_get_number_of_units (void)
{
HMODULE h = NULL;
gint ret = 0;
PFN_GetNumber fn = (PFN_GetNumber) dynamic_resolve ("gimp_unit_get_number_of_units", &h);
if (fn)
ret = fn ();
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (gint, gimp_unit_get_number_of_units, (void), 0, PFN_GetNumber, ());
const gchar *
gimp_unit_get_symbol (GimpUnit unit)
{
HMODULE h = NULL;
gchar* ret = NULL;
PFN_GetUnitStr fn = (PFN_GetUnitStr) dynamic_resolve ("gimp_unit_get_symbol", &h);
if (fn)
ret = fn (unit);
if (h)
FreeLibrary (h);
return ret;
}
ENTRY (const gchar *, gimp_unit_get_symbol, (GimpUnit unit), NULL, PFN_GetUnitStr, (unit));
#endif /* G_OS_WIN32 */
## Makefile for building the GIMP DLLs and LIBs with gcc on Win32.
################################
#
# Seriously out-of-date. Only Unix-style build supported now for gcc on Win32.
#
################################
## Makefile for building the GIMP DLLs and libs with gcc on Win32.
## You should use GNU make running on cygwin.
## Use: make -f makefile.mingw
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment