[cfitsio] Update to 3.49 and fix dependency zlib (#14064)

* [cfitsio] Update to 3.49 and fix dependency zlib

* export unofficial cmake targets

* [cfitsio] Fix file paths, export cmake targets

* [cfitsio] Required cmake_policy CMP0012

* [ccfits] Fix dependency cfitsio

* [cfitsio] Fixup pkgconfig

* [healpix] Fix dependency cfitsio

* [cfitsio] fix homepage and patches

Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com>
This commit is contained in:
Jack·Boos·Yu 2020-10-17 02:05:12 -07:00 committed by GitHub
parent 0b5b24698f
commit 32c5722104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 206 additions and 65 deletions

View File

@ -1,5 +1,6 @@
Source: ccfits
Version: 2.5-5
Version: 2.5
Port-Version: 6
Homepage: https://heasarc.gsfc.nasa.gov/fitsio/ccfits
Description: CCfits is an object oriented interface to the cfitsio library. It is designed to make the capabilities of cfitsio available to programmers working in C++.
Build-Depends: cfitsio

View File

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d72ae85..405d96b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,8 +22,8 @@ ENDIF()
#add_subdirectory (src)
-find_package(CFITSIO REQUIRED)
-INCLUDE_DIRECTORIES(${CFITSIO_INCLUDE_DIR})
+find_package(unofficial-cfitsio CONFIG REQUIRED)
+set(CFITSIO_LIBRARY cfitsio)
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)

View File

@ -7,7 +7,9 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive_ex(
ARCHIVE ${ARCHIVE}
OUT_SOURCE_PATH SOURCE_PATH
PATCHES dll_exports.patch
PATCHES
dll_exports.patch
fix-dependency.patch
)
vcpkg_configure_cmake(

View File

@ -1,40 +0,0 @@
From 67400fcbd3ab2f7e68a8e7a60139b1b615debae2 Mon Sep 17 00:00:00 2001
From: Nicole Mazzuca <mazzucan@outlook.com>
Date: Wed, 23 Sep 2020 10:27:43 -0700
Subject: [PATCH] correct headers for getcwd
---
fitsio.h | 3 +++
group.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/fitsio.h b/fitsio.h
index ec26d9d..792bb95 100644
--- a/fitsio.h
+++ b/fitsio.h
@@ -39,6 +39,9 @@ SERVICES PROVIDED HEREUNDER."
#define CFITSIO_MAJOR 3
#define CFITSIO_SONAME 5
+/* Required for getcwd() */
+#define _POSIX_C_SOURCE 200112L
+
/* the SONAME is incremented in a new release if the binary shared */
/* library (on linux and Mac systems) is not backward compatible */
/* with the previous release of CFITSIO */
diff --git a/group.c b/group.c
index 9326c57..cec0f6a 100644
--- a/group.c
+++ b/group.c
@@ -24,7 +24,7 @@
#include <direct.h> /* defines the getcwd function on Windows PCs */
#endif
-#if defined(unix) || defined(__unix__) || defined(__unix) || defined(HAVE_UNISTD_H)
+#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(HAVE_UNISTD_H)
#include <unistd.h> /* needed for getcwd prototype on unix machines */
#endif
--
2.24.3 (Apple Git-128)

View File

@ -0,0 +1,39 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d6af49..9e7d2ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,9 +94,8 @@ IF (NOT MSVC)
# Find curl library, for HTTPS support:
IF (UseCurl)
- FIND_PACKAGE(CURL)
+ FIND_PACKAGE(CURL CONFIG REQUIRED)
IF (CURL_FOUND)
- INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
ADD_DEFINITIONS(-DCFITSIO_HAVE_CURL)
ENDIF()
ENDIF()
@@ -128,18 +127,20 @@ SET(SRC_FILES
# Only include zlib source files if we are building a shared library.
# Users will need to link their executable with zlib independently.
-IF (BUILD_SHARED_LIBS)
+IF (0)
set(SRC_FILES ${SRC_FILES}
zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c
zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c
zlib/uncompr.c zlib/zutil.c
)
+ELSE()
+ FIND_PACKAGE(ZLIB REQUIRED)
ENDIF()
ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES})
-TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB})
+TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB} ZLIB::ZLIB)
IF (CURL_FOUND)
- TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBRARIES})
+ TARGET_LINK_LIBRARIES(${LIB_NAME} CURL::libcurl)
ENDIF(CURL_FOUND)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION})

