summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/game-development.scm21
-rw-r--r--gnu/packages/patches/renpy-use-system-fribidi.patch52
3 files changed, 73 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index f8c615a83d..18a2389514 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1569,6 +1569,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/rct-add-missing-headers.patch		\
   %D%/packages/patches/readline-link-ncurses.patch		\
   %D%/packages/patches/readline-6.2-CVE-2014-2524.patch		\
+  %D%/packages/patches/renpy-use-system-fribidi.patch		\
   %D%/packages/patches/reposurgeon-add-missing-docbook-files.patch	\
   %D%/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch	\
   %D%/packages/patches/ri-li-modernize_cpp.patch		\
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 557f02f564..21f7f7e880 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1120,7 +1120,18 @@ developed mainly for Ren'py.")
        (method url-fetch)
        (uri (string-append "https://www.renpy.org/dl/" version
                            "/renpy-" version "-source.tar.bz2"))
-       (sha256 (base32 "1anr5cfbvbsbik4v4rvrkdkciwhg700k4lydfbs4n85raimz9mw4"))))
+       (sha256 (base32 "1anr5cfbvbsbik4v4rvrkdkciwhg700k4lydfbs4n85raimz9mw4"))
+       (modules '((guix build utils)))
+       (patches
+        (search-patches
+         "renpy-use-system-fribidi.patch"))
+       (snippet
+        '(with-directory-excursion "module"
+           ;; drop generated sources
+           (delete-file-recursively "gen")
+           ;; drop fribidi sources
+           (delete-file-recursively "fribidi-src")
+           #t))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; Ren'py doesn't seem to package tests
@@ -1133,6 +1144,13 @@ developed mainly for Ren'py.")
                (("xdg-open")
                 (which "xdg-open")))
              #t))
+         (add-after 'unpack 'fix-include-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "module/setup.py"
+               (("/usr/include/fribidi")
+                (string-append (assoc-ref inputs "fribidi")
+                               "/include/fribidi")))
+             #t))
          (add-after 'set-paths 'set-build-vars
            (lambda* (#:key inputs #:allow-other-keys)
              (setenv "RENPY_CYTHON"
@@ -1170,6 +1188,7 @@ developed mainly for Ren'py.")
     (inputs
      `(("ffmpeg" ,ffmpeg)
        ("freetype" ,freetype)
+       ("fribidi" ,fribidi)
        ("glew" ,glew)
        ("libpng" ,libpng)
        ("python2-pygame" ,python2-pygame-sdl2)
diff --git a/gnu/packages/patches/renpy-use-system-fribidi.patch b/gnu/packages/patches/renpy-use-system-fribidi.patch
new file mode 100644
index 0000000000..1437274bcc
--- /dev/null
+++ b/gnu/packages/patches/renpy-use-system-fribidi.patch
@@ -0,0 +1,52 @@
+See also [Arch] and [Gentoo] for similar patches in other distros.
+[Arch] https://github.com/archlinux/svntogit-community/blob/packages/renpy/trunk/renpy-system-fribidi.patch
+[Gentoo] https://gitweb.gentoo.org/repo/gentoo.git/tree/games-engines/renpy/files/renpy-7.3.5-use-system-fribidi.patch
+
+Index: renpy-7.3.5-source/module/renpybidicore.c
+===================================================================
+--- renpy-7.3.5-source.orig/module/renpybidicore.c
++++ renpy-7.3.5-source/module/renpybidicore.c
+@@ -1,5 +1,5 @@
+ #include <Python.h>
+-#include <fribidi-src/lib/fribidi.h>
++#include <fribidi.h>
+ #include <stdlib.h>
+
+ #ifndef alloca
+Index: renpy-7.3.5-source/module/setup.py
+===================================================================
+--- renpy-7.3.5-source.orig/module/setup.py
++++ renpy-7.3.5-source/module/setup.py
+@@ -119,30 +119,13 @@ cython(
+     sdl + [ png, 'z', 'm' ])
+
+ FRIBIDI_SOURCES = """
+-fribidi-src/lib/fribidi.c
+-fribidi-src/lib/fribidi-arabic.c
+-fribidi-src/lib/fribidi-bidi.c
+-fribidi-src/lib/fribidi-bidi-types.c
+-fribidi-src/lib/fribidi-deprecated.c
+-fribidi-src/lib/fribidi-joining.c
+-fribidi-src/lib/fribidi-joining-types.c
+-fribidi-src/lib/fribidi-mem.c
+-fribidi-src/lib/fribidi-mirroring.c
+-fribidi-src/lib/fribidi-run.c
+-fribidi-src/lib/fribidi-shape.c
+ renpybidicore.c
+ """.split()
+ cython(
+     "_renpybidi",
+     FRIBIDI_SOURCES,
+-    includes=[
+-        BASE + "/fribidi-src/",
+-        BASE + "/fribidi-src/lib/",
+-        ],
+-    define_macros=[
+-        ("FRIBIDI_ENTRY", ""),
+-        ("HAVE_CONFIG_H", "1"),
+-        ])
++    includes=["/usr/include/fribidi"],
++    libs=["fribidi"])
+
+
+ cython("_renpysteam", language="c++", compile_if=steam_sdk, libs=["steam_api"])