golly: 3.3 -> 4.1

This commit is contained in:
Michael Raskin 2021-12-06 16:27:09 +01:00
parent 2c7ebb5524
commit 65b2df8b45
3 changed files with 32 additions and 16 deletions

View file

@ -1,31 +1,47 @@
{lib, stdenv, fetchurl, wxGTK, perl, python2, zlib, libGLU, libGL, libX11}:
{lib, stdenv, fetchurl, wxGTK, perl, python3, zlib, libGLU, libGL, libX11, SDL2}:
stdenv.mkDerivation rec {
pname = "golly";
version = "3.3";
version = "4.1";
src = fetchurl {
sha256 = "1j3ksnar4rdam4xiyspgyrs1pifbvxfxkrn65brkwxpx39mpgzc8";
sha256 = "1j30dpzy6wh8fv1j2750hzc6wb0nhk83knl9fapccxgxw9n5lrbc";
url="mirror://sourceforge/project/golly/golly/golly-${version}/golly-${version}-src.tar.gz";
};
buildInputs = [
wxGTK perl python2 zlib libGLU libGL libX11
wxGTK perl python3 zlib libGLU libGL libX11 SDL2
];
setSourceRoot = ''
sourceRoot=$(echo */gui-wx/configure)
sourceRoot=$(echo */gui-wx/)
'';
postPatch = ''
sed -e '/gollydir =/agollydir += "/../share/golly/";' -i wxgolly.cpp
grep share/golly wxgolly.cpp
sed -e 's@PYTHON_SHLIB@${python3}/lib/libpython3.so@' -i wxprefs.cpp
sed -e 's@PERL_SHLIB@'"$(find "${perl}/lib/" -name libperl.so)"'@' -i wxprefs.cpp
! grep _SHLIB *.cpp
grep /lib/libpython wxprefs.cpp
grep /libperl wxprefs.cpp
'';
# Link against Python explicitly as it is needed for scripts
makeFlags=[
"AM_LDFLAGS="
"-f" "makefile-gtk"
"ENABLE_SOUND=1" "ENABLE_PERL=1"
];
NIX_LDFLAGS="-l${python2.libPrefix} -lperl";
preConfigure=''
export NIX_LDFLAGS="$NIX_LDFLAGS -L$(dirname "$(find ${perl} -name libperl.so)")"
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE
-DPYTHON_SHLIB=$(basename "$(
readlink -f ${python2}/lib/libpython*.so)")"
installPhase = ''
mkdir -p "$out/bin"
cp ../golly ../bgolly "$out/bin"
mkdir -p "$out/share/doc/golly/"
cp ../docs/* "$out/share/doc/golly/"
mkdir -p "$out/share/golly"
cp -r ../{Help,Patterns,Scripts,Rules} "$out/share/golly"
'';
meta = {

View file

@ -1,5 +1,5 @@
SF_redirect () {
redirect
redirect 99
process 'http://[a-z]+[.]dl[.]sourceforge[.]net/' 'mirror://sourceforge/'
process '[?].*' ''
}

View file

@ -69,8 +69,8 @@ version_link () {
redirect () {
CURRENT_URL="$(curl -I -L --max-redirs "${1:-99}" "$CURRENT_URL" |
grep -E '^Location: ' | position_choice "${2:-999999}" "$3" |
sed -e 's/^Location: //; s/\r//')"
grep -E '^[Ll]ocation: ' | position_choice "${2:-999999}" "$3" |
sed -e 's/^[Ll]ocation: //; s/\r//')"
echo "Redirected: $*"
echo "URL: $CURRENT_URL" >&2
}