From 6d367a0a02c32dc17e4210a867b9c6e133a1b3b8 Mon Sep 17 00:00:00 2001 From: Kevin Meagher <11620178+kjmeagher@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:59:28 -0500 Subject: [PATCH] cfitsio-4.5.0 This is a file wrap with a patch. It is mostly based on the CMakeLists.txt provided in the source. But there were a few defines in the autotolls version that werent in the cmake that I also added. --- ci_config.json | 8 + releases.json | 6 + subprojects/cfitsio.wrap | 9 + subprojects/packagefiles/cfitsio/meson.build | 261 ++++++++++++++++++ .../packagefiles/cfitsio/meson.options | 38 +++ 5 files changed, 322 insertions(+) create mode 100644 subprojects/cfitsio.wrap create mode 100644 subprojects/packagefiles/cfitsio/meson.build create mode 100644 subprojects/packagefiles/cfitsio/meson.options diff --git a/ci_config.json b/ci_config.json index 8ef616fe8..9908e0b1a 100644 --- a/ci_config.json +++ b/ci_config.json @@ -55,6 +55,14 @@ "cexception:werror=false" ] }, + "cfitsio":{ + "build_options":[ + "cfitsio:curl=enabled", + "cfitsio:reentrant=enabled", + "cfitsio:bzip2=enabled", + "cfitsio:fortran=enabled" + ] + }, "cglm": { "build_options": [ "cglm:build_tests=true" diff --git a/releases.json b/releases.json index d23f7ef28..18f587250 100644 --- a/releases.json +++ b/releases.json @@ -348,6 +348,12 @@ "1.3.3-1" ] }, + "cfitsio":{ + "dependency_names": [ + "cfitsio" + ], + "versions":["4.5.0-1"] + }, "cglm": { "dependency_names": [ "cglm" diff --git a/subprojects/cfitsio.wrap b/subprojects/cfitsio.wrap new file mode 100644 index 000000000..8e7cf500d --- /dev/null +++ b/subprojects/cfitsio.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = cfitsio-4.5.0 +source_url = https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.5.0.tar.gz +source_filename = cfitsio-4.5.0.tar.gz +source_hash = e4854fc3365c1462e493aa586bfaa2f3d0bb8c20b75a524955db64c27427ce09 +patch_directory = cfitsio + +[provide] +cfitsio = cfitsio_dep diff --git a/subprojects/packagefiles/cfitsio/meson.build b/subprojects/packagefiles/cfitsio/meson.build new file mode 100644 index 000000000..823a8b809 --- /dev/null +++ b/subprojects/packagefiles/cfitsio/meson.build @@ -0,0 +1,261 @@ +project( + 'cfitsio', + 'c', + version: '4.5.0', + meson_version: '>=1.1.0', + license: 'CFITSIO', + license_files: ['licenses/License.txt'], +) +has_fortran = add_languages('fortran', required: get_option('fortran')) + +SOVERSION = 10 + +cc = meson.get_compiler('c') +libm = cc.find_library('m') + +if target_machine.system() != 'windows' + curl = dependency( + 'libcurl', + required: get_option('curl'), + fallback: ['curl', 'libcurl'], + ) + if curl.found() + add_project_arguments('-DCFITSIO_HAVE_CURL', language: 'c') + endif +endif + +threads = dependency('threads', required: get_option('reentrant')) +if threads.found() + add_project_arguments('-D_REENTRANT', language: 'c') +endif + +zlib = dependency('zlib', fallback: ['zlib', 'zlib_dep']) + +if target_machine.system() != 'windows' + bzip2 = dependency( + 'bzip2', + required: get_option('bzip2'), + fallback: ['bzip2', 'bzip2'], + ) + if bzip2.found() + add_project_arguments('-DHAVE_BZIP2=1', language: 'c') + endif +endif + +if get_option('hera') + add_project_arguments('-DBUILD_HERA=1', language: 'c') +endif + +if cc.get_id() != 'msvc' and cc.has_function('gethostbyname') and cc.has_function( + 'connect', +) + add_project_arguments('-DHAVE_NET_SERVICES', language: 'c') + if cc.has_header_symbol('stdio.h', 'fmemopen') + add_project_arguments('-DHAVE_FMEMOPEN', language: 'c') + endif +endif + +if get_option('sse2') + if cc.has_argument('-msse2') + add_project_arguments('-msse2', language: 'c') + elif cc.get_id() == 'msvc' + add_project_arguments('-D__SSE2__=1') + endif +endif + +if get_option('ssse3') + if cc.has_argument('-mssse3') + add_project_arguments('-mssse3', language: 'c') + elif cc.get_id() == 'msvc' + add_project_arguments('-D__SSE2__=1', '-D__SSSE3__=1', language: 'c') + endif +endif + +if cc.has_header_symbol('unistd.h', 'ftruncate') + add_project_arguments('-DHAVE_UNISTD_H', '-DHAVE_FTRUNCATE', language: 'c') +endif + +shmem_prefix = [ + '#include ', + '#include ', + '#include ', +] +flock_prefix = ['#include '] + +have_shmem_services = true +foreach func : ['shmat', 'shmdt', 'shmget', 'semget'] + have_shmem_services = have_shmem_services and cc.has_function( + func, + prefix: shmem_prefix, + ) +endforeach +if have_shmem_services + add_project_arguments('-DHAVE_SHMEM_SERVICES', language: 'c') + if cc.has_type('flock_t', prefix: flock_prefix) + add_project_arguments('-DHAVE_FLOCK_T', language: 'c') + endif + if cc.has_type('union semun', prefix: shmem_prefix) + add_project_arguments('-DHAVE_UNION_SEMUN', language: 'c') + endif +endif + +if cc.has_type('long long') + add_project_arguments('-DHAVE_LONGLONG', language: 'c') +endif + +install_headers('fitsio.h', 'fitsio2.h', 'longnam.h') + +libcfitsio_la_SOURCES = [ + 'buffers.c', + 'cfileio.c', + 'checksum.c', + 'drvrfile.c', + 'drvrmem.c', + 'drvrnet.c', + 'drvrsmem.c', + 'editcol.c', + 'edithdu.c', + 'eval_l.c', + 'eval_y.c', + 'eval_f.c', + 'fitscore.c', + 'getcol.c', + 'getcolb.c', + 'getcold.c', + 'getcole.c', + 'getcoli.c', + 'getcolj.c', + 'getcolk.c', + 'getcoll.c', + 'getcols.c', + 'getcolsb.c', + 'getcoluk.c', + 'getcolui.c', + 'getcoluj.c', + 'getkey.c', + 'group.c', + 'grparser.c', + 'histo.c', + 'iraffits.c', + 'modkey.c', + 'putcol.c', + 'putcolb.c', + 'putcold.c', + 'putcole.c', + 'putcoli.c', + 'putcolj.c', + 'putcolk.c', + 'putcoluk.c', + 'putcoll.c', + 'putcols.c', + 'putcolsb.c', + 'putcolu.c', + 'putcolui.c', + 'putcoluj.c', + 'putkey.c', + 'region.c', + 'scalnull.c', + 'swapproc.c', + 'wcssub.c', + 'wcsutil.c', + 'imcompress.c', + 'quantize.c', + 'ricecomp.c', + 'pliocomp.c', + 'fits_hcompress.c', + 'fits_hdecompress.c', + 'simplerng.c', + 'zcompress.c', + 'zuncompress.c', +] + +if has_fortran + libcfitsio_la_SOURCES += [ + 'f77_wrap1.c', + 'f77_wrap2.c', + 'f77_wrap3.c', + 'f77_wrap4.c', + ] +endif + +libcfitsio = shared_library( + 'cfitsio', + libcfitsio_la_SOURCES, + dependencies: [libm, zlib, curl, threads, bzip2], + version: meson.project_version(), + soversion: SOVERSION, + install: true, +) + +cfitsio_dep = declare_dependency( + include_directories: include_directories('.'), + link_with: libcfitsio, +) + +pkg = import('pkgconfig') +pkg.generate( + libraries: libcfitsio, + version: meson.project_version(), + name: 'cifitsio', + description: 'FITS File Subroutine Library', + url: 'https://heasarc.gsfc.nasa.gov/fitsio/', +) + +executable( + 'fitscopy', + 'utilities/fitscopy.c', + dependencies: cfitsio_dep, + install: get_option('utils'), +) +executable( + 'fitsverify', + 'utilities/ftverify.c', + 'utilities/fvrf_data.c', + 'utilities/fvrf_file.c', + 'utilities/fvrf_head.c', + 'utilities/fvrf_key.c', + 'utilities/fvrf_misc.c', + c_args: '-DSTANDALONE', + dependencies: cfitsio_dep, + install: get_option('utils'), +) +executable( + 'fpack', + 'utilities/fpack.c', + 'utilities/fpackutil.c', + dependencies: [libm, cfitsio_dep], + install: get_option('utils'), +) +executable( + 'funpack', + 'utilities/funpack.c', + 'utilities/fpackutil.c', + dependencies: [libm, cfitsio_dep], + link_with: libcfitsio, + install: get_option('utils'), +) + +executable('executimcopy', 'utilities/imcopy.c', dependencies: cfitsio_dep) +if have_shmem_services + executable('smem', 'utilities/smem.c', dependencies: cfitsio_dep) +endif + +test( + 'cookbook', + executable('cookbook', 'utilities/cookbook.c', dependencies: cfitsio_dep), +) +test( + 'testprog', + executable('testprog', 'utilities/testprog.c', dependencies: cfitsio_dep), +) + +if has_fortran + test( + 'testf77', + executable('testf77', 'utilities/testf77.f', dependencies: cfitsio_dep), + ) +endif +benchmark( + 'speed', + executable('speed', 'utilities/speed.c', dependencies: cfitsio_dep), +) diff --git a/subprojects/packagefiles/cfitsio/meson.options b/subprojects/packagefiles/cfitsio/meson.options new file mode 100644 index 000000000..dcc8967c6 --- /dev/null +++ b/subprojects/packagefiles/cfitsio/meson.options @@ -0,0 +1,38 @@ +option( + 'curl', + type: 'feature', + description: 'Enable linking with the curl library. Enables remote file i/o support', +) +option( + 'reentrant', + type: 'feature', + description: 'Enable reentrant multithreading', +) +option( + 'utils', + type: 'boolean', + description: 'Build fpack, funpack, fitscopy, and fitsverify executables', +) +option( + 'sse2', + type: 'boolean', + description: 'Enable use of instructions in the SSE2 extended instruction set', +) +option( + 'ssse3', + type: 'boolean', + description: 'Enable use of instructions in the SSSE3 extended instruction set', +) +option('hera', type: 'boolean', description: 'Build for HERA (ASD use only)') +option( + 'bzip2', + type: 'feature', + description: 'Enable bzip2 support. Optional path to the location of include/bzlib.h and lib/libbz2', +) +# option('gsiftp',type:'feature', description: 'Enable Globus Toolkit gsiftp protocol support') +# option('gsiftp-flavour','Define Globus Toolkit gsiftp protocol flavour') +option( + 'fortran', + type: 'feature', + description: 'Build package with Fortran support', +)