Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / nlopt / default.nix
blob2fae17a232364057a05e7deffd4ade4a7832b751
1 { lib, stdenv, fetchFromGitHub, cmake, octave ? null, libiconv }:
3 stdenv.mkDerivation rec {
4   pname = "nlopt";
5   version = "2.7.1";
7   src = fetchFromGitHub {
8     owner = "stevengj";
9     repo = pname;
10     rev = "v${version}";
11     sha256 = "sha256-TgieCX7yUdTAEblzXY/gCN0r6F9TVDh4RdNDjQdXZ1o=";
12   };
14   nativeBuildInputs = [ cmake ] ++ lib.optionals stdenv.isDarwin [ libiconv ];
15   buildInputs = [ octave ];
17   configureFlags = [
18     "--with-cxx"
19     "--enable-shared"
20     "--with-pic"
21     "--without-guile"
22     "--without-python"
23     "--without-matlab"
24   ] ++ lib.optionals (octave != null) [
25     "--with-octave"
26     "M_INSTALL_DIR=$(out)/${octave.sitePath}/m"
27     "OCT_INSTALL_DIR=$(out)/${octave.sitePath}/oct"
28   ];
30   postFixup = ''
31     substituteInPlace $out/lib/cmake/nlopt/NLoptLibraryDepends.cmake --replace \
32       'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/' 'INTERFACE_INCLUDE_DIRECTORIES "'
33   '';
35   meta = {
36     homepage = "https://nlopt.readthedocs.io/en/latest/";
37     description = "Free open-source library for nonlinear optimization";
38     license = lib.licenses.lgpl21Plus;
39     hydraPlatforms = lib.platforms.linux;
40   };