mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-19 11:23:29 +00:00
openarena: compile from sources
- Add desktop item - Use `finalAttrs` pattern - Sort attributes and parameters naturally - Update license - Add `meta.mainProgram` attribute - Add `drupol` as maintainer
This commit is contained in:
parent
30683ca1d4
commit
758b6fa94b
@ -1,43 +1,122 @@
|
|||||||
{ lib, fetchurl, makeWrapper, patchelf, pkgs, stdenv, SDL, libglvnd, libogg, libvorbis, curl, openal }:
|
{ lib
|
||||||
|
, fetchzip
|
||||||
|
, fetchFromGitHub
|
||||||
|
, stdenv
|
||||||
|
, fetchpatch
|
||||||
|
, copyDesktopItems
|
||||||
|
, curl
|
||||||
|
, makeBinaryWrapper
|
||||||
|
, pkg-config
|
||||||
|
, which
|
||||||
|
, freetype
|
||||||
|
, libglvnd
|
||||||
|
, libogg
|
||||||
|
, libvorbis
|
||||||
|
, libxmp
|
||||||
|
, openal
|
||||||
|
, SDL2
|
||||||
|
, speex
|
||||||
|
, makeDesktopItem
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
let
|
||||||
pname = "openarena";
|
openarena-maps = fetchzip {
|
||||||
version = "0.8.8";
|
name = "openarena-maps";
|
||||||
|
url = "https://download.tuxfamily.org/openarena/rel/088/openarena-0.8.8.zip";
|
||||||
src = fetchurl {
|
hash = "sha256-Rup1n14k9sKcyVFYzFqPYV+BEBCnUNwpnFsnyGrhl20=";
|
||||||
name = "openarena.zip";
|
|
||||||
url = "http://openarena.ws/request.php?4";
|
|
||||||
sha256 = "0jmc1cmdz1rcvqc9ilzib1kilpwap6v0d331l6q53wsibdzsz3ss";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgs.unzip patchelf makeWrapper];
|
openarena-source = fetchFromGitHub {
|
||||||
|
name = "openarena-source";
|
||||||
|
owner = "OpenArena";
|
||||||
|
repo = "engine";
|
||||||
|
rev = "075cb860a4d2bc43e75e5f506eba7da877708aba";
|
||||||
|
hash = "sha256-ofQKQyS3ti5TSN+zqwPFYuJiB9kvdER6zTWn8yrOpQU=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "openarena";
|
||||||
|
version = "unstable-2023-03-02";
|
||||||
|
|
||||||
installPhase = let
|
srcs = [
|
||||||
gameDir = "$out/openarena-$version";
|
openarena-source
|
||||||
interpreter = "$(< \"$NIX_CC/nix-support/dynamic-linker\")";
|
openarena-maps
|
||||||
libPath = lib.makeLibraryPath [ SDL libglvnd libogg libvorbis curl openal ];
|
];
|
||||||
arch = {
|
|
||||||
"x86_64-linux" = "x86_64";
|
|
||||||
"i386-linux" = "i386";
|
|
||||||
}.${stdenv.hostPlatform.system};
|
|
||||||
in ''
|
|
||||||
mkdir -pv $out/bin
|
|
||||||
cd $out
|
|
||||||
unzip $src
|
|
||||||
|
|
||||||
patchelf --set-interpreter "${interpreter}" "${gameDir}/openarena.${arch}"
|
sourceRoot = "openarena-source";
|
||||||
patchelf --set-interpreter "${interpreter}" "${gameDir}/oa_ded.${arch}"
|
|
||||||
|
|
||||||
makeWrapper "${gameDir}/openarena.${arch}" "$out/bin/openarena" \
|
patches = [
|
||||||
--prefix LD_LIBRARY_PATH : "${libPath}"
|
# Fix Makefile `copyFiles` target
|
||||||
makeWrapper "${gameDir}/oa_ded.${arch}" "$out/bin/oa_ded"
|
# Related upstream issue: https://github.com/OpenArena/engine/issues/83
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/OpenArena/engine/commit/f2b424bd332e90a1e2592edd21c62bdb8cd05214.patch";
|
||||||
|
hash = "sha256-legiXLtZAeG2t1esiBa37qkAgxPJVM7JLhjpxGUmWCo=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
copyDesktopItems
|
||||||
|
curl
|
||||||
|
makeBinaryWrapper
|
||||||
|
pkg-config
|
||||||
|
which
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
freetype
|
||||||
|
libglvnd
|
||||||
|
libogg
|
||||||
|
libvorbis
|
||||||
|
libxmp
|
||||||
|
openal
|
||||||
|
SDL2
|
||||||
|
speex
|
||||||
|
];
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
makeFlags = [
|
||||||
|
"USE_INTERNAL_LIBS=0"
|
||||||
|
"USE_FREETYPE=1"
|
||||||
|
"USE_OPENAL_DLOPEN=0"
|
||||||
|
"USE_CURL_DLOPEN=0"
|
||||||
|
"ARCH=${stdenv.hostPlatform.linuxArch}"
|
||||||
|
];
|
||||||
|
|
||||||
|
installTargets = [ "copyfiles" ];
|
||||||
|
installFlags = [ "COPYDIR=$(out)/share/openarena" ];
|
||||||
|
|
||||||
|
preInstall = ''
|
||||||
|
mkdir -p $out/share/openarena
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
install -Dm644 misc/quake3.svg $out/share/icons/hicolor/scalable/apps/openarena.svg
|
||||||
|
|
||||||
|
makeWrapper $out/share/openarena/openarena.* $out/bin/openarena
|
||||||
|
makeWrapper $out/share/openarena/oa_ded.* $out/bin/oa_ded
|
||||||
|
|
||||||
|
ln -s ${openarena-maps}/baseoa $out/share/openarena/baseoa
|
||||||
|
ln -s ${openarena-maps}/missionpack $out/share/openarena/missionpack
|
||||||
|
'';
|
||||||
|
|
||||||
|
desktopItems = [
|
||||||
|
(makeDesktopItem {
|
||||||
|
name = "OpenArena";
|
||||||
|
exec = "openarena";
|
||||||
|
icon = "openarena";
|
||||||
|
comment = "A fast-paced 3D first-person shooter, similar to id Software Inc.'s Quake III Arena";
|
||||||
|
desktopName = "openarena";
|
||||||
|
categories = [ "Game" "ActionGame" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Crossplatform openarena client";
|
description = "A fast-paced 3D first-person shooter, similar to id Software Inc.'s Quake III Arena";
|
||||||
homepage = "http://openarena.ws/";
|
homepage = "http://openarena.ws/";
|
||||||
maintainers = [ lib.maintainers.wyvie ];
|
license = lib.licenses.gpl2Plus;
|
||||||
platforms = [ "i386-linux" "x86_64-linux" ];
|
mainProgram = "openarena";
|
||||||
license = lib.licenses.gpl2;
|
maintainers = with lib.maintainers; [ drupol wyvie ];
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user