Merge pull request #284626 from numinit/armagetronad-unstable-updates

armagetronad.*: 0.2.9.1.1 -> 0.2.9.2.3
This commit is contained in:
Sandro 2024-03-24 22:14:33 +01:00 committed by GitHub
commit 60f419e047
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 85 additions and 64 deletions

View file

@ -1,4 +1,9 @@
import ./make-test-python.nix ({ pkgs, ...} : { system ? builtins.currentSystem,
config ? {},
pkgs ? import ../.. { inherit system config; }
}:
with import ../lib/testing-python.nix { inherit system pkgs; };
let let
user = "alice"; user = "alice";
@ -16,7 +21,8 @@ let
test-support.displayManager.auto.user = user; test-support.displayManager.auto.user = user;
}; };
in { in
makeTest {
name = "armagetronad"; name = "armagetronad";
meta = with pkgs.lib.maintainers; { meta = with pkgs.lib.maintainers; {
maintainers = [ numinit ]; maintainers = [ numinit ];
@ -269,4 +275,4 @@ in {
srv.node.wait_until_fails(f"ss --numeric --udp --listening | grep -q {srv.port}") srv.node.wait_until_fails(f"ss --numeric --udp --listening | grep -q {srv.port}")
''; '';
}) }

View file

@ -21,6 +21,7 @@
, libpng , libpng
, libxml2 , libxml2
, protobuf , protobuf
, xvfb-run
, dedicatedServer ? false , dedicatedServer ? false
}: }:
@ -28,64 +29,69 @@ let
latestVersionMajor = "0.2.9"; latestVersionMajor = "0.2.9";
unstableVersionMajor = "0.4"; unstableVersionMajor = "0.4";
latestCommonBuildInputs = [ SDL SDL_image SDL_mixer libpng ]; srcs =
let
unstableCommonBuildInputs = [ SDL2 SDL2_image SDL2_mixer glew ftgl freetype ]; fetchArmagetron = rev: hash:
unstableCommonNativeBuildInputs = [ SDL ]; # for sdl-config fetchFromGitLab {
srcs = {
${latestVersionMajor} = rec {
version = "${latestVersionMajor}.1.1";
src = fetchFromGitLab {
owner = "armagetronad"; owner = "armagetronad";
repo = "armagetronad"; repo = "armagetronad";
rev = "v${version}"; inherit rev hash;
sha256 = "tvmKGqzH8IYTSeahc8XmN3RV+GdE5GsP8pAlwG8Ph3M="; };
in
{
# https://gitlab.com/armagetronad/armagetronad/-/tags
${latestVersionMajor} =
let
version = "${latestVersionMajor}.2.3";
rev = "v${version}";
hash = "sha256-lfYJ3luGK9hB0aiiBiJIqq5ddANqGaVtKXckbo4fl2g=";
in dedicatedServer: {
inherit version;
src = fetchArmagetron rev hash;
extraBuildInputs = lib.optionals (!dedicatedServer) [ libpng SDL SDL_image SDL_mixer ];
}; };
extraBuildInputs = latestCommonBuildInputs;
};
# https://gitlab.com/armagetronad/armagetronad/-/commits/trunk/?ref_type=heads
${unstableVersionMajor} = ${unstableVersionMajor} =
let let
rev = "4bf6245a668ce181cd464b767ce436a6b7bf8506"; rev = "e7f41fd26363e7c6a72f0c673470ed06ab54ae08";
in hash = "sha256-Uxxk6L7WPxKYQ4CNxWwEtvbZjK8BqYNTuwwdleZ44Ro=";
{ in dedicatedServer: {
version = "${unstableVersionMajor}-${builtins.substring 0 8 rev}"; version = "${unstableVersionMajor}-${builtins.substring 0 8 rev}";
src = fetchFromGitLab { src = fetchArmagetron rev hash;
owner = "armagetronad"; extraBuildInputs = [ protobuf boost ]
repo = "armagetronad"; ++ lib.optionals (!dedicatedServer) [ glew ftgl freetype SDL2 SDL2_image SDL2_mixer ];
inherit rev; extraNativeBuildInputs = [ bison ];
sha256 = "cpJmQHCS6asGasD7anEgNukG9hRXpsIJZrCr3Q7uU4I="; extraNativeInstallCheckInputs = lib.optionals (!dedicatedServer) [ xvfb-run ];
};
extraBuildInputs = [ protobuf boost ] ++ unstableCommonBuildInputs;
extraNativeBuildInputs = [ bison ] ++ unstableCommonNativeBuildInputs;
}; };
# https://gitlab.com/armagetronad/armagetronad/-/commits/hack-0.2.8-sty+ct+ap/?ref_type=heads
"${latestVersionMajor}-sty+ct+ap" = "${latestVersionMajor}-sty+ct+ap" =
let let
rev = "fdfd5fb97083aed45467385b96d50d87669e4023"; rev = "a5bffe9dda2b43d330433f76f14eb374701f326a";
in hash = "sha256-cNABxfg3MSmbxU/R78QyPOMwXGqJEamaFOPNw5yhDGE=";
{ in dedicatedServer: {
version = "${latestVersionMajor}-sty+ct+ap-${builtins.substring 0 8 rev}"; version = "${latestVersionMajor}-sty+ct+ap-${builtins.substring 0 8 rev}";
src = fetchFromGitLab { src = fetchArmagetron rev hash;
owner = "armagetronad"; extraBuildInputs = lib.optionals (!dedicatedServer) [ libpng SDL SDL_image SDL_mixer ];
repo = "armagetronad";
inherit rev;
sha256 = "UDbe7DiMLzNFAs4C6BbnmdEjqSltSbnk/uQfNOLGAfo=";
};
extraBuildInputs = latestCommonBuildInputs;
extraNativeBuildInputs = [ python3 ];
}; };
}; };
mkArmagetron = { version, src, dedicatedServer ? false, extraBuildInputs ? [ ], extraNativeBuildInputs ? [ ] }@params: # Creates an Armagetron build. Takes a function returning build inputs for a particular value of dedicatedServer.
mkArmagetron = fn: dedicatedServer:
let let
# Compute the build params.
resolvedParams = fn dedicatedServer;
# Figure out the binary name depending on whether this is a dedicated server.
mainProgram = if dedicatedServer then "armagetronad-dedicated" else "armagetronad";
# Split the version into the major and minor parts # Split the version into the major and minor parts
versionParts = lib.splitString "-" version; versionParts = lib.splitString "-" resolvedParams.version;
splitVersion = lib.splitVersion (builtins.elemAt versionParts 0); splitVersion = lib.splitVersion (builtins.elemAt versionParts 0);
majorVersion = builtins.concatStringsSep "." (lib.lists.take 2 splitVersion); majorVersion = builtins.concatStringsSep "." (lib.lists.take 2 splitVersion);
minorVersionPart = parts: sep: expectedSize: minorVersionPart = parts: sep: expectedSize:
if builtins.length parts > expectedSize then if builtins.length parts > expectedSize then
sep + (builtins.concatStringsSep sep (lib.lists.drop expectedSize parts)) sep + (builtins.concatStringsSep sep (lib.lists.drop expectedSize parts))
else else
@ -93,9 +99,9 @@ let
minorVersion = (minorVersionPart splitVersion "." 2) + (minorVersionPart versionParts "-" 1) + "-nixpkgs"; minorVersion = (minorVersionPart splitVersion "." 2) + (minorVersionPart versionParts "-" 1) + "-nixpkgs";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation {
pname = if dedicatedServer then "armagetronad-dedicated" else "armagetronad"; pname = mainProgram;
inherit version src; inherit (resolvedParams) version src;
# Build works fine; install has a race. # Build works fine; install has a race.
enableParallelBuilding = true; enableParallelBuilding = true;
@ -124,10 +130,13 @@ let
] ++ lib.optional dedicatedServer "--enable-dedicated" ] ++ lib.optional dedicatedServer "--enable-dedicated"
++ lib.optional (!dedicatedServer) "--enable-music"; ++ lib.optional (!dedicatedServer) "--enable-music";
buildInputs = [ libxml2 ] ++ extraBuildInputs; buildInputs = [ libxml2 ]
++ (resolvedParams.extraBuildInputs or []);
nativeBuildInputs = [ autoconf automake gnum4 pkg-config which python3 ] nativeBuildInputs = [ autoconf automake gnum4 pkg-config which python3 ]
++ extraNativeBuildInputs; ++ (resolvedParams.extraNativeBuildInputs or []);
nativeInstallCheckInputs = resolvedParams.extraNativeInstallCheckInputs or [];
postInstall = lib.optionalString (!dedicatedServer) '' postInstall = lib.optionalString (!dedicatedServer) ''
mkdir -p $out/share/{applications,icons/hicolor} mkdir -p $out/share/{applications,icons/hicolor}
@ -139,16 +148,21 @@ let
installCheckPhase = '' installCheckPhase = ''
export XDG_RUNTIME_DIR=/tmp export XDG_RUNTIME_DIR=/tmp
bin="$out/bin/${pname}" bin="$out/bin/${mainProgram}"
version="$("$bin" --version || true)" if command -v xvfb-run &>/dev/null; then
prefix="$("$bin" --prefix || true)" run="xvfb-run $bin"
rubber="$("$bin" --doc | grep -m1 CYCLE_RUBBER)" else
run="$bin"
fi
version="$($run --version || true)"
prefix="$($run --prefix || true)"
rubber="$($run --doc | grep -m1 CYCLE_RUBBER)"
echo "Version: $version" >&2 echo "Version: $version" >&2
echo "Prefix: $prefix" >&2 echo "Prefix: $prefix" >&2
echo "Docstring: $rubber" >&2 echo "Docstring: $rubber" >&2
if [[ "$version" != *"${version}"* ]] || \ if [[ "$version" != *"${resolvedParams.version}"* ]] || \
[ "$prefix" != "$out" ] || \ [ "$prefix" != "$out" ] || \
[[ ! "$rubber" =~ ^CYCLE_RUBBER[[:space:]]+Niceness[[:space:]]factor ]]; then [[ ! "$rubber" =~ ^CYCLE_RUBBER[[:space:]]+Niceness[[:space:]]factor ]]; then
exit 1 exit 1
@ -160,27 +174,28 @@ let
# No passthru, end of the line. # No passthru, end of the line.
# https://www.youtube.com/watch?v=NOMa56y_Was # https://www.youtube.com/watch?v=NOMa56y_Was
} }
else if (version != srcs.${latestVersionMajor}.version) then { else if (resolvedParams.version != (srcs.${latestVersionMajor} dedicatedServer).version) then {
# Allow a "dedicated" passthru for versions other than the default. # Allow a "dedicated" passthru for versions other than the default.
dedicated = mkArmagetron (params // { dedicated = mkArmagetron fn true;
dedicatedServer = true;
});
} }
else (lib.mapAttrs (name: value: mkArmagetron value) (lib.filterAttrs (name: value: value.version != srcs.${latestVersionMajor}.version) srcs)) // { else
# Allow both a "dedicated" passthru and a passthru for all the options other than the latest version, which this is. (
dedicated = mkArmagetron (params // { lib.mapAttrs (name: value: mkArmagetron value dedicatedServer)
dedicatedServer = true; (lib.filterAttrs (name: value: (value dedicatedServer).version != (srcs.${latestVersionMajor} dedicatedServer).version) srcs)
}); ) //
}; {
# Allow both a "dedicated" passthru and a passthru for all the options other than the latest version, which this is.
dedicated = mkArmagetron fn true;
};
meta = with lib; { meta = with lib; {
homepage = "http://armagetronad.org"; inherit mainProgram;
homepage = "https://www.armagetronad.org";
description = "A multiplayer networked arcade racing game in 3D similar to Tron"; description = "A multiplayer networked arcade racing game in 3D similar to Tron";
mainProgram = "armagetronad-dedicated";
maintainers = with maintainers; [ numinit ]; maintainers = with maintainers; [ numinit ];
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
platforms = platforms.linux; platforms = platforms.linux;
}; };
}; };
in in
mkArmagetron (srcs.${latestVersionMajor} // { inherit dedicatedServer; }) mkArmagetron srcs.${latestVersionMajor} dedicatedServer