Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkgs/applications/science/math/sage/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# - https://wiki.debian.org/DebianScience/Sage
# - https://github.com/cschwan/sage-on-gentoo
# - https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/sagemath
# Look here to see how to use host libraries instead of sage ones
# - https://github.com/cschwan/sage-on-gentoo/blob/master/sci-mathematics/sage/sage-8.1-r2.ebuild

{ stdenv
, bash
Expand All @@ -31,6 +33,7 @@
, hevea
, buildDocs ? false
, optimize ? false # optimize sage to the current system (obviously impure)
, hostSingular ? true, singular ? null
}:

stdenv.mkDerivation rec {
Expand Down Expand Up @@ -83,6 +86,11 @@ stdenv.mkDerivation rec {
postPatch = ''
substituteAllInPlace src/bin/sage-env
bash=${bash} substituteAllInPlace build/bin/sage-spkg
'' +
# sed -i "s:lib/libSingular:$(get_libdir)/libSingular:" \
stdenv.lib.optionalString hostSingular ''
# fix library path of libSingular
substituteInPlace src/sage/env.py --replace lib/libSingular ${singular}/lib
'';

installPhase = ''
Expand Down Expand Up @@ -110,7 +118,8 @@ stdenv.mkDerivation rec {
babel-greek # optional for giac, otherwise throws a bunch of latex command not founds
;
})
];
] ++ stdenv.lib.optional hostSingular singular
;

nativeBuildInputs = [ gfortran6 perl which ];

Expand Down
21 changes: 13 additions & 8 deletions pkgs/applications/science/math/singular/default.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
{ stdenv, fetchurl, gmp, bison, perl, autoconf, ncurses, readline, coreutils, pkgconfig
, asLibsingular ? false
, autoreconfHook
}:

stdenv.mkDerivation rec {
name = "singular-${version}";
version="3-1-7";
version="4-1-0";

src = fetchurl {
url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/${version}/Singular-${version}.tar.gz";
sha256 = "1j4mcpnwzdp3h4qspk6ww0m67rmx4s11cy17pvzbpf70lm0jzzh2";
url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/${version}/singular-4.1.0p3.tar.gz";
sha256 = "105zs3zk46b1cps403ap9423rl48824ap5gyrdgmg8fma34680a4";
};

buildInputs = [ gmp perl ncurses readline ];
nativeBuildInputs = [ autoconf bison pkgconfig ];
buildInputs = [ autoreconfHook gmp perl ncurses readline ];
nativeBuildInputs = [ bison pkgconfig ];

postPatch=''
patchShebangs libpolys/tests/cxxtestgen.pl
patchShebangs git-version-gen
'';

preConfigure = ''
find . -type f -exec sed -e 's@/bin/rm@${coreutils}&@g' -i '{}' ';'
find . -type f -exec sed -e 's@/bin/uname@${coreutils}&@g' -i '{}' ';'
${stdenv.lib.optionalString asLibsingular ''NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DLIBSINGULAR"''}
'';

hardeningDisable = stdenv.lib.optional stdenv.isi686 "stackprotector";
Expand All @@ -28,7 +33,7 @@ stdenv.mkDerivation rec {
installPhase = ''
mkdir -p "$out"
cp -r Singular/LIB "$out/LIB"
make install${stdenv.lib.optionalString asLibsingular "-libsingular"}
make install

binaries="$(find "$out"/* \( -type f -o -type l \) -perm -111 \! -name '*.so' -maxdepth 1)"
ln -s "$out"/*/{include,lib} "$out"
Expand All @@ -48,6 +53,6 @@ stdenv.mkDerivation rec {
platforms = subtractLists platforms.i686 platforms.linux;
license = licenses.gpl3; # Or GPLv2 at your option - but not GPLv4
homepage = http://www.singular.uni-kl.de/index.php;
downloadPage = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/";
downloadPage = http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/;
};
}