diff --git a/default.nix b/default.nix index 00f919a..b4fa1f0 100644 --- a/default.nix +++ b/default.nix @@ -33,6 +33,8 @@ in oha = callPackage ./oha { }; + playgsf = callPackage ./playgsf { }; + snownews = callPackage ./snownews { }; textidote = callPackage ./textidote { }; diff --git a/flake.nix b/flake.nix index dde7bd4..7b0cedd 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,7 @@ face_morpher nsz oha + playgsf snownews textidote unxwb diff --git a/playgsf/default.nix b/playgsf/default.nix new file mode 100644 index 0000000..886a5fd --- /dev/null +++ b/playgsf/default.nix @@ -0,0 +1,58 @@ +{ lib, stdenv, fetchzip, fetchpatch, libao, libresample, zlib }: + +stdenv.mkDerivation rec { + pname = "playgsf"; + version = "0.7.1"; + + src = fetchzip { + url = "http://projects.raphnet.net/${pname}/${pname}-${version}.tar.gz"; + sha256 = "1y7qs2fnmlf2z8abb6190ga958vak33s3n4xrndg9zakdahi03ff"; + }; + + patches = [ + ./no-bundled-libresample.patch + # Make compile with newer GCC that does not allow invalid code + (fetchpatch { + name = "fixes.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/fixes.patch?h=playgsf&id=1d613d3923987b39ca81636650038e670b712b29"; + sha256 = "sha256-0sWvb/qF6LLtd2LfpLGwH/MKAjDKuElfXRGBlDrwYoU="; + }) + ]; + + nativeBuildInputs = [ ]; + buildInputs = [ libao libresample zlib ]; + + # nixpkgs version of libresample is used + postPatch = '' + rm -r libresample-0.1.3 + ''; + + # remove libresample + postConfigure = '' + substituteInPlace Makefile \ + --replace "-I./libresample-0.1.3/include" "" \ + --replace "-L./libresample-0.1.3" "" + ''; + + # if optimisations are on, a segfault in VBA/Util.o:585 (fread) occurs + # !!! HACK: re-compile that object without optimisations and link the main + # binary again + postBuild = '' + g++ -DLINUX -O0 -c VBA/Util.cpp -o VBA/Util.o + make + ''; + + installPhase = '' + runHook preInstall + install -D playgsf $out/bin/playgsf + runHook postInstall + ''; + + meta = with lib; { + description = "A simple command line player for gsf files based on the winamp plugin ‘Highly Advanced’"; + homepage = "http://projects.raphnet.net/#playgsf"; + license = with licenses; [ gpl2Plus mit unfree ]; # some files do not have license header and no global license + maintainers = with maintainers; [ sbruder ]; + platforms = platforms.unix; + }; +} diff --git a/playgsf/no-bundled-libresample.patch b/playgsf/no-bundled-libresample.patch new file mode 100644 index 0000000..34ef266 --- /dev/null +++ b/playgsf/no-bundled-libresample.patch @@ -0,0 +1,30 @@ +diff a/Makefile.in b/Makefile.in +--- a/Makefile.in ++++ b/Makefile.in +@@ -8,15 +8,9 @@ + + OBJS=gsf.o VBA/GBA.o VBA/Globals.o VBA/Sound.o VBA/Util.o VBA/bios.o VBA/memgzio.o VBA/snd_interp.o VBA/unzip.o linuxmain.o VBA/psftag.o + +-all: libresample-0.1.3/libresample.a $(OBJS) ++all: $(OBJS) + $(LD) $(LDFLAGS) $(OBJS) -lresample -o playgsf + +-libresample-0.1.3/libresample.a: libresample-0.1.3/Makefile +- $(MAKE) -C libresample-0.1.3 +- +-libresample-0.1.3/Makefile: +- cd libresample-0.1.3 ; ./configure ; cd .. +- + %.o: %.c %.h + $(CC) $(CFLAGS) -c $< -o $@ + +@@ -30,7 +24,7 @@ + $(CPP) $(CFLAGS) -c $< -o $@ + + clean: +- rm -rf *.o VBA/*.o playgsf autom4te.cache libresample-0.1.3/Makefile libresample-0.1.3/config.log libresample-0.1.3/config.status libresample-0.1.3/src/*.o ++ rm -rf *.o VBA/*.o playgsf autom4te.cache + + distclean: +- rm -f *.o VBA/*.o playgsf config.cache config.status Makefile config.h config.log libresample-0.1.3/src/*.o ++ rm -f *.o VBA/*.o playgsf config.cache config.status Makefile config.h config.log