Skip to content

Commit

Permalink
Merge pull request #270905 from Luflosi/fix-teeworlds-on-darwin
Browse files Browse the repository at this point in the history
teeworlds: fix build on Darwin
  • Loading branch information
wegank authored Nov 29, 2023
2 parents a32e8d5 + db5b387 commit b26d582
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions pkgs/games/teeworlds/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ fetchFromGitHub, lib, stdenv, cmake, pkg-config, python3, alsa-lib
, libX11, libGLU, SDL2, lua5_3, zlib, freetype, wavpack, icoutils
, nixosTests
, Carbon
, Cocoa
, buildClient ? true
}:
Expand Down Expand Up @@ -34,6 +33,14 @@ stdenv.mkDerivation rec {
substituteInPlace 'other/bundle/client/Info.plist.in' \
--replace ${"'"}''${TARGET_CLIENT}' 'teeworlds' \
--replace ${"'"}''${PROJECT_VERSION}' '${version}'
# Make sure some bundled dependencies are actually unbundled.
# This will fail compilation if one of these dependencies could not
# be found, instead of falling back to the bundled version.
rm -rf 'src/engine/external/wavpack/'
rm -rf 'src/engine/external/zlib/'
# md5, pnglite and json-parser (https://github.com/udp/json-parser)
# don't seem to be packaged in Nixpkgs, so don't unbundle them.
'';

nativeBuildInputs = [
Expand All @@ -45,17 +52,16 @@ stdenv.mkDerivation rec {

buildInputs = [
python3 lua5_3 zlib
wavpack
] ++ lib.optionals stdenv.isDarwin [
Cocoa
] ++ lib.optionals buildClient ([
libGLU
SDL2
freetype
wavpack
] ++ lib.optionals stdenv.isLinux [
libGLU
alsa-lib
libX11
] ++ lib.optionals stdenv.isDarwin [
Carbon
Cocoa
]);

cmakeFlags = [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38463,7 +38463,7 @@ with pkgs;
teetertorture = callPackage ../games/teetertorture { };

teeworlds = callPackage ../games/teeworlds {
inherit (darwin.apple_sdk.frameworks) Carbon Cocoa;
inherit (darwin.apple_sdk.frameworks) Cocoa;
};
teeworlds-server = teeworlds.override { buildClient = false; };

Expand Down

0 comments on commit b26d582

Please sign in to comment.