Skip to content

Commit

Permalink
cfitsio-4.5.0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kjmeagher committed Oct 30, 2024
1 parent 0150cf0 commit 6d367a0
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ci_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@
"1.3.3-1"
]
},
"cfitsio":{
"dependency_names": [
"cfitsio"
],
"versions":["4.5.0-1"]
},
"cglm": {
"dependency_names": [
"cglm"
Expand Down
9 changes: 9 additions & 0 deletions subprojects/cfitsio.wrap
Original file line number Diff line number Diff line change
@@ -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
261 changes: 261 additions & 0 deletions subprojects/packagefiles/cfitsio/meson.build
Original file line number Diff line number Diff line change
@@ -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 <sys/ipc.h>',
'#include <sys/shm.h>',
'#include <sys/sem.h>',
]
flock_prefix = ['#include <sys/flock.h>']

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),
)
38 changes: 38 additions & 0 deletions subprojects/packagefiles/cfitsio/meson.options
Original file line number Diff line number Diff line change
@@ -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',
)

0 comments on commit 6d367a0

Please sign in to comment.