-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
cmake, | ||
callPackage, | ||
fetchFromGitHub, | ||
makeWrapper, | ||
lib, | ||
stdenv, | ||
swig, | ||
which, | ||
boost, | ||
curl, | ||
gdal, | ||
libsvm, | ||
libgeotiff, | ||
muparser, | ||
muparserx, | ||
opencv, | ||
perl, | ||
python3, | ||
shark, | ||
tinyxml, | ||
enableFeatureExtraction ? true, | ||
enableHyperspectral ? true, | ||
enableLearning ? true, | ||
enableMiscellaneous ? true, | ||
enableOpenMP ? false, | ||
enablePython ? true, | ||
extraPythonPackages ? ps: with ps; [ ], | ||
enableRemote ? true, | ||
enableSAR ? true, | ||
enableSegmentation ? true, | ||
enableStereoProcessing ? true, | ||
}: | ||
let | ||
inherit (lib) optionalString optionals optional; | ||
pythonInputs = | ||
optionals enablePython (with python3.pkgs; [ numpy ]) ++ (extraPythonPackages python3.pkgs); | ||
|
||
otb-itk = callPackage ./itk_4_13/package.nix { }; | ||
otb-shark = shark.override { enableOpenMP = enableOpenMP; }; | ||
|
||
in | ||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "otb"; | ||
version = "9.0.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "orfeotoolbox"; | ||
repo = "otb"; | ||
rev = finalAttrs.version; | ||
hash = "sha256-Ut2aimQL6Reg62iceoaM7/nRuEV8PBWtOK7KFHKp0ws="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
cmake | ||
makeWrapper | ||
swig | ||
which | ||
]; | ||
|
||
# https://www.orfeo-toolbox.org/CookBook/CompilingOTBFromSource.html#native-build-with-system-dependencies | ||
# activates all modules and python by default | ||
cmakeFlags = | ||
optional enableFeatureExtraction "-DOTB_BUILD_FeaturesExtraction=ON" | ||
++ optional enableHyperspectral "-DOTB_BUILD_Hyperspectral=ON" | ||
++ optional enableLearning "-DOTB_BUILD_Learning=ON" | ||
++ optional enableMiscellaneous "-DOTB_BUILD_Miscellaneous=ON" | ||
++ optional enableOpenMP "-DOTB_USE_OPENMP=ON" | ||
++ optional enableRemote "-DOTB_BUILD_RemoteModules=ON" | ||
++ optional enableSAR "-DOTB_BUILD_SAR=ON" | ||
++ optional enableSegmentation "-DOTB_BUILD_Segmentation=ON" | ||
++ optional enableStereoProcessing "-DOTB_BUILD_StereoProcessing=ON" | ||
++ optional enablePython "-DOTB_WRAP_PYTHON=ON" | ||
++ optional finalAttrs.doInstallCheck "-DBUILD_TESTING=ON"; | ||
|
||
propagatedBuildInputs = [ | ||
boost | ||
curl | ||
gdal | ||
libgeotiff | ||
libsvm | ||
muparser | ||
muparserx | ||
opencv | ||
otb-itk | ||
otb-shark | ||
perl | ||
swig | ||
tinyxml | ||
] ++ optionals enablePython ([ python3 ] ++ pythonInputs); | ||
|
||
doInstallCheck = false; | ||
|
||
pythonPath = optionals enablePython pythonInputs; | ||
|
||
postInstall = '' | ||
wrapProgram $out/bin/otbcli \ | ||
--set OTB_INSTALL_DIR "$out" \ | ||
--set OTB_APPLICATION_PATH "$out/lib/otb/applications" | ||
''; | ||
|
||
meta = { | ||
description = "Open Source processing of remote sensing images"; | ||
homepage = "https://www.orfeo-toolbox.org/"; | ||
license = lib.licenses.asl20; | ||
maintainers = with lib.maintainers; [ daspk04 ]; | ||
}; | ||
}) |