From 4cabed88a6888a93dcd0715219a31fdbc658feee Mon Sep 17 00:00:00 2001 From: "Mark K. Kim" Date: Sun, 25 May 2008 02:30:45 +0000 Subject: [PATCH] Improved support for detecting missing dependencies: - Added libpaper-dev package checking. - Previously, SDL_Pango's bug forced Tux Paint to include a customized version of SDL_Pango.h in its distribution, so we couldn't tell if SDL_Pango was installed in the system by including SDL_Pango.h. We made a new workaround for SDL_Pango's bug that does not require Tux Paint to include SDL_Pango.h, so now we can check for SDL_Pango installation. - Makefile now includes a check for gettext installation and will not fail when attempting to generate .mo files or install .mo files. Instead, Makefile will now display a warning and skip the .mo file generation and installation steps. Many thanks to Arunodai Vudem for the patches. --- Makefile | 25 +++++++ docs/CHANGES.txt | 12 ++++ src/SDL_Pango.h | 168 ----------------------------------------------- src/dirwalk.c | 20 ++++++ src/fonts.c | 19 ++++++ src/tuxpaint.c | 11 +++- 6 files changed, 85 insertions(+), 170 deletions(-) delete mode 100644 src/SDL_Pango.h diff --git a/Makefile b/Makefile index 6583daadf..e10215b41 100644 --- a/Makefile +++ b/Makefile @@ -387,8 +387,24 @@ uninstall-i18n: # Install the translated text: +# We can install *.mo files if they were already generated, or if it can be +# generated from the *.po files. The *.mo files can be generated from the +# *.po files if we have the converter program, msgfmt, installed in the +# system. So we test for both and install them if either case is found +# to be true. If neither case is found to be true, we'll just install +# Tux Paint without the translation files. .PHONY: install-gettext +ifeq "$(wildcard trans/*.mo)$(shell msgfmt -h)" "" +install-gettext: + @echo + @echo "--------------------------------------------------------------" + @echo "Cannot install translation files because no translation files" + @echo "were found (trans/*.mo) and the 'msgfmt' program is not installed." + @echo "You will not be able to run Tux Paint in non-U.S. English modes." + @echo "--------------------------------------------------------------" +else install-gettext: $(INSTALLED_MOFILES) +endif # Install the Input Method files: @@ -428,7 +444,16 @@ $(MOFILES): trans/%.mo: src/po/%.po msgfmt -o $@ $< .PHONY: translations +ifeq "$(shell msgfmt -h)" "" +translations: trans + @echo "--------------------------------------------------------------" + @echo "Cannot find program 'msgfmt'!" + @echo "No translation files will be prepared." + @echo "Install gettext to run Tux Paint in non-U.S. English modes." + @echo "--------------------------------------------------------------" +else translations: trans $(MOFILES) +endif trans: @echo diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 903b8f323..8f0a38cbb 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -64,6 +64,11 @@ $Id$ * Makefile improvements. Albert Cahalan + * Makefile edited so that tuxpaint can be installed in the absence + of gettext in the system. + Arunodai Vudem + Mark K. Kim + * Making Magic Tool source throw less compiler warnings. * Documentation Improvements: @@ -101,6 +106,13 @@ $Id$ * "Ojibwe" is the proper spelling of the language, accepting that as a "--lang" option, too. + * The variables not declared as extern in SDL_Pango.h have been + renamed in dirwalk.c and fonts.c. SDL_Pango.h no longer needs to be + shipped along with tuxpaint code. Inclusion error message has been added + for missing libpaper. + Arunodai Vudem + Mark K. Kim + * New Starters: ------------- * Spirograph diff --git a/src/SDL_Pango.h b/src/SDL_Pango.h deleted file mode 100644 index 18d215cb4..000000000 --- a/src/SDL_Pango.h +++ /dev/null @@ -1,168 +0,0 @@ -/* SDL_Pango.h -- A companion library to SDL for working with Pango. - Copyright (C) 2004 NAKAMURA Ken'ichi - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -/*! @file - @brief Header file of SDL_Pango - - @author NAKAMURA Ken'ichi - @date 2004/08/26 - $Revision$ -*/ - -#ifndef SDL_PANGO_H -#define SDL_PANGO_H - -#include "SDL.h" - -#include "begin_code.h" - -#ifdef __cplusplus -extern "C" { -#endif - - - -typedef struct _contextImpl SDLPango_Context; - -/*! - General 4 X 4 matrix struct. -*/ -typedef struct _SDLPango_Matrix { - Uint8 m[4][4]; /*! Matrix variables */ -} SDLPango_Matrix; - - -/*! - Specifies direction of text. See Pango reference for detail -*/ -typedef enum { - SDLPANGO_DIRECTION_LTR, /*! Left to right */ - SDLPANGO_DIRECTION_RTL, /*! Right to left */ - SDLPANGO_DIRECTION_WEAK_LTR, /*! Left to right (weak) */ - SDLPANGO_DIRECTION_WEAK_RTL, /*! Right to left (weak) */ - SDLPANGO_DIRECTION_NEUTRAL /*! Neutral */ -} SDLPango_Direction; - -/*! - Specifies alignment of text. See Pango reference for detail -*/ -typedef enum { - SDLPANGO_ALIGN_LEFT, - SDLPANGO_ALIGN_CENTER, - SDLPANGO_ALIGN_RIGHT -} SDLPango_Alignment; - -extern DECLSPEC int SDLCALL SDLPango_Init(void); - -extern DECLSPEC int SDLCALL SDLPango_WasInit(void); - -extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext_GivenFontDesc(const char* font_desc); -extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext(void); - -extern DECLSPEC void SDLCALL SDLPango_FreeContext( - SDLPango_Context *context); - -extern DECLSPEC void SDLCALL SDLPango_SetSurfaceCreateArgs( - SDLPango_Context *context, - Uint32 flags, - int depth, - Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); - -extern DECLSPEC SDL_Surface * SDLCALL SDLPango_CreateSurfaceDraw( - SDLPango_Context *context); - -extern DECLSPEC void SDLCALL SDLPango_Draw( - SDLPango_Context *context, - SDL_Surface *surface, - int x, int y); - -extern DECLSPEC void SDLCALL SDLPango_SetDpi( - SDLPango_Context *context, - double dpi_x, double dpi_y); - -extern DECLSPEC void SDLCALL SDLPango_SetMinimumSize( - SDLPango_Context *context, - int width, int height); - -extern DECLSPEC void SDLCALL SDLPango_SetDefaultColor( - SDLPango_Context *context, - const SDLPango_Matrix *color_matrix); - -extern DECLSPEC int SDLCALL SDLPango_GetLayoutWidth( - SDLPango_Context *context); - -extern DECLSPEC int SDLCALL SDLPango_GetLayoutHeight( - SDLPango_Context *context); - -extern DECLSPEC void SDLCALL SDLPango_SetMarkup( - SDLPango_Context *context, - const char *markup, - int length); - -extern DECLSPEC void SDLCALL SDLPango_SetText_GivenAlignment( - SDLPango_Context *context, - const char *text, - int length, - SDLPango_Alignment alignment); - -extern DECLSPEC void SDLCALL SDLPango_SetText( - SDLPango_Context *context, - const char *markup, - int length); - -extern DECLSPEC void SDLCALL SDLPango_SetLanguage( - SDLPango_Context *context, - const char *language_tag); - -extern DECLSPEC void SDLCALL SDLPango_SetBaseDirection( - SDLPango_Context *context, - SDLPango_Direction direction); - - -#ifdef __FT2_BUILD_UNIX_H__ - -extern DECLSPEC void SDLCALL SDLPango_CopyFTBitmapToSurface( - const FT_Bitmap *bitmap, - SDL_Surface *surface, - const SDLPango_Matrix *matrix, - SDL_Rect *rect); - -#endif /* __FT2_BUILD_UNIX_H__ */ - - -#ifdef __PANGO_H__ - -extern DECLSPEC PangoFontMap* SDLCALL SDLPango_GetPangoFontMap( - SDLPango_Context *context); - -extern DECLSPEC PangoFontDescription* SDLCALL SDLPango_GetPangoFontDescription( - SDLPango_Context *context); - -extern DECLSPEC PangoLayout* SDLCALL SDLPango_GetPangoLayout( - SDLPango_Context *context); - -#endif /* __PANGO_H__ */ - - -#ifdef __cplusplus -} -#endif - -#include "close_code.h" - -#endif /* SDL_PANGO_H */ diff --git a/src/dirwalk.c b/src/dirwalk.c index 13151312d..6c5f89d29 100644 --- a/src/dirwalk.c +++ b/src/dirwalk.c @@ -19,6 +19,26 @@ #include "dirwalk.h" #include "progressbar.h" + +/* + The following section renames global variables defined in SDL_Pango.h to avoid errors during linking. + It is okay to rename these variables because they are constants. + SDL_Pang.h is included by fonts.h. +*/ +#define _MATRIX_WHITE_BACK _MATRIX_WHITE_BACK1 +#define MATRIX_WHITE_BACK MATRIX_WHITE_BACK1 +#define _MATRIX_BLACK_BACK _MATRIX_BLACK_BACK1 +#define MATRIX_BLACK_BACK MATRIX_BLACK_BACK1 +#define _MATRIX_TRANSPARENT_BACK_BLACK_LETTER _MATRIX_TRANSPARENT_BACK_BLACK_LETTER1 +#define MATRIX_TRANSPARENT_BACK_BLACK_LETTER MATRIX_TRANSPARENT_BACK_BLACK_LETTER1 +#define _MATRIX_TRANSPARENT_BACK_WHITE_LETTER _MATRIX_TRANSPARENT_BACK_WHITE_LETTER1 +#define MATRIX_TRANSPARENT_BACK_WHITE_LETTER MATRIX_TRANSPARENT_BACK_WHITE_LETTER1 +#define _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER1 +#define MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER1 +/* + The renaming ends here. +*/ + #include "fonts.h" #include "debug.h" diff --git a/src/fonts.c b/src/fonts.c index 7ca5e10dc..5a553abf0 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -17,6 +17,25 @@ #define gettext_noop(String) String #endif +/* + The following section renames global variables defined in SDL_Pango.h to avoid errors during linking. + It is okay to rename these variables because they are constants. + SDL_Pang.h is included by fonts.h. +*/ +#define _MATRIX_WHITE_BACK _MATRIX_WHITE_BACK2 +#define MATRIX_WHITE_BACK MATRIX_WHITE_BACK2 +#define _MATRIX_BLACK_BACK _MATRIX_BLACK_BACK2 +#define MATRIX_BLACK_BACK MATRIX_BLACK_BACK2 +#define _MATRIX_TRANSPARENT_BACK_BLACK_LETTER _MATRIX_TRANSPARENT_BACK_BLACK_LETTER2 +#define MATRIX_TRANSPARENT_BACK_BLACK_LETTER MATRIX_TRANSPARENT_BACK_BLACK_LETTER2 +#define _MATRIX_TRANSPARENT_BACK_WHITE_LETTER _MATRIX_TRANSPARENT_BACK_WHITE_LETTER2 +#define MATRIX_TRANSPARENT_BACK_WHITE_LETTER MATRIX_TRANSPARENT_BACK_WHITE_LETTER2 +#define _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER2 +#define MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER2 +/* + The renaming ends here. +*/ + #include "fonts.h" #include "i18n.h" #include "progressbar.h" diff --git a/src/tuxpaint.c b/src/tuxpaint.c index a601e058f..1836b2081 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -339,7 +339,7 @@ extern WrapperData macosx; #error "---------------------------------------------------" #endif -/* + #ifndef NO_SDLPANGO #include "SDL_Pango.h" @@ -352,7 +352,7 @@ extern WrapperData macosx; #endif #endif -*/ + #ifndef NOSOUND #include "SDL_mixer.h" @@ -919,6 +919,13 @@ magic_api *magic_api_struct; // Pointer to our internal functions; passed to sha #if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) #include +#if !defined(PAPER_H) +#error "---------------------------------------------------" +#error "If you installed libpaper from a package, be sure" +#error "to get the development package, as well!" +#error "(eg., 'libpaper-dev_1.1.21.deb')" +#error "---------------------------------------------------" +#endif static const char *printcommand = PRINTCOMMAND; static const char *altprintcommand = ALTPRINTCOMMAND; char *papersize = NULL;