diff mbox

gnu: Add higan.

Message ID 8737om6qkd.fsf@T420.taylan
State New
Headers show

Commit Message

Taylan Ulrich Bayırlı =?utf-8?Q?=2FKammer?= June 9, 2016, 8:43 p.m. UTC
ludo@gnu.org (Ludovic Courtès) writes:

> taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis:
>
>> ludo@gnu.org (Ludovic Courtès) writes:
>
> [...]
>
>>> In what sense is it unsuitable?  It’s OK to have a couple of patches,
>>> but it’s not quite OK to host a fork of the upstream package, IMO (at
>>> the very least, it can create confusion and make it harder to see how it
>>> differs from the “real” package.)
>>
>> The repo is just for having a consistent place from which the source can
>> be fetched, as the author doesn't want source bundles to be downloaded
>> from his website.  No changes to the code are made.
>>
>> The repo at GitLab didn't seem to tag releases properly.  That being
>> said, now that I look at it, it seems more like an oversight for v098.
>> Other releases seem to be tagged quite consistently:
>>
>>     https://gitlab.com/higan/higan/tags
>>
>> Should we use that repo instead?  It's a bit more official than mine.
>
> Yes, I think it would be more appropriate.

I contacted the maintainer of the repo and asked them to add a tag,
which is done now.

Note: apparently the author re-released 098 with a hotfix very soon
after releasing it, without making a version change.  In the repository,
this is tagged as 098b, which I use here.  I.e. this is not a true
version update; we were already using "this 098".

>>>>   * The program insists on looking in ~/.local/share for some data files
>>>>     that are actually installed in $prefix/share; does my strategy here
>>>>     look OK, in that I wrap the executable to copy the data files into
>>>>     ~/.local/share every time the program is run?
>>>
>>> Sounds like a sledgehammer no?  :-)
>>>
>>> If those files are immutable, what about patching Higan to look for
>>> those files in $datadir instead?
>>
>> Apparently, the files that are part of the distribution are pure data
>> files, i.e. fine to be read-only.  However, the directory hierarchy of
>> which they're a part needs to be writable, as higan creates further
>> files there.  With that cp -r, the directory hierarchy is made sure to
>> be there, and the data files made sure to be up to date.
>>
>> Although I didn't look too closely at the sources, patching higan to do
>> things differently would presumably be a nontrivial task, since it seems
>> bent on doing things in terms of this directory structure that contains
>> both pure data and read-write data files.
>
> Hmm OK.  What do other distros do?

More or less the same thing; it's sanctioned by the developers even
though it's acknowledged not to be a particularly good solution.  Here
we see Arch do the same:

https://git.archlinux.org/svntogit/community.git/tree/trunk/higan?h=packages/higan

(Though this one seems to have a bug because they copy things to
~/Emulation instead of the new ~/.local/share.  I'm confident that
~/.local/share is the right location in the latest release.  Also for
the cheats.bml file.)

Here's a patch that, in addition to switching the repo, adds a patch
removing a -march=native flag (which I assume would break
cross-compilation), and passes the make flag "profile=balanced" to make
higan less CPU intensive by emulating a bit less accurately (it was
running too slow on my i5, so this should be a better default).

I just saved a princess from an evil wizard with this so I can confirm
it runs smooth now.

Comments

Ludovic Courtès June 10, 2016, 12:56 p.m. UTC | #1
taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis:

> I contacted the maintainer of the repo and asked them to add a tag,
> which is done now.

Great!

> Note: apparently the author re-released 098 with a hotfix very soon
> after releasing it, without making a version change.  In the repository,
> this is tagged as 098b, which I use here.  I.e. this is not a true
> version update; we were already using "this 098".

Not great.  ;-)

>>> Apparently, the files that are part of the distribution are pure data
>>> files, i.e. fine to be read-only.  However, the directory hierarchy of
>>> which they're a part needs to be writable, as higan creates further
>>> files there.  With that cp -r, the directory hierarchy is made sure to
>>> be there, and the data files made sure to be up to date.
>>>
>>> Although I didn't look too closely at the sources, patching higan to do
>>> things differently would presumably be a nontrivial task, since it seems
>>> bent on doing things in terms of this directory structure that contains
>>> both pure data and read-write data files.
>>
>> Hmm OK.  What do other distros do?
>
> More or less the same thing; it's sanctioned by the developers even
> though it's acknowledged not to be a particularly good solution.  Here
> we see Arch do the same:
>
> https://git.archlinux.org/svntogit/community.git/tree/trunk/higan?h=packages/higan
>
> (Though this one seems to have a bug because they copy things to
> ~/Emulation instead of the new ~/.local/share.  I'm confident that
> ~/.local/share is the right location in the latest release.  Also for
> the cheats.bml file.)

