uqm: Include optional support for 3DO videos.
This is optional because you have to have an image of a Star Control II 3DO CD image. I decided to hack together a small OperaFS (that's the proprietary filesystem used with 3DO CD-ROMs) file extractor, which should possibly make it as painless as possible to include those videos. It may be a good idea to split off the haskell package into another attribute set (possibly haskellPackages?), but I really don't think there is a need for that, because it's really just UQM and 3DO specific. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
0353c8225a
commit
1aa68dd29f
64
pkgs/games/uqm/3dovideo.nix
Normal file
64
pkgs/games/uqm/3dovideo.nix
Normal file
@ -0,0 +1,64 @@
|
||||
{ stdenv, requireFile, writeText, fetchgit, haskellPackages }:
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
let
|
||||
makeSpin = num: let
|
||||
padded = (optionalString (lessThan num 10) "0") + toString num;
|
||||
in "slides.spins.${padded} = 3DOVID:" +
|
||||
"addons/3dovideo/spins/ship${padded}.duk:" +
|
||||
"addons/3dovideo/spins/spin.aif:" +
|
||||
"addons/3dovideo/spins/ship${padded}.aif:89";
|
||||
|
||||
videoRMP = writeText "3dovideo.rmp" (''
|
||||
slides.ending = 3DOVID:addons/3dovideo/ending/victory.duk
|
||||
slides.intro = 3DOVID:addons/3dovideo/intro/intro.duk
|
||||
'' + concatMapStrings makeSpin (range 0 24));
|
||||
|
||||
helper = with haskellPackages; cabal.mkDerivation (self: {
|
||||
pname = "uqm3donix";
|
||||
version = "0.1.0.0";
|
||||
|
||||
src = fetchgit {
|
||||
url = "git://github.com/aszlig/uqm3donix.git";
|
||||
rev = "97fc4fd736dcf9fe03e6e5a2c347c5bdc71c8366";
|
||||
sha256 = "09ws6j21mxkcjx444fxkf8a3q17jj6i7h2i9pf5ky52f6xds1h0j";
|
||||
};
|
||||
|
||||
isLibrary = false;
|
||||
isExecutable = true;
|
||||
|
||||
buildDepends = [ binary filepath tar ];
|
||||
|
||||
meta = {
|
||||
description = "Extract video files from a Star Control II 3DO image";
|
||||
license = self.stdenv.lib.licenses.bsd3;
|
||||
platforms = self.ghc.meta.platforms;
|
||||
};
|
||||
});
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
name = "uqm-3dovideo";
|
||||
|
||||
src = requireFile rec {
|
||||
name = "videos.tar";
|
||||
sha256 = "044h0cl69r0kc43vk4n0akk0prwzb7inq324h5yfqb38sd4zkds1";
|
||||
message = ''
|
||||
In order to get the intro and ending sequences from the 3DO version, you
|
||||
need to have the original 3DO Star Control II CD. Create an image from the
|
||||
CD and use uqm3donix* to extract a tarball with the videos from it. The
|
||||
reason for this is because the 3DO uses its own proprietary disk format.
|
||||
|
||||
Save the file as videos.tar and use "nix-prefetch-url file://${name}" to
|
||||
add it to the Nix store.
|
||||
|
||||
[*] ${helper}/bin/uqm3donix CDIMAGE ${name}
|
||||
'';
|
||||
};
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -vp "$out"
|
||||
tar xf "$src" -C "$out" --strip-components=3
|
||||
cp "${videoRMP}" "$out/3dovideo.rmp"
|
||||
'';
|
||||
}
|
@ -1,9 +1,18 @@
|
||||
{stdenv, fetchurl
|
||||
{ stdenv, fetchurl
|
||||
, pkgconfig, mesa
|
||||
, SDL, SDL_image, libpng, zlib, libvorbis, libogg, libmikmod, unzip
|
||||
, use3DOVideos ? false, requireFile ? null, writeText ? null
|
||||
, fetchgit ? null, haskellPackages ? null
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
assert use3DOVideos -> requireFile != null && writeText != null
|
||||
&& fetchgit != null && haskellPackages != null;
|
||||
|
||||
let
|
||||
videos = import ./3dovideo.nix {
|
||||
inherit stdenv requireFile writeText fetchgit haskellPackages;
|
||||
};
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "uqm-${version}";
|
||||
version = "0.7.0";
|
||||
|
||||
@ -41,7 +50,9 @@ stdenv.mkDerivation rec {
|
||||
cp $content uqm-${version}/content/packages/uqm-0.7.0-content.uqm
|
||||
cp $music uqm-${version}/content/addons/uqm-0.7.0-3domusic.uqm
|
||||
cp $voice uqm-${version}/content/addons/uqm-0.7.0-voice.uqm
|
||||
'';
|
||||
'' + stdenv.lib.optionalString use3DOVideos ''
|
||||
ln -s "${videos}" "uqm-${version}/content/addons/3dovideo"
|
||||
'';
|
||||
|
||||
/* uqm has a 'unique' build system with a root script incidentally called
|
||||
* 'build.sh'. */
|
||||
@ -52,16 +63,16 @@ stdenv.mkDerivation rec {
|
||||
echo "INPUT_install_libdir_VALUE='$out/lib'" >> config.state
|
||||
echo "INPUT_install_sharedir_VALUE='$out/share'" >> config.state
|
||||
PREFIX=$out ./build.sh uqm config
|
||||
'';
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
./build.sh uqm
|
||||
'';
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
./build.sh uqm install
|
||||
sed -i $out/bin/uqm -e "s%/usr/local/games/%$out%g"
|
||||
'';
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Remake of Star Control II";
|
||||
|
Loading…
Reference in New Issue
Block a user