Trying again...

This commit is contained in:
Mark K. Kim 2017-11-27 01:02:41 -05:00
parent ea7f013d0d
commit 472bf79bb9
10 changed files with 122 additions and 89 deletions

View file

@ -68,7 +68,7 @@ beos_MIMESET_CMD:=mimeset -f tuxpaint
MIMESET_CMD:=$($(OS)_MIMESET_CMD)
windows_SO_TYPE:=dll
osx_SO_TYPE:=bundle
osx_SO_TYPE:=dylib
beos_SO_TYPE:=so
linux_SO_TYPE:=so
SO_TYPE:=$($(OS)_SO_TYPE)
@ -79,12 +79,32 @@ LIBMINGW:=$($(OS)_LIBMINGW)
windows_EXE_EXT:=.exe
EXE_EXT:=$($(OS)_EXE_EXT)
windows_BUNDLE:=
osx_BUNDLE=./TuxPaint.app
beos_BUNDLE:=
linux_BUNDLE:=
BUNDLE:=$($(OS)_BUNDLE)
windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o
osx_ARCH_LIBS:=obj/postscript_print.o
osx_ARCH_LIBS:=obj/postscript_print.o obj/macos.o
beos_ARCH_LIBS:=obj/BeOS_print.o
linux_ARCH_LIBS:=obj/postscript_print.o
ARCH_LIBS:=$($(OS)_ARCH_LIBS)
windows_ARCH_CFLAGS:=
# osx_ARCH_CFLAGS:=-isystem /opt/local/include -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-unused-result -Wno-deprecated-declarations -Wno-missing-braces -Wno-parentheses-equality -Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers -Wno-missing-prototypes -Wno-incompatible-function-pointer-types -Wno-format -Wno-bitwise-op-parentheses -Wno-strict-prototypes -Wno-sign-compare -Wno-\#warnings -Wno-ignored-optimization-argument -Wno-implicit-function-declaration -Wno-tautological-pointer-compare -Wno-self-assign -Wno-absolute-value
osx_ARCH_CFLAGS:=-DHAVE_STRCASESTR -isystem /opt/local/include -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-unused-result -Wno-sign-compare -Wno-ignored-optimization-argument -Wno-deprecated-declarations -Wno-absolute-value -Wno-missing-prototypes -Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types -Wno-bitwise-op-parentheses -Wno-format -Wno-implicit-function-declaration -Wno-self-assign -Wno-parentheses-equality -Wno-strict-prototypes
beos_ARCH_CFLAGS:=
linux_ARCH_CFLAGS:=
ARCH_CFLAGS:=$($(OS)_ARCH_CFLAGS)
windows_ARCH_LDFLAGS:=
osx_ARCH_LDFLAGS:=-L/opt/local/lib
beos_ARCH_LDFLAGS:=
linux_ARCH_LDFLAGS:=
ARCH_LDFLAGS:=$($(OS)_ARCH_LDFLAGS)
LDFLAGS:=$(ARCH_LDFLAGS)
PAPER_LIB:=$(call linktest,-lpaper,)
PNG:=$(call linktest,-lpng,)
PNG:=$(if $(PNG),$(PNG),$(call linktest,-lpng12,))
@ -99,23 +119,26 @@ linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
ARCH_LINKS:=$($(OS)_ARCH_LINKS)
windows_ARCH_HEADERS:=src/win32_print.h
osx_ARCH_HEADERS:=
osx_ARCH_HEADERS:=src/macos.h
beos_ARCH_HEADERS:=src/BeOS_print.h
linux_ARCH_HEADERS:=
ARCH_HEADERS:=$($(OS)_ARCH_HEADERS)
# Where things will go when ultimately installed:
# For macOS, the prefix is relative to DESTDIR.
windows_PREFIX:=/usr/local
osx_PREFIX:=/usr/local
osx_PREFIX:=Resources
beos_PREFIX=$(shell finddir B_APPS_DIRECTORY)/TuxPaint
linux_PREFIX:=/usr/local
PREFIX:=$($(OS)_PREFIX)
# Root directory to place files when creating packages.
# PKG_ROOT is the old name for this, and should be undefined.
# macOS is set up as a bundle, with all files under 'Contents'.
# "TuxPaint-1" is the OLPC XO name. Installing to ./ is bad!
ifeq ($(PREFIX),./)
ifeq ($(OS),osx)
DESTDIR:=$(BUNDLE)/Contents/
else ifeq ($(PREFIX),./)
DESTDIR:=TuxPaint-1
else
DESTDIR:=$(PKG_ROOT)
@ -217,6 +240,8 @@ hack:
@echo 'SDL_LIBS is' $(SDL_LIBS)
@echo 'SDL_CFLAGS is' $(SDL_CFLAGS)
@echo 'SVG_CFLAGS is' $(SVG_CFLAGS)
@echo 'PAPER_LIB is' $(PAPER_LIB)
@echo 'PNG is' $(PNG)
@echo 'LDFLAGS is' $(LDFLAGS)
@echo 'CFLAGS is' $(CFLAGS)
@echo 'CPPFLAGS is' $(CPPFLAGS)
@ -232,7 +257,8 @@ CFLAGS:=$(CPPFLAGS) $(OPTFLAGS) -W -Wall -fno-common -ffloat-store \
-Wbad-function-cast -Wwrite-strings \
-Waggregate-return \
-Wstrict-prototypes -Wmissing-prototypes \
$(shell src/test-option.sh -Wstrict-aliasing=2)
$(shell src/test-option.sh -Wstrict-aliasing=2) \
$(ARCH_CFLAGS)
DEFS:=-DVER_DATE=\"$(VER_DATE)\" -DVER_VERSION=\"$(VER_VERSION)\" \
-DDATA_PREFIX=\"$(patsubst $(DESTDIR)%,%,$(DATA_PREFIX))/\" \
@ -433,7 +459,7 @@ trans:
######
windows_ARCH_INSTALL:=
osx_ARCH_INSTALL:=
osx_ARCH_INSTALL:=install-bundlefiles
beos_ARCH_INSTALL:=install-haiku
linux_ARCH_INSTALL:=install-gnome install-kde install-kde-icons
ARCH_INSTALL:=$($(OS)_ARCH_INSTALL)
@ -455,11 +481,18 @@ install: install-bin install-data install-man install-doc \
@echo
@echo "--------------------------------------------------------------"
@echo
@echo "All done! Now (preferably NOT as 'root' superuser),"
@echo "you can type the command 'tuxpaint' to run the program!!!"
@echo
@echo "For more information, see the 'tuxpaint' man page,"
@echo "run 'tuxpaint --usage' or see $(DOC_PREFIX)/README.txt"
@if [ "x$(OS)" == "xosx" ]; then \
echo "All done! Now you can double click $(BUNDLE) to run the"; \
echo "program!!!"; \
echo; \
echo "For more information, see $(DOC_PREFIX)/README.txt"; \
else \
echo "All done! Now (preferably NOT as 'root' superuser),"; \
echo "you can type the command 'tuxpaint' to run the program!!!"; \
echo; \
echo "For more information, see the 'tuxpaint' man page,"; \
echo "run 'tuxpaint --usage' or see $(DOC_PREFIX)/README.txt"; \
fi
@echo
@echo "Visit Tux Paint's home page for more information, updates"
@echo "and to learn how you can help out!"
@ -558,6 +591,7 @@ clean:
@if [ -d starters/.thumbs ]; then rmdir starters/.thumbs; fi
@-rm -f templates/.thumbs/*.png
@if [ -d templates/.thumbs ]; then rmdir templates/.thumbs; fi
@-if [ "x$(BUNDLE)" != "x" ]; then rm -rf $(BUNDLE); fi
@echo
# "make uninstall" should remove the various parts from their
@ -602,6 +636,9 @@ uninstall: uninstall-i18n
-rm -r $(INCLUDE_PREFIX)/tuxpaint
-rm $(BIN_PREFIX)/tp-magic-config
-rm -r $(DEVDOC_PREFIX)
-if [ "x$(BUNDLE)" != "x" ]; then \
rm -rf $(BUNDLE); \
fi
# Install default config file:
@ -976,6 +1013,20 @@ install-man:
@chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tp-magic-config.1.gz
# Install the support files for macOS application bundle
.PHONY: install-bundlefiles
install-bundlefiles:
@echo
@echo "...Installing App Bundle Support Files..."
@mkdir -p $(BUNDLE)/Contents/MacOS
@mkdir -p $(BUNDLE)/Contents/Resources
@mkdir -p $(BUNDLE)/Contents/lib
@cp -p tuxpaint $(BUNDLE)/Contents/MacOS
@cp -p macos/PkgInfo $(BUNDLE)/Contents
@cp -p macos/Info.plist $(BUNDLE)/Contents
@cp -p macos/tuxpaint.icns $(BUNDLE)/Contents/Resources
@custom/macos.sh
# Build the program!
@ -1026,7 +1077,7 @@ obj/tuxpaint.o: src/tuxpaint.c \
obj/parse.c: obj/parse_step1.c
@echo
@echo "...Generating the command-line and config file parser (STEP 2)..."
@sed -r -e 's/^const struct/static const struct/' -e 's/_GNU/_TUX/' obj/parse_step1.c > obj/parse.c
@sed -e 's/^const struct/static const struct/' -e 's/_GNU/_TUX/' obj/parse_step1.c > obj/parse.c
obj/parse_step1.c: src/parse.gperf
@echo
@ -1129,6 +1180,12 @@ obj/postscript_print.o: src/postscript_print.c Makefile \
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/postscript_print.c -o obj/postscript_print.o
obj/macos.o: src/macos.c src/macos.h src/debug.h
@echo
@echo "...Compiling macOS support..."
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/macos.c -o obj/macos.o
obj/resource.o: win32/resources.rc win32/resource.h
@echo
@echo "...Compiling win32 resources..."
@ -1172,14 +1229,14 @@ MAGIC_SDL_LIBS:=-L/usr/local/lib $(LIBMINGW) $(shell $(PKG_CONFIG) $(SDL_PCNAME)
MAGIC_ARCH_LINKS:=-lintl $(PNG)
windows_PLUGIN_LIBS:=$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS)
osx_PLUGIN_LIBS:=
osx_PLUGIN_LIBS:=$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS)
beos_PLUGIN_LIBS:="$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS) $(MAGIC_SDL_CPPFLAGS)"
linux_PLUGIN_LIBS:=
PLUGIN_LIBS:=$($(OS)_PLUGIN_LIBS)
#MAGIC_CFLAGS:=-g3 -O2 -fvisibility=hidden -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall $(MAGIC_SDL_CPPFLAGS) -Isrc/
MAGIC_CFLAGS:=-g3 -O2 -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall $(MAGIC_SDL_CPPFLAGS) -Isrc/
SHARED_FLAGS:=-shared -fpic -Wl,--warn-shared-textrel
MAGIC_CFLAGS:=-g3 -O2 -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall $(MAGIC_SDL_CPPFLAGS) -Isrc/ $(ARCH_CFLAGS)
SHARED_FLAGS:=-shared -fpic
MAGIC_C:=$(wildcard magic/src/*.c)
MAGIC_SO:=$(patsubst magic/src/%.c,magic/%.$(SO_TYPE),$(MAGIC_C))

View file

@ -1,10 +1,8 @@
Tux Paint Customization
//EP added in 0.9.22 the customization process, custom folder and its files
This folder allows for customization of Tux Paint. One example is adding resources such as fonts, stamps, starters...
On Mac OS X, at the very end of build in Xcode, a build phase looks for macosx.sh script in this folder. If found, it is run, otherwise no customization is done.
On Mac OS X, at the very end of the build, macos.sh script in this folder is run.
On Windows, the win32.bat in this folder has to be run manually. At some point, a calling to the script could be integrated in the build process so as to be run automatically, just like it is on Mac OS X (see above).

View file

@ -1053,6 +1053,9 @@ $Id$
* Mac OS X coding and builds
Martin Fuhrer <mfuhrer@users.sourceforge.net>
Darrell Walisser <walisser@mac.com> [retired]
Eric Poncet <http://www.linguasoft.com/>
Harvey Ginter <harveyginter@gmail.com>
Mark K. Kim <mkkim214@gmail.com>
* Maemo (Nokia 770 and N880) coding and builds
Alessandro Pasotti <apasotti@gmail.com>

View file

@ -101,6 +101,11 @@ $Id$
the wrong(lossy) way, the program will crash
(SF.net Bug #210)
* Ports
-----
* Rewrite the build system to be more Linux-like, with no XCode IDE.
Mark K. Kim <mkkim214@gmail.com>
* Other Improvements:
-------------------
* Reformatted source code via GNU Indent tool; should

View file

@ -126,7 +126,7 @@ Loading Tux Paint
Mac OS X Users
Simply double-click the "Tux Paint" icon.
Simply double-click the "TuxPaint.app" icon.
----------------------------------------------------------------------
@ -591,17 +591,17 @@ Available Tools
Printer Settings
(Windows and Mac OS X)
(Windows)
By default, Tux Paint simply prints to the
default printer with default settings when the
'Print' button is pushed.
However, if you hold the [Alt] (or [Option])
key on the keyboard while pushing the button,
as long as you're not in fullscreen mode, your
operating system's printer dialog will appear,
where you can change the settings.
However, if you hold the [Alt] key on the
keyboard while pushing the button, as long as
you're not in fullscreen mode, your operating
system's printer dialog will appear, where you
can change the settings.
You can have the printer configuration changes
stored by using the "printcfg" option, either
@ -743,7 +743,7 @@ Available Tools
Mac OS X
Inside the user's "Library" folder:
"/Users/(user name)/Library/Application
Support/Tux Paint/saved/"
Support/TuxPaint/saved/"
Linux/Unix
Inside a hidden ".tuxpaint" directory, in the user's home

View file

@ -37,6 +37,14 @@ As of this writing, the required libraries are:
Tux Paint.
*** WARNING ***
---------------
Having any UNIX-like toolset installed on your Mac besides MacPorts and
XCode, such as Fink or Brew, will prevent your app bundle from being
portable. Be sure Fink and Brew are not accessible from your build
environment.
HOW TO BUILD
------------
Simply, run:

View file

@ -67,16 +67,15 @@
#include "win32_print.h"
#endif
#ifdef __APPLE__
#include "macos.h"
#endif
#ifdef __HAIKU__
#include <FindDirectory.h>
#include <fs_info.h>
#endif
#ifdef __APPLE__
#include "wrapperdata.h"
extern WrapperData macosx;
#endif
/* system fonts that cause TTF_OpenFont to crash */
static const char *problemFonts[] = {
"/Library/Fonts//AppleMyungjo.ttf",
@ -217,7 +216,7 @@ TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size)
if (!ret)
{
snprintf(str, sizeof(str), "%s/%s.ttf", macosx.fontsPath, lang_prefix);
snprintf(str, sizeof(str), "%s/%s.ttf", macos_fontsPath(), lang_prefix);
ret = TuxPaint_Font_OpenFont("", str, size);
}
#endif
@ -1001,7 +1000,7 @@ static void loadfonts(SDL_Surface * screen, const char *const dir)
#elif defined(__APPLE__)
loadfonts(screen, "/System/Library/Fonts");
loadfonts(screen, "/Library/Fonts");
loadfonts(screen, macosx.fontsPath);
loadfonts(screen, macos_fontsPath());
loadfonts(screen, "/usr/share/fonts");
loadfonts(screen, "/usr/X11R6/lib/X11/fonts");
#elif defined(__sun__)

