3
0
Fork 0
forked from mirrors/nixpkgs

singular: add an option to install as libsingular

This commit is contained in:
Michael Raskin 2016-10-12 20:22:52 +02:00
parent 8e9ad9bfdc
commit 2bed05d8e1
2 changed files with 22 additions and 7 deletions

View file

@ -1,4 +1,6 @@
{ stdenv, fetchurl, gmp, bison, perl, autoconf, ncurses, readline, coreutils }:
{ stdenv, fetchurl, gmp, bison, perl, autoconf, ncurses, readline, coreutils, pkgconfig
, asLibsingular ? false
}:
stdenv.mkDerivation rec {
name = "singular-${version}";
@ -9,23 +11,33 @@ stdenv.mkDerivation rec {
sha256 = "1j4mcpnwzdp3h4qspk6ww0m67rmx4s11cy17pvzbpf70lm0jzzh2";
};
buildInputs = [ gmp bison perl autoconf ncurses readline coreutils ];
buildInputs = [ gmp perl ncurses readline ];
nativeBuildInputs = [ autoconf bison pkgconfig ];
preConfigure = ''
find . -exec sed -e 's@/bin/rm@${coreutils}&@g' -i '{}' ';'
find . -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";
postInstall = ''
rm -rf "$out/LIB"
cp -Tr Singular/LIB "$out/lib"
ln -s "$out"/*/include "$out"
# The Makefile actually defaults to `make install` anyway
buildPhase = "true;";
installPhase = ''
mkdir -p "$out"
cp -r Singular/LIB "$out/LIB"
make install${stdenv.lib.optionalString asLibsingular "-libsingular"}
binaries="$(find "$out"/* \( -type f -o -type l \) -perm -111 \! -name '*.so' -maxdepth 1)"
ln -s "$out"/*/{include,lib} "$out"
mkdir -p "$out/bin"
ln -s "$out/"*/Singular "$out/bin"
ln -s $binaries "$out/bin"
'';
enableParallelBuild = true;
meta = with stdenv.lib; {
description = "A CAS for polynomial computations";
maintainers = with maintainers;

View file

@ -16712,6 +16712,9 @@ in
};
singular = callPackage ../applications/science/math/singular {};
libsingular = callPackage ../applications/science/math/singular {
asLibsingular = true;
};
scilab = callPackage ../applications/science/math/scilab {
withXaw3d = false;