teeworlds: build on macOS

Luflosi 38cb19ac 0289bacd

+73 -5
+37 -4
pkgs/games/teeworlds/default.nix
··· 1 1 { fetchFromGitHub, lib, stdenv, cmake, pkg-config, python3, alsa-lib 2 2 , libX11, libGLU, SDL2, lua5_3, zlib, freetype, wavpack, icoutils 3 3 , nixosTests 4 + , Carbon 5 + , Cocoa 4 6 }: 5 7 6 8 stdenv.mkDerivation rec { ··· 15 17 fetchSubmodules = true; 16 18 }; 17 19 20 + patches = [ 21 + # Can't use fetchpatch or fetchpatch2 because of https://github.com/NixOS/nixpkgs/issues/32084 22 + # Using fetchurl instead is also not a good idea, see https://github.com/NixOS/nixpkgs/issues/32084#issuecomment-727223713 23 + ./rename-VERSION-to-VERSION.txt.patch 24 + ]; 25 + 18 26 postPatch = '' 19 27 # set compiled-in DATA_DIR so resources can be found 20 28 substituteInPlace src/engine/shared/storage.cpp \ 21 29 --replace '#define DATA_DIR "data"' \ 22 30 '#define DATA_DIR "${placeholder "out"}/share/teeworlds/data"' 31 + 32 + # Quote nonsense is a workaround for https://github.com/NixOS/nix/issues/661 33 + substituteInPlace 'other/bundle/client/Info.plist.in' \ 34 + --replace ${"'"}''${TARGET_CLIENT}' 'teeworlds' \ 35 + --replace ${"'"}''${PROJECT_VERSION}' '${version}' 23 36 ''; 24 37 25 - nativeBuildInputs = [ cmake pkg-config icoutils ]; 38 + nativeBuildInputs = [ 39 + cmake 40 + pkg-config 41 + ] ++ lib.optionals stdenv.isLinux [ 42 + icoutils 43 + ]; 26 44 27 45 buildInputs = [ 28 - python3 alsa-lib libX11 libGLU SDL2 lua5_3 zlib freetype wavpack 46 + python3 libGLU SDL2 lua5_3 zlib freetype wavpack 47 + ] ++ lib.optionals stdenv.isLinux [ 48 + alsa-lib 49 + libX11 50 + ] ++ lib.optionals stdenv.isDarwin [ 51 + Carbon 52 + Cocoa 29 53 ]; 30 54 31 - postInstall = '' 55 + postInstall = lib.optionalString stdenv.isLinux '' 32 56 # Convert and install desktop icon 33 57 mkdir -p $out/share/pixmaps 34 58 icotool --extract --index 1 --output $out/share/pixmaps/teeworlds.png $src/other/icons/teeworlds.ico 35 59 36 60 # Install menu item 37 61 install -D $src/other/teeworlds.desktop $out/share/applications/teeworlds.desktop 62 + '' + lib.optionalString stdenv.isDarwin '' 63 + mkdir -p "$out/Applications/teeworlds.app/Contents/MacOS" 64 + mkdir -p "$out/Applications/teeworlds.app/Contents/Resources" 65 + 66 + cp '../other/icons/teeworlds.icns' "$out/Applications/teeworlds.app/Contents/Resources/" 67 + cp '../other/bundle/client/Info.plist.in' "$out/Applications/teeworlds.app/Contents/Info.plist" 68 + cp '../other/bundle/client/PkgInfo' "$out/Applications/teeworlds.app/Contents/" 69 + ln -s "$out/bin/teeworlds" "$out/Applications/teeworlds.app/Contents/MacOS/" 70 + ln -s "$out/share/teeworlds/data" "$out/Applications/teeworlds.app/Contents/Resources/data" 38 71 ''; 39 72 40 73 passthru.tests.teeworlds = nixosTests.teeworlds; ··· 52 85 homepage = "https://teeworlds.com/"; 53 86 license = "BSD-style, see `license.txt'"; 54 87 maintainers = with lib.maintainers; [ astsmtl Luflosi ]; 55 - platforms = lib.platforms.linux; 88 + platforms = lib.platforms.unix; 56 89 }; 57 90 }
+33
pkgs/games/teeworlds/rename-VERSION-to-VERSION.txt.patch
··· 1 + From 86d6687ef07f7f05457a7f67537b650656b13820 Mon Sep 17 00:00:00 2001 2 + From: =?UTF-8?q?Robert=20M=C3=BCller?= <robert.mueller@uni-siegen.de> 3 + Date: Fri, 15 Oct 2021 23:45:50 +0200 4 + Subject: [PATCH] rename VERSION to VERSION.txt: 5 + 6 + Fixes compilation on systems with case insensitive file names where the standard library includes the version file source code. 7 + --- 8 + src/engine/external/json-parser/{VERSION => VERSION.txt} | 0 9 + src/engine/external/pnglite/{VERSION => VERSION.txt} | 0 10 + src/engine/external/wavpack/{VERSION => VERSION.txt} | 0 11 + src/engine/external/zlib/{VERSION => VERSION.txt} | 0 12 + 4 files changed, 0 insertions(+), 0 deletions(-) 13 + rename src/engine/external/json-parser/{VERSION => VERSION.txt} (100%) 14 + rename src/engine/external/pnglite/{VERSION => VERSION.txt} (100%) 15 + rename src/engine/external/wavpack/{VERSION => VERSION.txt} (100%) 16 + rename src/engine/external/zlib/{VERSION => VERSION.txt} (100%) 17 + 18 + diff --git a/src/engine/external/json-parser/VERSION b/src/engine/external/json-parser/VERSION.txt 19 + similarity index 100% 20 + rename from src/engine/external/json-parser/VERSION 21 + rename to src/engine/external/json-parser/VERSION.txt 22 + diff --git a/src/engine/external/pnglite/VERSION b/src/engine/external/pnglite/VERSION.txt 23 + similarity index 100% 24 + rename from src/engine/external/pnglite/VERSION 25 + rename to src/engine/external/pnglite/VERSION.txt 26 + diff --git a/src/engine/external/wavpack/VERSION b/src/engine/external/wavpack/VERSION.txt 27 + similarity index 100% 28 + rename from src/engine/external/wavpack/VERSION 29 + rename to src/engine/external/wavpack/VERSION.txt 30 + diff --git a/src/engine/external/zlib/VERSION b/src/engine/external/zlib/VERSION.txt 31 + similarity index 100% 32 + rename from src/engine/external/zlib/VERSION 33 + rename to src/engine/external/zlib/VERSION.txt
+3 -1
pkgs/top-level/all-packages.nix
··· 35402 35402 35403 35403 teetertorture = callPackage ../games/teetertorture { }; 35404 35404 35405 - teeworlds = callPackage ../games/teeworlds { }; 35405 + teeworlds = callPackage ../games/teeworlds { 35406 + inherit (darwin.apple_sdk.frameworks) Carbon Cocoa; 35407 + }; 35406 35408 35407 35409 tengine = callPackage ../servers/http/tengine { 35408 35410 openssl = openssl_1_1;