2018-04-23 20:13:25 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
2018-07-29 19:53:56 +01:00
|
|
|
, fetchpatch
|
2020-09-09 19:27:35 +01:00
|
|
|
, libmysqlclient
|
2018-04-23 20:13:25 +01:00
|
|
|
# Excerpt from glpk's INSTALL file:
|
|
|
|
# This feature allows the exact simplex solver to use the GNU MP
|
|
|
|
# bignum library. If it is disabled, the exact simplex solver uses the
|
|
|
|
# GLPK bignum module, which provides the same functionality as GNU MP,
|
|
|
|
# however, it is much less efficient.
|
|
|
|
, withGmp ? true
|
|
|
|
, gmp
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert withGmp -> gmp != null;
|
2010-04-23 22:15:48 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-04-23 20:13:25 +01:00
|
|
|
version = "4.65";
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "glpk";
|
2010-04-23 22:15:48 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "mirror://gnu/glpk/${pname}-${version}.tar.gz";
|
2018-03-08 18:30:08 +00:00
|
|
|
sha256 = "040sfaa9jclg2nqdh83w71sv9rc1sznpnfiripjdyr48cady50a2";
|
2010-04-23 22:15:48 +01:00
|
|
|
};
|
|
|
|
|
2020-09-09 19:27:35 +01:00
|
|
|
buildInputs =
|
|
|
|
[ libmysqlclient
|
|
|
|
] ++ stdenv.lib.optionals withGmp [
|
|
|
|
gmp
|
|
|
|
];
|
2018-04-23 20:13:25 +01:00
|
|
|
|
|
|
|
configureFlags = stdenv.lib.optionals withGmp [
|
|
|
|
"--with-gmp"
|
|
|
|
];
|
|
|
|
|
2018-07-29 19:53:56 +01:00
|
|
|
patches = [
|
|
|
|
# GLPK makes it possible to customize its message printing behaviour. Sage
|
|
|
|
# does that and needs to differentiate between printing regular messages and
|
|
|
|
# printing errors. Unfortunately there is no way to tell and glpk upstream
|
|
|
|
# rejected this patch. All it does is set the variable pointing to the error
|
|
|
|
# file back to NULL before glpk calls abort(). In sage's case, abort won't
|
|
|
|
# actually be called because the error handler jumps out of the function.
|
|
|
|
# This shouldn't affect everybody else, since glpk just calls abort()
|
|
|
|
# immediately afterwards anyways.
|
|
|
|
# See the sage trac ticket for more details:
|
|
|
|
# https://trac.sagemath.org/ticket/20710#comment:18
|
|
|
|
(fetchpatch {
|
|
|
|
name = "error_recovery.patch";
|
|
|
|
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/glpk/patches/error_recovery.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
|
|
|
|
sha256 = "0z99z9gd31apb6x5n5n26411qzx0ma3s6dnznc4x61x86bhq31qf";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-09-09 19:27:35 +01:00
|
|
|
postPatch =
|
|
|
|
# Do not hardcode the include path for libmysqlclient.
|
|
|
|
''
|
|
|
|
substituteInPlace configure \
|
|
|
|
--replace '-I/usr/include/mysql' '$(mysql_config --include)'
|
|
|
|
'';
|
|
|
|
|
2010-04-23 22:15:48 +01:00
|
|
|
doCheck = true;
|
|
|
|
|
2020-11-17 19:41:33 +00:00
|
|
|
meta = with stdenv.lib; {
|
2010-04-23 22:15:48 +01:00
|
|
|
description = "The GNU Linear Programming Kit";
|
|
|
|
|
|
|
|
longDescription =
|
|
|
|
'' The GNU Linear Programming Kit is intended for solving large
|
|
|
|
scale linear programming problems by means of the revised
|
|
|
|
simplex method. It is a set of routines written in the ANSI C
|
|
|
|
programming language and organized in the form of a library.
|
|
|
|
'';
|
|
|
|
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.gnu.org/software/glpk/";
|
2020-11-17 19:41:33 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2010-04-23 22:15:48 +01:00
|
|
|
|
2020-11-17 19:41:33 +00:00
|
|
|
maintainers = with maintainers; [ bjg ] ++ teams.sage.members;
|
|
|
|
platforms = platforms.all;
|
2010-04-23 22:15:48 +01:00
|
|
|
};
|
|
|
|
}
|