View File

@ -0,0 +1,48 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e7d2ee..5b37adc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ OPTION(UseCurl "UseCurl" ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
-set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/")
+set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/cfitsio")
# Define project version
SET(${PROJECT_NAME}_MAJOR_VERSION 3)
@@ -138,19 +138,31 @@ ELSE()
ENDIF()
ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES})
-TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB} ZLIB::ZLIB)
+TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC $<INSTALL_INTERFACE:include/cfitsio>)
+TARGET_LINK_LIBRARIES(${LIB_NAME} PUBLIC ${PTHREADS_LIBRARY} ${M_LIB} ZLIB::ZLIB)
IF (CURL_FOUND)
- TARGET_LINK_LIBRARIES(${LIB_NAME} CURL::libcurl)
+ TARGET_LINK_LIBRARIES(${LIB_NAME} PUBLIC CURL::libcurl)
ENDIF(CURL_FOUND)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION})
-install(TARGETS ${LIB_NAME} DESTINATION ${LIB_DESTINATION})
install(TARGETS ${LIB_NAME}
+ EXPORT unofficial-${LIB_NAME}-config
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
+set(CFITSIO_VERSION 3.49)
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(unofficial-${LIB_NAME}-version.cmake VERSION ${CFITSIO_VERSION} COMPATIBILITY ExactVersion)
+
+install(FILES ${CMAKE_BINARY_DIR}/unofficial-${LIB_NAME}-version.cmake DESTINATION share/unofficial-${LIB_NAME})
+
+install(
+ EXPORT unofficial-${LIB_NAME}-config
+ DESTINATION share/unofficial-${LIB_NAME}
+)
+
# Only build test code and executables if building a shared library:
IF (BUILD_SHARED_LIBS)

View File

@ -0,0 +1,27 @@
From af09ca45ad71a540aafc4989676e9a0b88bf2948 Mon Sep 17 00:00:00 2001
From: Nicole Mazzuca <mazzucan@outlook.com>
Date: Fri, 16 Oct 2020 12:28:37 -0700
Subject: [PATCH] add `-Wno-error=implicit-funciton-declaration` to cmake
---
CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b37adc..fead70c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,10 @@ SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
PROJECT(CFITSIO)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
+if (NOT MSVC)
+ add_compile_options(-Wno-error=implicit-function-declaration)
+endif()
+
# Allow @rpath token in target install name on Macs.
# See "cmake --help-policy CMP0042" for more information.
IF(POLICY CMP0042)
--
2.28.0.windows.1

View File

@ -1,5 +1,13 @@
Source: cfitsio
Version: 3.410
Port-Version: 4
Homepage: https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c
Version: 3.49
Homepage: https://heasarc.gsfc.nasa.gov/fitsio/
Description: Library of C and Fortran subroutines for reading and writing data files in FITS (Flexible Image Transport System) data format
Build-Depends: zlib
Feature: curl
Description: UseCurl
Build-Depends: curl
Feature: pthreads
Description: Thread-safe build (using pthreads)
Build-Depends: pthreads (windows)

View File

@ -1,38 +1,65 @@
vcpkg_download_distfile(ARCHIVE
URLS "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio3410.tar.gz"
FILENAME "cfitsio3410.tar.gz"
SHA512 b2ac31ab17e19eeeb4f1601f42f348402c0a4ab03725dbf74fe75eaabbee2f44f64f0c0ee7f0b2688bd93a9cc0dccf29f07e73b9148fff97fc78bebdbb5f6f0f
URLS "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.49.tar.gz"
FILENAME "cfitsio-3.49.tar.gz"
SHA512 9836a4af3bbbfed1ea1b4c70b9d500ac485d7c3d8131eb8a25ee6ef6662f46ba52b5161c45c709ed9a601ff0e9ec36daa5650eaaf4f2cc7d6f4bb5640f10da15
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES
0001-correct-headers-for-getcwd.patch
0001-fix-dependencies.patch
0002-export-cmake-targets.patch
0003-add-Wno-error-implicit-funciton-declaration-to-cmake.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
curl UseCurl
)
if ("curl" IN_LIST FEATURES)
set(FIND_CURL_DEPENDENCY "find_dependency(CURL CONFIG)")
endif()
if ("pthreads" IN_LIST FEATURES)
if (VCPKG_TARGET_IS_WINDOWS)
set(WITH_PTHREADS ON)
set(FIND_PTHREADS_DEPENDENCY "find_dependency(pthreads)")
else()
message(WARNING "Feature pthreads only support Windows, disable it now.")
set(WITH_PTHREADS OFF)
endif()
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
-DUSE_PTHREADS=${WITH_PTHREADS}
)
vcpkg_install_cmake()
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-cfitsio TARGET_PATH share/unofficial-cfitsio)
# Remove duplicate include files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/include/unistd.h)
file(READ ${CURRENT_PACKAGES_DIR}/share/unofficial-cfitsio/unofficial-cfitsio-config.cmake ASSIMP_CONFIG)
file(WRITE ${CURRENT_PACKAGES_DIR}/share/unofficial-cfitsio/unofficial-cfitsio-config.cmake "
include(CMakeFindDependencyMacro)
${FIND_CURL_DEPENDENCY}
${FIND_PTHREADS_DEPENDENCY}
find_dependency(ZLIB)
${ASSIMP_CONFIG}
")
# cfitsio uses very common names for its headers, so they must be moved to a subdirectory
file(RENAME ${CURRENT_PACKAGES_DIR}/include ${CURRENT_PACKAGES_DIR}/cfitsio)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/cfitsio ${CURRENT_PACKAGES_DIR}/include/cfitsio)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/unofficial-cfitsio/unofficial-cfitsio-config.cmake
"cmake_policy(VERSION 2.6)"
"cmake_policy(VERSION 2.6)\r\n\
# Required for the evaluation of \"if(@BUILD_SHARED_LIBS@)\" below to function\r\n\
cmake_policy(SET CMP0012 NEW)\r\n"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
# move DLLs to bin directories for dynamic builds
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cfitsio.dll ${CURRENT_PACKAGES_DIR}/bin/cfitsio.dll)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cfitsio.dll ${CURRENT_PACKAGES_DIR}/debug/bin/cfitsio.dll)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/include/unistd.h ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cfitsio RENAME copyright)
file(INSTALL ${SOURCE_PATH}/FindPthreads.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/unofficial-cfitsio)
file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -1,6 +1,6 @@
Source: healpix
Version: 1.12.10
Port-Version: 6
Port-Version: 7
Homepage: http://healpix.sourceforge.net/
Description: HEALPix is an acronym for Hierarchical Equal Area isoLatitude Pixelation of a sphere.
Build-Depends: cfitsio

