3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/science/math/palp/default.nix

92 lines
3.1 KiB
Nix
Raw Normal View History

2021-03-07 14:47:42 +00:00
{ lib
, stdenv
2018-04-11 11:26:50 +01:00
, fetchurl
, dimensions ? 6 # works for <= dimensions dimensions, but is only optimized for that exact value
, doSymlink ? true # symlink the executables to the default location (without dimension postfix)
}:
2020-04-07 22:08:03 +01:00
let
dim = toString dimensions;
in
2018-04-11 11:26:50 +01:00
stdenv.mkDerivation rec {
2020-04-07 22:08:03 +01:00
pname = "palp";
2020-11-04 01:49:21 +00:00
version = "2.20";
2018-04-11 11:26:50 +01:00
src = fetchurl {
2020-11-04 01:49:21 +00:00
url = "http://hep.itp.tuwien.ac.at/~kreuzer/CY/palp/${pname}-${version}.tar.gz";
sha256 = "1q1cl3vpdir16szy0jcadysydcrjp48hqxyx42kr8g9digkqjgkj";
2018-04-11 11:26:50 +01:00
};
hardeningDisable = [
"format"
];
2018-04-11 11:26:50 +01:00
2021-01-15 13:21:58 +00:00
patchPhase = lib.optionalString stdenv.isDarwin ''
2018-08-09 21:28:27 +01:00
substituteInPlace GNUmakefile --replace gcc cc
'';
2018-04-11 11:26:50 +01:00
preBuild = ''
2021-03-07 14:47:42 +00:00
echo Building PALP optimized for ${dim} dimensions
sed -i "s/^#define[^a-zA-Z]*POLY_Dmax.*/#define POLY_Dmax ${dim}/" Global.h
2018-04-11 11:26:50 +01:00
'';
# palp has no tests of its own. This test is an adapted sage test that failed
# when #28029 was merged.
doCheck = true;
checkPhase = ''
./nef.x -f -N << EOF | grep -q 'np='
3 6
1 0 0 -1 0 0
0 1 0 0 -1 0
0 0 1 0 0 -1
EOF
'';
2018-04-11 11:26:50 +01:00
installPhase = ''
2021-03-07 14:47:42 +00:00
mkdir -p $out/bin
2018-04-11 11:26:50 +01:00
for file in poly class cws nef mori; do
2021-03-07 14:47:42 +00:00
cp -p $file.x "$out/bin/$file-${dim}d.x"
2018-04-11 11:26:50 +01:00
done
2021-01-15 13:21:58 +00:00
'' + lib.optionalString doSymlink ''
2021-03-07 14:47:42 +00:00
cd $out/bin
2018-04-11 11:26:50 +01:00
for file in poly class cws nef mori; do
2021-03-07 14:47:42 +00:00
ln -sf $file-6d.x $file.x
2018-04-11 11:26:50 +01:00
done
'';
meta = with lib; {
2018-04-11 11:26:50 +01:00
description = "A Package for Analyzing Lattice Polytopes";
longDescription = ''
A Package for Analyzing Lattice Polytopes (PALP) is a set of C
programs for calculations with lattice polytopes and applications to
toric geometry.
It contains routines for vertex and facet enumeration, computation of
incidences and symmetries, as well as completion of the set of lattice
points in the convex hull of a given set of points. In addition, there
are procedures specialised to reflexive polytopes such as the
enumeration of reflexive subpolytopes, and applications to toric
geometry and string theory, like the computation of Hodge data and
fibration structures for toric Calabi-Yau varieties. The package is
well tested and optimised in speed as it was used for time consuming
tasks such as the classification of reflexive polyhedra in 4
dimensions and the creation and manipulation of very large lists of
5-dimensional polyhedra.
While originally intended for low-dimensional applications, the
algorithms work in any dimension and our key routine for vertex and
facet enumeration compares well with existing packages.
'';
2020-04-07 22:08:03 +01:00
homepage = "http://hep.itp.tuwien.ac.at/~kreuzer/CY/CYpalp.html";
2020-05-16 14:05:45 +01:00
# Not really a changelog, but a one-line summary of each update that should
# be reviewed on update.
changelog = "http://hep.itp.tuwien.ac.at/~kreuzer/CY/CYpalp.html";
2018-04-11 11:26:50 +01:00
# Just a link on the website pointing to gpl -- now gplv3. When the last
# version was released that pointed to gplv2 however, so thats probably
# the right license.
license = licenses.gpl2;
maintainers = teams.sage.members;
2018-08-09 21:28:27 +01:00
platforms = platforms.unix;
2018-04-11 11:26:50 +01:00
};
}