Added support for building tuxpaint on Haiku

This commit is contained in:
Scott McCreary 2009-12-08 08:38:30 +00:00
parent da628a6e45
commit 3f7b0bd972
4 changed files with 49 additions and 28 deletions

View file

@ -46,7 +46,7 @@ comptest = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(1) $(2) -o dummy.o dummy.c $
echo "$(1)"; \ echo "$(1)"; \
fi ;) fi ;)
beos_RSRC_CMD:=xres -o tuxpaint src/tuxpaint.rsrc beos_RSRC_CMD:=rc src/tuxpaint.rdef && xres -o tuxpaint src/tuxpaint.rsrc
RSRC_CMD:=$($(OS)_RSRC_CMD) RSRC_CMD:=$($(OS)_RSRC_CMD)
beos_MIMESET_CMD:=mimeset -f tuxpaint beos_MIMESET_CMD:=mimeset -f tuxpaint
@ -79,7 +79,7 @@ FRIBIDI_CFLAGS:=$(shell pkg-config --cflags fribidi)
windows_ARCH_LINKS:=-lintl $(PNG) -lwinspool -lshlwapi $(FRIBIDI_LIB) windows_ARCH_LINKS:=-lintl $(PNG) -lwinspool -lshlwapi $(FRIBIDI_LIB)
osx_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB) osx_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
beos_ARCH_LINKS:="-lintl $(PNG) -lz -lbe -liconv $(FRIBIDI_LIB)" beos_ARCH_LINKS:="-lintl $(PNG) -lz -lbe -lnetwork -liconv $(FRIBIDI_LIB)"
linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB) linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
ARCH_LINKS:=$($(OS)_ARCH_LINKS) ARCH_LINKS:=$($(OS)_ARCH_LINKS)
@ -92,11 +92,10 @@ ARCH_HEADERS:=$($(OS)_ARCH_HEADERS)
# Where things will go when ultimately installed: # Where things will go when ultimately installed:
windows_PREFIX:=/usr/local windows_PREFIX:=/usr/local
osx_PREFIX:=/usr/local osx_PREFIX:=/usr/local
beos_PREFIX:=/boot/apps/Games/TuxPaint beos_PREFIX:=$(shell finddir B_APPS_DIRECTORY)/TuxPaint
linux_PREFIX:=/usr/local linux_PREFIX:=/usr/local
PREFIX:=$($(OS)_PREFIX) PREFIX:=$($(OS)_PREFIX)
# Root directory to place files when creating packages. # Root directory to place files when creating packages.
# PKG_ROOT is the old name for this, and should be undefined. # PKG_ROOT is the old name for this, and should be undefined.
# "TuxPaint-1" is the OLPC XO name. Installing to ./ is bad! # "TuxPaint-1" is the OLPC XO name. Installing to ./ is bad!
@ -139,6 +138,10 @@ else
CONFDIR:=$(DESTDIR)$(PREFIX)/etc/tuxpaint CONFDIR:=$(DESTDIR)$(PREFIX)/etc/tuxpaint
endif endif
ifeq ($(SYSNAME),Haiku)
CONFDIR:=$(shell finddir B_USER_SETTINGS_DIRECTORY)/TuxPaint
endif
# Icons and launchers: # Icons and launchers:
ICON_PREFIX:=$(DESTDIR)$(PREFIX)/share/pixmaps ICON_PREFIX:=$(DESTDIR)$(PREFIX)/share/pixmaps
X11_ICON_PREFIX:=$(DESTDIR)$(PREFIX)/X11R6/include/X11/pixmaps X11_ICON_PREFIX:=$(DESTDIR)$(PREFIX)/X11R6/include/X11/pixmaps
@ -396,7 +399,7 @@ trans:
windows_ARCH_INSTALL:= windows_ARCH_INSTALL:=
osx_ARCH_INSTALL:= osx_ARCH_INSTALL:=
beos_ARCH_INSTALL:= beos_ARCH_INSTALL:=install-haiku
linux_ARCH_INSTALL:=install-gnome install-kde install-kde-icons linux_ARCH_INSTALL:=install-gnome install-kde install-kde-icons
ARCH_INSTALL:=$($(OS)_ARCH_INSTALL) ARCH_INSTALL:=$($(OS)_ARCH_INSTALL)
@ -778,6 +781,13 @@ install-dlls:
strip -s $(BIN_PREFIX)/lib/pango/1.6.0/modules/*.dll; \ strip -s $(BIN_PREFIX)/lib/pango/1.6.0/modules/*.dll; \
fi fi
# Install symlink:
.PHONY: install-haiku
install-haiku:
@echo
@echo "...Installing symlink in apps/TuxPaint to tuxpaint executable file..."
@ln -sf $(DESTDIR)$(shell finddir B_APPS_DIRECTORY)/TuxPaint/bin/tuxpaint $(DESTDIR)$(shell finddir B_APPS_DIRECTORY)/TuxPaint/tuxpaint
# Install the import script: # Install the import script:
.PHONY: install-importscript .PHONY: install-importscript
install-importscript: install-importscript:

View file

@ -22,7 +22,7 @@
/* Jan. 17, 2003 */ /* Jan. 17, 2003 */
/* $Id$ */ /* $Id$ */
#ifndef __BEOS_PRINT_H__ #ifndef __BEOS_PRINT_H__
#define __BEOS_PRINT_H__ #define __BEOS_PRINT_H__
@ -32,12 +32,11 @@
extern "C" extern "C"
{ {
#endif /* */ #endif /* __cplusplus */
extern int SurfacePrint(SDL_Surface * surf); extern int SurfacePrint(SDL_Surface * surf);
extern int IsPrinterAvailable(); extern int IsPrinterAvailable();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* */ #endif /* __cplusplus */
#endif /* */ #endif /* __BEOS_PRINT__ */

View file

@ -67,6 +67,11 @@
#include "win32_print.h" #include "win32_print.h"
#endif #endif
#ifdef __HAIKU__
#include <FindDirectory.h>
#include <fs_info.h>
#endif
#ifdef __APPLE__ #ifdef __APPLE__
#include "wrapperdata.h" #include "wrapperdata.h"
extern WrapperData macosx; extern WrapperData macosx;
@ -1013,7 +1018,9 @@ void run_font_scanner(SDL_Surface * screen, const char *restrict const locale)
close(sv[1]); close(sv[1]);
return; return;
} }
#ifndef __HAIKU__
nice(42); // be nice, letting the main thread get the CPU nice(42); // be nice, letting the main thread get the CPU
#endif
sched_yield(); // try to let the parent run right now sched_yield(); // try to let the parent run right now
prctl(PR_SET_PDEATHSIG, 9); // get killed if parent exits prctl(PR_SET_PDEATHSIG, 9); // get killed if parent exits
if(getppid()==1) if(getppid()==1)

