Unverified Commit b499a542 authored by Vladimír Čunát's avatar Vladimír Čunát Committed by GitHub
Browse files

cfitsio: 4.4.1 -> 4.6.2 (#440450)

parents f469e177 6acdc0bc
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
diff --git a/cfitsio.pc.cmake b/cfitsio.pc.cmake
index 949b80e..6ffcaa6 100644
--- a/cfitsio.pc.cmake
+++ b/cfitsio.pc.cmake
@@ -1,7 +1,7 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=${prefix}
-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+libdir="@CMAKE_INSTALL_FULL_LIBDIR@"
+includedir="@CMAKE_INSTALL_FULL_INCLUDEDIR@"
 
 Name: cfitsio
 Description: FITS File Subroutine Library
+0 −21
Original line number Diff line number Diff line
diff -ruN cfitsio/configure cfitsio-rpath-universal/configure
--- cfitsio/configure	2018-05-09 21:16:00.000000000 +0200
+++ cfitsio-rpath-universal/configure	2021-10-27 12:02:25.000000000 +0200
@@ -4829,16 +4829,7 @@
     SHLIB_SUFFIX=".dylib"
     CFITSIO_SHLIB="lib\${PACKAGE}.\${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}\${SHLIB_SUFFIX}"
     CFITSIO_SHLIB_SONAME="lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX}"
-    case $host in
-        *darwin[56789]*)
-            SHLIB_LD="$CC -dynamiclib -install_name lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX} -compatibility_version \${CFITSIO_SONAME} -current_version \${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}.\${CFITSIO_MICRO}"
-            ;;
-        *)
-            # 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}.\${CFITSIO_MICRO}"
-            ;;
-    esac
+    SHLIB_LD="$CC -dynamiclib -install_name ${out}/lib/lib\${PACKAGE}.\${CFITSIO_SONAME}\${SHLIB_SUFFIX} -compatibility_version \${CFITSIO_SONAME} -current_version \${CFITSIO_SONAME}.\${CFITSIO_MAJOR}.\${CFITSIO_MINOR}"
 
     lhea_shlib_cflags="-fPIC -fno-common"
     ;;
+46 −14
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  fetchurl,
  fetchFromGitHub,
  gitUpdater,
  cmake,
  bzip2,
  curl,
  zlib,
@@ -9,15 +11,28 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "cfitsio";
  version = "4.4.1";
  version = "4.6.2";

  src = fetchurl {
    url = "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-${finalAttrs.version}.tar.gz";
    hash = "sha256-ZqHcPyGAD57qvZ6sV3uR/N2aq7pnj7ujuFJzGRENHSU=";
  src = fetchFromGitHub {
    owner = "HEASARC";
    repo = finalAttrs.pname;
    tag = "${finalAttrs.pname}-${finalAttrs.version}";
    hash = "sha256-WLsX23hNhaITjCvMEV7NUEvyDfQiObSJt1qFC12z7wY=";
  };

  outputs = [
    "bin"
    "dev"
    "out"
    "doc"
  ];

  patches = [
    ./darwin-rpath-universal.patch
    ./cfitsio-pc-cmake.patch
  ];

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
@@ -26,9 +41,11 @@ stdenv.mkDerivation (finalAttrs: {
    zlib
  ];

  configureFlags = [
    "--with-bzip2=${bzip2.out}"
    "--enable-reentrant"
  cmakeFlags = [
    "-DUSE_PTHREADS=ON"
    "-DTESTS=ON"
    "-DUTILS=ON"
    "-DUSE_BZIP2=ON"
  ];

  env = lib.optionalAttrs stdenv.hostPlatform.isFreeBSD {
@@ -36,16 +53,31 @@ stdenv.mkDerivation (finalAttrs: {
    # not showing us gethostbyname()
    NIX_CFLAGS_COMPILE = "-D__BSD_VISIBLE=1";
  };

  hardeningDisable = [ "format" ];

  # Shared-only build
  buildFlags = [ "shared" ];
  doCheck = true;
  doInstallCheck = true;

  postPatch = ''
    sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in
  # On testing cfitsio: https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/README
  installCheckPhase = ''
    ./TestProg > testprog.lis
    diff -s testprog.lis ../testprog.out
    cmp testprog.fit ../testprog.std
  '';

  # Fixup installation
  # Remove installed test tools and benchmark
  postInstall = ''
    install -Dm644 -t "$out/share/doc/${finalAttrs.pname}" ../docs/*.pdf
    rm "$out/bin/cookbook"
    rmdir "$out/bin"
    rm "$bin/bin/smem" "$bin/bin/speed"
  '';

  passthru = {
    updateScript = gitUpdater { rev-prefix = "${finalAttrs.pname}-"; };
  };

  meta = {
    homepage = "https://heasarc.gsfc.nasa.gov/fitsio/";
    description = "Library for reading and writing FITS data files";