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)

View file

@ -7,7 +7,7 @@ bill@newbreedsoftware.com
http://www.tuxpaint.org/
June 17, 2002 - February 16, 2010
June 17, 2002 - February 24, 2010
$Id$
@ -735,6 +735,9 @@ $Id$
* Windows 32-bit coding and builds
John Popplewell <john@johnnypops.demon.co.uk>
* Tweaks to help Windows cross-compiling under Linux
Volker Grabsch <vog@notjusthosting.com>
* Mac OS X coding and builds
Martin Fuhrer <mfuhrer@users.sourceforge.net>
Darrell Walisser <walisser@mac.com> [retired]
@ -744,6 +747,7 @@ $Id$
* BeOS coding and builds
Luc 'Begasus' Schrijvers <Begasus@skynet.be>
Scott McCreary <scottmc@users.sourceforge.net>
Marcin 'Shard' Konicki <shard at beosjournal.org> [retired]
* Debian Linux packages

View file

@ -8,7 +8,7 @@ http://www.tuxpaint.org/
$Id$
2009.February.18 (0.9.22)
2009.February.24 (0.9.22)
* New Tools:
----------
* Label - A tool to add text to a drawing, which can be modified or
@ -35,6 +35,14 @@ $Id$
* Wet Paint - Draws a light coat of paint, and smudges at the same time.
(Based on Smudge tool. Requested by gallery artist Angela.)
* Build System Improvements:
--------------------------
* Variety of tweaks to help Tux Paint cross-compile for Windows under Linux
Volker Grabsch <vog@notjusthosting.com>
* Added support for building under Haiku OS
Scott McCreary <scottmc@users.sourceforge.net>
* Other Improvements:
-------------------
* Template images are now supported. Similar to Starters, they are

View file

@ -24,7 +24,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - February 18, 2006
June 14, 2002 - February 24, 2010
$Id$
*/
@ -52,7 +52,7 @@
WIN32 and MINGW don't have strcasestr().
*/
#define NOMINMAX
#include "Shlwapi.h"
#include "shlwapi.h"
#define strcasestr StrStrI
#endif /* WIN32 */

View file

@ -131,7 +131,7 @@ int no_system_fonts = 1;
#endif
int all_locale_fonts;
volatile long font_thread_done;
static volatile long font_thread_aborted;
volatile long font_thread_aborted;
volatile long waiting_for_fonts;
static int font_scanner_pid;
int font_socket_fd;

View file

@ -69,6 +69,7 @@
extern SDL_Thread *font_thread;
extern volatile long font_thread_done;
extern volatile long font_thread_aborted;
extern volatile long waiting_for_fonts;
extern int font_socket_fd;

View file

@ -6,13 +6,13 @@
%{
#include "../src/parse.h"
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <stdint.h>
#include "../src/parse.h"
const char PARSE_YES[] = "yes";
const char PARSE_NO[] = "no";

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - October 13, 2009
June 14, 2002 - February 24, 2010
*/
@ -268,7 +268,7 @@ typedef struct safer_dirent
ino_t d_ino;
ino_t d_pino;
unsigned short d_reclen;
char d_name[NAME_MAX];
char d_name[FILENAME_MAX];
} safer_dirent;
#define dirent safer_dirent
@ -1501,9 +1501,9 @@ static int cursor_left, cursor_x, cursor_y, cursor_textwidth; /* canvas-relative
static int old_cursor_x, old_cursor_y;
static int cur_label, cur_select;
static int been_saved;
static char file_id[NAME_MAX];
static char starter_id[NAME_MAX];
static char template_id[NAME_MAX];
static char file_id[FILENAME_MAX];
static char starter_id[FILENAME_MAX];
static char template_id[FILENAME_MAX];
static int brush_scroll;
static int stamp_scroll[MAX_STAMP_GROUPS];
static int font_scroll, magic_scroll, tool_scroll;
@ -8248,7 +8248,7 @@ static SDL_Surface *thumbnail2(SDL_Surface * src, int max_x, int max_y,
Uint32(*getpixel) (SDL_Surface *, int, int) =
getpixels[src->format->BytesPerPixel];
/* FIXME: Deal with gamma, per: http://www.4p8.com/eric.brasseur/gamma.html */
/* Determine scale and centering offsets: */
if (!keep_aspect)
@ -10152,7 +10152,7 @@ static void autoscale_copy_smear_free(SDL_Surface * src, SDL_Surface * dst,
static void load_starter_id(char *saved_id)
{
char *rname;
char fname[NAME_MAX];
char fname[FILENAME_MAX];
FILE *fi;
char color_tag;
int r, g, b;
@ -19425,8 +19425,10 @@ static void setup_config(char *argv[])
// FIXME: most of this is not required before starting the font scanner
#ifdef PAPER_H
if(tmpcfg_cmd.papersize && !strcmp(tmpcfg_cmd.papersize, "help"))
show_available_papersizes(0);
#endif
#define SETBOOL(x) do{ if(tmpcfg.x) x = (tmpcfg.x==PARSE_YES); }while(0)
SETBOOL(all_locale_fonts);
@ -19504,10 +19506,12 @@ static void setup_config(char *argv[])
strcpy(colorfile, tmpcfg.colorfile); // FIXME can overflow
if(tmpcfg.print_delay)
print_delay = atoi(tmpcfg.print_delay);
#ifdef PAPER_H
if(tmpcfg.printcommand)
printcommand = tmpcfg.printcommand;
if(tmpcfg.altprintcommand)
altprintcommand = tmpcfg.altprintcommand;
#endif
if(tmpcfg.alt_print_command_default)
{
// FIXME: probably need extra variables
@ -19518,8 +19522,10 @@ static void setup_config(char *argv[])
else
alt_print_command_default = ALTPRINT_MOD; // default ("mod")
}
#ifdef PAPER_H
if(tmpcfg.papersize)
papersize = tmpcfg.papersize;
#endif
}