2022-02-20 02:22:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, callPackage
|
|
|
|
, fetchFromGitHub
|
2024-02-01 08:19:28 +00:00
|
|
|
, davix
|
2022-02-20 02:22:22 +00:00
|
|
|
, cmake
|
|
|
|
, cppunit
|
2024-02-01 08:19:28 +00:00
|
|
|
, gtest
|
2023-05-26 09:26:47 +00:00
|
|
|
, makeWrapper
|
2022-02-24 21:40:53 +00:00
|
|
|
, pkg-config
|
2022-02-20 02:22:22 +00:00
|
|
|
, curl
|
|
|
|
, fuse
|
|
|
|
, libkrb5
|
|
|
|
, libuuid
|
2022-09-29 23:43:34 +00:00
|
|
|
, libxcrypt
|
2022-02-20 02:22:22 +00:00
|
|
|
, libxml2
|
|
|
|
, openssl
|
|
|
|
, readline
|
2024-02-01 08:19:28 +00:00
|
|
|
, scitokens-cpp
|
2022-02-20 02:22:22 +00:00
|
|
|
, systemd
|
2022-02-24 21:40:53 +00:00
|
|
|
, voms
|
2022-02-20 02:22:22 +00:00
|
|
|
, zlib
|
2023-03-08 22:13:22 +00:00
|
|
|
# Build bin/test-runner
|
2023-03-08 22:17:09 +00:00
|
|
|
, enableTestRunner ? true
|
2022-07-25 03:28:13 +00:00
|
|
|
# If not null, the builder will
|
|
|
|
# move "$out/etc" to "$out/etc.orig" and symlink "$out/etc" to externalEtc.
|
|
|
|
, externalEtc ? "/etc"
|
2024-02-01 08:19:28 +00:00
|
|
|
, removeReferencesTo
|
2022-02-20 02:22:22 +00:00
|
|
|
}:
|
|
|
|
|
2023-03-08 22:30:09 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-02-20 02:22:22 +00:00
|
|
|
pname = "xrootd";
|
2024-02-01 08:19:28 +00:00
|
|
|
version = "5.6.6";
|
2022-02-20 02:22:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xrootd";
|
|
|
|
repo = "xrootd";
|
2023-03-08 22:30:09 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2022-02-20 02:22:22 +00:00
|
|
|
fetchSubmodules = true;
|
2024-02-01 08:19:28 +00:00
|
|
|
hash = "sha256-vSZKTsDMY5bhfniFOQ11VA30gjfb4Y8tCC7JNjNw8Y0=";
|
2022-02-20 02:22:22 +00:00
|
|
|
};
|
|
|
|
|
2023-10-20 18:35:38 +00:00
|
|
|
outputs = [ "bin" "out" "dev" "man" ]
|
|
|
|
++ lib.optional (externalEtc != null) "etc";
|
2022-02-20 02:22:22 +00:00
|
|
|
|
2023-03-08 22:13:22 +00:00
|
|
|
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=";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
;
|
2022-02-20 02:22:22 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2023-05-26 09:26:47 +00:00
|
|
|
makeWrapper
|
2022-02-20 02:22:22 +00:00
|
|
|
pkg-config
|
2024-02-01 08:19:28 +00:00
|
|
|
removeReferencesTo
|
2022-02-20 02:22:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2024-02-01 08:19:28 +00:00
|
|
|
davix
|
2022-02-20 02:22:22 +00:00
|
|
|
curl
|
|
|
|
libkrb5
|
|
|
|
libuuid
|
2022-09-29 23:43:34 +00:00
|
|
|
libxcrypt
|
2022-02-20 02:22:22 +00:00
|
|
|
libxml2
|
|
|
|
openssl
|
|
|
|
readline
|
2024-02-01 08:19:28 +00:00
|
|
|
scitokens-cpp
|
2022-02-20 02:22:22 +00:00
|
|
|
zlib
|
2024-02-01 08:19:28 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals (!stdenv.isDarwin) [
|
|
|
|
# https://github.com/xrootd/xrootd/blob/5b5a1f6957def2816b77ec773c7e1bfb3f1cfc5b/cmake/XRootDFindLibs.cmake#L58
|
2023-02-03 07:36:07 +00:00
|
|
|
fuse
|
2022-02-20 02:22:22 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.isLinux [
|
|
|
|
systemd
|
2022-02-24 21:40:53 +00:00
|
|
|
voms
|
2022-02-20 02:22:22 +00:00
|
|
|
]
|
2023-03-08 22:17:09 +00:00
|
|
|
++ lib.optionals enableTestRunner [
|
2024-02-01 08:19:28 +00:00
|
|
|
gtest
|
2022-02-20 02:22:22 +00:00
|
|
|
cppunit
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs genversion.sh
|
2024-02-01 08:19:28 +00:00
|
|
|
substituteInPlace cmake/XRootDConfig.cmake.in \
|
|
|
|
--replace-fail "@PACKAGE_CMAKE_INSTALL_" "@CMAKE_INSTALL_FULL_"
|
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
sed -i cmake/XRootDOSDefs.cmake -e '/set( MacOSX TRUE )/ainclude( GNUInstallDirs )'
|
2022-02-20 02:22:22 +00:00
|
|
|
'';
|
|
|
|
|
2022-07-25 03:28:13 +00:00
|
|
|
# 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"
|
2024-02-01 08:19:28 +00:00
|
|
|
''
|
|
|
|
# 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"
|
2022-07-25 03:28:13 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
|
|
|
mkdir -p "$out/lib/systemd/system"
|
|
|
|
install -m 644 -t "$out/lib/systemd/system" ../packaging/common/*.service ../packaging/common/*.socket
|
|
|
|
'';
|
|
|
|
|
2024-02-01 08:19:28 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DXRootD_VERSION_STRING=${finalAttrs.version}"
|
|
|
|
] ++ lib.optionals enableTestRunner [
|
|
|
|
"-DFORCE_ENABLED=TRUE"
|
|
|
|
"-DENABLE_DAVIX=TRUE"
|
|
|
|
"-DENABLE_FUSE=${if (!stdenv.isDarwin) then "TRUE" else "FALSE"}" # not supported
|
|
|
|
"-DENABLE_MACAROONS=OFF"
|
|
|
|
"-DENABLE_PYTHON=FALSE" # built separately
|
|
|
|
"-DENABLE_SCITOKENS=TRUE"
|
2022-02-20 02:22:22 +00:00
|
|
|
"-DENABLE_TESTS=TRUE"
|
2024-02-01 08:19:28 +00:00
|
|
|
"-DENABLE_VOMS=${if stdenv.isLinux then "TRUE" else "FALSE"}"
|
2022-02-20 02:22:22 +00:00
|
|
|
];
|
|
|
|
|
2024-02-17 20:38:01 +00:00
|
|
|
postFixup = lib.optionalString (externalEtc != null) ''
|
2023-10-20 18:35:38 +00:00
|
|
|
moveToOutput etc "$etc"
|
2022-07-25 03:28:13 +00:00
|
|
|
ln -s ${lib.escapeShellArg externalEtc} "$out/etc"
|
|
|
|
'';
|
|
|
|
|
2024-02-17 20:38:01 +00:00
|
|
|
dontPatchELF = true; # shrinking rpath will cause runtime failures in dlopen
|
|
|
|
|
2022-02-20 02:22:22 +00:00
|
|
|
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 ];
|
|
|
|
};
|
2023-03-08 22:30:09 +00:00
|
|
|
})
|