From 5473798787bcd6e4be1aa9603e9ebe5ef1533da0 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 14 Nov 2024 14:30:21 -0500 Subject: [PATCH 1/5] root: adapt to new darwin SDK --- pkgs/applications/science/misc/root/5.nix | 5 +---- pkgs/applications/science/misc/root/default.nix | 12 +++++------- pkgs/top-level/all-packages.nix | 5 +---- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/pkgs/applications/science/misc/root/5.nix b/pkgs/applications/science/misc/root/5.nix index 62f80ee48096..b6e27322f5c7 100644 --- a/pkgs/applications/science/misc/root/5.nix +++ b/pkgs/applications/science/misc/root/5.nix @@ -19,8 +19,6 @@ , xz , gsl , xxHash -, Cocoa -, OpenGL , noSplash ? false }: @@ -36,7 +34,6 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ pcre python3 zlib libxml2 lz4 xz gsl xxHash libxcrypt ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ libX11 libXpm libXft libXext libGLU libGL ] - ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ Cocoa OpenGL ] ; patches = [ @@ -147,7 +144,7 @@ stdenv.mkDerivation rec { "-Dxml=ON" "-Dxrootd=OFF" ] - ++ lib.optional stdenv.hostPlatform.isDarwin "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks"; + ++ lib.optional ((!stdenv.hostPlatform.isDarwin) && (stdenv.cc.libc != null)) "-DC_INCLUDE_DIRS=${lib.getDev stdenv.cc.libc}/include"; setupHook = ./setup-hook.sh; diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/applications/science/misc/root/default.nix index 91450bcab748..8991da6aab2c 100644 --- a/pkgs/applications/science/misc/root/default.nix +++ b/pkgs/applications/science/misc/root/default.nix @@ -5,6 +5,7 @@ , fetchurl , makeWrapper , writeText +, apple-sdk , cmake , coreutils , git @@ -50,9 +51,6 @@ , patchRcPathPosix , tbb , xrootd -, Cocoa -, CoreSymbolication -, OpenGL }: stdenv.mkDerivation rec { @@ -110,8 +108,10 @@ stdenv.mkDerivation rec { tbb xrootd ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + apple-sdk.privateFrameworksHook + ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ libX11 libXpm libXft libXext libGLU libGL ] - ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ Cocoa CoreSymbolication OpenGL ] ; patches = [ @@ -172,10 +172,8 @@ stdenv.mkDerivation rec { "-Dsqlite=OFF" "-Dvdt=OFF" ] - ++ lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${lib.getDev stdenv.cc.libc}/include" + ++ lib.optional ((!stdenv.hostPlatform.isDarwin) && (stdenv.cc.libc != null)) "-DC_INCLUDE_DIRS=${lib.getDev stdenv.cc.libc}/include" ++ lib.optionals stdenv.hostPlatform.isDarwin [ - "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks" - # fatal error: module map file '/nix/store/-Libsystem-osx-10.12.6/include/module.modulemap' not found # fatal error: could not build module '_Builtin_intrinsics' "-Druntime_cxxmodules=OFF" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b08d97d5d06c..1ca157fd8a65 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18236,12 +18236,9 @@ with pkgs; root = callPackage ../applications/science/misc/root { python = python3; - inherit (darwin.apple_sdk.frameworks) Cocoa CoreSymbolication OpenGL; }; - root5 = lowPrio (callPackage ../applications/science/misc/root/5.nix { - inherit (darwin.apple_sdk.frameworks) Cocoa OpenGL; - }); + root5 = lowPrio (callPackage ../applications/science/misc/root/5.nix { }); rink = callPackage ../applications/science/misc/rink { inherit (darwin.apple_sdk.frameworks) Security; From 48bcebe361325ad6d4e51f1df6733e61c00212b9 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 14 Nov 2024 14:30:51 -0500 Subject: [PATCH 2/5] root: 6.32.06 -> 6.32.08 --- pkgs/applications/science/misc/root/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/applications/science/misc/root/default.nix index 8991da6aab2c..7352c16d312e 100644 --- a/pkgs/applications/science/misc/root/default.nix +++ b/pkgs/applications/science/misc/root/default.nix @@ -55,7 +55,7 @@ stdenv.mkDerivation rec { pname = "root"; - version = "6.32.06"; + version = "6.32.08"; passthru = { tests = import ./tests { inherit callPackage; }; @@ -63,7 +63,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "https://root.cern.ch/download/root_v${version}.source.tar.gz"; - hash = "sha256-P8Ay2T/oSN6lrbG0fY8KhieVIyk/7gqis81Sof+rckc="; + hash = "sha256-Ka1JRact/xoAnDJqZbb6XuJHhJiCMlHTzvhqLL63eyc="; }; clad_src = fetchgit { From adea5468dc8025149584f76a7e322c153c520b18 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 14 Nov 2024 14:37:17 -0500 Subject: [PATCH 3/5] root: move to by-name --- .../ro/root/package.nix} | 4 ++-- .../misc => by-name/ro}/root/setup-hook.sh | 0 .../misc => by-name/ro}/root/sw_vers.patch | 0 .../ro}/root/tests/default.nix | 0 .../ro}/root/tests/test-thisroot.nix | 0 .../ro/root5}/disable_libc_dicts_root5.patch | 0 .../5.nix => by-name/ro/root5/package.nix} | 0 .../root5}/purify_include_paths_root5.patch | 0 .../ro/root5}/root5-python311-fix.patch | 0 pkgs/by-name/ro/root5/setup-hook.sh | 19 +++++++++++++++++++ .../ro/root5}/sw_vers_root5.patch | 0 .../libraries/physics/hepmc3/default.nix | 2 +- pkgs/top-level/all-packages.nix | 6 ------ 13 files changed, 22 insertions(+), 9 deletions(-) rename pkgs/{applications/science/misc/root/default.nix => by-name/ro/root/package.nix} (99%) rename pkgs/{applications/science/misc => by-name/ro}/root/setup-hook.sh (100%) rename pkgs/{applications/science/misc => by-name/ro}/root/sw_vers.patch (100%) rename pkgs/{applications/science/misc => by-name/ro}/root/tests/default.nix (100%) rename pkgs/{applications/science/misc => by-name/ro}/root/tests/test-thisroot.nix (100%) rename pkgs/{applications/science/misc/root => by-name/ro/root5}/disable_libc_dicts_root5.patch (100%) rename pkgs/{applications/science/misc/root/5.nix => by-name/ro/root5/package.nix} (100%) rename pkgs/{applications/science/misc/root => by-name/ro/root5}/purify_include_paths_root5.patch (100%) rename pkgs/{applications/science/misc/root => by-name/ro/root5}/root5-python311-fix.patch (100%) create mode 100644 pkgs/by-name/ro/root5/setup-hook.sh rename pkgs/{applications/science/misc/root => by-name/ro/root5}/sw_vers_root5.patch (100%) diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/by-name/ro/root/package.nix similarity index 99% rename from pkgs/applications/science/misc/root/default.nix rename to pkgs/by-name/ro/root/package.nix index 7352c16d312e..19d61c405c76 100644 --- a/pkgs/applications/science/misc/root/default.nix +++ b/pkgs/by-name/ro/root/package.nix @@ -37,7 +37,7 @@ , nlohmann_json , pkg-config , procps -, python +, python3 , which , xxHash , zlib @@ -104,7 +104,7 @@ stdenv.mkDerivation rec { patchRcPathCsh patchRcPathFish patchRcPathPosix - python.pkgs.numpy + python3.pkgs.numpy tbb xrootd ] diff --git a/pkgs/applications/science/misc/root/setup-hook.sh b/pkgs/by-name/ro/root/setup-hook.sh similarity index 100% rename from pkgs/applications/science/misc/root/setup-hook.sh rename to pkgs/by-name/ro/root/setup-hook.sh diff --git a/pkgs/applications/science/misc/root/sw_vers.patch b/pkgs/by-name/ro/root/sw_vers.patch similarity index 100% rename from pkgs/applications/science/misc/root/sw_vers.patch rename to pkgs/by-name/ro/root/sw_vers.patch diff --git a/pkgs/applications/science/misc/root/tests/default.nix b/pkgs/by-name/ro/root/tests/default.nix similarity index 100% rename from pkgs/applications/science/misc/root/tests/default.nix rename to pkgs/by-name/ro/root/tests/default.nix diff --git a/pkgs/applications/science/misc/root/tests/test-thisroot.nix b/pkgs/by-name/ro/root/tests/test-thisroot.nix similarity index 100% rename from pkgs/applications/science/misc/root/tests/test-thisroot.nix rename to pkgs/by-name/ro/root/tests/test-thisroot.nix diff --git a/pkgs/applications/science/misc/root/disable_libc_dicts_root5.patch b/pkgs/by-name/ro/root5/disable_libc_dicts_root5.patch similarity index 100% rename from pkgs/applications/science/misc/root/disable_libc_dicts_root5.patch rename to pkgs/by-name/ro/root5/disable_libc_dicts_root5.patch diff --git a/pkgs/applications/science/misc/root/5.nix b/pkgs/by-name/ro/root5/package.nix similarity index 100% rename from pkgs/applications/science/misc/root/5.nix rename to pkgs/by-name/ro/root5/package.nix diff --git a/pkgs/applications/science/misc/root/purify_include_paths_root5.patch b/pkgs/by-name/ro/root5/purify_include_paths_root5.patch similarity index 100% rename from pkgs/applications/science/misc/root/purify_include_paths_root5.patch rename to pkgs/by-name/ro/root5/purify_include_paths_root5.patch diff --git a/pkgs/applications/science/misc/root/root5-python311-fix.patch b/pkgs/by-name/ro/root5/root5-python311-fix.patch similarity index 100% rename from pkgs/applications/science/misc/root/root5-python311-fix.patch rename to pkgs/by-name/ro/root5/root5-python311-fix.patch diff --git a/pkgs/by-name/ro/root5/setup-hook.sh b/pkgs/by-name/ro/root5/setup-hook.sh new file mode 100644 index 000000000000..7affd21012eb --- /dev/null +++ b/pkgs/by-name/ro/root5/setup-hook.sh @@ -0,0 +1,19 @@ +thisroot () { + # Workaround thisroot.sh dependency on man + if [ -z "${MANPATH-}" ]; then + MANPATH=: + fi + local oldOpts="-u" + shopt -qo nounset || oldOpts="+u" + set +u + source @out@/bin/thisroot.sh + set "$oldOpts" +} + +postHooks+=(thisroot) + +addRootIncludePath() { + addToSearchPath ROOT_INCLUDE_PATH $1/include +} + +addEnvHooks "$targetOffset" addRootIncludePath diff --git a/pkgs/applications/science/misc/root/sw_vers_root5.patch b/pkgs/by-name/ro/root5/sw_vers_root5.patch similarity index 100% rename from pkgs/applications/science/misc/root/sw_vers_root5.patch rename to pkgs/by-name/ro/root5/sw_vers_root5.patch diff --git a/pkgs/development/libraries/physics/hepmc3/default.nix b/pkgs/development/libraries/physics/hepmc3/default.nix index c622d7562001..f7f281af74f3 100644 --- a/pkgs/development/libraries/physics/hepmc3/default.nix +++ b/pkgs/development/libraries/physics/hepmc3/default.nix @@ -11,7 +11,7 @@ let pythonVersion = with lib.versions; "${major python.version}${minor python.version}"; withPython = python != null; # ensure that root is built with the same python interpreter, as it links against numpy - root_py = if withPython then root.override { inherit python; } else root; + root_py = if withPython then root.override { python3 = python; } else root; in stdenv.mkDerivation rec { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1ca157fd8a65..f6a847b642dd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18234,12 +18234,6 @@ with pkgs; ns-3 = callPackage ../development/libraries/science/networking/ns-3 { python = python3; }; - root = callPackage ../applications/science/misc/root { - python = python3; - }; - - root5 = lowPrio (callPackage ../applications/science/misc/root/5.nix { }); - rink = callPackage ../applications/science/misc/rink { inherit (darwin.apple_sdk.frameworks) Security; }; From 7bee67400f5f5ed7451a4fc73e91e075789b42bb Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 14 Nov 2024 14:41:28 -0500 Subject: [PATCH 4/5] root: apply nixfmt --- pkgs/by-name/ro/root/package.nix | 387 ++++++++++++++++-------------- pkgs/by-name/ro/root5/package.nix | 149 +++++++----- 2 files changed, 295 insertions(+), 241 deletions(-) diff --git a/pkgs/by-name/ro/root/package.nix b/pkgs/by-name/ro/root/package.nix index 19d61c405c76..6c0c9b9b5dd8 100644 --- a/pkgs/by-name/ro/root/package.nix +++ b/pkgs/by-name/ro/root/package.nix @@ -1,56 +1,57 @@ -{ stdenv -, lib -, callPackage -, fetchgit -, fetchurl -, makeWrapper -, writeText -, apple-sdk -, cmake -, coreutils -, git -, davix -, ftgl -, gl2ps -, glew -, gnugrep -, gnused -, gsl -, gtest -, lapack -, libX11 -, libXpm -, libXft -, libXext -, libGLU -, libGL -, libxcrypt -, libxml2 -, llvm_16 -, lsof -, lz4 -, xz -, man -, openblas -, openssl -, pcre -, nlohmann_json -, pkg-config -, procps -, python3 -, which -, xxHash -, zlib -, zstd -, giflib -, libjpeg -, libtiff -, libpng -, patchRcPathCsh -, patchRcPathFish -, patchRcPathPosix -, tbb -, xrootd +{ + stdenv, + lib, + callPackage, + fetchgit, + fetchurl, + makeWrapper, + writeText, + apple-sdk, + cmake, + coreutils, + git, + davix, + ftgl, + gl2ps, + glew, + gnugrep, + gnused, + gsl, + gtest, + lapack, + libX11, + libXpm, + libXft, + libXext, + libGLU, + libGL, + libxcrypt, + libxml2, + llvm_16, + lsof, + lz4, + xz, + man, + openblas, + openssl, + pcre, + nlohmann_json, + pkg-config, + procps, + python3, + which, + xxHash, + zlib, + zstd, + giflib, + libjpeg, + libtiff, + libpng, + patchRcPathCsh, + patchRcPathFish, + patchRcPathPosix, + tbb, + xrootd, }: stdenv.mkDerivation rec { @@ -74,110 +75,125 @@ stdenv.mkDerivation rec { hash = "sha256-iKrZsuUerrlrjXBrxcTsFu/t0Pb0sa4UlfSwd1yhg3g="; }; - nativeBuildInputs = [ makeWrapper cmake pkg-config git ]; - propagatedBuildInputs = [ - nlohmann_json + nativeBuildInputs = [ + makeWrapper + cmake + pkg-config + git ]; - buildInputs = [ - davix - ftgl - gl2ps - glew - pcre - zlib - zstd - lapack - libxcrypt - libxml2 - llvm_16 - lz4 - xz - gsl - gtest - openblas - openssl - xxHash - giflib - libjpeg - libtiff - libpng - patchRcPathCsh - patchRcPathFish - patchRcPathPosix - python3.pkgs.numpy - tbb - xrootd - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - apple-sdk.privateFrameworksHook - ] - ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ libX11 libXpm libXft libXext libGLU libGL ] - ; + propagatedBuildInputs = [ nlohmann_json ]; + buildInputs = + [ + davix + ftgl + gl2ps + glew + pcre + zlib + zstd + lapack + libxcrypt + libxml2 + llvm_16 + lz4 + xz + gsl + gtest + openblas + openssl + xxHash + giflib + libjpeg + libtiff + libpng + patchRcPathCsh + patchRcPathFish + patchRcPathPosix + python3.pkgs.numpy + tbb + xrootd + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk.privateFrameworksHook ] + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + libX11 + libXpm + libXft + libXext + libGLU + libGL + ]; - patches = [ - ./sw_vers.patch - ]; + patches = [ ./sw_vers.patch ]; - preConfigure = '' - for path in builtins/*; do - if [[ "$path" != "builtins/openui5" ]] && [[ "$path" != "builtins/rendercore" ]]; then - rm -rf "$path" - fi - done - substituteInPlace cmake/modules/SearchInstalledSoftware.cmake \ - --replace-fail 'set(lcgpackages ' '#set(lcgpackages ' + preConfigure = + '' + for path in builtins/*; do + if [[ "$path" != "builtins/openui5" ]] && [[ "$path" != "builtins/rendercore" ]]; then + rm -rf "$path" + fi + done + substituteInPlace cmake/modules/SearchInstalledSoftware.cmake \ + --replace-fail 'set(lcgpackages ' '#set(lcgpackages ' - # We have to bypass the connection check, because it would disable clad. - # This should probably be fixed upstream with a flag to disable the - # connectivity check! - substituteInPlace CMakeLists.txt \ - --replace-fail 'if(clad AND NO_CONNECTION)' 'if(FALSE)' - # Make sure that clad is not downloaded when building - substituteInPlace interpreter/cling/tools/plugins/clad/CMakeLists.txt \ - --replace-fail 'UPDATE_COMMAND ""' 'SOURCE_DIR ${clad_src} DOWNLOAD_COMMAND "" UPDATE_COMMAND ""' - # Make sure that clad is finding the right llvm version - substituteInPlace interpreter/cling/tools/plugins/clad/CMakeLists.txt \ - --replace-fail '-DLLVM_DIR=''${LLVM_BINARY_DIR}' '-DLLVM_DIR=${llvm_16.dev}/lib/cmake/llvm' + # We have to bypass the connection check, because it would disable clad. + # This should probably be fixed upstream with a flag to disable the + # connectivity check! + substituteInPlace CMakeLists.txt \ + --replace-fail 'if(clad AND NO_CONNECTION)' 'if(FALSE)' + # Make sure that clad is not downloaded when building + substituteInPlace interpreter/cling/tools/plugins/clad/CMakeLists.txt \ + --replace-fail 'UPDATE_COMMAND ""' 'SOURCE_DIR ${clad_src} DOWNLOAD_COMMAND "" UPDATE_COMMAND ""' + # Make sure that clad is finding the right llvm version + substituteInPlace interpreter/cling/tools/plugins/clad/CMakeLists.txt \ + --replace-fail '-DLLVM_DIR=''${LLVM_BINARY_DIR}' '-DLLVM_DIR=${llvm_16.dev}/lib/cmake/llvm' - substituteInPlace interpreter/llvm-project/clang/tools/driver/CMakeLists.txt \ - --replace-fail 'add_clang_symlink(''${link} clang)' "" + substituteInPlace interpreter/llvm-project/clang/tools/driver/CMakeLists.txt \ + --replace-fail 'add_clang_symlink(''${link} clang)' "" - # Don't require textutil on macOS - : > cmake/modules/RootCPack.cmake + # Don't require textutil on macOS + : > cmake/modules/RootCPack.cmake - # Hardcode path to fix use with cmake - sed -i cmake/scripts/ROOTConfig.cmake.in \ - -e '1iset(nlohmann_json_DIR "${nlohmann_json}/lib/cmake/nlohmann_json/")' + # Hardcode path to fix use with cmake + sed -i cmake/scripts/ROOTConfig.cmake.in \ + -e '1iset(nlohmann_json_DIR "${nlohmann_json}/lib/cmake/nlohmann_json/")' - patchShebangs build/unix/ - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - # Eliminate impure reference to /System/Library/PrivateFrameworks - substituteInPlace core/macosx/CMakeLists.txt \ - --replace-fail "-F/System/Library/PrivateFrameworks " "" - '' + lib.optionalString (stdenv.hostPlatform.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") '' - MACOSX_DEPLOYMENT_TARGET=10.16 - ''; + patchShebangs build/unix/ + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + # Eliminate impure reference to /System/Library/PrivateFrameworks + substituteInPlace core/macosx/CMakeLists.txt \ + --replace-fail "-F/System/Library/PrivateFrameworks " "" + '' + + + lib.optionalString + (stdenv.hostPlatform.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") + '' + MACOSX_DEPLOYMENT_TARGET=10.16 + ''; - cmakeFlags = [ - "-DCMAKE_INSTALL_BINDIR=bin" - "-DCMAKE_INSTALL_LIBDIR=lib" - "-DCMAKE_INSTALL_INCLUDEDIR=include" - "-Dbuiltin_llvm=OFF" - "-Dfail-on-missing=ON" - "-Dfitsio=OFF" - "-Dgnuinstall=ON" - "-Dmathmore=ON" - "-Dmysql=OFF" - "-Dpgsql=OFF" - "-Dsqlite=OFF" - "-Dvdt=OFF" - ] - ++ lib.optional ((!stdenv.hostPlatform.isDarwin) && (stdenv.cc.libc != null)) "-DC_INCLUDE_DIRS=${lib.getDev stdenv.cc.libc}/include" - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - # fatal error: module map file '/nix/store/-Libsystem-osx-10.12.6/include/module.modulemap' not found - # fatal error: could not build module '_Builtin_intrinsics' - "-Druntime_cxxmodules=OFF" - ]; + cmakeFlags = + [ + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-Dbuiltin_llvm=OFF" + "-Dfail-on-missing=ON" + "-Dfitsio=OFF" + "-Dgnuinstall=ON" + "-Dmathmore=ON" + "-Dmysql=OFF" + "-Dpgsql=OFF" + "-Dsqlite=OFF" + "-Dvdt=OFF" + ] + ++ lib.optional ( + (!stdenv.hostPlatform.isDarwin) && (stdenv.cc.libc != null) + ) "-DC_INCLUDE_DIRS=${lib.getDev stdenv.cc.libc}/include" + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # fatal error: module map file '/nix/store/-Libsystem-osx-10.12.6/include/module.modulemap' not found + # fatal error: could not build module '_Builtin_intrinsics' + "-Druntime_cxxmodules=OFF" + ]; postInstall = '' for prog in rootbrowse rootcp rooteventselector rootls rootmkdir rootmv rootprint rootrm rootslimtree; do @@ -187,11 +203,13 @@ stdenv.mkDerivation rec { # Make ldd and sed available to the ROOT executable by prefixing PATH. wrapProgram "$out/bin/root" \ - --prefix PATH : "${lib.makeBinPath [ - gnused # sed - stdenv.cc # c++ ld etc. - stdenv.cc.libc # ldd - ]}" + --prefix PATH : "${ + lib.makeBinPath [ + gnused # sed + stdenv.cc # c++ ld etc. + stdenv.cc.libc # ldd + ] + }" # Patch thisroot.{sh,csh,fish} @@ -199,36 +217,46 @@ stdenv.mkDerivation rec { # but it also need to support Bash-less POSIX shell like dash, # as they are mentioned in `thisroot.sh`. - patchRcPathPosix "$out/bin/thisroot.sh" "${lib.makeBinPath [ - coreutils # dirname tail - gnugrep # grep - gnused # sed - lsof # lsof - man # manpath - procps # ps - which # which - ]}" - patchRcPathCsh "$out/bin/thisroot.csh" "${lib.makeBinPath [ - coreutils - gnugrep - gnused - lsof # lsof - man - which - ]}" - patchRcPathFish "$out/bin/thisroot.fish" "${lib.makeBinPath [ - coreutils - man - which - ]}" + patchRcPathPosix "$out/bin/thisroot.sh" "${ + lib.makeBinPath [ + coreutils # dirname tail + gnugrep # grep + gnused # sed + lsof # lsof + man # manpath + procps # ps + which # which + ] + }" + patchRcPathCsh "$out/bin/thisroot.csh" "${ + lib.makeBinPath [ + coreutils + gnugrep + gnused + lsof # lsof + man + which + ] + }" + patchRcPathFish "$out/bin/thisroot.fish" "${ + lib.makeBinPath [ + coreutils + man + which + ] + }" ''; # error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer - env.CXXFLAGS = lib.optionalString (stdenv.hostPlatform.system == "x86_64-darwin") "-faligned-allocation"; + env.CXXFLAGS = lib.optionalString ( + stdenv.hostPlatform.system == "x86_64-darwin" + ) "-faligned-allocation"; # workaround for # https://github.com/root-project/root/issues/14778 - env.NIX_LDFLAGS = lib.optionalString (!stdenv.hostPlatform.isDarwin) "--version-script,${writeText "version.map" "ROOT { global: *; };"}"; + env.NIX_LDFLAGS = lib.optionalString ( + !stdenv.hostPlatform.isDarwin + ) "--version-script,${writeText "version.map" "ROOT { global: *; };"}"; # To use the debug information on the fly (without installation) # add the outPath of root.debug into NIX_DEBUG_INFO_DIRS (in PATH-like format) @@ -245,7 +273,10 @@ stdenv.mkDerivation rec { homepage = "https://root.cern/"; description = "Data analysis framework"; platforms = platforms.unix; - maintainers = [ maintainers.guitargeek maintainers.veprbl ]; + maintainers = [ + maintainers.guitargeek + maintainers.veprbl + ]; license = licenses.lgpl21; }; } diff --git a/pkgs/by-name/ro/root5/package.nix b/pkgs/by-name/ro/root5/package.nix index b6e27322f5c7..0a03d44667d5 100644 --- a/pkgs/by-name/ro/root5/package.nix +++ b/pkgs/by-name/ro/root5/package.nix @@ -1,25 +1,26 @@ -{ lib -, stdenv -, fetchurl -, fetchpatch -, cmake -, pcre -, pkg-config -, python3 -, libX11 -, libXpm -, libXft -, libXext -, libGLU -, libGL -, zlib -, libxml2 -, libxcrypt -, lz4 -, xz -, gsl -, xxHash -, noSplash ? false +{ + lib, + stdenv, + fetchurl, + fetchpatch, + cmake, + pcre, + pkg-config, + python3, + libX11, + libXpm, + libXft, + libXext, + libGLU, + libGL, + zlib, + libxml2, + libxcrypt, + lz4, + xz, + gsl, + xxHash, + noSplash ? false, }: stdenv.mkDerivation rec { @@ -31,10 +32,30 @@ stdenv.mkDerivation rec { sha256 = "1ln448lszw4d6jmbdphkr2plwxxlhmjkla48vmmq750xc1lxlfrc"; }; - nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = [ pcre python3 zlib libxml2 lz4 xz gsl xxHash libxcrypt ] - ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ libX11 libXpm libXft libXext libGLU libGL ] - ; + nativeBuildInputs = [ + cmake + pkg-config + ]; + buildInputs = + [ + pcre + python3 + zlib + libxml2 + lz4 + xz + gsl + xxHash + libxcrypt + ] + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + libX11 + libXpm + libXft + libXext + libGLU + libGL + ]; patches = [ ./sw_vers_root5.patch @@ -69,45 +90,47 @@ stdenv.mkDerivation rec { # https://github.com/root-project/root/issues/13216 hardeningDisable = [ "fortify3" ]; - preConfigure = '' - # binutils 2.37 fixes - fixupList=( - cint/demo/gl/make0 - cint/demo/exception/Makefile - cint/demo/makecint/KRcc/Makefile - cint/demo/makecint/Stub2/Make2 - cint/demo/makecint/Array/Makefile - cint/demo/makecint/DArray/Makefile - cint/demo/makecint/ReadFile/Makefile - cint/demo/makecint/stl/Makefile - cint/demo/makecint/Stub2/Make1 - cint/cint/include/makemat - cint/cint/lib/WildCard/Makefile - cint/cint/include/make.arc - cint/cint/lib/qt/Makefile - cint/cint/lib/pthread/Makefile - graf2d/asimage/src/libAfterImage/Makefile.in - ) - for toFix in "''${fixupList[@]}"; do - substituteInPlace "$toFix" --replace "clq" "cq" - done + preConfigure = + '' + # binutils 2.37 fixes + fixupList=( + cint/demo/gl/make0 + cint/demo/exception/Makefile + cint/demo/makecint/KRcc/Makefile + cint/demo/makecint/Stub2/Make2 + cint/demo/makecint/Array/Makefile + cint/demo/makecint/DArray/Makefile + cint/demo/makecint/ReadFile/Makefile + cint/demo/makecint/stl/Makefile + cint/demo/makecint/Stub2/Make1 + cint/cint/include/makemat + cint/cint/lib/WildCard/Makefile + cint/cint/include/make.arc + cint/cint/lib/qt/Makefile + cint/cint/lib/pthread/Makefile + graf2d/asimage/src/libAfterImage/Makefile.in + ) + for toFix in "''${fixupList[@]}"; do + substituteInPlace "$toFix" --replace "clq" "cq" + done - patchShebangs build/unix/ - ln -s ${lib.getDev stdenv.cc.libc}/include/AvailabilityMacros.h cint/cint/include/ + patchShebangs build/unix/ + ln -s ${lib.getDev stdenv.cc.libc}/include/AvailabilityMacros.h cint/cint/include/ - # __malloc_hook is deprecated - substituteInPlace misc/memstat/src/TMemStatHook.cxx \ - --replace "defined(R__GNU) && (defined(R__LINUX) || defined(__APPLE__))" \ - "defined(R__GNU) && (defined(__APPLE__))" - '' - # Fix CINTSYSDIR for "build" version of rootcint - # This is probably a bug that breaks out-of-source builds - + '' - substituteInPlace cint/cint/src/loadfile.cxx\ - --replace 'env = "cint";' 'env = "'`pwd`'/cint";' - '' + lib.optionalString noSplash '' - substituteInPlace rootx/src/rootx.cxx --replace "gNoLogo = false" "gNoLogo = true" - ''; + # __malloc_hook is deprecated + substituteInPlace misc/memstat/src/TMemStatHook.cxx \ + --replace "defined(R__GNU) && (defined(R__LINUX) || defined(__APPLE__))" \ + "defined(R__GNU) && (defined(__APPLE__))" + '' + # Fix CINTSYSDIR for "build" version of rootcint + # This is probably a bug that breaks out-of-source builds + + '' + substituteInPlace cint/cint/src/loadfile.cxx\ + --replace 'env = "cint";' 'env = "'`pwd`'/cint";' + '' + + lib.optionalString noSplash '' + substituteInPlace rootx/src/rootx.cxx --replace "gNoLogo = false" "gNoLogo = true" + ''; cmakeFlags = [ "-Drpath=ON" From a32e0aa07ca206c9fd2fde021d4d6135b75211cc Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 17 Nov 2024 21:54:46 -0500 Subject: [PATCH 5/5] root5: -fpermissive fix for new compiler, patch for python312 --- pkgs/by-name/ro/root5/package.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/by-name/ro/root5/package.nix b/pkgs/by-name/ro/root5/package.nix index 0a03d44667d5..01fb35ee76d8 100644 --- a/pkgs/by-name/ro/root5/package.nix +++ b/pkgs/by-name/ro/root5/package.nix @@ -121,6 +121,11 @@ stdenv.mkDerivation rec { substituteInPlace misc/memstat/src/TMemStatHook.cxx \ --replace "defined(R__GNU) && (defined(R__LINUX) || defined(__APPLE__))" \ "defined(R__GNU) && (defined(__APPLE__))" + + # python 3.12 + substituteInPlace bindings/pyroot/src/PyROOT.h \ + --replace " PyUnicode_GET_SIZE" " PyUnicode_GetLength" \ + --replace " PyUnicode_GetSize" " PyUnicode_GetLength" '' # Fix CINTSYSDIR for "build" version of rootcint # This is probably a bug that breaks out-of-source builds @@ -169,6 +174,8 @@ stdenv.mkDerivation rec { ] ++ lib.optional ((!stdenv.hostPlatform.isDarwin) && (stdenv.cc.libc != null)) "-DC_INCLUDE_DIRS=${lib.getDev stdenv.cc.libc}/include"; + env.NIX_CFLAGS_COMPILE = "-fpermissive"; + setupHook = ./setup-hook.sh; meta = with lib; {