diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index 3233baea8f4..ab1dc4b5fe1 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -41,9 +41,15 @@ stdenv.mkDerivation rec { ++ (stdenv.lib.optionals (!stdenv.isDarwin) [ mesa libX11 ]) ; + # makeinfo is required by Octave at runtime to display help + prePatch = '' + substituteInPlace libinterp/corefcn/help.cc \ + --replace 'Vmakeinfo_program = "makeinfo"' \ + 'Vmakeinfo_program = "${texinfo}/bin/makeinfo"' + '' # REMOVE ON VERSION BUMP # Needed for Octave-4.2.1 on darwin. See https://savannah.gnu.org/bugs/?50234 - prePatch = stdenv.lib.optionalString stdenv.isDarwin '' + + stdenv.lib.optionalString stdenv.isDarwin '' sed 's/inline file_stat::~file_stat () { }/file_stat::~file_stat () { }/' -i ./liboctave/system/file-stat.cc ''; diff --git a/pkgs/development/interpreters/octave/hg.nix b/pkgs/development/interpreters/octave/hg.nix new file mode 100644 index 00000000000..a34834af48c --- /dev/null +++ b/pkgs/development/interpreters/octave/hg.nix @@ -0,0 +1,75 @@ +args@{ stdenv, openblas, ghostscript ? null, texinfo + + , # These are arguments that shouldn't be passed to the + # octave package. + texlive, tex ? texlive.combined.scheme-small + , epstool, pstoedit, transfig + , lib, fetchhg, callPackage + , autoconf, automake, libtool + , bison, librsvg, icoutils, gperf + + , # These are options that can be passed in addition to the ones + # octave usually takes. + # - rev is the HG revision. Use "tip" for the bleeding edge. + # - docs can be set to false to skip building documentation. + rev ? "23269", docs ? true + + , # All remaining arguments will be passed to the octave package. + ... + }: + +with stdenv.lib; +let + octaveArgs = removeAttrs args + [ "texlive" "tex" + "epstool" "pstoedit" "transfig" + "lib" "fetchhg" "callPackage" + "autoconf" "automake" "libtool" + "bison" "librsvg" "icoutils" "gperf" + "rev" "docs" + ]; + octave = callPackage ./default.nix octaveArgs; + + # List of hashes for known HG revisions. + sha256s = { + "23269" = "87f560e873ad1454fdbcdd8aca65f9f0b1e605bdc00aebbdc4f9d862ca72ff1d"; + }; + +in lib.overrideDerivation octave (attrs: rec { + version = "4.3.0pre${rev}"; + name = "octave-${version}"; + + src = fetchhg { + url = http://www.octave.org/hg/octave; + inherit rev; + + sha256 = + if builtins.hasAttr rev sha256s + then builtins.getAttr rev sha256s + else null; + + fetchSubrepos = true; + }; + + # Octave's test for including this flag seems to be broken in 4.3. + F77_INTEGER_8_FLAG = optional openblas.blas64 "-fdefault-integer-8"; + + # This enables texinfo to find the files it needs. + TEXINPUTS = ".:build-aux:${texinfo}/texmf-dist/tex/generic/epsf:"; + + disableDocs = !docs || ghostscript == null; + + nativeBuildInputs = attrs.nativeBuildInputs + ++ [ autoconf automake libtool bison librsvg icoutils gperf ] + ++ optionals (!disableDocs) [ tex epstool pstoedit transfig ]; + + # Run bootstrap before any other patches, as other patches may refer + # to files that are generated by the bootstrap. + prePatch = '' + patchShebangs bootstrap + ./bootstrap + '' + attrs.prePatch; + + configureFlags = attrs.configureFlags ++ + optional disableDocs "--disable-docs"; +}) diff --git a/pkgs/development/pure-modules/octave/default.nix b/pkgs/development/pure-modules/octave/default.nix index 61bc7a4d5c1..f1a54eb50ae 100644 --- a/pkgs/development/pure-modules/octave/default.nix +++ b/pkgs/development/pure-modules/octave/default.nix @@ -19,7 +19,9 @@ stdenv.mkDerivation rec { description = "An Octave module for the Pure programming language"; homepage = http://puredocs.bitbucket.org/pure-octave.html; license = stdenv.lib.licenses.gpl3Plus; - platforms = stdenv.lib.platforms.linux; + # This is set to none for now because it does not work with the + # current stable version of Octave. + platforms = stdenv.lib.platforms.none; maintainers = with stdenv.lib.maintainers; [ asppsa ]; }; } diff --git a/pkgs/tools/graphics/epstool/default.nix b/pkgs/tools/graphics/epstool/default.nix new file mode 100644 index 00000000000..9735adca53d --- /dev/null +++ b/pkgs/tools/graphics/epstool/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + version = "3.08"; + name = "epstool-${version}"; + + src = fetchurl { + url = "http://ftp.de.debian.org/debian/pool/main/e/epstool/epstool_${version}+repack.orig.tar.gz"; + sha256 = "1pfgqbipwk36clhma2k365jkpvyy75ahswn8jczzys382jalpwgk"; + }; + + installPhase = '' + make EPSTOOL_ROOT=$out install + ''; + + patches = [ ./gcc43.patch ]; + + meta = with stdenv.lib; { + description = "A utility to create or extract preview images in EPS files, fix bounding boxes and convert to bitmaps"; + homepage = http://pages.cs.wisc.edu/~ghost/gsview/epstool.htm; + license = licenses.gpl2; + maintainers = [ maintainers.asppsa ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/tools/graphics/epstool/gcc43.patch b/pkgs/tools/graphics/epstool/gcc43.patch new file mode 100644 index 00000000000..398ce08c518 --- /dev/null +++ b/pkgs/tools/graphics/epstool/gcc43.patch @@ -0,0 +1,20 @@ +--- epstool-3.08.orig/src/epstool.c 2005-06-10 04:41:00.000000000 -0500 ++++ epstool-3.08/src/epstool.c 2009-02-16 20:55:43.186140029 -0600 +@@ -2824,7 +2824,7 @@ + code = -1; + } + if ((code==0) && stdout_name && (hChildStdoutWr == -1)) { +- handle = open(stdout_name, O_WRONLY | O_CREAT); ++ handle = open(stdout_name, O_WRONLY | O_CREAT, 0644); + hChildStdoutWr = dup2(handle, 1); + if (handle != -1) + close(handle); +@@ -2832,7 +2832,7 @@ + code = -1; + } + if ((code==0) && stderr_name && (hChildStderrWr == -1)) { +- handle = open(stderr_name, O_WRONLY | O_CREAT); ++ handle = open(stderr_name, O_WRONLY | O_CREAT, 0644); + hChildStderrWr = dup2(handle, 2); + if (handle != -1) + close(handle); diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7b888a7d06d..cffdc0addc5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1674,6 +1674,8 @@ with pkgs; eplot = callPackage ../tools/graphics/eplot { }; + epstool = callPackage ../tools/graphics/epstool { }; + ethtool = callPackage ../tools/misc/ethtool { }; ettercap = callPackage ../applications/networking/sniffers/ettercap { }; @@ -5941,17 +5943,29 @@ with pkgs; git = gitMinimal; }; - octave = callPackage ../development/interpreters/octave { - qt = null; - ghostscript = null; - graphicsmagick = null; - llvm = null; - hdf5 = null; - glpk = null; - suitesparse = null; - jdk = null; - openblas = if stdenv.isDarwin then openblasCompat else openblas; - }; + inherit ( + let + defaultOctaveOptions = { + qt = null; + ghostscript = null; + graphicsmagick = null; + llvm = null; + hdf5 = null; + glpk = null; + suitesparse = null; + jdk = null; + openblas = if stdenv.isDarwin then openblasCompat else openblas; + }; + + hgOctaveOptions = + (removeAttrs defaultOctaveOptions ["ghostscript"]) // { + overridePlatforms = stdenv.lib.platforms.none; + }; + in { + octave = callPackage ../development/interpreters/octave defaultOctaveOptions; + octaveHg = lowPrio (callPackage ../development/interpreters/octave/hg.nix hgOctaveOptions); + }) octave octaveHg; + octaveFull = (lowPrio (callPackage ../development/interpreters/octave { qt = qt4; overridePlatforms = ["x86_64-linux" "x86_64-darwin"]; diff --git a/pkgs/top-level/pure-packages.nix b/pkgs/top-level/pure-packages.nix index 005e09cc003..a1600888032 100644 --- a/pkgs/top-level/pure-packages.nix +++ b/pkgs/top-level/pure-packages.nix @@ -1,4 +1,4 @@ -{ callPackage }: +{ callPackage, octaveHg }: rec { audio = callPackage ../development/pure-modules/audio { }; @@ -19,7 +19,7 @@ rec { lv2 = callPackage ../development/pure-modules/lv2 { }; midi = callPackage ../development/pure-modules/midi { }; mpfr = callPackage ../development/pure-modules/mpfr { }; - octave = callPackage ../development/pure-modules/octave { }; + octave = callPackage ../development/pure-modules/octave { octave = octaveHg; }; odbc = callPackage ../development/pure-modules/odbc { }; pandoc = callPackage ../development/pure-modules/pandoc { }; rational = callPackage ../development/pure-modules/rational { };