Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

teeworlds: fix build on Darwin #270905

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

@jtbx jtbx Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this dependency isn't needed for the server it should be put in the lib.optionals buildClient list.

edit: did not read the commit message, looks good

] ++ 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 @@ -38490,7 +38490,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