From 22dd59cd672d876a99c719087117b19074cd0d49 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 1 Jul 2019 07:28:36 -0500 Subject: gn: Add octave@3.4.3. Add two upstream patches and package glpk@4.48 for octave to use. --- gn/packages/maths.scm | 74 +++++++++++++++++++++++++++++++++++++++++++++++ gnulib-gets.patch | 60 ++++++++++++++++++++++++++++++++++++++ octave-nested-class.patch | 39 +++++++++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 gn/packages/maths.scm create mode 100644 gnulib-gets.patch create mode 100644 octave-nested-class.patch diff --git a/gn/packages/maths.scm b/gn/packages/maths.scm new file mode 100644 index 0000000..f57459d --- /dev/null +++ b/gn/packages/maths.scm @@ -0,0 +1,74 @@ +(define-module (gn packages maths) + #:use-module (gnu packages) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix utils) + #:use-module (gnu packages base) + #:use-module (gnu packages gperf) + #:use-module (gnu packages maths) + #:use-module (gnu packages texinfo) + #:use-module (srfi srfi-1)) + +(define-public octave-3.4.3 + (package + (inherit octave-cli) + (name "octave") + (version "3.4.3") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://gnu/octave/octave-" + version ".tar.gz")) + (sha256 + (base32 + "04lh3crzwpramvfvxq34n2r29pmfl37rssj853nz9a3pyq7wrrir")) + (patches (search-patches "gnulib-gets.patch" + "octave-nested-class.patch")))) + (arguments + (substitute-keyword-arguments (package-arguments octave-cli) + ((#:configure-flags cf) + `(cons "--enable-docs=no" ; docs fail to build + ,cf)) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'patch-configure-script + (lambda _ + (substitute* '("configure" + "src/DLD-FUNCTIONS/__delaunayn__.cc" + "src/DLD-FUNCTIONS/__voronoi__.cc" + "src/DLD-FUNCTIONS/convhulln.cc") + (("qhull/qhull.h") "libqhull/libqhull.h") + (("qhull/qhull_a.h") "libqhull/qhull_a.h")) + #t)) + (replace 'configure-makeinfo + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/help.cc" + (("\"makeinfo\"") + (string-append + "\"" (assoc-ref inputs "texinfo") "/bin/makeinfo\""))) + #t)))))) + (native-inputs + `(("glibc-2.27" ,glibc-2.27) ; works around fseeko.c problem in gnulib + ,@(fold alist-delete (package-native-inputs octave-cli) + '("lzip")))) + (inputs + `(("glpk" ,glpk-4.48) + ("gperf" ,gperf) + ,@(fold alist-delete (package-inputs octave-cli) + ;; suitesparse provides cholmod_common_struct, may need older version + '("glpk" "suitesparse")))))) + +;; 4.49 is the last version with _glp_lpx_simplex exported +;; 4.49 is the version where all lpx_ routines were removed +(define-public glpk-4.48 + (package + (inherit glpk) + (version "4.48") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://gnu/glpk/glpk-" + version ".tar.gz")) + (sha256 + (base32 + "1cddqsdcfwavdklg7hsfifppsry81dx3c17wzk6r22mjjpwcihmb")))))) diff --git a/gnulib-gets.patch b/gnulib-gets.patch new file mode 100644 index 0000000..cccb55a --- /dev/null +++ b/gnulib-gets.patch @@ -0,0 +1,60 @@ +Minimally modified from upstream +only first change set from lib/stdio.in.h taken +s@lib/stdio@libgnu/stdio@g run on the 'diff' line. + +From: Eric Blake +Date: Thu, 29 Mar 2012 19:30:41 +0000 (-0600) +Subject: stdio: don't assume gets any more +X-Git-Tag: v0.1~799 +X-Git-Url: https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff_plain;h=66712c23388e93e5c518ebc8515140fa0c807348 + +stdio: don't assume gets any more + +Gnulib intentionally does not have a gets module, and now that C11 +and glibc have dropped it, we should be more proactive about warning +any user on a platform that still has a declaration of this dangerous +interface. + +* m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets +support. +* modules/stdio (Makefile.am): Likewise. +* gnu/stdio-read.c (gets): Likewise. +* tests/test-stdio-c++.cc: Likewise. +* m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment. +* gnu/stdio.in.h (gets): Make warning occur in more places. +* doc/posix-functions/gets.texi (gets): Update documentation. +Reported by Christer Solskogen. + +Signed-off-by: Eric Blake +--- +diff --git a/libgnu/stdio.in.h b/libgnu/stdio.in.h +index aa7b599..c377b6e 100644 +--- a/libgnu/stdio.in.h ++++ b/libgnu/stdio.in.h +@@ -698,22 +698,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " + # endif + #endif + +-#if @GNULIB_GETS@ +-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +-# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +-# undef gets +-# define gets rpl_gets +-# endif +-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1))); +-_GL_CXXALIAS_RPL (gets, char *, (char *s)); +-# else +-_GL_CXXALIAS_SYS (gets, char *, (char *s)); +-# undef gets +-# endif +-_GL_CXXALIASWARN (gets); + /* It is very rare that the developer ever has full control of stdin, +- so any use of gets warrants an unconditional warning. Assume it is +- always declared, since it is required by C89. */ ++ so any use of gets warrants an unconditional warning; besides, C11 ++ removed it. */ ++#undef gets ++#if HAVE_RAW_DECL_GETS + _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + #endif + diff --git a/octave-nested-class.patch b/octave-nested-class.patch new file mode 100644 index 0000000..6d835cb --- /dev/null +++ b/octave-nested-class.patch @@ -0,0 +1,39 @@ +https://hg.savannah.gnu.org/hgweb/octave/raw-rev/7ffd2a0791ef + +# HG changeset patch +# User John W. Eaton +# Date 1325958274 18000 +# Node ID 7ffd2a0791ef389474bb52228e9b046a3721ab3f +# Parent 906eecd4bf43b0146c50019ee41acac2dc83c935 +fix name lookup problem with static nested class + +* oct-inttypes.h (octave_int_arith_base::mul): +Tag truncate_int with octave_int_base::. +(octave_int_arith_base::mul): Likewise. + +diff --git a/liboctave/oct-inttypes.h b/liboctave/oct-inttypes.h +--- a/liboctave/oct-inttypes.h ++++ b/liboctave/oct-inttypes.h +@@ -366,8 +366,8 @@ + { + // Promotion type for multiplication (if exists). + typedef typename query_integer_type<2*sizeof (T), false>::type mptype; +- return truncate_int (static_cast (x) +- * static_cast (y)); ++ return octave_int_base::truncate_int (static_cast (x) ++ * static_cast (y)); + } + + // Division with rounding to nearest. Note that / and % are probably +@@ -621,8 +621,8 @@ + { + // Promotion type for multiplication (if exists). + typedef typename query_integer_type<2*sizeof (T), true>::type mptype; +- return truncate_int (static_cast (x) +- * static_cast (y)); ++ return octave_int_base::truncate_int (static_cast (x) ++ * static_cast (y)); + } + + // Division. + -- cgit v1.2.3