From d2111b0cbb97e07d7f3f30b663d02448657dbe14 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Mon, 3 Jun 2024 23:10:37 -0700 Subject: [PATCH 1/7] dfhack: 50.13-r1.1 -> 50.13-r2.1 --- pkgs/games/dwarf-fortress/dfhack/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/games/dwarf-fortress/dfhack/default.nix b/pkgs/games/dwarf-fortress/dfhack/default.nix index 96a5dac52540..31cc277e770c 100644 --- a/pkgs/games/dwarf-fortress/dfhack/default.nix +++ b/pkgs/games/dwarf-fortress/dfhack/default.nix @@ -90,9 +90,9 @@ let xmlRev = "980b1af13acc31660dce632f913c968f52e2b275"; }; "50.13" = { - dfHackRelease = "50.13-r1.1"; - hash = "sha256-FiXanXflszTr4ogz+EoDAUxzE2U9ODeZIJJ1u6Xm4Mo="; - xmlRev = "3507715fd07340de5a6c47064220f6e17343e5d5"; + dfHackRelease = "50.13-r2.1"; + hash = "sha256-IcjDDZX9YSLzympNc++1Xl85cK/0ASVDvzeNaebYNTQ="; + xmlRev = "c5debb15f696c3d1cb3706e2eb201eccef64f61a"; }; }; From 880bea37bdba456116086eacb045cf914bda9008 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Mon, 3 Jun 2024 23:24:09 -0700 Subject: [PATCH 2/7] dwarf-fortress: fix eval on darwin --- pkgs/games/dwarf-fortress/default.nix | 6 ++++-- pkgs/games/dwarf-fortress/game.nix | 4 ++-- pkgs/games/dwarf-fortress/wrapper/default.nix | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix index acf50d650c49..e5bbf60e1550 100644 --- a/pkgs/games/dwarf-fortress/default.nix +++ b/pkgs/games/dwarf-fortress/default.nix @@ -49,7 +49,9 @@ let # The latest Dwarf Fortress version. Maintainers: when a new version comes # out, ensure that (unfuck|dfhack|twbt) are all up to date before changing # this. Note that unfuck and twbt are not required for 50. - latestVersion = "50.13"; + latestVersion = if stdenv.isLinux then "50.13" + else if stdenv.isDarwin then "0.47.05" + else throw "Unsupported system"; # Converts a version to a package name. versionToName = version: "dwarf-fortress_${replaceStrings ["."] ["_"] version}"; @@ -62,7 +64,7 @@ let let isAtLeast50 = versionAtLeast dfVersion "50.0"; - dwarf-fortress-unfuck = optionalAttrs (!isAtLeast50) (callPackage ./unfuck.nix { inherit dfVersion; }); + dwarf-fortress-unfuck = optionalAttrs (!isAtLeast50 && stdenv.isLinux) (callPackage ./unfuck.nix { inherit dfVersion; }); dwarf-fortress = callPackage ./game.nix { inherit dfVersion; diff --git a/pkgs/games/dwarf-fortress/game.nix b/pkgs/games/dwarf-fortress/game.nix index 6e8467e55df9..121091c5f216 100644 --- a/pkgs/games/dwarf-fortress/game.nix +++ b/pkgs/games/dwarf-fortress/game.nix @@ -53,7 +53,7 @@ let patchVersion = elemAt dfVersionTuple (dfVersionBaseIndex + 1); isAtLeast50 = baseVersion >= 50; - enableUnfuck = !isAtLeast50 && dwarf-fortress-unfuck != null; + enableUnfuck = !isAtLeast50 && dwarf-fortress-unfuck != null && (dwarf-fortress-unfuck.dfVersion or null) == dfVersion; game = if hasAttr dfVersion df-hashes @@ -95,7 +95,7 @@ stdenv.mkDerivation { fi ''; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = optional stdenv.isLinux autoPatchelfHook; buildInputs = optionals isAtLeast50 [ SDL2 SDL2_image SDL2_mixer ] ++ optional (!isAtLeast50) SDL ++ optional enableUnfuck dwarf-fortress-unfuck diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix index 2dd771ee922d..daa27ce5dc00 100644 --- a/pkgs/games/dwarf-fortress/wrapper/default.nix +++ b/pkgs/games/dwarf-fortress/wrapper/default.nix @@ -197,8 +197,8 @@ stdenv.mkDerivation rec { chmod 755 $out/bin/soundsense ''; - doInstallCheck = true; - nativeInstallCheckInputs = [ expect xvfb-run ]; + doInstallCheck = stdenv.isLinux; + nativeInstallCheckInputs = lib.optionals stdenv.isLinux [ expect xvfb-run ]; installCheckPhase = let commonExpectStatements = fmod: lib.optionalString isAtLeast50 '' From 3b7edb3eed3f4e38a3890bcae352bd02e988d03b Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Thu, 6 Jun 2024 13:07:21 -0700 Subject: [PATCH 3/7] dwarf-fortress: run postUnpack on darwin --- pkgs/games/dwarf-fortress/game.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/games/dwarf-fortress/game.nix b/pkgs/games/dwarf-fortress/game.nix index 121091c5f216..80d3056aae95 100644 --- a/pkgs/games/dwarf-fortress/game.nix +++ b/pkgs/games/dwarf-fortress/game.nix @@ -84,7 +84,7 @@ stdenv.mkDerivation { sourceRoot = "."; - postUnpack = optionalString stdenv.isLinux '' + postUnpack = '' directory=${ if stdenv.isLinux then "df_linux" else if stdenv.isDarwin then "df_osx" @@ -108,6 +108,9 @@ stdenv.mkDerivation { mkdir -p $out cp -r * $out + # Clean up OS X detritus in the tarball. + find $out -type f -name '._*' -exec rm -rf {} \; + # Lots of files are +x in the newer releases... find $out -type d -exec chmod 0755 {} \; find $out -type f -exec chmod 0644 {} \; @@ -116,7 +119,7 @@ stdenv.mkDerivation { [ -f $out/run_df ] && chmod +x $out/run_df # We don't need any of these since they will just break autoPatchelf on $out/hash.md5.orig From b0cf365258c849cb8823db8bacff6d87ece898ab Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Fri, 7 Jun 2024 15:09:42 -0700 Subject: [PATCH 4/7] dwarf-fortress: wrapper: fix Darwin compatibility --- .../wrapper/dwarf-fortress-init.in | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in index 61b1b4da6168..1c739a1afbbf 100644 --- a/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in +++ b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in @@ -4,18 +4,6 @@ shopt -s extglob export NIXPKGS_DF_ENV="@env@" -if [[ -v DF_DIR ]] && [ -n "$DF_DIR" ] && { [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; }; then - # Compatibility for users that were using DF_DIR, since the dfhack script clobbers this variable. - export NIXPKGS_DF_HOME="$DF_DIR" -fi - -if [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; then - export NIXPKGS_DF_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux" -fi - -# Compatibility. -export DF_DIR="$NIXPKGS_DF_HOME" - ### BEGIN: Default DF options declare -A _NIXPKGS_DF_OPTS _NIXPKGS_DF_OPTS[fmod]=0 # Don't use fmod by default. @@ -131,6 +119,30 @@ go() { exit 1 } +os_name="$(@uname@)" +os_rev="$(@uname@ -r)" + +if [ "$os_name" == Linux ]; then + df_dir="df_linux" +elif [ "$os_name" == Darwin ]; then + df_dir="df_osx" +else + log "Unknown platform: $os_name" + exit 1 +fi + +if [[ -v DF_DIR ]] && [ -n "$DF_DIR" ] && { [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; }; then + # Compatibility for users that were using DF_DIR, since the dfhack script clobbers this variable. + export NIXPKGS_DF_HOME="$DF_DIR" +fi + +if [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; then + export NIXPKGS_DF_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/$df_dir" +fi + +# Compatibility. +export DF_DIR="$NIXPKGS_DF_HOME" + @mkdir@ -p "$NIXPKGS_DF_HOME" @cat@ <&2 @@ -156,7 +168,7 @@ EOF cd "$NIXPKGS_DF_ENV" # All potential important files in DF 50 and below. -for path in dwarfort *.so libs raw data/init/* data/!(init|index|announcement); do +for path in dwarfort dwarfort.exe df *.so libs raw data/init/* data/!(init|index|announcement); do force_delete=0 if [[ "$path" == libfmod*.so* ]] && [ "${_NIXPKGS_DF_OPTS[fmod]}" -eq 0 ]; then force_delete=1 @@ -175,7 +187,12 @@ for path in index announcement help dipscript; do done # Handle library paths on Darwin. -if [ "$(@uname@)" == Darwin ]; then - export DYLD_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs" - export DYLD_FRAMEWORK_PATH="$NIXPKGS_DF_ENV/libs" +if [ "$os_name" == Darwin ]; then + if [ "${os_rev%%.*}" -ge 11 ]; then + export DYLD_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs" + export DYLD_FRAMEWORK_PATH="$NIXPKGS_DF_ENV/libs" + else + export DYLD_FALLBACK_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs" + export DYLD_FALLBACK_FRAMEWORK_PATH="$NIXPKGS_DF_ENV/libs" + fi fi From bcde7a9d681a44873272fa3edb1ccd598621ef88 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Sat, 15 Jun 2024 18:54:53 -0700 Subject: [PATCH 5/7] dwarf-fortress: darwin libs --- pkgs/games/dwarf-fortress/game.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/games/dwarf-fortress/game.nix b/pkgs/games/dwarf-fortress/game.nix index 80d3056aae95..42b68356020f 100644 --- a/pkgs/games/dwarf-fortress/game.nix +++ b/pkgs/games/dwarf-fortress/game.nix @@ -2,6 +2,8 @@ , lib , fetchurl , SDL +, SDL_image +, SDL_ttf , SDL2 , SDL2_image , SDL2_mixer @@ -119,7 +121,7 @@ stdenv.mkDerivation { [ -f $out/run_df ] && chmod +x $out/run_df # We don't need any of these since they will just break autoPatchelf on $out/hash.md5.orig @@ -132,6 +134,7 @@ stdenv.mkDerivation { ln -s ${getLib ncurses}/lib/libncurses.dylib $out/libs ln -s ${getLib gcc.cc}/lib/libstdc++.6.dylib $out/libs + ln -s ${getLib gcc.cc}/lib/libgcc_s.1.dylib $out/libs ln -s ${getLib fmodex}/lib/libfmodex.dylib $out/libs install_name_tool \ From 37cd3a3f20ffba3666b3dba31a8efb01b1e24c54 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Sat, 15 Jun 2024 22:43:25 -0700 Subject: [PATCH 6/7] dwarf-fortress: remove unused dependencies --- pkgs/games/dwarf-fortress/game.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/games/dwarf-fortress/game.nix b/pkgs/games/dwarf-fortress/game.nix index 42b68356020f..95a4ff06e570 100644 --- a/pkgs/games/dwarf-fortress/game.nix +++ b/pkgs/games/dwarf-fortress/game.nix @@ -2,8 +2,6 @@ , lib , fetchurl , SDL -, SDL_image -, SDL_ttf , SDL2 , SDL2_image , SDL2_mixer From 12789d65591dbb7d73fe6f07b55fbb64cb392baa Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Sun, 7 Jul 2024 15:44:21 -0700 Subject: [PATCH 7/7] dfhack: 50.13-r2.1 -> 50.13-r3 --- pkgs/games/dwarf-fortress/dfhack/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/games/dwarf-fortress/dfhack/default.nix b/pkgs/games/dwarf-fortress/dfhack/default.nix index 31cc277e770c..cb0e1e529637 100644 --- a/pkgs/games/dwarf-fortress/dfhack/default.nix +++ b/pkgs/games/dwarf-fortress/dfhack/default.nix @@ -90,9 +90,9 @@ let xmlRev = "980b1af13acc31660dce632f913c968f52e2b275"; }; "50.13" = { - dfHackRelease = "50.13-r2.1"; - hash = "sha256-IcjDDZX9YSLzympNc++1Xl85cK/0ASVDvzeNaebYNTQ="; - xmlRev = "c5debb15f696c3d1cb3706e2eb201eccef64f61a"; + dfHackRelease = "50.13-r3"; + hash = "sha256-WbkJ8HmLT5GdZgDmcuFh+1uzhloKM9um0b9YO//uR7Y="; + xmlRev = "f0530a22149606596e97e3e17d941df3aafe29b9"; }; };