Patch collection from Volker Grabsch to help Tux Paint cross-compile for Windows:

* Solve the 'FIXME: "finddir" ...' (The trick is to use "=" instead of ":=". That way, $(beos_PREFIX) will only be evaluated when it is actually used.)
* include "shlwapi.h" instead of "Shlwapi.h" (Otherwise, compiling for Windows will fail on a case sensitive file system. (e.g. a Unix file system when cross compiling))
* use FILENAME_MAX instead of NAME_MAX (FILENAME_MAX is more portable than NAME_MAX. Also, recent MinGW versions don't support NAME_MAX anymore.)
* Exposing font_thread_aborted via extern [tweak to Volker's patch which removed a logic test, which is probably not what we want]
* include parse.h (and thus compiler.h) after <stdio.h> (This ensures that the perror() macro of compiler.h won't confuse the perror() function declaration of <stdio.h>.)
* fix another compiling error about undefined variables (The tuxpaint.c uses printcommand/altprintcommand/papersize even when they aren't defined, i.e. when libpaper is not used. This patch solves the issue by using "#ifdef PAPER_H")
* call show_available_papersizes() only when libpaper is used
* permit cross compiling by using Make variables instead of hard-coded tools

Documented scottmc's Haiku improvements.
This commit is contained in:
William Kendrick 2010-02-25 07:06:13 +00:00
parent 5be63987d1
commit 7b31b7549d
8 changed files with 46 additions and 25 deletions

View file

@ -4,7 +4,7 @@
# bill@newbreedsoftware.com
# http://www.tuxpaint.org/
# June 14, 2002 - November 20, 2009
# June 14, 2002 - February 24, 2010
# The version number, for release:
@ -34,6 +34,9 @@ endif
endif
endif
WINDRES:=windres
PKG_CONFIG:=pkg-config
# test if a library can be linked
linktest = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) -o dummy.o dummy.c $(LDFLAGS) $(1) $(2) > /dev/null 2>&1; \
then \
@ -74,8 +77,8 @@ PAPER_LIB:=$(call linktest,-lpaper,)
PNG:=$(call linktest,-lpng,)
PNG:=$(if $(PNG),$(PNG),$(call linktest,-lpng12,))
FRIBIDI_LIB:=$(shell pkg-config --libs fribidi)
FRIBIDI_CFLAGS:=$(shell pkg-config --cflags fribidi)
FRIBIDI_LIB:=$(shell $(PKG_CONFIG) --libs fribidi)
FRIBIDI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags fribidi)
windows_ARCH_LINKS:=-lintl $(PNG) -lwinspool -lshlwapi $(FRIBIDI_LIB)
osx_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
@ -93,8 +96,7 @@ ARCH_HEADERS:=$($(OS)_ARCH_HEADERS)
windows_PREFIX:=/usr/local
osx_PREFIX:=/usr/local
# FIXME: "finddir" fails on other platforms -bjk 2009.12.08
beos_PREFIX:=$(shell finddir B_APPS_DIRECTORY)/TuxPaint
beos_PREFIX=$(shell finddir B_APPS_DIRECTORY)/TuxPaint
linux_PREFIX:=/usr/local
PREFIX:=$($(OS)_PREFIX)
@ -164,7 +166,7 @@ CURSOR_SHAPES:=LARGE
# Libraries, paths, and flags:
SDL_LIBS:=$(shell sdl-config --libs) -lSDL_image -lSDL_ttf
SDL_LIBS:=$(shell $(PKG_CONFIG) sdl --libs) -lSDL_image -lSDL_ttf
# Sound support
SDL_MIXER_LIB:=$(call linktest,-lSDL_mixer,$(SDL_LIBS))
@ -176,15 +178,15 @@ NOPANGOFLAG:=$(if $(SDL_PANGO_LIB),,-DNO_SDLPANGO$(warning -lSDL_Pango failed, n
SDL_LIBS+=$(SDL_MIXER_LIB) $(SDL_PANGO_LIB)
SDL_CFLAGS:=$(shell sdl-config --cflags)
SDL_CFLAGS:=$(shell $(PKG_CONFIG) sdl --cflags)
# New one: -lrsvg-2 -lcairo
# Old one: -lcairo -lsvg -lsvg-cairo
SVG_LIB:=$(shell pkg-config --libs librsvg-2.0 cairo || pkg-config --libs libsvg-cairo)
SVG_LIB:=$(shell $(PKG_CONFIG) --libs librsvg-2.0 cairo || $(PKG_CONFIG) --libs libsvg-cairo)
# lots of -I things, so really should be SVG_CPPFLAGS
SVG_CFLAGS:=$(shell pkg-config --cflags librsvg-2.0 cairo || pkg-config --cflags libsvg-cairo)
SVG_CFLAGS:=$(shell $(PKG_CONFIG) --cflags librsvg-2.0 cairo || $(PKG_CONFIG) --cflags libsvg-cairo)
# SVG support via Cairo
NOSVGFLAG:=$(if $(SVG_LIB),,-DNOSVG$(warning No SVG for you!))
@ -1004,7 +1006,7 @@ obj/postscript_print.o: src/postscript_print.c Makefile \
obj/resource.o: win32/resources.rc win32/resource.h
@echo
@echo "...Compiling win32 resources..."
@windres -i win32/resources.rc -o obj/resource.o
@$(WINDRES) -i win32/resources.rc -o obj/resource.o
src/tp_magic_api.h: src/tp_magic_api.h.in
@ -1033,8 +1035,8 @@ obj:
######
MAGIC_SDL_CPPFLAGS:=$(shell sdl-config --cflags)
MAGIC_SDL_LIBS:=-L/usr/local/lib $(LIBMINGW) $(shell sdl-config --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
MAGIC_SDL_CPPFLAGS:=$(shell $(PKG_CONFIG) sdl --cflags)
MAGIC_SDL_LIBS:=-L/usr/local/lib $(LIBMINGW) $(shell $(PKG_CONFIG) sdl --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
MAGIC_ARCH_LINKS:=-lintl $(PNG)
windows_PLUGIN_LIBS:=$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS)