diff --git a/pkgs/tools/networking/xrootd/fetchxrd.nix b/pkgs/by-name/xr/xrootd/fetchxrd.nix similarity index 100% rename from pkgs/tools/networking/xrootd/fetchxrd.nix rename to pkgs/by-name/xr/xrootd/fetchxrd.nix diff --git a/pkgs/by-name/xr/xrootd/package.nix b/pkgs/by-name/xr/xrootd/package.nix new file mode 100644 index 000000000000..2860c1198538 --- /dev/null +++ b/pkgs/by-name/xr/xrootd/package.nix @@ -0,0 +1,163 @@ +{ + lib, + stdenv, + callPackage, + fetchFromGitHub, + davix, + cmake, + gtest, + makeWrapper, + pkg-config, + curl, + isa-l, + fuse, + libkrb5, + libuuid, + libxcrypt, + libxml2, + openssl, + readline, + scitokens-cpp, + systemd, + voms, + zlib, + # If not null, move the default configuration files to "$etc/etc" and look for the configuration + # directory at externalEtc. + # Otherwise, the program will look for the configuration files under $out/etc." + externalEtc ? "/etc", + removeReferencesTo, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "xrootd"; + version = "5.7.1"; + + src = fetchFromGitHub { + owner = "xrootd"; + repo = "xrootd"; + rev = "refs/tags/v${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-ZU31nsQgs+Gz9mV8LVv4utJ7g8TXN5OxHjNDfQlt38M="; + }; + + postPatch = + '' + patchShebangs genversion.sh + substituteInPlace cmake/XRootDConfig.cmake.in \ + --replace-fail "@PACKAGE_CMAKE_INSTALL_" "@CMAKE_INSTALL_FULL_" + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + sed -i cmake/XRootDOSDefs.cmake -e '/set( MacOSX TRUE )/ainclude( GNUInstallDirs )' + ''; + + outputs = [ + "bin" + "out" + "dev" + "man" + ] ++ lib.optional (externalEtc != null) "etc"; + + nativeBuildInputs = [ + cmake + makeWrapper + pkg-config + removeReferencesTo + ]; + + buildInputs = + [ + davix + curl + isa-l + libkrb5 + libuuid + libxcrypt + libxml2 + openssl + readline + scitokens-cpp + zlib + ] + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + # https://github.com/xrootd/xrootd/blob/5b5a1f6957def2816b77ec773c7e1bfb3f1cfc5b/cmake/XRootDFindLibs.cmake#L58 + fuse + ] + ++ lib.filter (lib.meta.availableOn stdenv.hostPlatform) [ + systemd # only available on specific non-static Linux platforms + voms # only available on Linux due to gsoap failing to build on Darwin + ]; + + # https://github.com/xrootd/xrootd/blob/master/packaging/rhel/xrootd.spec.in#L665-L675= + postInstall = + '' + mkdir -p "$out/lib/tmpfiles.d" + install -m 644 -T ../packaging/rhel/xrootd.tmpfiles "$out/lib/tmpfiles.d/xrootd.conf" + mkdir -p "$out/etc/xrootd" + install -m 644 -t "$out/etc/xrootd" ../packaging/common/*.cfg + install -m 644 -t "$out/etc/xrootd" ../packaging/common/client.conf + mkdir -p "$out/etc/xrootd/client.plugins.d" + install -m 644 -t "$out/etc/xrootd/client.plugins.d" ../packaging/common/client-plugin.conf.example + mkdir -p "$out/etc/logrotate.d" + install -m 644 -T ../packaging/common/xrootd.logrotate "$out/etc/logrotate.d/xrootd" + '' + # Leaving those in bin/ leads to a cyclic reference between $dev and $bin + # This happens since https://github.com/xrootd/xrootd/commit/fe268eb622e2192d54a4230cea54c41660bd5788 + # So far, this xrootd-config script does not seem necessary in $bin + + '' + moveToOutput "bin/xrootd-config" "$dev" + moveToOutput "bin/.xrootd-config-wrapped" "$dev" + '' + + lib.optionalString stdenv.hostPlatform.isLinux '' + mkdir -p "$out/lib/systemd/system" + install -m 644 -t "$out/lib/systemd/system" ../packaging/common/*.service ../packaging/common/*.socket + ''; + + cmakeFlags = [ + (lib.cmakeFeature "XRootD_VERSION_STRING" finalAttrs.version) + (lib.cmakeBool "FORCE_ENABLED" true) + (lib.cmakeBool "ENABLE_DAVIX" true) + (lib.cmakeBool "ENABLE_FUSE" (!stdenv.hostPlatform.isDarwin)) # XRootD doesn't support MacFUSE + (lib.cmakeBool "ENABLE_MACAROONS" false) + (lib.cmakeBool "ENABLE_PYTHON" false) # built separately + (lib.cmakeBool "ENABLE_SCITOKENS" true) + (lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck) + (lib.cmakeBool "ENABLE_VOMS" stdenv.hostPlatform.isLinux) + ]; + + # TODO(@ShamrockLee): Enable the checks. + doCheck = false; + checkInputs = [ gtest ]; + + postFixup = lib.optionalString (externalEtc != null) '' + moveToOutput etc "$etc" + ln -s ${lib.escapeShellArg externalEtc} "$out/etc" + ''; + + dontPatchELF = true; # shrinking rpath will cause runtime failures in dlopen + + passthru = { + fetchxrd = callPackage ./fetchxrd.nix { xrootd = finalAttrs.finalPackage; }; + tests = { + test-xrdcp = finalAttrs.passthru.fetchxrd { + pname = "xrootd-test-xrdcp"; + # Use the the bin output hash of xrootd as version to ensure that + # the test gets rebuild everytime xrootd gets rebuild + version = + finalAttrs.version + + "-" + + builtins.substring (builtins.stringLength builtins.storeDir + 1) 32 "${finalAttrs.finalPackage}"; + url = "root://eospublic.cern.ch//eos/opendata/alice/2010/LHC10h/000138275/ESD/0000/AliESDs.root"; + hash = "sha256-tIcs2oi+8u/Qr+P7AAaPTbQT+DEt26gEdc4VNerlEHY="; + }; + }; + }; + + meta = { + description = "High performance, scalable fault tolerant data access"; + homepage = "https://xrootd.slac.stanford.edu"; + changelog = "https://github.com/xrootd/xrootd/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.lgpl3Plus; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ ShamrockLee ]; + }; +}) diff --git a/pkgs/development/python-modules/xrootd/default.nix b/pkgs/development/python-modules/xrootd/default.nix index 33b42f9f0f35..65d874d73c2d 100644 --- a/pkgs/development/python-modules/xrootd/default.nix +++ b/pkgs/development/python-modules/xrootd/default.nix @@ -3,7 +3,6 @@ buildPythonPackage, cmake, setuptools, - wheel, xrootd, }: @@ -15,10 +14,9 @@ buildPythonPackage rec { sourceRoot = "${src.name}/bindings/python"; - nativeBuildInputs = [ + build-system = [ cmake setuptools - wheel ]; buildInputs = [ xrootd ]; @@ -30,11 +28,11 @@ buildPythonPackage rec { # Tests are only compatible with Python 2 doCheck = false; - meta = with lib; { + meta = { description = "XRootD central repository"; homepage = "https://github.com/xrootd/xrootd"; changelog = "https://github.com/xrootd/xrootd/releases/tag/v${version}"; - license = licenses.gpl3Only; - maintainers = with maintainers; [ GaetanLepage ]; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ GaetanLepage ]; }; } diff --git a/pkgs/tools/networking/xrootd/default.nix b/pkgs/tools/networking/xrootd/default.nix deleted file mode 100644 index 60da8d7e6e21..000000000000 --- a/pkgs/tools/networking/xrootd/default.nix +++ /dev/null @@ -1,152 +0,0 @@ -{ lib -, stdenv -, callPackage -, fetchFromGitHub -, davix -, cmake -, cppunit -, gtest -, makeWrapper -, pkg-config -, curl -, fuse -, libkrb5 -, libuuid -, libxcrypt -, libxml2 -, openssl -, readline -, scitokens-cpp -, systemd -, voms -, zlib - # Build bin/test-runner -, enableTestRunner ? true - # If not null, the builder will - # move "$out/etc" to "$out/etc.orig" and symlink "$out/etc" to externalEtc. -, externalEtc ? "/etc" -, removeReferencesTo -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "xrootd"; - version = "5.6.6"; - - src = fetchFromGitHub { - owner = "xrootd"; - repo = "xrootd"; - rev = "v${finalAttrs.version}"; - fetchSubmodules = true; - hash = "sha256-vSZKTsDMY5bhfniFOQ11VA30gjfb4Y8tCC7JNjNw8Y0="; - }; - - outputs = [ "bin" "out" "dev" "man" ] - ++ lib.optional (externalEtc != null) "etc"; - - passthru.fetchxrd = callPackage ./fetchxrd.nix { xrootd = finalAttrs.finalPackage; }; - passthru.tests = - lib.optionalAttrs stdenv.hostPlatform.isLinux { - test-runner = callPackage ./test-runner.nix { xrootd = finalAttrs.finalPackage; }; - } // { - test-xrdcp = finalAttrs.passthru.fetchxrd { - pname = "xrootd-test-xrdcp"; - # Use the the bin output hash of xrootd as version to ensure that - # the test gets rebuild everytime xrootd gets rebuild - version = finalAttrs.version + "-" + builtins.substring (builtins.stringLength builtins.storeDir + 1) 32 "${finalAttrs.finalPackage}"; - url = "root://eospublic.cern.ch//eos/opendata/alice/2010/LHC10h/000138275/ESD/0000/AliESDs.root"; - hash = "sha256-tIcs2oi+8u/Qr+P7AAaPTbQT+DEt26gEdc4VNerlEHY="; - }; - } - ; - - nativeBuildInputs = [ - cmake - makeWrapper - pkg-config - removeReferencesTo - ]; - - buildInputs = [ - davix - curl - libkrb5 - libuuid - libxcrypt - libxml2 - openssl - readline - scitokens-cpp - zlib - ] - ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ - # https://github.com/xrootd/xrootd/blob/5b5a1f6957def2816b77ec773c7e1bfb3f1cfc5b/cmake/XRootDFindLibs.cmake#L58 - fuse - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - systemd - voms - ] - ++ lib.optionals enableTestRunner [ - gtest - cppunit - ]; - - preConfigure = '' - patchShebangs genversion.sh - substituteInPlace cmake/XRootDConfig.cmake.in \ - --replace-fail "@PACKAGE_CMAKE_INSTALL_" "@CMAKE_INSTALL_FULL_" - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - sed -i cmake/XRootDOSDefs.cmake -e '/set( MacOSX TRUE )/ainclude( GNUInstallDirs )' - ''; - - # https://github.com/xrootd/xrootd/blob/master/packaging/rhel/xrootd.spec.in#L665-L675= - postInstall = '' - mkdir -p "$out/lib/tmpfiles.d" - install -m 644 -T ../packaging/rhel/xrootd.tmpfiles "$out/lib/tmpfiles.d/xrootd.conf" - mkdir -p "$out/etc/xrootd" - install -m 644 -t "$out/etc/xrootd" ../packaging/common/*.cfg - install -m 644 -t "$out/etc/xrootd" ../packaging/common/client.conf - mkdir -p "$out/etc/xrootd/client.plugins.d" - install -m 644 -t "$out/etc/xrootd/client.plugins.d" ../packaging/common/client-plugin.conf.example - mkdir -p "$out/etc/logrotate.d" - install -m 644 -T ../packaging/common/xrootd.logrotate "$out/etc/logrotate.d/xrootd" - '' - # Leaving those in bin/ leads to a cyclic reference between $dev and $bin - # This happens since https://github.com/xrootd/xrootd/commit/fe268eb622e2192d54a4230cea54c41660bd5788 - # So far, this xrootd-config script does not seem necessary in $bin - + '' - moveToOutput "bin/xrootd-config" "$dev" - moveToOutput "bin/.xrootd-config-wrapped" "$dev" - '' + lib.optionalString stdenv.hostPlatform.isLinux '' - mkdir -p "$out/lib/systemd/system" - install -m 644 -t "$out/lib/systemd/system" ../packaging/common/*.service ../packaging/common/*.socket - ''; - - cmakeFlags = [ - "-DXRootD_VERSION_STRING=${finalAttrs.version}" - ] ++ lib.optionals enableTestRunner [ - "-DFORCE_ENABLED=TRUE" - "-DENABLE_DAVIX=TRUE" - "-DENABLE_FUSE=${if (!stdenv.hostPlatform.isDarwin) then "TRUE" else "FALSE"}" # not supported - "-DENABLE_MACAROONS=OFF" - "-DENABLE_PYTHON=FALSE" # built separately - "-DENABLE_SCITOKENS=TRUE" - "-DENABLE_TESTS=TRUE" - "-DENABLE_VOMS=${if stdenv.hostPlatform.isLinux then "TRUE" else "FALSE"}" - ]; - - postFixup = lib.optionalString (externalEtc != null) '' - moveToOutput etc "$etc" - ln -s ${lib.escapeShellArg externalEtc} "$out/etc" - ''; - - dontPatchELF = true; # shrinking rpath will cause runtime failures in dlopen - - meta = with lib; { - description = "High performance, scalable fault tolerant data access"; - homepage = "https://xrootd.slac.stanford.edu"; - license = licenses.lgpl3Plus; - platforms = platforms.all; - maintainers = with maintainers; [ ShamrockLee ]; - }; -}) diff --git a/pkgs/tools/networking/xrootd/test-runner.nix b/pkgs/tools/networking/xrootd/test-runner.nix deleted file mode 100644 index b878febc7bff..000000000000 --- a/pkgs/tools/networking/xrootd/test-runner.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ runCommand, xrootd }: - -# These tests are specified in the test procedure of the upstream CD: -# https://github.com/xrootd/xrootd/blob/master/.github/workflows/build.yml#L90-L98 -runCommand "${xrootd.pname}-run-tests-${xrootd.version}" { - testRunnerPath = "${xrootd}/bin/test-runner"; - testLibraries = [ "XrdClTests" ]; - XrdClTestsSuites = [ "UtilsTest" "SocketTest" "PollerTest" ]; - pname = "${xrootd.pname}-run-tests"; - inherit (xrootd) version; - meta.mainProgram = "test-runner"; -} '' - for testLibrary in $testLibraries; do - echo "Testing $testLibrary" - testLibraryPath="${xrootd.out}/lib/lib''${testLibrary}.so" - testsuiteVarname="''${testLibrary}Suites" - for testsuite in ''${!testsuiteVarname}; do - echo "Doing test $testsuite" - "$testRunnerPath" "$testLibraryPath" "All Tests/$testsuite/" - done - done - mkdir -p "$out/bin" - ln -s "$testRunnerPath" "$out/bin/test-runner" -'' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c35b950a6813..dd3d073cf15a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2038,11 +2038,6 @@ with pkgs; xpaste = callPackage ../tools/text/xpaste { }; - xrootd = callPackage ../tools/networking/xrootd { - # Workaround systemd static build breakage - systemd = if systemd.meta.broken then null else systemd; - }; - yabridge = callPackage ../tools/audio/yabridge { wine = wineWowPackages.staging; };