From 7c149b86c3c2e84a07c7eb575e23c64878507fc8 Mon Sep 17 00:00:00 2001 From: Robbin C Date: Tue, 1 Sep 2015 21:16:36 +0800 Subject: [PATCH 1/4] dfhack: init at 0.40.24-r3 A Dwarf Fortress memory access library, distributed with scripts and plugins implementing a wide variety of useful functions and tools. --- pkgs/games/dfhack/default.nix | 62 +++++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +++ 2 files changed, 66 insertions(+) create mode 100644 pkgs/games/dfhack/default.nix diff --git a/pkgs/games/dfhack/default.nix b/pkgs/games/dfhack/default.nix new file mode 100644 index 00000000000..046f11545a5 --- /dev/null +++ b/pkgs/games/dfhack/default.nix @@ -0,0 +1,62 @@ +{ stdenv, fetchgit, dwarf_fortress, cmake, zlib, perl, XMLLibXML, XMLLibXSLT +}: + +let + baseVersion = "40"; + patchVersion = "24-r3"; + src = fetchgit { + url = "https://github.com/DFHack/dfhack.git"; + rev = "0849099f2083e100cae6f64940b4eff4c28ce2eb"; + sha256 = "0lnqrayi8hwfivkrxb7fw8lb6v95i04pskny1px7084n7nzvyv8b"; + }; + +in + +assert stdenv.system == "i686-linux"; +assert dwarf_fortress.name == "dwarf-fortress-0.40.24"; + +stdenv.mkDerivation rec { + name = "dfhack-0.${baseVersion}.${patchVersion}"; + + inherit baseVersion patchVersion src; + + buildInputs = [ cmake zlib perl XMLLibXML XMLLibXSLT ]; + + preConfigure = '' + export cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix/dfhack $cmakeFlags" + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/build/depends/protobuf + ''; + + installPhase = '' + mkdir -p $out/dfhack + make install + cp ../package/linux/dfhack $out/dfhack/ + mkdir -p $out/bin + cat > $out/bin/dfhack_install_dir < dfhack + # write md5sum of binary + sed -e s/c42f55948a448645d6609102ef6439e8/`md5sum ${dwarf_fortress}/share/df_linux/libs/Dwarf_Fortress | cut -f1 -d\ `/ $out/dfhack/hack/symbols.xml > hack/symbols.xml + + echo "DFHack installed successfully in \$1. To play, run ./dfhack in it." + + EOF + chmod +x $out/bin/dfhack_install_dir + ''; + + meta = { + description = "A Dwarf Fortress memory access library"; + homepage = https://github.com/DFHack/dfhack; + license = stdenv.lib.licenses.bsd2; + maintainers = with stdenv.lib.maintainers; [ robbinch ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d4b1752e397..d63c5d67a8d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13489,6 +13489,10 @@ let crrcsim = callPackage ../games/crrcsim {}; + dfhack = callPackage_i686 ../games/dfhack { + inherit (pkgsi686Linux.perlPackages) XMLLibXML XMLLibXSLT; + }; + dhewm3 = callPackage ../games/dhewm3 {}; drumkv1 = callPackage ../applications/audio/drumkv1 { }; From 5856e44258166d261698aae54c3992e87c495fe1 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 23 Sep 2015 20:47:27 -0700 Subject: [PATCH 2/4] jemalloc: Fix jemalloc prefix for applications which expect ^malloc --- pkgs/development/compilers/rustc/generic.nix | 4 ++++ pkgs/development/libraries/jemalloc/default.nix | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/rustc/generic.nix b/pkgs/development/compilers/rustc/generic.nix index 9df259cee8e..8b3c61d5271 100644 --- a/pkgs/development/compilers/rustc/generic.nix +++ b/pkgs/development/compilers/rustc/generic.nix @@ -138,6 +138,10 @@ stdenv.mkDerivation { sed -i configure \ -e '/probe_need CFG_CURLORWGET/d' + # Fix the use of jemalloc prefixes which our jemalloc doesn't have + [ -f src/liballoc_jemalloc/lib.rs ] && sed -i 's,je_,,g' src/liballoc_jemalloc/lib.rs + [ -f src/liballoc/heap.rs ] && sed -i 's,je_,,g' src/liballoc/heap.rs # Remove for 1.4.0+ + # Useful debugging parameter #export VERBOSE=1 ''; diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix index e0272529907..d40cdf75ad1 100644 --- a/pkgs/development/libraries/jemalloc/default.nix +++ b/pkgs/development/libraries/jemalloc/default.nix @@ -8,11 +8,6 @@ stdenv.mkDerivation rec { sha256 = "1wiydkp8a4adwsgfsd688hpv2z7hjv5manhckchk96v6qdsbqk91"; }; - # Rust refers to jemalloc functions directly so make sure the prefix matchs. - configureFlags = [ - "--with-jemalloc-prefix=je_" - ]; - meta = with stdenv.lib; { homepage = http://www.canonware.com/jemalloc/index.html; description = "a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support"; From 4856efb7046809184778f6d9c59e6e6f3e81b74f Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 23 Sep 2015 22:31:28 -0700 Subject: [PATCH 3/4] rustc: Disable system jemalloc until we can make it compatible --- pkgs/development/compilers/rustc/generic.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/rustc/generic.nix b/pkgs/development/compilers/rustc/generic.nix index 8b3c61d5271..2dc91cb5ec4 100644 --- a/pkgs/development/compilers/rustc/generic.nix +++ b/pkgs/development/compilers/rustc/generic.nix @@ -115,7 +115,7 @@ stdenv.mkDerivation { configureFlags = configureFlags ++ [ "--enable-local-rust" "--local-rust-root=$snapshot" "--enable-rpath" ] - ++ [ "--llvm-root=${llvmPackages_37.llvm}" "--jemalloc-root=${jemalloc}/lib" ] + ++ [ "--llvm-root=${llvmPackages_37.llvm}" ] #"--jemalloc-root=${jemalloc}/lib" ] ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${stdenv.cc.binutils}/bin/ar" ] ++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang"; @@ -139,8 +139,9 @@ stdenv.mkDerivation { -e '/probe_need CFG_CURLORWGET/d' # Fix the use of jemalloc prefixes which our jemalloc doesn't have - [ -f src/liballoc_jemalloc/lib.rs ] && sed -i 's,je_,,g' src/liballoc_jemalloc/lib.rs - [ -f src/liballoc/heap.rs ] && sed -i 's,je_,,g' src/liballoc/heap.rs # Remove for 1.4.0+ + # TODO: reenable if we can figure out how to get our jemalloc to work + #[ -f src/liballoc_jemalloc/lib.rs ] && sed -i 's,je_,,g' src/liballoc_jemalloc/lib.rs + #[ -f src/liballoc/heap.rs ] && sed -i 's,je_,,g' src/liballoc/heap.rs # Remove for 1.4.0+ # Useful debugging parameter #export VERBOSE=1 From 9c345fc97d15d34655759fb5076eab162098b138 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 23 Sep 2015 22:31:40 -0700 Subject: [PATCH 4/4] jemalloc: 4.0.0 -> 4.0.2 --- pkgs/development/libraries/jemalloc/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix index d40cdf75ad1..4e13c9b1d93 100644 --- a/pkgs/development/libraries/jemalloc/default.nix +++ b/pkgs/development/libraries/jemalloc/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl }: stdenv.mkDerivation rec { - name = "jemalloc-4.0.0"; + name = "jemalloc-4.0.2"; src = fetchurl { url = "http://www.canonware.com/download/jemalloc/${name}.tar.bz2"; - sha256 = "1wiydkp8a4adwsgfsd688hpv2z7hjv5manhckchk96v6qdsbqk91"; + sha256 = "04a6iw9wiwiknd7v3l3i7vpmc5nvv52islnb1hz9idmdk259r2hd"; }; meta = with stdenv.lib; {