Merge pull request #377 from b4n/autotools-mingw-cross

Autotools: Fix MinGW cross-compilation
This commit is contained in:
Colomban Wendling 2015-01-20 16:09:49 +01:00
commit 14f1468f78
3 changed files with 29 additions and 49 deletions

View File

@ -5,7 +5,7 @@
#define VER_FILEVERSION_STR "1.25"
#define APP_MANIFEST 1
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "../icons/geany.ico"
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "icons/geany.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION

View File

@ -18,50 +18,16 @@ geanyfunctions.h: genapi.py ../src/plugins.c
all: geanyfunctions.h
demoplugin_la_LDFLAGS = -module -avoid-version
classbuilder_la_LDFLAGS = -module -avoid-version
htmlchars_la_LDFLAGS = -module -avoid-version
export_la_LDFLAGS = -module -avoid-version
saveactions_la_LDFLAGS = -module -avoid-version
filebrowser_la_LDFLAGS = -module -avoid-version
splitwindow_la_LDFLAGS = -module -avoid-version
demoplugin_la_LDFLAGS = -module -avoid-version -no-undefined
classbuilder_la_LDFLAGS = -module -avoid-version -no-undefined
htmlchars_la_LDFLAGS = -module -avoid-version -no-undefined
export_la_LDFLAGS = -module -avoid-version -no-undefined
saveactions_la_LDFLAGS = -module -avoid-version -no-undefined
filebrowser_la_LDFLAGS = -module -avoid-version -no-undefined
splitwindow_la_LDFLAGS = -module -avoid-version -no-undefined
if PLUGINS
if MINGW
# build Geany for Windows on non-Windows systems (cross-compile)
# (this is a little hack'ish and surely can be improved)
DLL_LD_FLAGS = -module -avoid-version
MINGW_CFLAGS = \
-DGEANY_DATADIR=\"data\" \
-DHAVE_CONFIG_H \
-DGTK \
-I$(top_srcdir) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/tagmanager/src \
-I$(top_srcdir)/scintilla/include \
$(GTK_CFLAGS) \
$(PLUGIN_CFLAGS)
.PHONY: all clean
all-local: \
classbuilder.dll \
htmlchars.dll \
export.dll \
saveactions.dll \
splitwindow.dll \
filebrowser.dll
.c.dll:
$(CC) $(MINGW_CFLAGS) -o $@.o -c $<
$(CC) -shared $@.o $(GTK_LIBS) $(DLL_LD_FLAGS) -o $@
clean:
rm -f *.o *.dll
else
# Plugins to be installed
plugin_LTLIBRARIES = \
classbuilder.la \
@ -99,11 +65,16 @@ saveactions_la_LIBADD = $(GTK_LIBS)
filebrowser_la_LIBADD = $(GTK_LIBS)
splitwindow_la_LIBADD = $(GTK_LIBS)
endif # MINGW
endif # PLUGINS
AM_CPPFLAGS = \
-DDATADIR=\"$(datadir)\" \
if MINGW
# FIXME: why is this define different than the non-MINGW one?
AM_CPPFLAGS = -DGEANY_DATADIR=\"data\"
else
AM_CPPFLAGS = -DDATADIR=\"$(datadir)\"
endif
AM_CPPFLAGS += \
-DGTK \
-I$(top_srcdir)/src \
-I$(top_srcdir)/tagmanager/src \
@ -115,10 +86,19 @@ AM_CPPFLAGS = \
# This part allows people to build their own plugins in here.
# Yes, it's a mess.
#
custom_plugins_cppflags = -DHAVE_CONFIG_H -I$(top_srcdir)
custom_plugins_ldflags = -module -avoid-version
if MINGW
SUFFIXES = .c .dll
.c.dll:
$(CC) $(AM_CPPFLAGS) $(custom_plugins_cppflags) $(CPPFLAGS) $(CFLAGS) -o $@.o -c $<
$(CC) -shared $@.o $(GTK_LIBS) $(custom_plugins_ldflags) $(LIBS) $(PLUGIN_LIBS) $(LDFLAGS) -o $@
else
SUFFIXES = .c .so
.c.so:
$(LIBTOOL) --mode=compile $(CC) -DHAVE_CONFIG_H -I$(top_srcdir) $(AM_CPPFLAGS) $(CFLAGS) -c $< -o tmp$@.lo $(PLUGIN_CFLAGS)
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o libtmp$@.la -rpath $(plugindir) tmp$@.lo $(LIBS) $(LDFLAGS) -module -avoid-version $(PLUGIN_LIBS)
$(LIBTOOL) --mode=compile $(CC) $(AM_CPPFLAGS) $(custom_plugins_cppflags) $(CPPFLAGS) $(CFLAGS) -c $< -o tmp$@.lo
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o libtmp$@.la -rpath $(plugindir) tmp$@.lo $(LIBS) $(LDFLAGS) $(custom_plugins_ldflags) $(PLUGIN_LIBS)
@rm -f tmp$@.lo tmp$@.o libtmp$@.la
@cp .libs/libtmp$@.so* $@
@rm -f .libs/libtmp$@.*
endif

View File

@ -124,8 +124,8 @@ geany_LDFLAGS = -mwindows -mms-bitfields
WINDRES = $(host_alias)-windres
geany_private.res:
$(WINDRES) -i ../geany_private.rc --input-format=rc -o geany_private.res -O coff;
geany_private.res: $(top_srcdir)/geany_private.rc
$(WINDRES) -i $(top_srcdir)/geany_private.rc --input-format=rc -o $@ -O coff
clean-local:
rm -f geany_private.res