unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#38925] [PATCH] Add Tuxmath
@ 2020-01-04 19:45 Nicolas Goaziou
  2020-01-05  0:52 ` Nicolas Goaziou
  2020-02-02 14:28 ` bug#38925: " Nicolas Goaziou
  0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2020-01-04 19:45 UTC (permalink / raw)
  To: 38925

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

Hello,

The following set of patches add Tuxmath. Unfortunately, my keyboard
doesn't respond when playing the game, but leoprikler on #guix reported
it was working fine there. I guess I'm out of luck.

Anyway, here are the patches.

Regards,

-- 
Nicolas Goaziou

[-- Attachment #2: 0001-gnu-Add-sdl-pango.patch --]
[-- Type: text/x-diff, Size: 18818 bytes --]

From a0d54545e463931227c70ebc858f28b2f2a0de13 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date: Fri, 3 Jan 2020 17:20:27 +0100
Subject: [PATCH 1/3] gnu: Add sdl-pango.

* gnu/packages/sdl.scm (sdl-pango): New variable.
* gnu/packages/patches/sdl-pango-api_additions.patch: New file.
* gnu/packages/patches/sdl-pango-blit_overflow.patch: New file.
* gnu/packages/patches/sdl-pango-fillrect_crash.patch: New file.
* gnu/packages/patches/sdl-pango-fix-explicit-SDLPango_CopyFTBitmapToSurface.patch:
New file.
* gnu/packages/patches/sdl-pango-matrix_declarations.patch: New file.
* gnu/packages/patches/sdl-pango-sans-serif.patch: New file.
* gnu/local.mk (sdl-pango): Reference patches.

add
---
 gnu/local.mk                                  |   6 +
 .../patches/sdl-pango-api_additions.patch     | 128 +++++++++++++++++
 .../patches/sdl-pango-blit_overflow.patch     |  32 +++++
 .../patches/sdl-pango-fillrect_crash.patch    |  15 ++
 ...licit-SDLPango_CopyFTBitmapToSurface.patch |  20 +++
 .../sdl-pango-matrix_declarations.patch       | 131 ++++++++++++++++++
 .../patches/sdl-pango-sans-serif.patch        |  13 ++
 gnu/packages/sdl.scm                          |  52 ++++++-
 8 files changed, 396 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/sdl-pango-api_additions.patch
 create mode 100644 gnu/packages/patches/sdl-pango-blit_overflow.patch
 create mode 100644 gnu/packages/patches/sdl-pango-fillrect_crash.patch
 create mode 100644 gnu/packages/patches/sdl-pango-fix-explicit-SDLPango_CopyFTBitmapToSurface.patch
 create mode 100644 gnu/packages/patches/sdl-pango-matrix_declarations.patch
 create mode 100644 gnu/packages/patches/sdl-pango-sans-serif.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c7dcc65082..2cfeee7b6b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1245,6 +1245,12 @@ dist_patch_DATA =						\
   %D%/packages/patches/p7zip-CVE-2017-17969.patch		\
   %D%/packages/patches/p7zip-remove-unused-code.patch		\
   %D%/packages/patches/pam-mount-luks2-support.patch		\
+  %D%/packages/patches/sdl-pango-api_additions.patch		\
+  %D%/packages/patches/sdl-pango-blit_overflow.patch		\
+  %D%/packages/patches/sdl-pango-fillrect_crash.patch		\
+  %D%/packages/patches/sdl-pango-fix-explicit-SDLPango_CopyFTBitmapToSurface.patch	\
+  %D%/packages/patches/sdl-pango-matrix_declarations.patch	\
+  %D%/packages/patches/sdl-pango-sans-serif.patch		\
   %D%/packages/patches/patchutils-test-perms.patch		\
   %D%/packages/patches/patch-hurd-path-max.patch		\
   %D%/packages/patches/pcre2-fix-jit_match-crash.patch		\
diff --git a/gnu/packages/patches/sdl-pango-api_additions.patch b/gnu/packages/patches/sdl-pango-api_additions.patch
new file mode 100644
index 0000000000..5c02e79910
--- /dev/null
+++ b/gnu/packages/patches/sdl-pango-api_additions.patch
@@ -0,0 +1,128 @@
+Index: SDL_Pango-0.1.2/src/SDL_Pango.c
+===================================================================
+--- SDL_Pango-0.1.2.orig/src/SDL_Pango.c	2004-12-10 10:06:33.000000000 +0100
++++ SDL_Pango-0.1.2/src/SDL_Pango.c	2007-09-18 14:56:35.362379428 +0200
+@@ -723,13 +723,9 @@
+     SDL_UnlockSurface(surface);
+ }
+ 
+-/*!
+-    Create a context which contains Pango objects.
+ 
+-    @return A pointer to the context as a SDLPango_Context*.
+-*/
+ SDLPango_Context*
+-SDLPango_CreateContext()
++SDLPango_CreateContext_GivenFontDesc(const char* font_desc)
+ {
+     SDLPango_Context *context = g_malloc(sizeof(SDLPango_Context));
+     G_CONST_RETURN char *charset;
+@@ -743,8 +739,7 @@
+     pango_context_set_language (context->context, pango_language_from_string (charset));
+     pango_context_set_base_dir (context->context, PANGO_DIRECTION_LTR);
+ 
+-    context->font_desc = pango_font_description_from_string(
+-	MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
++    context->font_desc = pango_font_description_from_string(font_desc);
+ 
+     context->layout = pango_layout_new (context->context);
+ 
+@@ -762,6 +757,17 @@
+ }
+ 
+ /*!
++    Create a context which contains Pango objects.
++
++    @return A pointer to the context as a SDLPango_Context*.
++*/
++SDLPango_Context*
++SDLPango_CreateContext()
++{
++    SDLPango_CreateContext_GivenFontDesc(MAKE_FONT_NAME(DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
++}
++
++/*!
+     Free a context.
+ 
+     @param *context [i/o] Context to be free
+@@ -1053,6 +1059,20 @@
+     pango_layout_set_font_description (context->layout, context->font_desc);
+ }
+ 
++void
++SDLPango_SetText_GivenAlignment(
++    SDLPango_Context *context,
++    const char *text,
++    int length,
++    SDLPango_Alignment alignment)
++{
++    pango_layout_set_attributes(context->layout, NULL);
++    pango_layout_set_text (context->layout, text, length);
++    pango_layout_set_auto_dir (context->layout, TRUE);
++    pango_layout_set_alignment (context->layout, alignment);
++    pango_layout_set_font_description (context->layout, context->font_desc);
++}
++
+ /*!
+     Set plain text to context.
+     Text must be utf-8.
+@@ -1067,11 +1087,7 @@
+     const char *text,
+     int length)
+ {
+-    pango_layout_set_attributes(context->layout, NULL);
+-    pango_layout_set_text (context->layout, text, length);
+-    pango_layout_set_auto_dir (context->layout, TRUE);
+-    pango_layout_set_alignment (context->layout, PANGO_ALIGN_LEFT);
+-    pango_layout_set_font_description (context->layout, context->font_desc);
++    SDLPango_SetText_GivenAlignment(context, text, length, SDLPANGO_ALIGN_LEFT);
+ }
+ 
+ /*!
+Index: SDL_Pango-0.1.2/src/SDL_Pango.h
+===================================================================
+--- SDL_Pango-0.1.2.orig/src/SDL_Pango.h	2004-12-10 10:06:33.000000000 +0100
++++ SDL_Pango-0.1.2/src/SDL_Pango.h	2007-09-18 15:00:41.736419485 +0200
+@@ -26,6 +26,7 @@
+ 
+ #ifndef SDL_PANGO_H
+ #define SDL_PANGO_H
++#define SDL_PANGO_HAS_GC_EXTENSIONS
+ 
+ #include "SDL.h"
+ 
+@@ -109,12 +110,20 @@
+     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();
+ 
+ extern DECLSPEC int SDLCALL SDLPango_WasInit();
+ 
++extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext_GivenFontDesc(const char* font_desc);
+ extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext();
+ 
+ extern DECLSPEC void SDLCALL SDLPango_FreeContext(
+@@ -157,6 +166,12 @@
+     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,
diff --git a/gnu/packages/patches/sdl-pango-blit_overflow.patch b/gnu/packages/patches/sdl-pango-blit_overflow.patch
new file mode 100644
index 0000000000..411d066a74
--- /dev/null
+++ b/gnu/packages/patches/sdl-pango-blit_overflow.patch
@@ -0,0 +1,32 @@
+Index: sdlpango-0.1.2/src/SDL_Pango.c
+===================================================================
+--- sdlpango-0.1.2.orig/src/SDL_Pango.c	2007-10-08 19:44:15.000000000 +0000
++++ sdlpango-0.1.2/src/SDL_Pango.c	2007-10-08 19:45:27.000000000 +0000
+@@ -725,16 +725,23 @@
+     int x = rect->x;
+     int y = rect->y;
+ 
++    if(x < 0) {
++	width += x; x = 0;
++    }
+     if(x + width > surface->w) {
+ 	width = surface->w - x;
+-	if(width <= 0)
+-	    return;
++    }
++    if(width <= 0)
++	return;
++
++    if(y < 0) {
++	height += y; y = 0;
+     }
+     if(y + height > surface->h) {
+ 	height = surface->h - y;
+-	if(height <= 0)
+-	    return;
+     }
++    if(height <= 0)
++	return;
+ 
+     if(SDL_LockSurface(surface)) {
+ 	SDL_SetError("surface lock failed");
diff --git a/gnu/packages/patches/sdl-pango-fillrect_crash.patch b/gnu/packages/patches/sdl-pango-fillrect_crash.patch
new file mode 100644
index 0000000000..7a41bbf2fe
--- /dev/null
+++ b/gnu/packages/patches/sdl-pango-fillrect_crash.patch
@@ -0,0 +1,15 @@
+Index: SDL_Pango-0.1.2/src/SDL_Pango.c
+===================================================================
+--- SDL_Pango-0.1.2.orig/src/SDL_Pango.c	2007-09-18 15:56:12.406223540 +0200
++++ SDL_Pango-0.1.2/src/SDL_Pango.c	2007-09-18 15:57:27.986530616 +0200
+@@ -932,7 +932,9 @@
+     width = PANGO_PIXELS (logical_rect.width);
+     height = PANGO_PIXELS (logical_rect.height);
+ 
+-    SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 0, 0, 0, 0));
++    if (width && height) {
++        SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 0, 0, 0, 0));
++    }
+ 
+     if((! context->tmp_ftbitmap) || context->tmp_ftbitmap->width < width
+ 	|| context->tmp_ftbitmap->rows < height)
diff --git a/gnu/packages/patches/sdl-pango-fix-explicit-SDLPango_CopyFTBitmapToSurface.patch b/gnu/packages/patches/sdl-pango-fix-explicit-SDLPango_CopyFTBitmapToSurface.patch
new file mode 100644
index 0000000000..3d4b10cc10
--- /dev/null
+++ b/gnu/packages/patches/sdl-pango-fix-explicit-SDLPango_CopyFTBitmapToSurface.patch
@@ -0,0 +1,20 @@
+--- a/src/SDL_Pango.h
++++ b/src/SDL_Pango.h
+@@ -171,7 +171,7 @@
+     SDLPango_Direction direction);
+ 
+ 
+-#ifdef __FT2_BUILD_UNIX_H__
++#ifdef FT2BUILD_H_
+ 
+ extern DECLSPEC void SDLCALL SDLPango_CopyFTBitmapToSurface(
+     const FT_Bitmap *bitmap,
+@@ -179,7 +179,7 @@
+     const SDLPango_Matrix *matrix,
+     SDL_Rect *rect);
+ 
+-#endif	/* __FT2_BUILD_UNIX_H__ */
++#endif
+ 
+ 
+ #ifdef __PANGO_H__
diff --git a/gnu/packages/patches/sdl-pango-matrix_declarations.patch b/gnu/packages/patches/sdl-pango-matrix_declarations.patch
new file mode 100644
index 0000000000..c35d0a708d
--- /dev/null
+++ b/gnu/packages/patches/sdl-pango-matrix_declarations.patch
@@ -0,0 +1,131 @@
+Index: SDL_Pango-0.1.2/src/SDL_Pango.c
+===================================================================
+--- SDL_Pango-0.1.2.orig/src/SDL_Pango.c	2007-09-18 15:03:10.732910311 +0200
++++ SDL_Pango-0.1.2/src/SDL_Pango.c	2007-09-18 15:04:41.970109622 +0200
+@@ -286,6 +286,59 @@
+ } contextImpl;
+ 
+ 
++const SDLPango_Matrix _MATRIX_WHITE_BACK
++    = {255, 0, 0, 0,
++       255, 0, 0, 0,
++       255, 0, 0, 0,
++       255, 255, 0, 0,};
++
++/*!
++    Specifies white back and black letter.
++*/
++const SDLPango_Matrix *MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK;
++
++const SDLPango_Matrix _MATRIX_BLACK_BACK
++    = {0, 255, 0, 0,
++       0, 255, 0, 0,
++       0, 255, 0, 0,
++       255, 255, 0, 0,};
++/*!
++    Specifies black back and white letter.
++*/
++const SDLPango_Matrix *MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK;
++
++const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
++    = {0, 0, 0, 0,
++       0, 0, 0, 0,
++       0, 0, 0, 0,
++       0, 255, 0, 0,};
++/*!
++    Specifies transparent back and black letter.
++*/
++const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER = &_MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
++
++const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
++    = {255, 255, 0, 0,
++       255, 255, 0, 0,
++       255, 255, 0, 0,
++       0, 255, 0, 0,};
++/*!
++    Specifies transparent back and white letter.
++*/
++const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER = &_MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
++
++const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
++    = {255, 255, 0, 0,
++       255, 255, 0, 0,
++       255, 255, 0, 0,
++       0, 0, 0, 0,};
++/*!
++    Specifies transparent back and transparent letter.
++    This is useful for KARAOKE like rendering.
++*/
++const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = &_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
++
++
+ /*!
+     Initialize the Glib and Pango API.
+     This must be called before using other functions in this library,
+Index: SDL_Pango-0.1.2/src/SDL_Pango.h
+===================================================================
+--- SDL_Pango-0.1.2.orig/src/SDL_Pango.h	2007-09-18 15:03:10.732910311 +0200
++++ SDL_Pango-0.1.2/src/SDL_Pango.h	2007-09-18 15:06:24.919976401 +0200
+@@ -47,57 +47,27 @@
+     Uint8 m[4][4];  /*! Matrix variables */
+ } SDLPango_Matrix;
+ 
+-const SDLPango_Matrix _MATRIX_WHITE_BACK
+-    = {255, 0, 0, 0,
+-       255, 0, 0, 0,
+-       255, 0, 0, 0,
+-       255, 255, 0, 0,};
+-
+ /*!
+     Specifies white back and black letter.
+ */
+-const SDLPango_Matrix *MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK;
+-
+-const SDLPango_Matrix _MATRIX_BLACK_BACK
+-    = {0, 255, 0, 0,
+-       0, 255, 0, 0,
+-       0, 255, 0, 0,
+-       255, 255, 0, 0,};
++extern const SDLPango_Matrix *MATRIX_WHITE_BACK;
+ /*!
+     Specifies black back and white letter.
+ */
+-const SDLPango_Matrix *MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK;
+-
+-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
+-    = {0, 0, 0, 0,
+-       0, 0, 0, 0,
+-       0, 0, 0, 0,
+-       0, 255, 0, 0,};
++extern const SDLPango_Matrix *MATRIX_BLACK_BACK;
+ /*!
+     Specifies transparent back and black letter.
+ */
+-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER = &_MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
+-
+-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
+-    = {255, 255, 0, 0,
+-       255, 255, 0, 0,
+-       255, 255, 0, 0,
+-       0, 255, 0, 0,};
++extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
+ /*!
+     Specifies transparent back and white letter.
+ */
+-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER = &_MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
+-
+-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
+-    = {255, 255, 0, 0,
+-       255, 255, 0, 0,
+-       255, 255, 0, 0,
+-       0, 0, 0, 0,};
++extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
+ /*!
+     Specifies transparent back and transparent letter.
+     This is useful for KARAOKE like rendering.
+ */
+-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = &_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
++extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
+ 
+ /*!
+     Specifies direction of text. See Pango reference for detail
diff --git a/gnu/packages/patches/sdl-pango-sans-serif.patch b/gnu/packages/patches/sdl-pango-sans-serif.patch
new file mode 100644
index 0000000000..ccdc8150a7
--- /dev/null
+++ b/gnu/packages/patches/sdl-pango-sans-serif.patch
@@ -0,0 +1,13 @@
+Index: SDL_Pango-0.1.2/src/SDL_Pango.c
+===================================================================
+--- SDL_Pango-0.1.2.orig/src/SDL_Pango.c	2007-09-18 15:12:20.736253215 +0200
++++ SDL_Pango-0.1.2/src/SDL_Pango.c	2007-09-18 15:12:44.621614364 +0200
+@@ -234,7 +234,7 @@
+ //! non-zero if initialized
+ static int IS_INITIALIZED = 0;
+ 
+-#define DEFAULT_FONT_FAMILY "Sans"
++#define DEFAULT_FONT_FAMILY "sans-serif"
+ #define DEFAULT_FONT_SIZE 12
+ #define DEFAULT_DPI 96
+ #define _MAKE_FONT_NAME(family, size) family " " #size
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index f7a34003d1..930da592e3 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -8,7 +8,7 @@
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
-;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;;
@@ -40,10 +40,12 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages audio)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages fcitx)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages ibus)
   #:use-module (gnu packages image)
@@ -308,6 +310,54 @@ SDL.")
     (home-page "https://www.libsdl.org/projects/SDL_net/")
     (license zlib)))
 
+(define-public sdl-pango
+  (package
+    (name "sdl-pango")
+    (version "0.1.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://sourceforge/sdlpango/SDL_Pango/" version "/"
+             "SDL_Pango-" version  ".tar.gz"))
+       (sha256
+        (base32 "197baw1dsg0p4pljs5k0fshbyki00r4l49m1drlpqw6ggawx6xbz"))
+       (patches
+        (search-patches
+         "sdl-pango-api_additions.patch"
+         "sdl-pango-blit_overflow.patch"
+         "sdl-pango-fillrect_crash.patch"
+         "sdl-pango-fix-explicit-SDLPango_CopyFTBitmapToSurface.patch"
+         "sdl-pango-matrix_declarations.patch"
+         "sdl-pango-sans-serif.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags (list "--disable-static")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'autogen
+           ;; Force reconfiguration because the included libtool
+           ;; generates linking errors.
+           (lambda _ (invoke "autoreconf" "-vif"))))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("glib" ,glib)
+       ("harfbuzz" ,harfbuzz)
+       ("pango" ,pango)
+       ("sdl" ,sdl)))
+    (home-page "http://sdlpango.sourceforge.net")
+    (synopsis "Pango SDL binding")
+    (description "This library is a wrapper around the Pango library.
+It allows you to use TrueType fonts to render internationalized and
+tagged text in SDL applications.")
+    (license lgpl2.1)))
+
 (define-public sdl-ttf
   (package
     (name "sdl-ttf")
-- 
2.24.1


[-- Attachment #3: 0002-gnu-Add-t4k-common.patch --]
[-- Type: text/x-diff, Size: 3500 bytes --]

From 7544109175a91b911f636475f077dda1c9a6f22c Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date: Fri, 3 Jan 2020 17:24:22 +0100
Subject: [PATCH 2/3] gnu: Add t4k-common.

* gnu/packages/education.scm (t4k-common): New variable.
---
 gnu/packages/education.scm | 49 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/education.scm b/gnu/packages/education.scm
index ecb8678b02..190d3a54eb 100644
--- a/gnu/packages/education.scm
+++ b/gnu/packages/education.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018, 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -36,6 +36,7 @@
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages image)
   #:use-module (gnu packages javascript)
   #:use-module (gnu packages kde)
   #:use-module (gnu packages kde-frameworks) ; extra-cmake-modules
@@ -612,3 +613,49 @@ each key.  A collection of lessons are included for a wide range of different
 languages and keyboard layouts, and typing statistics are used to dynamically
 adjust the level of difficulty.")
     (license license:gpl2)))
+
+(define-public t4k-common
+  (package
+    (name "t4k-common")
+    (version "0.1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/tux4kids/t4kcommon")
+             (commit (string-append "upstream/" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "13q02xpmps9qg8zrzzy2gzv4a6afgi28lxk4z242j780v0gphchp"))
+       (patches
+        (search-patches "t4k-common-libpng16.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f                      ;FIXME: cannot find how to run tests
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'set-paths 'set-sdl-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "CPATH" (string-append (assoc-ref inputs "sdl")
+                                            "/include/SDL:"
+                                            (or (getenv "CPATH") "")))))
+         (add-after 'unpack 'fix-andika-font-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "src/t4k_sdl.c"
+               (("(/usr/share/.*?)/AndikaDesRevG\\.ttf")
+                (string-append (assoc-ref inputs "font-andika")
+                               "/share/fonts/truetype")))
+             #t)))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("font-andika" ,font-sil-andika)
+       ("libpng" ,libpng)
+       ("librsvg" ,librsvg)
+       ("libxml2" ,libxml2)
+       ("sdl" ,(sdl-union (list sdl sdl-image sdl-mixer sdl-net sdl-pango)))))
+    (home-page "https://github.com/tux4kids/t4kcommon")
+    (synopsis "Library of code shared between TuxMath and TuxType")
+    (description "Tux4Kids-Common is a library of code shared between
+TuxMath and TuxType.")
+    (license license:gpl3+)))
-- 
2.24.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-Add-tuxmath.patch --]
[-- Type: text/x-diff, Size: 3278 bytes --]

From b9aac45a35b8314466a260da1cd58a2b5739aa8b Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date: Fri, 3 Jan 2020 17:26:15 +0100
Subject: [PATCH 3/3] gnu: Add tuxmath.

* gnu/packages/education.scm (tuxmath): New variable.
---
 gnu/packages/education.scm | 61 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/gnu/packages/education.scm b/gnu/packages/education.scm
index 190d3a54eb..8c68418d86 100644
--- a/gnu/packages/education.scm
+++ b/gnu/packages/education.scm
@@ -659,3 +659,64 @@ adjust the level of difficulty.")
     (description "Tux4Kids-Common is a library of code shared between
 TuxMath and TuxType.")
     (license license:gpl3+)))
+
+(define-public tuxmath
+  (package
+    (name "tuxmath")
+    (version "2.0.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/tux4kids/tuxmath")
+             (commit (string-append "upstream/" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1f1pz83w6d3mbik2h6xavfxmk5apxlngxbkh80x0m55lhniwkdxv"))
+       (modules '((guix build utils)))
+       ;; Unbundle fonts.
+       (snippet
+        `(begin
+           (for-each delete-file (find-files "data/fonts" "\\.ttf$"))
+           #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ;no test
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'set-paths 'set-sdl-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "CPATH"
+                     (string-append (assoc-ref inputs "sdl")
+                                    "/include/SDL:"
+                                    (or (getenv "CPATH") "")))))
+         (add-after 'install 'install-desktop-file
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (apps (string-append out "/share/applications"))
+                    (pixmaps (string-append out "/share/pixmaps")))
+               (install-file "tuxmath.desktop" apps)
+               (for-each (lambda (f) (install-file f pixmaps))
+                         (find-files "data/images/icons/"
+                                     "tuxmath\\.(png|ico|svg)$"))
+               #t))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("librsvg" ,librsvg)
+       ("libxml2" ,libxml2)
+       ("sdl" ,(sdl-union (list sdl sdl-image sdl-mixer sdl-net sdl-pango)))
+       ("t4k-common" ,t4k-common)))
+    (home-page "https://github.com/tux4kids/tuxmath")
+    (synopsis "Educational math tutorial game")
+    (description "@emph{Tux, of Math Command} is an educational math
+tutorial game starring Tux, the Linux penguin, in which you play the
+part of Commander Tux, as he defends his friends from an attack of
+math equations.  Comets are crashing towards the friendly penguins in
+their igloos, and you must destroy the comets by solving their
+equations.
+
+TuxMath also includes Factoroids, a game that gives practice in
+factoring numbers and simplifying fractions, as well as zapping rocks
+floating through space.")
+    (license license:gpl3+)))
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#38925] [PATCH] Add Tuxmath
  2020-01-04 19:45 [bug#38925] [PATCH] Add Tuxmath Nicolas Goaziou
@ 2020-01-05  0:52 ` Nicolas Goaziou
  2020-02-02 14:28 ` bug#38925: " Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2020-01-05  0:52 UTC (permalink / raw)
  To: 38925

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> +(define-public tuxmath
> +  (package
> +    (name "tuxmath")
> +    (version "2.0.3")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/tux4kids/tuxmath")
> +             (commit (string-append "upstream/" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "1f1pz83w6d3mbik2h6xavfxmk5apxlngxbkh80x0m55lhniwkdxv"))
> +       (modules '((guix build utils)))
> +       ;; Unbundle fonts.
> +       (snippet
> +        `(begin
> +           (for-each delete-file (find-files "data/fonts" "\\.ttf$"))
> +           #t))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:tests? #f                      ;no test
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'set-paths 'set-sdl-paths
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (setenv "CPATH"
> +                     (string-append (assoc-ref inputs "sdl")
> +                                    "/include/SDL:"
> +                                    (or (getenv "CPATH") "")))))

Added missing #t here.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#38925: [PATCH] Add Tuxmath
  2020-01-04 19:45 [bug#38925] [PATCH] Add Tuxmath Nicolas Goaziou
  2020-01-05  0:52 ` Nicolas Goaziou
@ 2020-02-02 14:28 ` Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2020-02-02 14:28 UTC (permalink / raw)
  To: 38925-done

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
> The following set of patches add Tuxmath. Unfortunately, my keyboard
> doesn't respond when playing the game, but leoprikler on #guix reported
> it was working fine there. I guess I'm out of luck.
>
> Anyway, here are the patches.

Applied as 8baaf51f0a6891cc2fb34928dab2337b627218c5

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-02 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-04 19:45 [bug#38925] [PATCH] Add Tuxmath Nicolas Goaziou
2020-01-05  0:52 ` Nicolas Goaziou
2020-02-02 14:28 ` bug#38925: " Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).