View file

@ -218,8 +218,11 @@ char *strcasestr(const char *haystack, const char *needle)
#include <locale.h> #include <locale.h>
#ifdef __BEOS__ #if defined __BEOS__ || defined __HAIKU__
#include <wchar.h> #include <wchar.h>
#include <stdbool.h>
#define FALSE false
#define TRUE true
#else #else
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
@ -251,7 +254,7 @@ char *strcasestr(const char *haystack, const char *needle)
#include <dirent.h> #include <dirent.h>
#include <signal.h> #include <signal.h>
#ifdef __BEOS__ #if defined __BEOS__ //|| defined __HAIKU__
/* BeOS */ /* BeOS */
@ -1096,7 +1099,7 @@ enum {
static magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */ static magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) #if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
#include <paper.h> #include <paper.h>
#if !defined(PAPER_H) #if !defined(PAPER_H)
#error "---------------------------------------------------" #error "---------------------------------------------------"
@ -1923,6 +1926,8 @@ static void mainloop(void)
int *thing_scroll; int *thing_scroll;
int cur_thing, do_draw, max; int cur_thing, do_draw, max;
int ignoring_motion; int ignoring_motion;
int j;
unsigned int i;
SDL_TimerID scrolltimer = NULL; SDL_TimerID scrolltimer = NULL;
SDL_Event event; SDL_Event event;
SDLKey key; SDLKey key;
@ -3778,8 +3783,7 @@ static void mainloop(void)
cur_font = select_cur_font; cur_font = select_cur_font;
text_state = select_text_state; text_state = select_text_state;
text_size = select_text_size; text_size = select_text_size;
// int j;
int j;
for (j = 0; j < num_font_families; j++) for (j = 0; j < num_font_families; j++)
{ {
if (user_font_families[j] if (user_font_families[j]
@ -5474,6 +5478,8 @@ static void show_version(int details)
printf(" Built for Windows (WIN32)\n"); printf(" Built for Windows (WIN32)\n");
#elif __BEOS__ #elif __BEOS__
printf(" Built for BeOS (__BEOS__)\n"); printf(" Built for BeOS (__BEOS__)\n");
#elif __HAIKU__
printf(" Built for Haiku (__HAIKU__)\n");
#elif NOKIA_770 #elif NOKIA_770
printf(" Built for Maemo (NOKIA_770)\n"); printf(" Built for Maemo (NOKIA_770)\n");
#elif OLPC_XO #elif OLPC_XO
@ -5594,7 +5600,7 @@ static void show_usage(int exitcode)
#endif #endif
" %s [--printdelay=SECONDS]\n" " %s [--printdelay=SECONDS]\n"
" %s [--altprintmod | --altprintalways | --altprintnever]\n" " %s [--altprintmod | --altprintalways | --altprintnever]\n"
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) #if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
" %s [--papersize PAPERSIZE | --papersize help]\n" " %s [--papersize PAPERSIZE | --papersize help]\n"
#endif #endif
" %s [--lang LANGUAGE | --locale LOCALE | --lang help]\n" " %s [--lang LANGUAGE | --locale LOCALE | --lang help]\n"
@ -5613,7 +5619,7 @@ static void show_usage(int exitcode)
blank, blank,
#endif #endif
blank, blank, blank, blank,
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) #if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
blank, blank,
#endif #endif
blank, blank, blank, blank, blank); blank, blank, blank, blank, blank);
@ -8998,7 +9004,7 @@ static void reset_avail_tools(void)
disallow_print = 1; disallow_print = 1;
#endif #endif
#ifdef __BEOS__ #if defined __BEOS__ || __HAIKU__
if (!IsPrinterAvailable()) if (!IsPrinterAvailable())
disallow_print = disable_print = 1; disallow_print = disable_print = 1;
#endif #endif
@ -14685,8 +14691,8 @@ void do_print(void)
if (error) if (error)
fprintf(stderr, "%s\n", error); fprintf(stderr, "%s\n", error);
} }
#elif defined(__BEOS__) #elif defined(__BEOS__) || defined(__HAIKU__)
/* BeOS */ /* BeOS and Haiku*/
SurfacePrint(save_canvas); SurfacePrint(save_canvas);
#elif defined(__APPLE__) #elif defined(__APPLE__)
@ -18511,7 +18517,7 @@ static void simply_render_node(struct label_node* node)
SDL_Rect dest, src; SDL_Rect dest, src;
wchar_t *str; wchar_t *str;
wchar_t tmp_str[256]; wchar_t tmp_str[256];
int w,h; int j,w,h;
unsigned i; unsigned i;
if (node->label_node_surface == NULL) if (node->label_node_surface == NULL)
@ -18535,7 +18541,6 @@ static void simply_render_node(struct label_node* node)
text_state = node->save_text_state; text_state = node->save_text_state;
text_size = node->save_text_size; text_size = node->save_text_size;
int j;
for (j = 0; j < num_font_families; j++) for (j = 0; j < num_font_families; j++)
{ {
if (user_font_families[j] if (user_font_families[j]
@ -19036,18 +19041,18 @@ static void show_available_papersizes(int exitcode)
static void parse_file_options(struct cfginfo *restrict tmpcfg, const char *filename) static void parse_file_options(struct cfginfo *restrict tmpcfg, const char *filename)
{ {
char str[256];
char* arg;
FILE *fi = fopen(filename, "r"); FILE *fi = fopen(filename, "r");
if(!fi) if(!fi)
return; return;
char str[256];
while(fgets(str, sizeof(str), fi)) while(fgets(str, sizeof(str), fi))
{ {
if(!isalnum(*str)) if(!isalnum(*str))
continue; continue;
strip_trailing_whitespace(str); strip_trailing_whitespace(str);
char *arg = strchr(str,'='); arg = strchr(str,'=');
if(arg) if(arg)
*arg++ = '\0'; *arg++ = '\0';
// FIXME: leaking mem here, but the trouble is that these // FIXME: leaking mem here, but the trouble is that these
@ -19192,7 +19197,7 @@ static void setup_config(char *argv[])
#if defined(_WIN32) #if defined(_WIN32)
/* Default local config file in users savedir directory on Windows */ /* Default local config file in users savedir directory on Windows */
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", savedir); /* FIXME */ snprintf(str, sizeof(str), "%s/tuxpaint.cfg", savedir); /* FIXME */
#elif defined(__BEOS__) #elif defined(__BEOS__) || defined(__HAIKU__)
/* BeOS: Use a "tuxpaint.cfg" file: */ /* BeOS: Use a "tuxpaint.cfg" file: */
strcpy(str, "tuxpaint.cfg"); strcpy(str, "tuxpaint.cfg");
#elif defined(__APPLE__) #elif defined(__APPLE__)