summary refs log tree commit diff
diff options
context:
space:
mode:
authorSebastien Maret <sebastien.maret@univ-grenoble-alpes.fr>2018-05-31 14:00:33 +0200
committerSebastien Maret <sebastien.maret@univ-grenoble-alpes.fr>2018-06-26 11:09:45 +0200
commit8603f343a326b954f7a61ec8f07322f0f8712cf6 (patch)
tree207f4bff357d3c8fcaa16be39a404fa3a4a77e15
parent1b3111e4361fdc337390448b22b4271437e7efc6 (diff)
downloadnixpkgs-8603f343a326b954f7a61ec8f07322f0f8712cf6.tar
nixpkgs-8603f343a326b954f7a61ec8f07322f0f8712cf6.tar.gz
nixpkgs-8603f343a326b954f7a61ec8f07322f0f8712cf6.tar.bz2
nixpkgs-8603f343a326b954f7a61ec8f07322f0f8712cf6.tar.lz
nixpkgs-8603f343a326b954f7a61ec8f07322f0f8712cf6.tar.xz
nixpkgs-8603f343a326b954f7a61ec8f07322f0f8712cf6.tar.zst
nixpkgs-8603f343a326b954f7a61ec8f07322f0f8712cf6.zip
gildas: init at 201806_a
-rw-r--r--pkgs/applications/science/astronomy/gildas/clang.patch22
-rw-r--r--pkgs/applications/science/astronomy/gildas/default.nix68
-rw-r--r--pkgs/applications/science/astronomy/gildas/openblas.patch96
-rw-r--r--pkgs/applications/science/astronomy/gildas/return-error-code.patch13
-rw-r--r--pkgs/applications/science/astronomy/gildas/wrapper.patch19
-rw-r--r--pkgs/top-level/all-packages.nix2
6 files changed, 220 insertions, 0 deletions
diff --git a/pkgs/applications/science/astronomy/gildas/clang.patch b/pkgs/applications/science/astronomy/gildas/clang.patch
new file mode 100644
index 00000000000..4d6654a99ae
--- /dev/null
+++ b/pkgs/applications/science/astronomy/gildas/clang.patch
@@ -0,0 +1,22 @@
+diff -ruN gildas-src-jun18a/admin/define-system.sh gildas-src-jun18a.clang/admin/define-system.sh
+--- gildas-src-jun18a/admin/define-system.sh	2018-03-12 11:07:57.000000000 +0100
++++ gildas-src-jun18a.clang/admin/define-system.sh	2018-06-12 14:56:14.000000000 +0200
+@@ -218,13 +218,13 @@
+         	else
+         	    GAG_MACHINE=pc
+         	fi
+-                if which gcc > /dev/null 2>&1; then
+-                    DEFAULT_CCOMPILER=gcc
++                if which clang > /dev/null 2>&1; then
++                    DEFAULT_CCOMPILER=clang
+                 fi
+-                if which g++ > /dev/null 2>&1; then
+-                    DEFAULT_CXXCOMPILER=g++
+-                elif which clang++ > /dev/null 2>&1; then
++                if which clang++ > /dev/null 2>&1; then
+                     DEFAULT_CXXCOMPILER=clang++
++                elif which g++ > /dev/null 2>&1; then
++                    DEFAULT_CXXCOMPILER=g++
+                 fi
+         	if which ifort > /dev/null 2>&1; then
+         	    DEFAULT_FCOMPILER=ifort
diff --git a/pkgs/applications/science/astronomy/gildas/default.nix b/pkgs/applications/science/astronomy/gildas/default.nix
new file mode 100644
index 00000000000..bd7288f2e9c
--- /dev/null
+++ b/pkgs/applications/science/astronomy/gildas/default.nix
@@ -0,0 +1,68 @@
+{ stdenv, fetchurl, gtk2-x11 , pkgconfig , python27 , gfortran , lesstif
+, cfitsio , getopt , perl , groff , which , openblas
+}:
+
+let
+  python27Env = python27.withPackages(ps: with ps; [ numpy ]);
+in
+
+stdenv.mkDerivation rec {
+  srcVersion = "jun18a";
+  version = "20180601_a";
+  name = "gildas-${version}";
+
+  src = fetchurl {
+    url = "http://www.iram.fr/~gildas/dist/gildas-src-${srcVersion}.tar.gz";
+    sha256 = "0k4x0g69fphb1759cwcw6bbs8imwmq0qwj6zqixxk60skk4n4jvb";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ pkgconfig groff perl getopt gfortran which ];
+
+  buildInputs = [ gtk2-x11 lesstif cfitsio python27Env openblas ];
+
+  patches = [ ./wrapper.patch ./return-error-code.patch ./openblas.patch ./clang.patch ];
+
+  configurePhase=''
+    substituteInPlace admin/wrapper.sh --replace '%%OUT%%' $out
+    substituteInPlace admin/wrapper.sh --replace '%%PYTHONHOME%%' ${python27Env}
+    source admin/gildas-env.sh -c gfortran -o openmp -s ${openblas}/lib
+    echo "gag_doc:        $out/share/doc/" >> kernel/etc/gag.dico.lcl
+  '';
+
+  buildPhase=''
+    make depend
+    make install
+  '';
+
+  installPhase=''
+    mkdir -p $out/bin
+    cp -a ../gildas-exe-${srcVersion}/* $out
+    mv $out/$GAG_EXEC_SYSTEM $out/libexec
+    cp admin/wrapper.sh $out/bin/gildas-wrapper.sh
+    chmod 755 $out/bin/gildas-wrapper.sh
+    for i in $out/libexec/bin/* ; do
+      ln -s $out/bin/gildas-wrapper.sh $out/bin/$(basename "$i")
+    done
+  '';
+
+  meta = {
+    description = "Radioastronomy data analysis software";
+    longDescription = ''
+      GILDAS is a collection of state-of-the-art software
+      oriented toward (sub-)millimeter radioastronomical
+      applications (either single-dish or interferometer).
+      It is daily used to reduce all data acquired with the
+      IRAM 30M telescope and Plateau de Bure Interferometer
+      PDBI (except VLBI observations). GILDAS is easily
+      extensible. GILDAS is written in Fortran-90, with a
+      few parts in C/C++ (mainly keyboard interaction,
+      plotting, widgets).'';
+    homepage = http://www.iram.fr/IRAMFR/GILDAS/gildas.html;
+    license = stdenv.lib.licenses.free;
+    maintainers = [ stdenv.lib.maintainers.bzizou stdenv.lib.maintainers.smaret ];
+    platforms = stdenv.lib.platforms.all;
+  };
+
+}
diff --git a/pkgs/applications/science/astronomy/gildas/openblas.patch b/pkgs/applications/science/astronomy/gildas/openblas.patch
new file mode 100644
index 00000000000..4236b50796c
--- /dev/null
+++ b/pkgs/applications/science/astronomy/gildas/openblas.patch
@@ -0,0 +1,96 @@
+diff -ruN gildas-src-may18a.orig/admin/gildas-env.sh gildas-src-may18a/admin/gildas-env.sh
+--- gildas-src-may18a.orig/admin/gildas-env.sh	2018-04-24 18:20:08.000000000 +0200
++++ gildas-src-may18a/admin/gildas-env.sh	2018-05-04 16:39:18.982253471 +0200
+@@ -430,7 +430,7 @@
+         # dot (e.g. so.3 is not counted), because e.g. /usr/lib64/liblapack.so.3
+         # is useless and can not be found by the linker on command lines like
+         # "-L/usr/lib -llapack"
+-        occurences=`\ls ${2}/${1}* 2> /dev/null | \grep -v "${2}/${1}.*\." | \wc -l`
++        occurences=`\ls -l ${2}/${1}{so,a,h} 2> /dev/null | \wc -l`
+         if [ ${occurences} -ge 1 ]; then
+             \return 0
+         else
+@@ -458,11 +458,9 @@
+     SDM_MISSING=
+     #
+     for DIR in $GAGENV_SEARCH_PATH; do
+-        if file_present "liblapack." "${DIR}"; then
++        if file_present "libopenblas." "${DIR}"; then
+             LAPACK_PRESENT=yes
+             LAPACK_LIB_DIR=$DIR
+-        fi
+-        if file_present "libblas." "${DIR}"; then
+             BLAS_PRESENT=yes
+             BLAS_LIB_DIR=$DIR
+         fi
+@@ -493,7 +491,7 @@
+     X11_LIB=no
+     #
+     for DIR in $INC_PATH; do
+-        if file_present "X.h" "${DIR}/X11"; then
++        if file_present "X." "${DIR}/X11"; then
+             X11_INC=yes
+             X11_INC_DIR=$DIR
+         fi
+diff -ruN gildas-src-may18a.orig/admin/Makefile.build gildas-src-may18a/admin/Makefile.build
+--- gildas-src-may18a.orig/admin/Makefile.build	2018-03-19 17:48:07.000000000 +0100
++++ gildas-src-may18a/admin/Makefile.build	2018-05-04 16:39:18.982253471 +0200
+@@ -398,9 +398,7 @@
+ # only the shared libraries are installed (i.e. the corresponding archive
+ # libraries are missing).
+ 
+--lblas:
+-
+--llapack:
++-lopenblas:
+ 
+ -lslatec:
+ 
+diff -ruN gildas-src-may18a.orig/admin/Makefile.def gildas-src-may18a/admin/Makefile.def
+--- gildas-src-may18a.orig/admin/Makefile.def	2018-03-21 17:53:34.000000000 +0100
++++ gildas-src-may18a/admin/Makefile.def	2018-05-04 16:41:59.233518207 +0200
+@@ -206,7 +206,7 @@
+ ###########################################################################
+ # Other defaults
+ 
+-LINEAR = lapack
++LINEAR = openblas
+ GLOBAL_DIRTY = $(builddir) *~ TAGS ChangeLog* Makefile.bak
+ 
+ ###########################################################################
+@@ -515,7 +515,7 @@
+ ###########################################################################
+ # Kernel libraries
+ 
+-LEGACY_LIBS = -lslatec -llapack -lblas
++LEGACY_LIBS = -lslatec -lopenblas
+ _GAG_LIBS = -lggui -lgcore -lgio -lgfits -lgwcs -lgmath -lgsys -lginc
+ ifndef GAG_WIN32
+   GAG_LIBS = $(_GAG_LIBS)
+diff -ruN gildas-src-may18a.orig/legacy/slatec/Makefile gildas-src-may18a/legacy/slatec/Makefile
+--- gildas-src-may18a.orig/legacy/slatec/Makefile	2014-12-09 11:31:56.000000000 +0100
++++ gildas-src-may18a/legacy/slatec/Makefile	2018-05-04 16:39:18.982253471 +0200
+@@ -24,7 +24,7 @@
+ U-all.o V-all.o W-all.o X-all.o Y-all.o Z-all.o d1mach.o i1mach.o pimach.o  \
+ r1mach.o dummy.o P-all.o P-value.o Dp-1vlu.o 
+ 
+-LIB_DEPENDS = -llapack -lblas
++LIB_DEPENDS = -lopenblas
+ 
+ ifeq ($(GAG_COMPILER_FKIND),ifc)
+   OPTION_FFLAGS = 
+diff -ruN gildas-src-may18a.orig/packages/clic/lib/Makefile gildas-src-may18a/packages/clic/lib/Makefile
+--- gildas-src-may18a.orig/packages/clic/lib/Makefile	2018-01-16 11:53:15.000000000 +0100
++++ gildas-src-may18a/packages/clic/lib/Makefile	2018-05-04 16:39:18.982253471 +0200
+@@ -56,9 +56,9 @@
+ sg_line_table.o table_passband.o clic_index.o clic_blank.o
+ 
+ # Mathematical library dependency
+-ifeq ($(LINEAR),lapack)
++ifeq ($(LINEAR),openblas)
+   LINEAR_LIB_OBJECTS = singular.o mth_lapack.o
+-  LINEAR_LIB_DEPENDS = -llapack -lblas
++  LINEAR_LIB_DEPENDS = -lopenblas
+ else 
+   ifeq ($(LINEAR),nag)
+     LINEAR_LIB_OBJECTS = mth_nag.o
diff --git a/pkgs/applications/science/astronomy/gildas/return-error-code.patch b/pkgs/applications/science/astronomy/gildas/return-error-code.patch
new file mode 100644
index 00000000000..f0bd7da9354
--- /dev/null
+++ b/pkgs/applications/science/astronomy/gildas/return-error-code.patch
@@ -0,0 +1,13 @@
+diff --new-file -r -u gildas-src-dec17a.orig/admin/gildas-env.sh gildas-src-dec17a/admin/gildas-env.sh
+--- gildas-src-dec17a.orig/admin/gildas-env.sh	2017-10-24 11:39:18.000000000 +0200
++++ gildas-src-dec17a/admin/gildas-env.sh	2017-12-01 11:17:32.051953670 +0100
+@@ -1010,6 +1010,9 @@
+     gagenv_message "$gagenv_errors error(s) and $gagenv_warnings warning(s) detected"
+     if [ $gagenv_errors -ne 0 ]; then
+         gagenv_message "GILDAS will not compile"
++	gagenv_clean
++        echo
++        \return 1
+     elif [ $gagenv_warnings -ne 0 ]; then
+         gagenv_message "GILDAS will compile with some optional features disabled"
+     else
diff --git a/pkgs/applications/science/astronomy/gildas/wrapper.patch b/pkgs/applications/science/astronomy/gildas/wrapper.patch
new file mode 100644
index 00000000000..2e470a1e9cd
--- /dev/null
+++ b/pkgs/applications/science/astronomy/gildas/wrapper.patch
@@ -0,0 +1,19 @@
+diff --new-file -r -u gildas-src-feb17d.orig/admin/wrapper.sh gildas-src-feb17d/admin/wrapper.sh
+--- gildas-src-feb17d.orig/admin/wrapper.sh	1970-01-01 01:00:00.000000000 +0100
++++ gildas-src-feb17d/admin/wrapper.sh	2017-05-18 21:00:01.660778782 +0200
+@@ -0,0 +1,15 @@
++#!/bin/sh -e
++
++export GAG_ROOT_DIR="%%OUT%%"
++export GAG_PATH="${GAG_ROOT_DIR}/etc"
++export GAG_EXEC_SYSTEM="libexec"
++export PYTHONHOME="%%PYTHONHOME%%"
++if [ -z "\$PYTHONPATH" ]; then
++  PYTHONPATH="${GAG_ROOT_DIR}/${GAG_EXEC_SYSTEM}/python"
++else
++  PYTHONPATH="${GAG_ROOT_DIR}/${GAG_EXEC_SYSTEM}/python:${PYTHONPATH}"
++fi
++export PYTHONPATH
++export LD_LIBRARY_PATH=${GAG_ROOT_DIR}/${GAG_EXEC_SYSTEM}/lib/
++me=`basename $0`
++exec ${GAG_ROOT_DIR}/${GAG_EXEC_SYSTEM}/bin/${me} ${*}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 9cae3fa291d..945ad8eff7e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -20686,6 +20686,8 @@ with pkgs;
 
   fityk = callPackage ../applications/science/misc/fityk { };
 
+  gildas = callPackage ../applications/science/astronomy/gildas { };
+
   gplates = callPackage ../applications/science/misc/gplates {
     boost = boost160;
     cgal = cgal.override { boost = boost160; };