Skip to content

Commit

Permalink
otb: init at 9.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
daspk04 committed Nov 14, 2024
1 parent b82ffb8 commit 7263a69
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions pkgs/by-name/ot/otb/package.nix
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 ];
};
})

0 comments on commit 7263a69

Please sign in to comment.