Hmmk.

> Here's a patch that, in addition to switching the repo, adds a patch
> removing a -march=native flag (which I assume would break
> cross-compilation),

‘-march=native’ breaks distribution of pre-built binaries since the
binary produced in the build farm may or may not run on the user’s
hardware, depending on the exact CPU being used.  So this patch is the
right thing to do!

> and passes the make flag "profile=balanced" to make higan less CPU
> intensive by emulating a bit less accurately (it was running too slow
> on my i5, so this should be a better default).

OK.

> I just saved a princess from an evil wizard with this so I can confirm
> it runs smooth now.

Wonderful.  :-)

> From 93ccdf075caf462af742cf46cad35697001db124 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
>  <taylanbayirli@gmail.com>
> Date: Thu, 9 Jun 2016 21:53:02 +0300
> Subject: [PATCH] gnu: higan: Various improvements.
>
> * gnu/packages/games.scm (higan): Use semi-official repository at GitLab
> (using hotfix tag 098b which is equivalent to official release 098).
> Add a patch to remove the build flag -march=native.  Set profile to
> balanced.
> * gnu/packages/patches/higan-remove-march-native-flag.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.

OK!

Thanks,
Ludo’.
diff mbox

Patch

From 93ccdf075caf462af742cf46cad35697001db124 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Thu, 9 Jun 2016 21:53:02 +0300
Subject: [PATCH] gnu: higan: Various improvements.

* gnu/packages/games.scm (higan): Use semi-official repository at GitLab
(using hotfix tag 098b which is equivalent to official release 098).
Add a patch to remove the build flag -march=native.  Set profile to
balanced.
* gnu/packages/patches/higan-remove-march-native-flag.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                              |  1 +
 gnu/packages/games.scm                                    |  9 ++++++---
 gnu/packages/patches/higan-remove-march-native-flag.patch | 13 +++++++++++++
 3 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/higan-remove-march-native-flag.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d3e7262..210d3aa 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -542,6 +542,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch	\
   %D%/packages/patches/gtkglext-disable-disable-deprecated.patch \
   %D%/packages/patches/hdf5-config-date.patch			\
+  %D%/packages/patches/higan-remove-march-native-flag.patch	\
   %D%/packages/patches/hop-bigloo-4.0b.patch			\
   %D%/packages/patches/hop-linker-flags.patch			\
   %D%/packages/patches/hydra-automake-1.15.patch		\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 4181ffb..2aa46e3 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -2248,15 +2248,17 @@  Red Eclipse provides fast paced and accessible gameplay.")
 (define-public higan
   (package
     (name "higan")
-    (version "098")
+    (version "098b")
     (source
      (origin
        (method url-fetch)
        (uri (string-append
-             "https://github.com/TaylanUB/higan/archive/v" version ".tar.gz"))
+             "https://gitlab.com/higan/higan/repository/archive.tar.gz?ref=v"
+             version))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "12snxrk8wa94x3l69qcimgm0xc22zjgf7vzhckp2lzyfbf27950v"))))
+        (base32 "05j0xzr01gsyia4gj6jmdzklll4iky1kwxgxw0mmfcgm10m0h3bf"))
+       (patches (search-patches "higan-remove-march-native-flag.patch"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
@@ -2322,6 +2324,7 @@  Red Eclipse provides fast paced and accessible gameplay.")
                    `("PATH" ":" prefix (,bin))))))))
        #:make-flags
        (list "compiler=g++"
+             "profile=balanced"      ;default is accuracy; which is quite slow
              (string-append "prefix=" (assoc-ref %outputs "out")))
        ;; There is no test suite.
        #:tests? #f))
diff --git a/gnu/packages/patches/higan-remove-march-native-flag.patch b/gnu/packages/patches/higan-remove-march-native-flag.patch
new file mode 100644
index 0000000..8f4a36d
--- /dev/null
+++ b/gnu/packages/patches/higan-remove-march-native-flag.patch
@@ -0,0 +1,13 @@ 
+Remove -march=native from build flags.
+
+--- a/higan/GNUmakefile
++++ b/higan/GNUmakefile
+@@ -32,7 +32,7 @@ ifeq ($(platform),windows)
+ else ifeq ($(platform),macosx)
+   flags += -march=native
+ else ifneq ($(filter $(platform),linux bsd),)
+-  flags += -march=native -fopenmp
++  flags += -fopenmp
+   link += -fopenmp
+   link += -Wl,-export-dynamic
+   link += -lX11 -lXext
-- 
2.7.4