uqm: Bring back package and fix 3do extractor.

It was dropped in 324719a5a611501d7b54e14f205465f5da1242b1.

The UQM package itself doesn't require Haskell, but in order to extract
contents from the 3do version of the game, we need to have a small
helper utility which I wrote in Haskell a while ago. In order to switch
it to Haskell NG, only very minor modifications were necessary, which
are now done with this commit instead of dropping the whole game.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>

aszlig c7e7f12e 5454be28

+170
+60
pkgs/games/uqm/3dovideo.nix
··· 1 + { stdenv, requireFile, writeText, fetchurl, haskellPackages }: 2 + 3 + with stdenv.lib; 4 + 5 + let 6 + makeSpin = num: let 7 + padded = (optionalString (lessThan num 10) "0") + toString num; 8 + in "slides.spins.${padded} = 3DOVID:" + 9 + "addons/3dovideo/spins/ship${padded}.duk:" + 10 + "addons/3dovideo/spins/spin.aif:" + 11 + "addons/3dovideo/spins/ship${padded}.aif:89"; 12 + 13 + videoRMP = writeText "3dovideo.rmp" ('' 14 + slides.ending = 3DOVID:addons/3dovideo/ending/victory.duk 15 + slides.intro = 3DOVID:addons/3dovideo/intro/intro.duk 16 + '' + concatMapStrings makeSpin (range 0 24)); 17 + 18 + helper = with haskellPackages; mkDerivation { 19 + pname = "uqm3donix"; 20 + version = "0.1.0.0"; 21 + 22 + src = fetchurl { 23 + url = "https://github.com/aszlig/uqm3donix/archive/v0.1.0.0.tar.gz"; 24 + sha256 = "0d40gpc3bqkw68varjxwgbdzxw0dvwqksijmvij5ixmlcspbjgvb"; 25 + }; 26 + 27 + isLibrary = false; 28 + isExecutable = true; 29 + 30 + buildDepends = [ base binary bytestring filepath tar ]; 31 + 32 + description = "Extract video files from a Star Control II 3DO image"; 33 + license = stdenv.lib.licenses.bsd3; 34 + }; 35 + 36 + in stdenv.mkDerivation { 37 + name = "uqm-3dovideo"; 38 + 39 + src = requireFile rec { 40 + name = "videos.tar"; 41 + sha256 = "044h0cl69r0kc43vk4n0akk0prwzb7inq324h5yfqb38sd4zkds1"; 42 + message = '' 43 + In order to get the intro and ending sequences from the 3DO version, you 44 + need to have the original 3DO Star Control II CD. Create an image from the 45 + CD and use uqm3donix* to extract a tarball with the videos from it. The 46 + reason for this is because the 3DO uses its own proprietary disk format. 47 + 48 + Save the file as videos.tar and use "nix-prefetch-url file://${name}" to 49 + add it to the Nix store. 50 + 51 + [*] ${helper}/bin/uqm3donix CDIMAGE ${name} 52 + ''; 53 + }; 54 + 55 + buildCommand = '' 56 + mkdir -vp "$out" 57 + tar xf "$src" -C "$out" --strip-components=3 58 + cp "${videoRMP}" "$out/3dovideo.rmp" 59 + ''; 60 + }
+108
pkgs/games/uqm/default.nix
··· 1 + { stdenv, fetchurl 2 + , pkgconfig, mesa 3 + , SDL, SDL_image, libpng, zlib, libvorbis, libogg, libmikmod, unzip 4 + 5 + , use3DOVideos ? false, requireFile ? null, writeText ? null 6 + , haskellPackages ? null 7 + 8 + , useRemixPacks ? false 9 + }: 10 + 11 + assert use3DOVideos -> requireFile != null && writeText != null 12 + && haskellPackages != null; 13 + 14 + with stdenv.lib; 15 + 16 + let 17 + videos = import ./3dovideo.nix { 18 + inherit stdenv requireFile writeText fetchurl haskellPackages; 19 + }; 20 + 21 + remixPacks = imap (num: sha256: fetchurl rec { 22 + name = "uqm-remix-disc${toString num}.uqm"; 23 + url = "mirror://sourceforge/sc2/${name}"; 24 + inherit sha256; 25 + }) [ 26 + "1s470i6hm53l214f2rkrbp111q4jyvnxbzdziqg32ffr8m3nk5xn" 27 + "1pmsq65k8gk4jcbyk3qjgi9yqlm0dlaimc2r8hz2fc9f2124gfvz" 28 + "07g966ylvw9k5q9jdzqdczp7c5qv4s91xjlg4z5z27fgcs7rzn76" 29 + "1l46k9aqlcp7d3fjkjb3n05cjfkxx8rjlypgqy0jmdx529vikj54" 30 + ]; 31 + 32 + in stdenv.mkDerivation rec { 33 + name = "uqm-${version}"; 34 + version = "0.7.0"; 35 + 36 + src = fetchurl { 37 + url = "mirror://sourceforge/sc2/uqm-${version}-source.tgz"; 38 + sha256 = "08dj7fsvflxx69an6vpf3wx050mk0ycmdv401yffrrqbgxgmqsd3"; 39 + }; 40 + 41 + content = fetchurl { 42 + url = "mirror://sourceforge/sc2/uqm-${version}-content.uqm"; 43 + sha256 = "1gx39ns698hyczd4nx73mr0z86bbi4q3h8sw3pxjh1lzla5xpxmq"; 44 + }; 45 + 46 + voice = fetchurl { 47 + url = "mirror://sourceforge/sc2/uqm-${version}-voice.uqm"; 48 + sha256 = "0yf9ff5sxk229202gsa7ski6wn7a8hkjjyr1yr7mjdxsnh0zik5w"; 49 + }; 50 + 51 + music = fetchurl { 52 + url = "mirror://sourceforge/sc2/uqm-${version}-3domusic.uqm"; 53 + sha256 = "10nbvcrr0lc0mxivxfkcbxnibwk3vwmamabrlvwdsjxd9pk8aw65"; 54 + }; 55 + 56 + 57 + /* uses pthread_cancel(), which requires libgcc_s.so.1 to be 58 + loadable at run-time. Adding the flag below ensures that the 59 + library can be found. Obviously, though, this is a hack. */ 60 + NIX_LDFLAGS="-lgcc_s"; 61 + 62 + buildInputs = [SDL SDL_image libpng libvorbis libogg libmikmod unzip pkgconfig mesa]; 63 + 64 + postUnpack = '' 65 + mkdir -p uqm-${version}/content/packages 66 + mkdir -p uqm-${version}/content/addons 67 + ln -s "$content" "uqm-${version}/content/packages/uqm-0.7.0-content.uqm" 68 + ln -s "$music" "uqm-${version}/content/addons/uqm-0.7.0-3domusic.uqm" 69 + ln -s "$voice" "uqm-${version}/content/addons/uqm-0.7.0-voice.uqm" 70 + '' + optionalString useRemixPacks (concatMapStrings (disc: '' 71 + ln -s "${disc}" "uqm-$version/content/addons/${disc.name}" 72 + '') remixPacks) + optionalString use3DOVideos '' 73 + ln -s "${videos}" "uqm-${version}/content/addons/3dovideo" 74 + ''; 75 + 76 + /* uqm has a 'unique' build system with a root script incidentally called 77 + * 'build.sh'. */ 78 + 79 + configurePhase = '' 80 + echo "INPUT_install_prefix_VALUE='$out'" >> config.state 81 + echo "INPUT_install_bindir_VALUE='$out/bin'" >> config.state 82 + echo "INPUT_install_libdir_VALUE='$out/lib'" >> config.state 83 + echo "INPUT_install_sharedir_VALUE='$out/share'" >> config.state 84 + PREFIX=$out ./build.sh uqm config 85 + ''; 86 + 87 + buildPhase = '' 88 + ./build.sh uqm 89 + ''; 90 + 91 + installPhase = '' 92 + ./build.sh uqm install 93 + sed -i $out/bin/uqm -e "s%/usr/local/games/%$out%g" 94 + ''; 95 + 96 + meta = { 97 + description = "Remake of Star Control II"; 98 + longDescription = '' 99 + The goals for the The Ur-Quan Masters project are: 100 + - to bring Star Control II to modern platforms, thereby making a lot of people happy 101 + - to make game translations easy, thereby making even more people happy 102 + - to adapt the code so that people can more easily make their own spin-offs, thereby making zillions more people happy! 103 + ''; 104 + homepage = http://sc2.sourceforge.net/; 105 + license = stdenv.lib.licenses.gpl2; 106 + maintainers = with maintainers; [ jcumming aszlig ]; 107 + }; 108 + }
+2
pkgs/top-level/all-packages.nix
··· 13126 13126 13127 13127 unvanquished = callPackage ../games/unvanquished { }; 13128 13128 13129 + uqm = callPackage ../games/uqm { }; 13130 + 13129 13131 urbanterror = callPackage ../games/urbanterror { }; 13130 13132 13131 13133 ue4demos = recurseIntoAttrs (callPackage ../games/ue4demos { });