From b02908c2133057cc88b4465285ce2c306952526d Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 7 Jul 2021 00:16:59 +0200 Subject: [PATCH] libtiff: Reenable OpenGL support on Darwin I found the correct inputs to get `libtiff` to compile with OpenGL support on Darwin. Allowing us to get rid of the ugly build system patch. --- .../libtiff/0001-Disable-OpenGL.patch | 26 ------------------- .../development/libraries/libtiff/default.nix | 15 ++++++----- pkgs/top-level/all-packages.nix | 4 ++- 3 files changed, 11 insertions(+), 34 deletions(-) delete mode 100644 pkgs/development/libraries/libtiff/0001-Disable-OpenGL.patch diff --git a/pkgs/development/libraries/libtiff/0001-Disable-OpenGL.patch b/pkgs/development/libraries/libtiff/0001-Disable-OpenGL.patch deleted file mode 100644 index 60ce8ed49b16..000000000000 --- a/pkgs/development/libraries/libtiff/0001-Disable-OpenGL.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 6385dfa45c86b79da4f84df10f481f0ba260ab1f Mon Sep 17 00:00:00 2001 -From: toonn -Date: Sat, 3 Jul 2021 20:38:25 +0200 -Subject: [PATCH] Disable OpenGL - ---- - CMakeLists.txt | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index efe857d..e72897b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -611,9 +611,6 @@ endif() - find_package(OpenGL) - find_package(GLUT) - set(HAVE_OPENGL FALSE) --if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND) -- set(HAVE_OPENGL TRUE) --endif() - # Purely to satisfy the generated headers: - check_include_file(GL/gl.h HAVE_GL_GL_H) - check_include_file(GL/glu.h HAVE_GL_GLU_H) --- -2.17.2 (Apple Git-113) - diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix index d004f35d3f1c..51c0d02def6c 100644 --- a/pkgs/development/libraries/libtiff/default.nix +++ b/pkgs/development/libraries/libtiff/default.nix @@ -8,6 +8,11 @@ , libjpeg , xz , zlib + +, Cocoa +, GLUT +, libGL +, libGLU }: #FIXME: fix aarch64-darwin build and get rid of ./aarch64-darwin.nix @@ -22,12 +27,7 @@ stdenv.mkDerivation rec { }; # FreeImage needs this patch - patches = [ ./headers.patch ] - # CMake manages to detect the OpenGL and GLUT system frameworks but doesn't - # find the `gl.h` header, making the tests fail. With older Clangs OpenGL - # wasn't detected so the simplest fix was to keep CMake from checking for - # it. This means `tiffgt` isn't built and tested. - ++ lib.optional stdenv.isDarwin ./0001-Disable-OpenGL.patch; + patches = [ ./headers.patch ]; outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ]; @@ -43,7 +43,8 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ libjpeg xz zlib ]; #TODO: opengl support (bogus configure detection) - buildInputs = [ libdeflate ]; # TODO: move all propagatedBuildInputs to buildInputs. + buildInputs = [ libdeflate ] # TODO: move all propagatedBuildInputs to buildInputs. + ++ lib.optionals (stdenv.isDarwin) [ Cocoa GLUT libGL libGLU ]; enableParallelBuilding = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5098e93f690b..60b38b7ca358 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18285,7 +18285,9 @@ with pkgs; libtiff = if stdenv.isDarwin && stdenv.isAarch64 then callPackage ../development/libraries/libtiff/aarch64-darwin.nix { } - else callPackage ../development/libraries/libtiff { }; + else callPackage ../development/libraries/libtiff { + inherit (darwin.apple_sdk.frameworks) Cocoa GLUT; + }; libtiger = callPackage ../development/libraries/libtiger { };