2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, fetchpatch
|
2020-10-16 20:44:37 +00:00
|
|
|
, libmysqlclient
|
2020-04-24 23:36:52 +00: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;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "5.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "glpk";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/glpk/${pname}-${version}.tar.gz";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-ShAT7rtQ9yj8YBvdgzsLKHAzPDs+WoFu66kh2VvsbxU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
buildInputs =
|
|
|
|
[ libmysqlclient
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals withGmp [
|
2020-10-16 20:44:37 +00:00
|
|
|
gmp
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
configureFlags = lib.optionals withGmp [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-gmp"
|
|
|
|
];
|
|
|
|
|
|
|
|
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";
|
2023-10-09 19:29:22 +00:00
|
|
|
url = "https://raw.githubusercontent.com/sagemath/sage/d3c1f607e32f964bf0cab877a63767c86fd00266/build/pkgs/glpk/patches/error_recovery.patch";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-2hNtUEoGTFt3JgUvLH3tPWnz+DZcXNhjXzS+/V89toA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
postPatch =
|
|
|
|
# Do not hardcode the include path for libmysqlclient.
|
|
|
|
''
|
|
|
|
substituteInPlace configure \
|
|
|
|
--replace '-I/usr/include/mysql' '$(mysql_config --include)'
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00: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.
|
|
|
|
'';
|
|
|
|
|
|
|
|
homepage = "https://www.gnu.org/software/glpk/";
|
2020-11-21 19:51:51 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ ] ++ teams.sage.members;
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "glpsol";
|
2020-11-21 19:51:51 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|