mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 19:21:04 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchFromBitbucket
|
|
, cmake
|
|
, pkg-config
|
|
, makeWrapper
|
|
, zlib
|
|
, bzip2
|
|
, libjpeg
|
|
, SDL2
|
|
, SDL2_net
|
|
, SDL2_mixer
|
|
, gtk3
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "ecwolf";
|
|
version = "1.4.1";
|
|
|
|
src = fetchFromBitbucket {
|
|
owner = pname;
|
|
repo = pname;
|
|
rev = version;
|
|
sha256 = "V2pSP8i20zB50WtUMujzij+ISSupdQQ/oCYYrOaTU1g=";
|
|
};
|
|
|
|
nativeBuildInputs = [ cmake pkg-config ]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper ];
|
|
buildInputs = [ zlib bzip2 libjpeg SDL2 SDL2_net SDL2_mixer gtk3 ];
|
|
|
|
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-framework AppKit";
|
|
|
|
# ECWolf installs its binary to the games/ directory, but Nix only adds bin/
|
|
# directories to the PATH.
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
mv "$out/games" "$out/bin"
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
mkdir -p $out/{Applications,bin}
|
|
cp -R ecwolf.app $out/Applications
|
|
makeWrapper $out/{Applications/ecwolf.app/Contents/MacOS,bin}/ecwolf
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Enhanched SDL-based port of Wolfenstein 3D for various platforms";
|
|
mainProgram = "ecwolf";
|
|
homepage = "https://maniacsvault.net/ecwolf/";
|
|
license = licenses.gpl2Plus;
|
|
maintainers = with maintainers; [ jayman2000 sander ];
|
|
platforms = platforms.all;
|
|
};
|
|
}
|