depot/third_party/nixpkgs/pkgs/by-name/al/alephone/package.nix
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

170 lines
3.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
lib,
stdenv,
fetchurl,
fetchpatch2,
alsa-lib,
boost,
curl,
ffmpeg_4,
icoutils,
libGLU,
libmad,
libogg,
libpng,
libsndfile,
libvorbis,
lua,
makeDesktopItem,
makeWrapper,
miniupnpc,
openal,
pkg-config,
SDL2,
SDL2_image,
SDL2_net,
SDL2_ttf,
speex,
unzip,
zlib,
zziplib,
alephone,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
outputs = [
"out"
"icons"
];
pname = "alephone";
version = "1.8.1";
src = fetchurl {
url =
let
date = "20240513";
in
"https://github.com/Aleph-One-Marathon/alephone/releases/download/release-${date}/AlephOne-${date}.tar.bz2";
sha256 = "sha256-IUvMfG4jtN/QXq4DQIDuI0+Bl3MSSwDGKOyjfcRWgvE=";
};
patches = [
# Fix build with miniupnpc 2.2.8
# https://github.com/Aleph-One-Marathon/alephone/pull/503
(fetchpatch2 {
url = "https://github.com/Aleph-One-Marathon/alephone/commit/e25c4bc1ac02619e811b8f19bf4c2f617550e124.patch?full_index=1";
hash = "sha256-BFLLSTjNl/+/kVb+t6EyW1jhAlKN/G+Q99TICV9VHOY=";
})
];
nativeBuildInputs = [
pkg-config
icoutils
];
buildInputs = [
alsa-lib
boost
curl
ffmpeg_4
libGLU
libmad
libogg
libpng
libsndfile
libvorbis
lua
miniupnpc
openal
SDL2
SDL2_image
SDL2_net
SDL2_ttf
speex
zlib
zziplib
];
configureFlags = [ "--with-boost-libdir=${boost.out}/lib" ];
makeFlags = [ "AR:=$(AR)" ];
enableParallelBuilding = true;
postInstall = ''
mkdir $icons
icotool -x -i 5 -o $icons Resources/Windows/*.ico
pushd $icons
for x in *_5_48x48x32.png; do
mv $x ''${x%_5_48x48x32.png}.png
done
popd
'';
passthru.tests.version =
# test that the version is correct
testers.testVersion { package = alephone; };
meta = {
description = "Aleph One is the open source continuation of Bungies Marathon 2 game engine";
mainProgram = "alephone";
homepage = "https://alephone.lhowon.org/";
license = [ lib.licenses.gpl3 ];
maintainers = with lib.maintainers; [ ehmry ];
platforms = lib.platforms.linux;
};
passthru.makeWrapper =
{
pname,
desktopName,
version,
zip,
meta,
icon ? alephone.icons + "/alephone.png",
...
}@extraArgs:
stdenv.mkDerivation (
{
inherit pname version;
desktopItem = makeDesktopItem {
name = desktopName;
exec = pname;
genericName = pname;
categories = [ "Game" ];
comment = meta.description;
inherit desktopName icon;
};
src = zip;
nativeBuildInputs = [
makeWrapper
unzip
];
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/bin $out/data/$pname $out/share/applications
cp -a * $out/data/$pname
cp $desktopItem/share/applications/* $out/share/applications
makeWrapper ${alephone}/bin/alephone $out/bin/$pname \
--add-flags $out/data/$pname
'';
}
// extraArgs
// {
meta =
alephone.meta
// {
license = lib.licenses.free;
mainProgram = pname;
hydraPlatforms = [ ];
}
// meta;
}
);
})