summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2010-06-03 15:19:59 +0000
committerMarc Weber <marco-oweber@gmx.de>2010-06-03 15:19:59 +0000
commitd3341315bdcef050a44fb6544dfd34464b63a40b (patch)
tree469a4c3d249f8a50ce32f3579c0a3c86007d5dd9 /pkgs
parentd3be228d9623d28af90de65d224278c98dae9863 (diff)
downloadnixlib-d3341315bdcef050a44fb6544dfd34464b63a40b.tar
nixlib-d3341315bdcef050a44fb6544dfd34464b63a40b.tar.gz
nixlib-d3341315bdcef050a44fb6544dfd34464b63a40b.tar.bz2
nixlib-d3341315bdcef050a44fb6544dfd34464b63a40b.tar.lz
nixlib-d3341315bdcef050a44fb6544dfd34464b63a40b.tar.xz
nixlib-d3341315bdcef050a44fb6544dfd34464b63a40b.tar.zst
nixlib-d3341315bdcef050a44fb6544dfd34464b63a40b.zip
adding gis system grass (graphviz 3d is not supported yet)
svn path=/nixpkgs/trunk/; revision=22131
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/misc/grass/default.nix182
-rw-r--r--pkgs/lib/composable-derivation.nix14
-rw-r--r--pkgs/top-level/all-packages.nix14
3 files changed, 204 insertions, 6 deletions
diff --git a/pkgs/applications/misc/grass/default.nix b/pkgs/applications/misc/grass/default.nix
new file mode 100644
index 000000000000..067e43545737
--- /dev/null
+++ b/pkgs/applications/misc/grass/default.nix
@@ -0,0 +1,182 @@
+{getConfig, ...}@a:
+
+# You can set gui by exporting GRASS_GUI=..
+# see http://grass.itc.it/gdp/html_grass64/g.gui.html
+# defaulting to wxpython because this is used in the manual
+let inherit (builtins) getAttr;
+    inherit (a.composableDerivation) edf wwf;
+    inherit (a.stdenv.lib) maybeAttr optionalString;
+
+    # wrapper for wwf call
+    # lib: the lib whose include and lib paths should be passed
+    # {}@args: additional args being merged before passing everything to wwf
+    wwfp = lib: {name, ...}@args:
+      let mbEnable = maybeAttr "enable" {} args;
+      in wwf (args // {
+      enable =  mbEnable // {
+        buildInputs = [ lib ]
+          ++ maybeAttr "buildInputs" [] mbEnable;
+        configureFlags = [
+          "--with-${name}-libs=${lib}/lib"
+          "--with-${name}-includes=${lib}/include"
+        ] ++ maybeAttr "configureFlags" [] mbEnable;
+      };
+    });
+in
+a.composableDerivation.composableDerivation {} (fix: {
+
+  name = "grass-6.4.0RC6";
+
+  buildInputs = [
+    # gentoos package depends on gmath ? 
+    a.pkgconfig
+    a.flex a.bison a.libXmu a.libXext a.libXp a.libX11 a.libXt a.libSM a.libICE
+    a.libXpm a.libXaw a.flex a.bison a.gdbm
+    a.makeWrapper
+  ];
+
+  cfg = {
+    _64bitSupport = getConfig ["grass" "64bitSupport"] true;
+    cursesSupport = getConfig ["grass" "curses"] true;
+    gdalSupport = getConfig ["grass" "gdal"] true;
+    pythonSupport = getConfig ["grass" "python"] true;
+    wxwidgetsSupport = getConfig ["grass" "wxwidgets"] true;
+    readlineSupport = getConfig ["grass" "readline"] true;
+    jpegSupport = getConfig ["grass" "jpeg"] true;
+    tiffSupport = getConfig ["grass" "tiff"] true;
+    pngSupport = getConfig ["grass" "png"] true;
+    tcltkSupport = getConfig ["grass" "tcltk"] true;
+    postgresSupport = getConfig ["grass" "postgres"] true;
+    mysqlSupport = getConfig ["grass" "mysql"] true;
+    sqliteSupport = getConfig ["grass" "sqlite"] true;
+    ffmpegSupport = getConfig ["grass" "ffmpeg"] true;
+    openglSupport = getConfig ["grass" "opengl"] true;
+    odbcSupport = getConfig ["grass" "odbc"] false; # fails to find libodbc - why ?
+    fftwSupport = getConfig ["grass" "fftw"] true;
+    blasSupport = getConfig ["grass" "blas"] true;
+    lapackSupport = getConfig ["grass" "lapack"] true;
+    cairoSupport = getConfig ["grass" "cairo"] true;
+    motifSupport = getConfig ["grass" "motif"] true;
+    freetypeSupport = getConfig ["grass" "freetype"] true;
+    projSupport = getConfig ["grass" "proj"] true;
+    opendwgSupport = getConfig ["grass" "dwg"] false;
+    largefileSupport = getConfig ["grass" "largefile"] true;
+  };
+
+  # ?? NLS support:                no
+  # ?? GLw support:                no
+  # ?? DWG support:                no
+  flags = {
+
+    python = {
+      configureFlags = [ "--with-python=${a.python}/bin/python-config" ];
+      buildInputs = [a.python a.swig];
+    };
+    
+  }
+  // edf { name = "_64bit"; feat = "64bit"; }
+  // wwfp a.ncurses { name = "curses"; }
+  // wwfp a.gdal { name = "gdal"; }
+  // wwfp a.wxGTK { name = "wxwidgets"; value = "${a.wxGTK}/bin/wx-config"; }
+  // wwfp a.readline { name = "readline"; }
+  // wwfp a.libjpeg { name = "jpeg"; }
+  // wwfp a.libtiff { name = "tiff"; }
+  // wwfp a.libpng { name = "png"; }
+  // wwfp a.tk { name = "tcltk"; enable.buildInputs = [ a.tcl ]; }
+  // wwfp a.postgresql { name = "postgres"; }
+  // wwf {
+    name = "mysql";
+    enable = {
+      buildInputs = [ a.mysql ];
+      configureFlags = [
+        "--with-mysql-libs=${a.mysql}/lib/mysql"
+        "--with-mysql-includes=${a.mysql}/include/mysql"
+      ];
+    };
+  }
+  // wwfp a.sqlite { name = "sqlite"; }
+  // wwf {
+    name = "ffmpeg";
+    enable = {
+      configureFlags = [
+        "--with-ffmpeg-libs=${a.ffmpeg}/lib"
+        "--with-ffmpeg-includes=${a.ffmpeg}/include"
+      ];
+      # is there a nicer way to pass additional include directories?
+      # this should work: --with-ffmpeg-includes=/usr/include/lib[av|sw]*
+      # I did not try
+      preConfigure = ''
+        for dir in ${a.ffmpeg}/include/*; do
+          if [ -d $dir ]; then
+            NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$dir"
+          fi
+        done
+      '';
+      buildInputs = [a.ffmpeg];
+    };
+  }
+  // wwfp a.mesa { name = "opengl"; }
+  // wwfp a.unixODBC { name = "odbc"; }
+  // wwfp a.fftw { name = "fftw"; }
+  // wwf {
+    name = "blas"; 
+    enable.configureFlags = [ "--with-blas-libs=${a.blas}/lib" ];
+  }
+  // wwf {
+    name = "lapack";
+    enable.configureFlags = [ "--with-lapack-libs=${a.liblapack}/lib" ];
+  }
+  // wwfp a.cairo {
+    name = "cairo";
+    enable.buildInputs = [ a.fontconfig a.libXrender ];
+  }
+  // wwfp a.motif { name = "motif"; }
+  // wwf {
+    name="freetype";
+    enable = {
+      buildInputs = [ a.freetype ];
+      configureFlags = [
+        "--with-freetype-libs=${a.freetype}/lib"
+        "--with-freetype-includes=${a.freetype}/include/freetype2"
+      ];
+    };
+  }
+  // wwfp a.proj { name = "proj"; enable.configureFlags = [ "--with-proj-share=${a.proj}/share"]; }
+  // wwfp a.opendwg { name = "opendwg"; }
+  // edf {
+    name = "largefile";
+  };
+  /* ?
+  // wwf {
+    name = "x";
+    enable.buildInputs = [];
+  };
+  */
+
+  src = a.fetchurl {
+    url = "http://grass.itc.it/grass64/source/grass-6.4.0RC6.tar.gz";
+    sha256 = "043cxa224rd4q1x2mq7sl7ylnxv2vvb4k8laycgcjnp60nzhlmaz";
+  };
+
+  postInstall = ''
+    e=$(echo $out/bin/grass*)
+    mv $out/bin/{,.}$(basename $e)
+    cat >> $e << EOF
+    #!/bin/sh
+    export PATH=${a.python}/bin:\$PATH
+    export GRASS_WISH=\${a.tk}/bin/wish
+    export GRASS_GUI=\''${GRASS_GUI:-wxpython}
+    export SHELL=/bin/sh
+    ${optionalString fix.fixed.cfg.wxwidgetsSupport ''export PYTHONPATH=\$PYTHONPATH\''${PYTHONPATH:+:}:$(toPythonPath ${a.wxPython})''}
+    exec $out/bin/.$(basename $e)
+    EOF
+    chmod +x $e
+  '';
+
+  meta = {
+    description = "free Geographic Information System (GIS) software used for geospatial data management and analysis, image processing, graphics/maps production, spatial modeling, and visualization";
+    homepage = http://grass.itc.it/index.php;
+    license = [ "GPL" ];
+  };
+
+})
diff --git a/pkgs/lib/composable-derivation.nix b/pkgs/lib/composable-derivation.nix
index 03f1f48ec72c..1099bd152bf6 100644
--- a/pkgs/lib/composable-derivation.nix
+++ b/pkgs/lib/composable-derivation.nix
@@ -42,11 +42,13 @@ let inherit (lib) nv nvs; in
   # W ith or W ithout F eature
   wwf = {name, feat ? name, enable ? {}, disable ? {}, value ? ""}:
     nvs name {
-    set = {
-      configureFlags = ["--with-${feat}${if value == "" then "" else "="}${value}"];
-    } // enable;
-    unset = {
-      configureFlags = ["--without-${feat}"];
-    } // disable;
+    set = enable // {
+      configureFlags = ["--with-${feat}${if value == "" then "" else "="}${value}"]
+                       ++ lib.maybeAttr "configureFlags" [] enable;
+    };
+    unset = disable // {
+      configureFlags = ["--without-${feat}"]
+                       ++ lib.maybeAttr "configureFlags" [] disable;
+    };
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 9c7c7db636bd..4421c56df655 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7704,6 +7704,20 @@ let
     inherit stdenv fetchurl zlib openssl;
   };
 
+  grass = import ../applications/misc/grass {
+    inherit (xlibs) libXmu libXext libXp libX11 libXt libSM libICE libXpm
+      libXaw libXrender;
+    inherit getConfig composableDerivation stdenv fetchurl
+      lib flex bison cairo fontconfig
+      gdal zlib ncurses gdbm proj pkgconfig swig
+      blas liblapack libjpeg libpng mysql unixODBC mesa postgresql python
+      readline sqlite tcl tk libtiff freetype ffmpeg makeWrapper wxGTK;
+    fftw = fftwSinglePrec;
+    motif = lesstif;
+    opendwg = libdwg;
+    wxPython = wxPython28;
+  };
+
   grip = import ../applications/misc/grip {
     inherit fetchurl stdenv lib grip pkgconfig curl cdparanoia libid3tag;
     inherit (gtkLibs) gtk glib;