nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, fetchFromGitHub
4, cmake
5, wrapGAppsHook
6, readline
7, ncurses
8, zlib
9, gsl
10, openmp
11, graphicsmagick
12, fftw
13, fftwFloat
14, fftwLongDouble
15, proj
16, shapelib
17, expat
18, udunits
19, eigen
20, pslib
21, libpng
22, plplot
23, libtiff
24, libgeotiff
25, libjpeg
26 # eccodes is broken on darwin
27, enableGRIB ? stdenv.isLinux
28, eccodes
29, enableGLPK ? stdenv.isLinux
30, glpk
31 # We enable it in hdf4 and use libtirpc as a dependency here from the passthru
32 # of hdf4
33, enableLibtirpc ? stdenv.isLinux
34, libtirpc
35, python3
36, enableMPI ? (stdenv.isLinux || stdenv.isDarwin)
37 # Choose MPICH over OpenMPI because it currently builds on AArch and Darwin
38, mpi
39 # Unfree optional dependency for hdf4 and hdf5
40, enableSzip ? false
41, szip
42, enableHDF4 ? true
43, hdf4
44, hdf4-forced ? null
45, enableHDF5 ? true
46 # HDF5 format version (API version) 1.10 and 1.12 is not fully compatible
47 # Specify if the API version should default to 1.10
48 # netcdf currently depends on hdf5 with `usev110Api=true`
49 # If you wish to use HDF5 API version 1.12 (`useHdf5v110Api=false`),
50 # you will need to turn NetCDF off.
51, useHdf5v110Api ? true
52, hdf5
53, hdf5-forced ? null
54, enableNetCDF ? true
55, netcdf
56, netcdf-forced ? null
57, plplot-forced ? null
58 # wxWidgets is preferred over X11 for this project but we only have it on Linux
59 # and Darwin.
60, enableWX ? (stdenv.isLinux || stdenv.isDarwin)
61, wxGTK32
62, Cocoa
63 # X11: OFF by default for platform consistency. Use X where WX is not available
64, enableXWin ? (!stdenv.isLinux && !stdenv.isDarwin)
65}:
66
67let
68 hdf4-custom =
69 if hdf4-forced != null
70 then hdf4-forced
71 else
72 hdf4.override {
73 uselibtirpc = enableLibtirpc;
74 szipSupport = enableSzip;
75 inherit szip;
76 };
77 hdf5-custom =
78 if hdf5-forced != null
79 then hdf5-forced
80 else
81 hdf5.override {
82 usev110Api = useHdf5v110Api;
83 mpiSupport = enableMPI;
84 inherit mpi;
85 szipSupport = enableSzip;
86 inherit szip;
87 };
88 netcdf-custom =
89 if netcdf-forced != null
90 then netcdf-forced
91 else
92 netcdf.override {
93 hdf5 = hdf5-custom;
94 };
95 enablePlplotDrivers = enableWX || enableXWin;
96 plplot-with-drivers =
97 if plplot-forced != null
98 then plplot-forced
99 else
100 plplot.override {
101 inherit
102 enableWX
103 enableXWin
104 ;
105 };
106in
107stdenv.mkDerivation rec {
108 pname = "gnudatalanguage";
109 version = "1.0.1";
110
111 src = fetchFromGitHub {
112 owner = pname;
113 repo = "gdl";
114 rev = "v${version}";
115 sha256 = "sha256-IrCLL8MQp0SkWj7sbfZlma5FrnMbgdl4E/1nPGy0Y60=";
116 };
117
118 buildInputs = [
119 readline
120 ncurses
121 zlib
122 gsl
123 openmp
124 graphicsmagick
125 fftw
126 fftwFloat
127 fftwLongDouble
128 proj
129 shapelib
130 expat
131 mpi
132 udunits
133 eigen
134 pslib
135 libpng
136 libtiff
137 libgeotiff
138 libjpeg
139 hdf4-custom
140 hdf5-custom
141 netcdf-custom
142 plplot-with-drivers
143 ] ++ lib.optional enableXWin plplot-with-drivers.libX11
144 ++ lib.optional enableGRIB eccodes
145 ++ lib.optional enableGLPK glpk
146 ++ lib.optional enableWX wxGTK32
147 ++ lib.optional (enableWX && stdenv.isDarwin) Cocoa
148 ++ lib.optional enableMPI mpi
149 ++ lib.optional enableLibtirpc hdf4-custom.libtirpc
150 ++ lib.optional enableSzip szip;
151
152 propagatedBuildInputs = [
153 (python3.withPackages (ps: with ps; [ numpy ]))
154 ];
155
156 nativeBuildInputs = [
157 cmake
158 ] ++ lib.optional enableWX wrapGAppsHook;
159
160 cmakeFlags = lib.optional (!enableHDF4) "-DHDF=OFF"
161 ++ [ (if enableHDF5 then "-DHDF5DIR=${hdf5-custom}" else "-DHDF5=OFF") ]
162 ++ lib.optional (!enableNetCDF) "-DNETCDF=OFF"
163 ++ lib.optional (!enablePlplotDrivers) "-DINTERACTIVE_GRAPHICS=OFF"
164 ++ lib.optional (!enableGRIB) "-DGRIB=OFF"
165 ++ lib.optional (!enableGLPK) "-DGLPK=OFF"
166 ++ lib.optional (!enableWX) "-DWXWIDGETS=OFF"
167 ++ lib.optional enableSzip "-DSZIPDIR=${szip}"
168 ++ lib.optionals enableXWin [ "-DX11=ON" "-DX11DIR=${plplot-with-drivers.libX11}" ]
169 ++ lib.optionals enableMPI [ "-DMPI=ON" "-DMPIDIR=${mpi}" ];
170
171 # Tests are failing on Hydra:
172 # ./src/common/dpycmn.cpp(137): assert ""IsOk()"" failed in GetClientArea(): invalid wxDisplay object
173 doCheck = stdenv.isLinux;
174
175 # Opt-out unstable tests
176 # https://github.com/gnudatalanguage/gdl/issues/482
177 # https://github.com/gnudatalanguage/gdl/issues/1079
178 # https://github.com/gnudatalanguage/gdl/issues/460
179 preCheck = ''
180 checkFlagsArray+=("ARGS=-E '${lib.concatMapStringsSep "|" (test: test + ".pro") [
181 "test_byte_conversion"
182 "test_bytscl"
183 "test_call_external"
184 "test_tic_toc"
185 "test_timestamp"
186 ]}'")
187 '';
188
189 passthru = {
190 hdf4 = hdf4-custom;
191 hdf5 = hdf5-custom;
192 netcdf = netcdf-custom;
193 plplot = plplot-with-drivers;
194 python = python3;
195 inherit
196 enableMPI
197 mpi
198 useHdf5v110Api
199 enableSzip
200 enableWX
201 enableXWin
202 ;
203 };
204
205 meta = with lib; {
206 description = "Free incremental compiler of IDL";
207 longDescription = ''
208 GDL (GNU Data Language) is a free/libre/open source incremental compiler
209 compatible with IDL (Interactive Data Language) and to some extent with PV-WAVE.
210 GDL is aimed as a drop-in replacement for IDL.
211 '';
212 homepage = "https://github.com/gnudatalanguage/gdl";
213 license = licenses.gpl2Only;
214 maintainers = with maintainers; [ ShamrockLee ];
215 platforms = platforms.all;
216 mainProgram = "gdl";
217 };
218}