2022-09-01 17:00:26 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, boost
|
|
|
|
, tbb
|
|
|
|
, makeWrapper
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "PotreeConverter";
|
2023-04-03 14:09:48 +02:00
|
|
|
version = "unstable-2023-02-27";
|
2022-09-01 17:00:26 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "potree";
|
|
|
|
repo = "PotreeConverter";
|
2023-04-03 14:09:48 +02:00
|
|
|
rev = "af4666fa1090983d8ce7c11dcf49ba19eda90995";
|
|
|
|
sha256 = "sha256-QYNY+/v6mBEJFiv3i2QS+zqkgWJqeqXSqNoh+ChAiQA=";
|
2022-09-01 17:00:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
tbb
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
patchPhase = ''
|
2023-04-03 13:48:48 +02:00
|
|
|
runHook prePatch
|
|
|
|
|
2022-09-01 17:00:26 +02:00
|
|
|
substituteInPlace ./CMakeLists.txt \
|
|
|
|
--replace "find_package(TBB REQUIRED)" ""
|
2023-04-03 13:48:48 +02:00
|
|
|
|
|
|
|
# prevent inheriting permissions from /nix/store when copying
|
|
|
|
substituteInPlace Converter/src/main.cpp --replace \
|
|
|
|
'fs::copy(templateDir, pagedir, fs::copy_options::overwrite_existing | fs::copy_options::recursive)' 'string cmd = "cp --no-preserve=mode -r " + templateDir + " " + pagedir; system(cmd.c_str());'
|
|
|
|
|
|
|
|
runHook postPatch
|
2022-09-01 17:00:26 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/{bin,lib}
|
|
|
|
mv liblaszip.so $out/lib
|
|
|
|
mv PotreeConverter $out/bin
|
|
|
|
ln -s $out/bin/PotreeConverter $out/bin/potreeconverter
|
|
|
|
|
|
|
|
# Create an empty wrapper, since PotreeConverter segfaults if called via
|
|
|
|
# $PATH rather than absolute path. An empty wrapper forces an absolute path
|
|
|
|
# on each invocation
|
|
|
|
wrapProgram $out/bin/PotreeConverter
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2023-04-03 13:48:04 +02:00
|
|
|
fixupPhase = ''
|
|
|
|
runHook preFixup
|
|
|
|
ln -s $src/resources $out/bin/resources
|
|
|
|
runHook postFixup
|
|
|
|
'';
|
2023-04-03 13:48:48 +02:00
|
|
|
|
2022-09-01 17:00:26 +02:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Create multi res point cloud to use with potree";
|
|
|
|
homepage = "https://github.com/potree/PotreeConverter";
|
|
|
|
license = licenses.bsd2;
|
|
|
|
maintainers = with maintainers; [ matthewcroughan ];
|
|
|
|
platforms = with platforms; linux;
|
|
|
|
};
|
|
|
|
}
|