From 60849da99ace9040f454eb616488293a63f6b0ab Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Fri, 26 May 2023 12:39:40 +0300 Subject: [PATCH] gnushogi: refactor, unbreak on darwin --- pkgs/games/gnushogi/default.nix | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pkgs/games/gnushogi/default.nix b/pkgs/games/gnushogi/default.nix index ee23585cf645..2557b0571ea9 100644 --- a/pkgs/games/gnushogi/default.nix +++ b/pkgs/games/gnushogi/default.nix @@ -1,21 +1,31 @@ -{ lib, stdenv, fetchurl, zlib }: +{ lib +, stdenv +, fetchurl +, fetchpatch +, zlib +}: stdenv.mkDerivation rec { pname = "gnushogi"; version = "1.4.2"; - buildInputs = [ zlib ]; src = fetchurl { url = "mirror://gnu/gnushogi/${pname}-${version}.tar.gz"; - sha256 = "0a9bsl2nbnb138lq0h14jfc5xvz7hpb2bcsj4mjn6g1hcsl4ik0y"; + hash = "sha256-HsxIqGYwPGNlJVKzJdaF5+9emJMkQIApGmHZZQXVKyk="; }; - env.LDFLAGS = lib.optionalString (!stdenv.isDarwin) "-Wl,-z,muldefs"; + patches = [ + (fetchpatch { + url = "https://sources.debian.org/data/main/g/gnushogi/1.4.2-7/debian/patches/01-make-dont-ignore"; + hash = "sha256-Aw0zfH+wkj+rQQzKIn6bSilP76YIO27FwJ8n1UzG6ow="; + }) + (fetchpatch { + url = "https://sources.debian.org/data/main/g/gnushogi/1.4.2-7/debian/patches/globals"; + hash = "sha256-wZJBPMYSz4n1kOyLmR9QOp70650R9xXQUWD5hvaMRok="; + }) + ]; - # Makefile ignores errors, so the build may silently succeed erroneously - postBuild = '' - test -e gnushogi/gnushogi || { echo "ERROR: no binary produced"; exit 1; } - ''; + buildInputs = [ zlib ]; meta = with lib; { description = "GNU implementation of Shogi, also known as Japanese Chess"; @@ -23,6 +33,5 @@ stdenv.mkDerivation rec { license = licenses.gpl3; maintainers = [ maintainers.ciil ]; platforms = platforms.unix; - broken = stdenv.isDarwin; # darwin does not support -z muldefs }; }