···11+{ lib
22+, stdenv
33+, fetchFromGitHub
44+, pkg-config
55+, makeWrapper
66+, SDL
77+, SDL_image
88+, SDL_ttf
99+, gtk2
1010+, glib
1111+}:
1212+1313+stdenv.mkDerivation rec {
1414+ pname = "hivelytracker";
1515+ version = "unstable-2020-08-19";
1616+1717+ src = fetchFromGitHub {
1818+ owner = "pete-gordon";
1919+ repo = "hivelytracker";
2020+ rev = "c8e3c7a5ee9f4a07cb4a941caecf7e4c4f4d40e0";
2121+ sha256 = "1nqianlf1msir6wqwapi7ys1vbmf6aik58wa54b6cn5v6kwxh75a";
2222+ };
2323+2424+ nativeBuildInputs = [
2525+ pkg-config
2626+ makeWrapper
2727+ ];
2828+2929+ buildInputs = [
3030+ SDL
3131+ SDL_image
3232+ SDL_ttf
3333+ gtk2
3434+ glib
3535+ ];
3636+3737+ makeFlags = [
3838+ "-C sdl"
3939+ "-f Makefile.linux"
4040+ "PREFIX=$(out)"
4141+ ];
4242+4343+ # TODO: try to exclude gtk and glib from darwin builds
4444+ NIX_CFLAGS_COMPILE = [
4545+ "-I${SDL}/include/SDL"
4646+ "-I${SDL_image}/include/SDL"
4747+ "-I${SDL_ttf}/include/SDL"
4848+ "-I${gtk2.dev}/include/gtk-2.0"
4949+ "-I${glib.dev}/include/glib-2.0"
5050+ ];
5151+5252+ # Also build the hvl2wav tool
5353+ postBuild = ''
5454+ make -C hvl2wav
5555+ '';
5656+5757+ postInstall = ''
5858+ # https://github.com/pete-gordon/hivelytracker/issues/43
5959+ # Ideally we should patch the sources, but the program can't open
6060+ # files passed as arguments anyway, so this works well enough until the
6161+ # issue is fixed.
6262+ wrapProgram $out/bin/hivelytracker \
6363+ --run "cd $out/share/hivelytracker"
6464+6565+ # Also install the hvl2wav tool
6666+ install -Dm755 hvl2wav/hvl2wav $out/bin/hvl2wav
6767+ '';
6868+6969+ meta = with lib; {
7070+ homepage = "http://www.hivelytracker.co.uk/";
7171+ downloadPage = "http://www.hivelytracker.co.uk/downl.php";
7272+ description = "Chip music tracker based upon the AHX format";
7373+ longDescription = ''
7474+ Hively Tracker is a tracker program based upon the AHX format created in
7575+ the mid '90s by Dexter and Pink of Abyss. The format was relatively
7676+ popular, and many songs were created and used in scene productions and
7777+ games. AHX was designed to create a very SID-like sound on the Amiga.
7878+7979+ HivelyTracker can import and export modules and instruments in the AHX
8080+ format, but it also improves on AHX in several ways and therefore has
8181+ its own instrument and module formats.
8282+ '';
8383+ license = licenses.bsd3;
8484+ platforms = platforms.all;
8585+ maintainers = with maintainers; [ fgaz ];
8686+ broken = stdenv.isDarwin; # TODO: try to use xcbuild
8787+ };
8888+}
8989+