From 3d2fd2268b1c9b923bbc2482332a93a863027c27 Mon Sep 17 00:00:00 2001 From: Sebastien Maret Date: Wed, 30 May 2018 14:31:07 +0200 Subject: [PATCH] cfitsio: add darwin support --- .../cfitsio/darwin-curl-config.patch | 25 +++++++++++++++++++ .../libraries/cfitsio/darwin-universal.patch | 12 +++++++++ .../development/libraries/cfitsio/default.nix | 6 +++-- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/libraries/cfitsio/darwin-curl-config.patch create mode 100644 pkgs/development/libraries/cfitsio/darwin-universal.patch diff --git a/pkgs/development/libraries/cfitsio/darwin-curl-config.patch b/pkgs/development/libraries/cfitsio/darwin-curl-config.patch new file mode 100644 index 000000000000..77d8f719d778 --- /dev/null +++ b/pkgs/development/libraries/cfitsio/darwin-curl-config.patch @@ -0,0 +1,25 @@ +diff -ruN cfitsio/configure cfitsio-curl-config/configure +--- cfitsio/configure 2018-05-09 21:16:00.000000000 +0200 ++++ cfitsio-curl-config/configure 2018-05-30 13:28:58.000000000 +0200 +@@ -4783,13 +4783,6 @@ + CURL_LIB="" + CURL_INC="" + # Use curl-config to get compiler & linker flags, if available. +-# On Macs, prefer XCode curl-config, and reject MacPorts version +-# until further notice to prevent build errors: +-if test "x$EXT" = xdarwin -a -x /usr/bin/curl-config; then +- CURLCONFIG="/usr/bin/curl-config" +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for curl-config... choosing /usr/bin/curl-config on Mac" >&5 +-$as_echo "checking for curl-config... choosing /usr/bin/curl-config on Mac" >&6; } +-else + # Extract the first word of "curl-config", so it can be a program name with args. + set dummy curl-config; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +@@ -4833,7 +4826,6 @@ + fi + fi + fi +-fi + CURLCONFIG=$ac_cv_prog_CURLCONFIG + if test -n "$CURLCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURLCONFIG" >&5 diff --git a/pkgs/development/libraries/cfitsio/darwin-universal.patch b/pkgs/development/libraries/cfitsio/darwin-universal.patch new file mode 100644 index 000000000000..db9b7b5a56e4 --- /dev/null +++ b/pkgs/development/libraries/cfitsio/darwin-universal.patch @@ -0,0 +1,12 @@ +diff -ruN cfitsio/configure cfitsio-universal/configure +--- cfitsio/configure 2018-05-09 21:16:00.000000000 +0200 ++++ cfitsio-universal/configure 2018-05-30 14:26:03.000000000 +0200 +@@ -4734,7 +4734,7 @@ + *) + # Build 'Universal' binaries (i386 & x86_64 architectures) and + # use rpath token on Darwin 10.x or newer: +- SHLIB_LD="$CC -dynamiclib $C_UNIV_SWITCH -headerpad_max_install_names -install_name @rpath/lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX} -compatibility_version \${CFITSIO_SONAME} -current_version \${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}" ++ SHLIB_LD="$CC -dynamiclib -headerpad_max_install_names -install_name @rpath/lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX} -compatibility_version \${CFITSIO_SONAME} -current_version \${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}" + ;; + esac + diff --git a/pkgs/development/libraries/cfitsio/default.nix b/pkgs/development/libraries/cfitsio/default.nix index ecf5fb1f02fd..1fc9b62ccc86 100644 --- a/pkgs/development/libraries/cfitsio/default.nix +++ b/pkgs/development/libraries/cfitsio/default.nix @@ -8,9 +8,11 @@ sha256 = "07fghxh5fl8nqk3q0dh8rvc83npnm0hisxzcj16a6r7gj5pmp40l"; }; + patches = [ ./darwin-curl-config.patch ./darwin-universal.patch ]; + # Shared-only build buildFlags = "shared"; - patchPhase = '' sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in + postPatch = '' sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in ''; meta = with stdenv.lib; { @@ -27,6 +29,6 @@ ''; # Permissive BSD-style license. license = "permissive"; - platforms = platforms.linux; + platforms = with platforms; linux ++ darwin; }; }