mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
dwarf-fortress-packages.soundSense: fix initialization and drop JDK 8
We don't need the JDK 8 override anymore; soundsense works fine without it if we use an --add-opens.
This commit is contained in:
parent
9d7246e046
commit
ab31da0235
6 changed files with 67 additions and 55 deletions
|
@ -7,8 +7,6 @@
|
||||||
libsForQt5,
|
libsForQt5,
|
||||||
newScope,
|
newScope,
|
||||||
perlPackages,
|
perlPackages,
|
||||||
jdk8,
|
|
||||||
jre8,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
# To whomever it may concern:
|
# To whomever it may concern:
|
||||||
|
@ -114,8 +112,6 @@ let
|
||||||
dfhack
|
dfhack
|
||||||
dwarf-therapist
|
dwarf-therapist
|
||||||
;
|
;
|
||||||
|
|
||||||
jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
|
|
||||||
}
|
}
|
||||||
// args
|
// args
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
stdenv,
|
stdenv,
|
||||||
fetchzip,
|
fetchzip,
|
||||||
dos2unix,
|
dos2unix,
|
||||||
soundPack ? stdenv.mkDerivation {
|
soundPack ? stdenv.mkDerivation {
|
||||||
name = "soundsense-soundpack";
|
name = "soundsense-soundpack";
|
||||||
src = fetchzip {
|
src = fetchzip {
|
||||||
url = "http://df.zweistein.cz/soundsense/soundpack.zip";
|
url = "https://df.zweistein.cz/soundsense/soundpack.zip";
|
||||||
sha256 = "0qz0mjkp7wp0gxk3ws2x760awv8c9lkacj2fn9bz3gqqnq262ffa";
|
hash = "sha256-yjlhBLYYv/FXsk5IpiZNDG2ugDldaD5mf+Dyc6es4GM=";
|
||||||
};
|
};
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
cp -r . $out
|
cp -r . $out
|
||||||
|
@ -20,8 +21,8 @@ stdenv.mkDerivation rec {
|
||||||
inherit soundPack;
|
inherit soundPack;
|
||||||
pname = "soundsense";
|
pname = "soundsense";
|
||||||
src = fetchzip {
|
src = fetchzip {
|
||||||
url = "http://df.zweistein.cz/soundsense/soundSense_${version}.zip";
|
url = "https://df.zweistein.cz/soundsense/soundSense_${version}.zip";
|
||||||
sha256 = "1gkrs69l3xsh858yjp204ddp29m668j630akm7arssc9359wxqkk";
|
hash = "sha256-c+LOUxmJaZ3VqVOBYSQypiZxWyNAXOlRQVD3QZPReb4=";
|
||||||
};
|
};
|
||||||
nativeBuildInputs = [ dos2unix ];
|
nativeBuildInputs = [ dos2unix ];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
@ -35,4 +36,14 @@ stdenv.mkDerivation rec {
|
||||||
ln -s $soundPack $out/soundsense/packs
|
ln -s $soundPack $out/soundsense/packs
|
||||||
'';
|
'';
|
||||||
passthru = { inherit version dfVersion; };
|
passthru = { inherit version dfVersion; };
|
||||||
|
meta = {
|
||||||
|
description = "Plays sound based on Dwarf Fortress game logs";
|
||||||
|
maintainers = with lib.maintainers; [
|
||||||
|
numinit
|
||||||
|
];
|
||||||
|
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
|
||||||
|
license = lib.licenses.gpl3Only;
|
||||||
|
platforms = lib.platforms.all;
|
||||||
|
homepage = "https://df.zweistein.cz/soundsense";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
dfhack,
|
dfhack,
|
||||||
enableSoundSense ? false,
|
enableSoundSense ? false,
|
||||||
soundSense,
|
soundSense,
|
||||||
jdk,
|
jre,
|
||||||
expect,
|
expect,
|
||||||
xvfb-run,
|
xvfb-run,
|
||||||
writeText,
|
writeText,
|
||||||
|
@ -235,7 +235,7 @@ lib.throwIf (enableTWBT' && !enableDFHack) "dwarf-fortress: TWBT requires DFHack
|
||||||
+ lib.optionalString enableSoundSense ''
|
+ lib.optionalString enableSoundSense ''
|
||||||
substitute $runSoundSense $out/bin/soundsense \
|
substitute $runSoundSense $out/bin/soundsense \
|
||||||
--subst-var-by stdenv_shell ${stdenv.shell} \
|
--subst-var-by stdenv_shell ${stdenv.shell} \
|
||||||
--subst-var-by jre ${jdk.jre} \
|
--subst-var-by jre ${jre} \
|
||||||
--subst-var dfInit
|
--subst-var dfInit
|
||||||
chmod 755 $out/bin/soundsense
|
chmod 755 $out/bin/soundsense
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -112,24 +112,27 @@ go() {
|
||||||
cd "$NIXPKGS_DF_HOME"
|
cd "$NIXPKGS_DF_HOME"
|
||||||
debug "Executing: $NIXPKGS_DF_HOME/$NIXPKGS_DF_EXE"
|
debug "Executing: $NIXPKGS_DF_HOME/$NIXPKGS_DF_EXE"
|
||||||
|
|
||||||
# Handle library paths on Darwin.
|
# Only mess with the library paths if we're starting Dwarf Fortress (not Soundsense).
|
||||||
if [ "$os_name" == Darwin ]; then
|
if [ "$NIXPKGS_DF_GAME" -eq 1 ]; then
|
||||||
if [ "${os_rev%%.*}" -ge 11 ]; then
|
# Handle library paths on Darwin.
|
||||||
export DYLD_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs"
|
if [ "$NIXPKGS_DF_PLATFORM" == df_osx ]; then
|
||||||
export DYLD_FRAMEWORK_PATH="$NIXPKGS_DF_ENV/libs"
|
if [ "${NIXPKGS_DF_PLATFORM_REV%%.*}" -ge 11 ]; then
|
||||||
else
|
export DYLD_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs"
|
||||||
export DYLD_FALLBACK_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs"
|
export DYLD_FRAMEWORK_PATH="$NIXPKGS_DF_ENV/libs"
|
||||||
export DYLD_FALLBACK_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
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$os_name" == Linux ]; then
|
if [ "$NIXPKGS_DF_PLATFORM" == df_linux ]; then
|
||||||
# We have to preload the audio plugin for audio to work. See Nix Pill #12 for this pattern:
|
# We have to preload the audio plugin for audio to work. See Nix Pill #12 for this pattern:
|
||||||
# https://nixos.org/guides/nix-pills/12-inputs-design-pattern.html
|
# https://nixos.org/guides/nix-pills/12-inputs-design-pattern.html
|
||||||
if [ "${_NIXPKGS_DF_OPTS[fmod]}" -eq 0 ] && [ -f "$NIXPKGS_DF_HOME/libfmod.so.13" ]; then
|
if [ "${_NIXPKGS_DF_OPTS[fmod]}" -eq 0 ] && [ -f "$NIXPKGS_DF_HOME/libfmod.so.13" ]; then
|
||||||
export LD_PRELOAD="$NIXPKGS_DF_HOME/libfmod.so.13${LD_PRELOAD:+:}${LD_PRELOAD:-}"
|
export LD_PRELOAD="$NIXPKGS_DF_HOME/libfmod.so.13${LD_PRELOAD:+:}${LD_PRELOAD:-}"
|
||||||
else
|
else
|
||||||
export LD_PRELOAD="@SDL2_mixer@${LD_PRELOAD:+:}${LD_PRELOAD:-}"
|
export LD_PRELOAD="@SDL2_mixer@${LD_PRELOAD:+:}${LD_PRELOAD:-}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -140,17 +143,17 @@ go() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Figure out the Dwarf Fortress directory (df_linux or df_osx).
|
||||||
os_name="$(@uname@)"
|
os_name="$(@uname@)"
|
||||||
os_rev="$(@uname@ -r)"
|
|
||||||
|
|
||||||
if [ "$os_name" == Linux ]; then
|
if [ "$os_name" == Linux ]; then
|
||||||
df_dir="df_linux"
|
export NIXPKGS_DF_PLATFORM="df_linux"
|
||||||
elif [ "$os_name" == Darwin ]; then
|
elif [ "$os_name" == Darwin ]; then
|
||||||
df_dir="df_osx"
|
export NIXPKGS_DF_PLATFORM="df_osx"
|
||||||
else
|
else
|
||||||
log "Unknown platform: $os_name"
|
log "Unknown platform: $os_name"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
export NIXPKGS_DF_PLATFORM_REV="$(@uname@ -r)"
|
||||||
|
|
||||||
if [[ -v DF_DIR ]] && [ -n "$DF_DIR" ] && { [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; }; then
|
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.
|
# Compatibility for users that were using DF_DIR, since the dfhack script clobbers this variable.
|
||||||
|
@ -158,7 +161,7 @@ if [[ -v DF_DIR ]] && [ -n "$DF_DIR" ] && { [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; then
|
if [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; then
|
||||||
export NIXPKGS_DF_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/$df_dir"
|
export NIXPKGS_DF_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/$NIXPKGS_DF_PLATFORM"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compatibility.
|
# Compatibility.
|
||||||
|
@ -187,26 +190,3 @@ export DF_DIR="$NIXPKGS_DF_HOME"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cd "$NIXPKGS_DF_ENV"
|
cd "$NIXPKGS_DF_ENV"
|
||||||
|
|
||||||
# All potential important files in DF 50 and below.
|
|
||||||
for path in dwarfort dwarfort.exe df *.so* libs raw data/init/* data/!(init|index|announcement); do
|
|
||||||
force_delete=0
|
|
||||||
if [[ "$path" == *fmod*.so* ]] && [ "${_NIXPKGS_DF_OPTS[fmod]}" -eq 0 ]; then
|
|
||||||
# Delete fmod plugins if we're using SDL_mixer.
|
|
||||||
force_delete=1
|
|
||||||
elif [[ "$path" == *mixer*.so* ]] && [ "${_NIXPKGS_DF_OPTS[fmod]}" -ne 0 ]; then
|
|
||||||
# Delete SDL_mixer plugins if we're using fmod.
|
|
||||||
force_delete=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "$path" ] && [ "$force_delete" -eq 0 ]; then
|
|
||||||
update_path "$path"
|
|
||||||
else
|
|
||||||
cleanup_path "$path"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# These need to be copied due to read only flags on older versions of DF.
|
|
||||||
for path in index announcement help dipscript; do
|
|
||||||
forcecopy_path "data/$path"
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,8 +1,32 @@
|
||||||
#!@stdenv_shell@ -e
|
#!@stdenv_shell@ -e
|
||||||
|
|
||||||
export NIXPKGS_DF_EXE="@dfExe@"
|
export NIXPKGS_DF_EXE="@dfExe@"
|
||||||
|
export NIXPKGS_DF_GAME=1
|
||||||
source @dfInit@
|
source @dfInit@
|
||||||
|
|
||||||
|
# All potential important files in DF 50 and below.
|
||||||
|
for path in dwarfort dwarfort.exe df *.so* libs raw data/init/* data/!(init|index|announcement); do
|
||||||
|
force_delete=0
|
||||||
|
if [[ "$path" == *fmod*.so* ]] && [ "${_NIXPKGS_DF_OPTS[fmod]}" -eq 0 ]; then
|
||||||
|
# Delete fmod plugins if we're using SDL_mixer.
|
||||||
|
force_delete=1
|
||||||
|
elif [[ "$path" == *mixer*.so* ]] && [ "${_NIXPKGS_DF_OPTS[fmod]}" -ne 0 ]; then
|
||||||
|
# Delete SDL_mixer plugins if we're using fmod.
|
||||||
|
force_delete=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "$path" ] && [ "$force_delete" -eq 0 ]; then
|
||||||
|
update_path "$path"
|
||||||
|
else
|
||||||
|
cleanup_path "$path"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# These need to be copied due to read only flags on older versions of DF.
|
||||||
|
for path in index announcement help dipscript; do
|
||||||
|
forcecopy_path "data/$path"
|
||||||
|
done
|
||||||
|
|
||||||
# If we're switching back from dfhack to vanilla, cleanup all dfhack
|
# If we're switching back from dfhack to vanilla, cleanup all dfhack
|
||||||
# links so Dwarf Fortress doesn't autoload its leftover libdfhooks.so.
|
# links so Dwarf Fortress doesn't autoload its leftover libdfhooks.so.
|
||||||
# Otherwise, populate them.
|
# Otherwise, populate them.
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!@stdenv_shell@ -e
|
#!@stdenv_shell@ -e
|
||||||
|
|
||||||
export NIXPKGS_DF_EXE="soundsense/soundSense.sh"
|
export NIXPKGS_DF_EXE="soundsense/soundSense.sh"
|
||||||
|
export NIXPKGS_DF_GAME=0
|
||||||
source @dfInit@
|
source @dfInit@
|
||||||
|
|
||||||
for path in soundsense/*; do
|
for path in soundsense/*; do
|
||||||
update_path "$path"
|
update_path "$path"
|
||||||
done
|
done
|
||||||
|
|
||||||
PATH="@jre@/bin:$PATH" go
|
JDK_JAVA_OPTIONS='--add-opens=java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED' PATH="@jre@/bin:$PATH" go "$@"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue