2016-10-12 19:22:52 +01:00
|
|
|
{ stdenv, fetchurl, gmp, bison, perl, autoconf, ncurses, readline, coreutils, pkgconfig
|
2018-04-11 12:52:10 +01:00
|
|
|
, autoreconfHook
|
2018-04-23 15:28:25 +01:00
|
|
|
, file
|
2018-04-11 12:52:10 +01:00
|
|
|
, flint
|
|
|
|
, ntl
|
|
|
|
, cddlib
|
|
|
|
, enableFactory ? true
|
|
|
|
, enableGfanlib ? true
|
2016-10-12 19:22:52 +01:00
|
|
|
}:
|
2010-12-05 18:37:47 +00:00
|
|
|
|
2015-06-25 21:46:54 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2018-04-11 12:52:10 +01:00
|
|
|
name = "singular-${version}${patchVersion}";
|
|
|
|
version = "4.1.1";
|
|
|
|
patchVersion = "p1";
|
2015-06-25 21:46:54 +01:00
|
|
|
|
2018-04-11 12:52:10 +01:00
|
|
|
urlVersion = builtins.replaceStrings [ "." ] [ "-" ] version;
|
2015-06-25 21:46:54 +01:00
|
|
|
src = fetchurl {
|
2018-04-11 12:52:10 +01:00
|
|
|
url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/${urlVersion}/singular-${version}${patchVersion}.tar.gz";
|
|
|
|
sha256 = "0wvgz7l1b7zkpmim0r3mvv4fp8xnhlbz4c7hc90rn30snlansnf1";
|
2010-12-05 18:37:47 +00:00
|
|
|
};
|
|
|
|
|
2018-04-23 15:28:25 +01:00
|
|
|
configureFlags = [
|
|
|
|
"--with-ntl=${ntl}"
|
|
|
|
] ++stdenv.lib.optionals enableFactory [
|
2018-04-11 12:52:10 +01:00
|
|
|
"--enable-factory"
|
|
|
|
] ++ stdenv.lib.optionals enableGfanlib [
|
|
|
|
"--enable-gfanlib"
|
|
|
|
];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
|
|
|
|
|
|
|
# For reference (last checked on commit 75f460d):
|
|
|
|
# https://github.com/Singular/Sources/blob/spielwiese/doc/Building-Singular-from-source.md
|
|
|
|
# https://github.com/Singular/Sources/blob/spielwiese/doc/external-packages-dynamic-modules.md
|
|
|
|
buildInputs = [
|
|
|
|
# necessary
|
|
|
|
gmp
|
|
|
|
# by upstream recommended but optional
|
|
|
|
ncurses
|
|
|
|
readline
|
|
|
|
ntl
|
|
|
|
flint
|
|
|
|
] ++ stdenv.lib.optionals enableGfanlib [
|
|
|
|
cddlib
|
|
|
|
];
|
2018-04-23 15:28:25 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
bison
|
|
|
|
perl
|
|
|
|
pkgconfig
|
|
|
|
autoreconfHook
|
|
|
|
];
|
2015-06-25 21:46:54 +01:00
|
|
|
|
2018-04-23 15:28:25 +01:00
|
|
|
preAutoreconf = ''
|
|
|
|
find . -type f -readable -writable -exec sed \
|
|
|
|
-e 's@/bin/rm@${coreutils}&@g' \
|
|
|
|
-e 's@/bin/uname@${coreutils}&@g' \
|
|
|
|
-e 's@/usr/bin/file@${file}/bin/file@g' \
|
|
|
|
-i '{}' ';'
|
2015-06-25 21:46:54 +01:00
|
|
|
'';
|
2010-12-05 18:37:47 +00:00
|
|
|
|
2016-04-03 13:25:05 +01:00
|
|
|
hardeningDisable = stdenv.lib.optional stdenv.isi686 "stackprotector";
|
|
|
|
|
2016-10-12 19:22:52 +01:00
|
|
|
# The Makefile actually defaults to `make install` anyway
|
|
|
|
buildPhase = "true;";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out"
|
2018-04-11 12:52:10 +01:00
|
|
|
cp -r Singular/LIB "$out/lib"
|
|
|
|
make install
|
|
|
|
|
|
|
|
# Make sure patchelf picks up the right libraries
|
|
|
|
rm -rf libpolys factory resources omalloc Singular
|
|
|
|
'';
|
|
|
|
|
|
|
|
# simple test to make sure singular starts and finds its libraries
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/Singular -c 'LIB "freegb.lib"; exit;'
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo >&2 "Error loading the freegb library in Singular."
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-06-25 21:46:54 +01:00
|
|
|
'';
|
2014-07-28 10:43:20 +01:00
|
|
|
|
2017-05-20 14:38:01 +01:00
|
|
|
enableParallelBuilding = true;
|
2016-10-12 19:22:52 +01:00
|
|
|
|
2015-06-25 21:46:54 +01:00
|
|
|
meta = with stdenv.lib; {
|
2010-12-05 18:37:47 +00:00
|
|
|
description = "A CAS for polynomial computations";
|
2017-03-30 14:04:17 +01:00
|
|
|
maintainers = with maintainers; [ raskin ];
|
|
|
|
platforms = subtractLists platforms.i686 platforms.linux;
|
2015-06-25 21:46:54 +01:00
|
|
|
license = licenses.gpl3; # Or GPLv2 at your option - but not GPLv4
|
2018-04-11 12:52:10 +01:00
|
|
|
homepage = http://www.singular.uni-kl.de;
|
2016-10-12 16:34:29 +01:00
|
|
|
downloadPage = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/";
|
2010-12-05 18:37:47 +00:00
|
|
|
};
|
2015-06-25 21:46:54 +01:00
|
|
|
}
|