nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 gitUpdater,
6 cmake,
7 bzip2,
8 curl,
9 zlib,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "cfitsio";
14 version = "4.6.3";
15
16 src = fetchFromGitHub {
17 owner = "HEASARC";
18 repo = "cfitsio";
19 tag = "cfitsio-${finalAttrs.version}";
20 hash = "sha256-nKxX3YNRJZpmcP8/0O2pMsYjcH6vzAWMpqaHYO+HoUo=";
21 };
22
23 outputs = [
24 "bin"
25 "dev"
26 "out"
27 "doc"
28 ];
29
30 patches = [
31 ./cfitsio-pc-cmake.patch
32 ];
33
34 nativeBuildInputs = [
35 cmake
36 ];
37
38 buildInputs = [
39 bzip2
40 curl
41 zlib
42 ];
43
44 cmakeFlags = [
45 "-DUSE_PTHREADS=ON"
46 "-DTESTS=ON"
47 "-DUTILS=ON"
48 "-DUSE_BZIP2=ON"
49 ];
50
51 env = lib.optionalAttrs stdenv.hostPlatform.isFreeBSD {
52 # concerning. upstream defines XOPEN_SOURCE=700 which makes FreeBSD very insistent on
53 # not showing us gethostbyname()
54 NIX_CFLAGS_COMPILE = "-D__BSD_VISIBLE=1";
55 };
56 hardeningDisable = [ "format" ];
57
58 doCheck = true;
59 doInstallCheck = true;
60
61 # On testing cfitsio: https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/README
62 installCheckPhase = ''
63 ./TestProg > testprog.lis
64 diff -s testprog.lis ../testprog.out
65 cmp testprog.fit ../testprog.std
66 '';
67
68 # Fixup installation
69 # Remove installed test tools and benchmark
70 postInstall = ''
71 install -Dm644 -t "$out/share/doc/${finalAttrs.pname}" ../docs/*.pdf
72 rm "$out/bin/cookbook"
73 rmdir "$out/bin"
74 rm "$bin/bin/smem" "$bin/bin/speed"
75 '';
76
77 passthru = {
78 updateScript = gitUpdater { rev-prefix = "${finalAttrs.pname}-"; };
79 };
80
81 meta = {
82 homepage = "https://heasarc.gsfc.nasa.gov/fitsio/";
83 description = "Library for reading and writing FITS data files";
84 longDescription = ''
85 CFITSIO is a library of C and Fortran subroutines for reading and
86 writing data files in FITS (Flexible Image Transport System) data
87 format. CFITSIO provides simple high-level routines for reading and
88 writing FITS files that insulate the programmer from the internal
89 complexities of the FITS format. CFITSIO also provides many
90 advanced features for manipulating and filtering the information in
91 FITS files.
92 '';
93 changelog = "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/docs/changes.txt";
94 license = lib.licenses.mit;
95 maintainers = with lib.maintainers; [
96 returntoreality
97 xbreak
98 ];
99 platforms = lib.platforms.unix;
100 };
101})