View file

@ -1108,9 +1108,6 @@ int setup_i18n(const char *restrict lang, const char *restrict locale)
if (lang)
locale = language_to_locale(lang);
#ifdef __APPLE__
patch_i18n(locale); //EP
#endif
return set_current_language(locale);
}

View file

@ -1,6 +1,3 @@
#ifdef __APPLE__
#include "patch.h" //EP
#endif
#include "onscreen_keyboard.h"
//#define DEBUG_OSK_COMPOSEMAP

View file

@ -298,26 +298,10 @@ typedef struct safer_dirent
#else /* __BEOS__ */
/* Not BeOS */
#ifdef __APPLE__
/* Apple */
#include "macosx_print.h"
#include "message.h"
#include "speech.h"
#include "wrapperdata.h"
extern WrapperData macosx;
#else /* __APPLE__ */
/* Not Windows, not BeOS, not Apple */
/* Not Windows, not BeOS */
#include "postscript_print.h"
#endif /* __APPLE__ */
#endif /* __BEOS__ */
#else /* WIN32 */
@ -360,6 +344,10 @@ static void mtw(wchar_t * wtok, char *tok)
#endif /* WIN32 */
#ifdef __APPLE__
#include "macos.h"
#endif
#include <errno.h>
#include <sys/stat.h>
@ -1280,7 +1268,7 @@ enum
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__) && !defined(__HAIKU__)
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__)
#include <paper.h>
#if !defined(PAPER_H)
#error "---------------------------------------------------"
@ -2495,14 +2483,6 @@ static void mainloop(void)
magic_switchin(canvas);
}
#ifdef __APPLE__
else if (key == SDLK_p && (mod & KMOD_CTRL) && (mod & KMOD_SHIFT) && !noshortcuts)
{
/* Ctrl-Shft-P - Page Setup */
if (!disable_print)
DisplayPageSetup(canvas);
}
#endif
else if (key == SDLK_p && (mod & KMOD_CTRL) && !noshortcuts)
{
/* Ctrl-P - Print */
@ -15899,7 +15879,7 @@ void do_print(void)
SDL_BlitSurface(canvas, NULL, save_canvas, NULL);
SDL_BlitSurface(label, NULL, save_canvas, NULL);
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__APPLE__) && !defined(__HAIKU__)
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__)
const char *pcmd;
FILE *pi;
@ -15951,18 +15931,6 @@ void do_print(void)
/* BeOS */
SurfacePrint(save_canvas);
#elif defined(__APPLE__)
/* Mac OS X */
int show = ((want_alt_printcommand || macosx.menuAction) && !fullscreen);
const char *error = SurfacePrint(save_canvas, show);
if (error)
{
fprintf(stderr, "Cannot print: %s\n", error);
do_prompt_snd(error, PROMPT_PRINT_YES, "", SND_TUXOK, 0, 0);
}
#endif
#endif
@ -21531,7 +21499,7 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
/* ================================================================================== */
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__)
static void show_available_papersizes(int exitcode)
{
FILE *fi = exitcode ? stderr : stdout;
@ -21762,7 +21730,7 @@ static void setup_config(char *argv[])
result = find_directory(B_USER_DIRECTORY, volume, false, buffer, sizeof(buffer));
asprintf((char **)&savedir, "%s/%s", buffer, "TuxPaint");
#elif __APPLE__
savedir = strdup(macosx.preferencesPath);
savedir = strdup(macos_preferencesPath());
#else
int tmp;
tmp = asprintf((char **)&savedir, "%s/%s", home, ".tuxpaint");
@ -21784,7 +21752,7 @@ static void setup_config(char *argv[])
strcpy(str, "tuxpaint.cfg");
#elif defined(__APPLE__)
/* Mac OS X: Use a "tuxpaint.cfg" file in the Tux Paint application support folder */
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macosx.preferencesPath);
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macos_preferencesPath());
#else
/* Linux and other Unixes: Use 'rc' style (~/.tuxpaintrc) */
@ -21815,7 +21783,7 @@ static void setup_config(char *argv[])
folder & extension inconsistency with Tux Paint Config application) */
/* Mac OS X: Use a "tuxpaint.cfg" file in the *global* Tux Paint
application support folder */
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macosx.globalPreferencesPath);
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macos_globalPreferencesPath());
parse_file_options(&tmpcfg_sys, str);
#else
/* normally /etc/tuxpaint/tuxpaint.conf */
@ -22277,10 +22245,11 @@ static void chdir_to_binary(char *argv0)
char *slash = strrchr(app_path, '/');
#if defined(__APPLE__)
/* EP added to fix 10.9 issue of current directory set by Finder
to something else than folder where app bundle resides */
/* typical path of app's binary on Mac OS : /Applications/Tux Paint.app/Contents/MacOS/Tux Paint */
int levels = 3; /* we need to back up 3 levels */
// On macOS, execution is deep inside the app bundle.
// E.g., "/Applications/TuxPaint.app/Contents/MacOS/tuxpaint"
// But we want to point somewhere higher up, say to "Contents", so we can access
// the resources in Resources folder. So move up one level.
int levels = 1; /* we need to back up 1 level */
while ((levels-- > 0) && (slash))
{