View File

@ -0,0 +1,13 @@
diff --git a/src/cxx/configure.ac b/src/cxx/configure.ac
index 63f05d7..e284f0d 100644
--- a/src/cxx/configure.ac
+++ b/src/cxx/configure.ac
@@ -175,7 +175,7 @@ CXXCFLAGS_NO_C="$CXXCFLAGS $CPPFLAGS"
LDCCFLAGS="$LDFLAGS $CCFLAGS"
LDCXXFLAGS="$LDFLAGS $CXXCFLAGS"
-AC_CHECK_LIB([cfitsio],[ffgnrwll],,AC_MSG_ERROR([could not find the cfitsio library]),[-lm])
+AC_CHECK_LIB([cfitsio -lz],[ffgnrwll],,AC_MSG_ERROR([could not find the cfitsio library]),[-lm -lz])
AC_CHECK_HEADERS([fitsio.h],,AC_MSG_ERROR([could not find the cfitsio header file]),)
AC_SUBST(SILENT_RULE)

View File

@ -7,6 +7,7 @@ vcpkg_from_sourceforge(
REF Healpix_${HEALPIX_VER}
FILENAME "Healpix_${HEALPIX_PACK_NAME}.tar.gz"
SHA512 29fe680d757bd94651bf029654257cb67286643aad510df4c2f0b06245174411376ec1beca64feebfac14a6fc0194525170635842916d79dcaddeddd9ac6f6c7
PATCHES fix-dependency.patch
)
vcpkg_configure_make(