about summary refs log tree commit diff
path: root/pkgs/development/interpreters/gnudatalanguage
diff options
context:
space:
mode:
authorShamrock Lee <44064051+ShamrockLee@users.noreply.github.com>2020-09-25 03:10:22 +0000
committerShamrock Lee <44064051+ShamrockLee@users.noreply.github.com>2021-10-17 14:06:31 +0800
commitd80b0c01711f840aa703a3c923f7d941cded15b9 (patch)
treecea51371c5b28d46491e0ac7162990930198a526 /pkgs/development/interpreters/gnudatalanguage
parent3c024373c16f5f677b79808ea1d5116c8caf6e9d (diff)
gnudatalanguage: Init at 1.0.0
*   Generate PlPlot drivers by
    injecting wxGtk31 (if enableWX == true)
    and/or xorg.libX11 (if enableXWin == true,
    default to false)
    into the buildInputs of plplot
    with plplot.overrideAttrs
*   Override hdf4 and hdf5 with
    custom mpi (if
    enableMPI == true and libraryMPI == mpich)
    and szip (if enableSzip == true, default to false)
Diffstat (limited to 'pkgs/development/interpreters/gnudatalanguage')
-rw-r--r--pkgs/development/interpreters/gnudatalanguage/default.nix203
1 files changed, 203 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/gnudatalanguage/default.nix b/pkgs/development/interpreters/gnudatalanguage/default.nix
new file mode 100644
index 0000000000000..38f3402330176
--- /dev/null
+++ b/pkgs/development/interpreters/gnudatalanguage/default.nix
@@ -0,0 +1,203 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, cmake
+, wrapGAppsHook
+, readline
+, ncurses
+, zlib
+, gsl
+, openmp
+, graphicsmagick
+, fftw
+, fftwFloat
+, fftwLongDouble
+, proj
+, shapelib
+, expat
+, udunits
+, eigen
+, pslib
+, eccodes
+, glpk
+, libpng
+, plplot
+, libtiff
+, libgeotiff
+, libjpeg
+  # We enable it in hdf4 and use libtirpc as a dependency here from the passthru
+  # of hdf4
+, enableLibtirpc ? stdenv.isLinux
+, libtirpc
+, python3
+, enableMPI ? (stdenv.isLinux || stdenv.isDarwin)
+  # Choose MPICH over OpenMPI because it currently builds on AArch and Darwin
+, mpi
+  # Unfree optional dependency for hdf4 and hdf5
+, enableSzip ? false
+, szip
+, enableHDF4 ? true
+, hdf4
+, hdf4-forced ? null
+, enableHDF5 ? true
+  # HDF5 format version (API version) 1.10 and 1.12 is not fully compatible
+  # Specify if the API version should default to 1.10
+  # netcdf currently depends on hdf5 with `usev110Api=true`
+  # If you wish to use HDF5 API version 1.12 (`useHdf5v110Api=false`),
+  # you will need to turn NetCDF off.
+, useHdf5v110Api ? true
+, hdf5
+, hdf5-forced ? null
+, enableNetCDF ? true
+, netcdf
+, netcdf-forced ? null
+, plplot-forced ? null
+  # wxWidgets is preferred over X11 for this project but we only have it on Linux
+  # and Darwin. Also, we use the wxWidgets dependency here from the passthru of
+  # plplot.
+, enableWX ? (stdenv.isLinux || stdenv.isDarwin)
+  # X11: OFF by default for platform consistency. Use X where WX is not available
+, enableXWin ? (!stdenv.isLinux && !stdenv.isDarwin)
+}:
+
+let
+  hdf4-custom =
+    if hdf4-forced != null
+    then hdf4-forced
+    else
+      hdf4.override {
+        uselibtirpc = enableLibtirpc;
+        szipSupport = enableSzip;
+        inherit szip;
+      };
+  hdf5-custom =
+    if hdf5-forced != null
+    then hdf5-forced
+    else
+      hdf5.override {
+        usev110Api = useHdf5v110Api;
+        mpiSupport = enableMPI;
+        inherit mpi;
+        szipSupport = enableSzip;
+        inherit szip;
+      };
+  netcdf-custom =
+    if netcdf-forced != null
+    then netcdf-forced
+    else
+      netcdf.override {
+        hdf5 = hdf5-custom;
+      };
+  enablePlplotDrivers = enableWX || enableXWin;
+  plplot-with-drivers =
+    if plplot-forced != null
+    then plplot-forced
+    else
+      plplot.override {
+        inherit
+          enableWX
+          enableXWin
+          ;
+      };
+in
+stdenv.mkDerivation rec {
+  pname = "gnudatalanguage";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = "gdl";
+    rev = "v${version}";
+    sha256 = "sha256-Y9LVRaWjQqpWqjNngxB406PE/rl/9S8rs0u0CK5ivUA=";
+  };
+
+  buildInputs = [
+    readline
+    ncurses
+    zlib
+    gsl
+    openmp
+    graphicsmagick
+    fftw
+    fftwFloat
+    fftwLongDouble
+    proj
+    shapelib
+    expat
+    mpi
+    udunits
+    eigen
+    pslib
+    eccodes
+    glpk
+    libpng
+    libtiff
+    libgeotiff
+    libjpeg
+    hdf4-custom
+    hdf5-custom
+    netcdf-custom
+    plplot-with-drivers
+  ] ++ lib.optional enableXWin plplot-with-drivers.libX11
+  ++ lib.optional enableWX plplot-with-drivers.wxWidgets
+  ++ lib.optional enableMPI mpi
+  ++ lib.optional enableLibtirpc hdf4-custom.libtirpc
+  ++ lib.optional enableSzip szip;
+
+  propagatedBuildInputs = [
+    (python3.withPackages (ps: with ps; [ numpy ]))
+  ];
+
+  nativeBuildInputs = [
+    cmake
+  ] ++ lib.optional enableWX wrapGAppsHook;
+
+  cmakeFlags = lib.optional (!enableHDF4) "-DHDF=OFF"
+    ++ [ (if enableHDF5 then "-DHDF5DIR=${hdf5-custom}" else "-DHDF5=OFF") ]
+    ++ lib.optional (!enableNetCDF) "-DNETCDF=OFF"
+    ++ lib.optional (!enablePlplotDrivers) "-DINTERACTIVE_GRAPHICS=OFF"
+    ++ lib.optional (!enableWX) "-DWXWIDGETS=OFF"
+    ++ lib.optional enableSzip "-DSZIPDIR=${szip}"
+    ++ lib.optionals enableXWin [ "-DX11=ON" "-DX11DIR=${plplot-with-drivers.libX11}" ]
+    ++ lib.optionals enableMPI [ "-DMPI=ON" "-DMPIDIR=${mpi}" ];
+
+  doCheck = true;
+
+  # Opt-out unstable tests
+  # https://github.com/gnudatalanguage/gdl/issues/482
+  # https://github.com/gnudatalanguage/gdl/issues/1079
+  # https://github.com/gnudatalanguage/gdl/issues/460
+  preCheck = ''
+    checkFlagsArray+=("ARGS=-E 'test_tic_toc.pro|test_byte_conversion.pro|test_bytscl.pro|test_call_external.pro'")
+  '';
+
+  passthru = {
+    hdf4 = hdf4-custom;
+    hdf5 = hdf5-custom;
+    netcdf = netcdf-custom;
+    plplot = plplot-with-drivers;
+    python = python3;
+    inherit
+      enableMPI
+      mpi
+      useHdf5v110Api
+      enableSzip
+      enableWX
+      enableXWin
+      ;
+  };
+
+  meta = with lib; {
+    description = "Free incremental compiler of IDL";
+    longDescription = ''
+      GDL (GNU Data Language) is a free/libre/open source incremental compiler
+      compatible with IDL (Interactive Data Language) and to some extent with PV-WAVE.
+      GDL is aimed as a drop-in replacement for IDL.
+    '';
+    homepage = "https://github.com/gnudatalanguage/gdl";
+    license = licenses.gpl2Only;
+    maintainers = with maintainers; [ ShamrockLee ];
+    platforms = platforms.all;
+    mainProgram = "gdl";
+  };
+}