summary refs log tree commit diff
path: root/pkgs/development/libraries/eigen
diff options
context:
space:
mode:
authorOrivej Desh <orivej@gmx.fr>2018-11-18 21:30:07 +0000
committerOrivej Desh (NixOS) <40807862+orivej-nixos@users.noreply.github.com>2018-11-18 21:30:07 +0000
commit023e54404c60b1e1b4ac8e2d975d3aead2fc4331 (patch)
tree3ea8bd53898384c82b5a1a8b0fbe749885280bd0 /pkgs/development/libraries/eigen
parentd7ef9a710716e737bd86be1adbefc0418b585d64 (diff)
downloadnixpkgs-023e54404c60b1e1b4ac8e2d975d3aead2fc4331.tar
nixpkgs-023e54404c60b1e1b4ac8e2d975d3aead2fc4331.tar.gz
nixpkgs-023e54404c60b1e1b4ac8e2d975d3aead2fc4331.tar.bz2
nixpkgs-023e54404c60b1e1b4ac8e2d975d3aead2fc4331.tar.lz
nixpkgs-023e54404c60b1e1b4ac8e2d975d3aead2fc4331.tar.xz
nixpkgs-023e54404c60b1e1b4ac8e2d975d3aead2fc4331.tar.zst
nixpkgs-023e54404c60b1e1b4ac8e2d975d3aead2fc4331.zip
eigen3_3: fix EIGEN3_INCLUDE_DIR location (#50628)
Eigen assumes that CMAKE_INSTALL_INCLUDEDIR is a path relative to
CMAKE_INSTALL_PREFIX (typically "include"), but CMake supports it being an
absolute path, which is the case in Nixpkgs. This resulted in EIGEN3_INCLUDE_DIR
being set to "/nix/store/…eigen…//nix/store/…eigen…/include/eigen3".

GNUInstallDirs_get_absolute_install_dir requires CMake 3.7.
Diffstat (limited to 'pkgs/development/libraries/eigen')
-rw-r--r--pkgs/development/libraries/eigen/3.3.nix10
-rw-r--r--pkgs/development/libraries/eigen/include-dir.patch49
2 files changed, 54 insertions, 5 deletions
diff --git a/pkgs/development/libraries/eigen/3.3.nix b/pkgs/development/libraries/eigen/3.3.nix
index e3367f661ca..c48f8e4c973 100644
--- a/pkgs/development/libraries/eigen/3.3.nix
+++ b/pkgs/development/libraries/eigen/3.3.nix
@@ -5,19 +5,19 @@ let
 in
 stdenv.mkDerivation {
   name = "eigen-${version}";
-  
+
   src = fetchurl {
     url = "https://bitbucket.org/eigen/eigen/get/${version}.tar.gz";
     name = "eigen-${version}.tar.gz";
     sha256 = "13p60x6k61zq2y2in7g4fy5p55cr5dbmj3zvw10zcazxraxbcm04";
   };
 
+  patches = [
+    ./include-dir.patch
+  ];
+
   nativeBuildInputs = [ cmake ];
 
-  postInstall = ''
-    sed -e '/Cflags:/s@''${prefix}/@@' -i "$out"/share/pkgconfig/eigen3.pc
-  '';
-   
   meta = with stdenv.lib; {
     description = "C++ template library for linear algebra: vectors, matrices, and related algorithms";
     license = licenses.lgpl3Plus;
diff --git a/pkgs/development/libraries/eigen/include-dir.patch b/pkgs/development/libraries/eigen/include-dir.patch
new file mode 100644
index 00000000000..7f3bd88557e
--- /dev/null
+++ b/pkgs/development/libraries/eigen/include-dir.patch
@@ -0,0 +1,49 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ project(Eigen3)
+ 
+-cmake_minimum_required(VERSION 2.8.5)
++cmake_minimum_required(VERSION 3.7)
+ 
+ # guard against in-source builds
+ 
+@@ -408,13 +408,6 @@ install(FILES
+   DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
+   )
+ 
+-if(EIGEN_BUILD_PKGCONFIG)
+-    configure_file(eigen3.pc.in eigen3.pc @ONLY)
+-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc
+-        DESTINATION ${PKGCONFIG_INSTALL_DIR}
+-        )
+-endif()
+-
+ add_subdirectory(Eigen)
+ 
+ add_subdirectory(doc EXCLUDE_FROM_ALL)
+@@ -510,8 +503,15 @@ set ( EIGEN_VERSION_MAJOR  ${EIGEN_WORLD_VERSION} )
+ set ( EIGEN_VERSION_MINOR  ${EIGEN_MAJOR_VERSION} )
+ set ( EIGEN_VERSION_PATCH  ${EIGEN_MINOR_VERSION} )
+ set ( EIGEN_DEFINITIONS "")
+-set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" )
+ set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} )
++GNUInstallDirs_get_absolute_install_dir(EIGEN_INCLUDE_DIR INCLUDE_INSTALL_DIR)
++
++if(EIGEN_BUILD_PKGCONFIG)
++    configure_file(eigen3.pc.in eigen3.pc @ONLY)
++    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc
++        DESTINATION ${PKGCONFIG_INSTALL_DIR}
++        )
++endif()
+ 
+ # Interface libraries require at least CMake 3.0
+ if (NOT CMAKE_VERSION VERSION_LESS 3.0)
+--- a/eigen3.pc.in
++++ b/eigen3.pc.in
+@@ -6,4 +6,4 @@ Description: A C++ template library for linear algebra: vectors, matrices, and r
+ Requires:
+ Version: @EIGEN_VERSION_NUMBER@
+ Libs:
+-Cflags: -I${prefix}/@INCLUDE_INSTALL_DIR@
++Cflags: -I@EIGEN_INCLUDE_DIR@