2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchurl,
|
2020-08-20 17:08:02 +00:00
|
|
|
bison, re2c, sconsPackages,
|
2020-04-24 23:36:52 +00:00
|
|
|
libcxx
|
|
|
|
}:
|
|
|
|
|
2021-07-17 21:14:59 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "gringo";
|
2021-07-17 21:14:59 +00:00
|
|
|
version = "4.5.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/project/potassco/gringo/${version}/gringo-${version}-source.tar.gz";
|
|
|
|
sha256 = "16k4pkwyr2mh5w8j91vhxh9aff7f4y31npwf09w6f8q63fxvpy41";
|
|
|
|
};
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
buildInputs = [ bison re2c sconsPackages.scons_3_1_2 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./gringo-4.5.4-cmath.patch
|
|
|
|
./gringo-4.5.4-to_string.patch
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace ./SConstruct \
|
|
|
|
--replace \
|
|
|
|
"env['CXX'] = 'g++'" \
|
|
|
|
"env['CXX'] = '$CXX'"
|
|
|
|
|
|
|
|
substituteInPlace ./SConstruct \
|
|
|
|
--replace \
|
|
|
|
"env['CPPPATH'] = []" \
|
2021-05-20 23:08:51 +00:00
|
|
|
"env['CPPPATH'] = ['${lib.getDev libcxx}/include/c++/v1']"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
substituteInPlace ./SConstruct \
|
|
|
|
--replace \
|
|
|
|
"env['LIBPATH'] = []" \
|
2021-05-20 23:08:51 +00:00
|
|
|
"env['LIBPATH'] = ['${lib.getLib libcxx}/lib']"
|
2022-04-27 09:35:20 +00:00
|
|
|
'' + ''
|
|
|
|
sed '1i#include <limits>' -i libgringo/gringo/{control,term}.hh
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
scons WITH_PYTHON= --build-dir=release
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp build/release/gringo $out/bin/gringo
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Converts input programs with first-order variables to equivalent ground programs";
|
|
|
|
homepage = "http://potassco.sourceforge.net/";
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = [ maintainers.hakuch ];
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
};
|
|
|
|
}
|