golly: fix build on darwin (#409514)

authored by Ben Siraphob and committed by GitHub f78a20aa 20752397

+33 -12
+33 -12
pkgs/applications/science/misc/golly/default.nix
··· 11 11 libX11, 12 12 SDL2, 13 13 }: 14 - stdenv.mkDerivation rec { 14 + stdenv.mkDerivation (finalAttrs: { 15 15 pname = "golly"; 16 16 version = "4.3"; 17 17 18 18 src = fetchurl { 19 19 hash = "sha256-UdJHgGPn7FDN4rYTgfPBAoYE5FGC43TP8OFBmYIqCB0="; 20 - url = "mirror://sourceforge/project/golly/golly/golly-${version}/golly-${version}-src.tar.gz"; 20 + url = "mirror://sourceforge/project/golly/golly/golly-${finalAttrs.version}/golly-${finalAttrs.version}-src.tar.gz"; 21 21 }; 22 22 23 23 buildInputs = [ ··· 35 35 wrapGAppsHook3 36 36 ]; 37 37 38 + # fails nondeterministically on darwin 39 + enableParallelBuilding = false; 40 + 38 41 setSourceRoot = '' 39 42 sourceRoot=$(echo */gui-wx) 40 43 ''; 41 44 42 - postPatch = '' 43 - sed -e 's@PYTHON_SHLIB@${python3}/lib/libpython3.so@' -i wxprefs.cpp 44 - ! grep _SHLIB *.cpp 45 - 46 - grep /lib/libpython wxprefs.cpp 47 - ''; 45 + postPatch = 46 + '' 47 + substituteInPlace wxprefs.cpp \ 48 + --replace-fail 'PYTHON_SHLIB' '${python3}/lib/libpython3.so' 49 + '' 50 + + lib.optionalString stdenv.hostPlatform.isDarwin '' 51 + substituteInPlace makefile-gtk \ 52 + --replace-fail '-Wl,--as-needed' "" \ 53 + --replace-fail '-lGL ' "" \ 54 + --replace-fail '-lGLU' "" 55 + ''; 48 56 49 57 makeFlags = [ 50 58 "-f" 51 59 "makefile-gtk" 52 60 "ENABLE_SOUND=1" 53 61 "GOLLYDIR=${placeholder "out"}/share/golly" 62 + "CC=${stdenv.cc.targetPrefix}cc" 63 + "CXX=${stdenv.cc.targetPrefix}c++" 64 + "CXXC=${stdenv.cc.targetPrefix}c++" 65 + "LD=${stdenv.cc.targetPrefix}c++" 66 + "WX_CONFIG=${lib.getExe' (lib.getDev wxGTK) "wx-config"}" 54 67 ]; 55 68 56 69 installPhase = '' 70 + runHook preInstall 71 + 57 72 mkdir -p "$out/bin" 58 73 cp ../golly ../bgolly "$out/bin" 59 74 ··· 62 77 63 78 mkdir -p "$out/share/golly" 64 79 cp -r ../{Help,Patterns,Scripts,Rules} "$out/share/golly" 80 + 81 + runHook postInstall 65 82 ''; 66 83 67 84 meta = { 68 85 description = "Cellular automata simulation program"; 69 - license = lib.licenses.gpl2; 70 - maintainers = [ lib.maintainers.raskin ]; 71 - platforms = lib.platforms.linux; 86 + license = lib.licenses.gpl2Plus; 87 + maintainers = with lib.maintainers; [ 88 + raskin 89 + siraben 90 + ]; 91 + platforms = lib.platforms.unix; 92 + homepage = "https://golly.sourceforge.io/"; 72 93 downloadPage = "https://sourceforge.net/projects/golly/files/golly"; 73 94 }; 74 - } 95 + })