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