Skip to content

Commit

Permalink
stp: 2.3.3 -> 2.3.4
Browse files Browse the repository at this point in the history
Bump the version, enable checkPhase, and create an installCheckPhase.
  • Loading branch information
numinit committed Oct 14, 2024
1 parent c65fe11 commit 14dff39
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 17 deletions.
61 changes: 49 additions & 12 deletions pkgs/applications/science/logic/stp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@
, boost
, bison
, flex
, pkg-config
, fetchFromGitHub
, fetchpatch
, perl
, python3
, zlib
, minisat
, cryptominisat
, gmp
, gtest
, lit
, outputcheck
}:

stdenv.mkDerivation rec {
pname = "stp";
version = "2.3.3";
version = "2.3.4";

src = fetchFromGitHub {
owner = "stp";
repo = "stp";
rev = version;
hash = "sha256-B+HQF4TJPkYrpodE4qo4JHvlu+a5HTJf1AFyXTnZ4vk=";
hash = "sha256-PtONKgqahT9x+5WHi3zyoXwDTdq/VapzBl3Aod7Cbgc=";
};
patches = [
# Fix missing type declaration
Expand All @@ -36,30 +41,62 @@ stdenv.mkDerivation rec {
})
];

postPatch = ''
# Upstream fix for gcc-13 support:
# https://github.com/stp/stp/pull/462
# Can't apply it as is as patch context changed in ither patches.
# TODO: remove me on 2.4 release
sed -e '1i #include <cstdint>' -i include/stp/AST/ASTNode.h
'';

buildInputs = [
boost
zlib
minisat
cryptominisat
python3
gmp
];
nativeBuildInputs = [ cmake bison flex perl ];
nativeBuildInputs = [ cmake bison flex perl pkg-config gtest lit ];
cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DENABLE_TESTING=ON" "-DLIT_ARGS=-v" ];
preConfigure = ''
python_install_dir=$out/${python3.sitePackages}
mkdir -p $python_install_dir
cmakeFlagsArray=(
$cmakeFlagsArray
"-DBUILD_SHARED_LIBS=ON"
"-DPYTHON_LIB_INSTALL_DIR=$python_install_dir"
)
# Version is wrong in 2.3.4, fix it.
substituteInPlace CMakeLists.txt \
--replace-fail 2.3.3 ${version} \
--replace-fail GIT-hash-notfound ${version}
# We want to use the Nix wrapper for the output check tool instead of running it through Python
substituteInPlace tests/query-files/lit.cfg \
--replace-fail "pythonExec + ' ' +OutputCheckTool" "OutputCheckTool"
# Link in gtest and the output check utility.
mkdir -p deps
ln -s ${gtest.src} deps/gtest
ln -s ${outputcheck} deps/OutputCheck
'';

doCheck = true;

postInstall = ''
# Clean up installed gtest/gmock files that shouldn't be there.
find $out/ \( -iname '*gtest*' -o -iname '*gmock*' \) -print | while read -r file; do
if [ -e "$file" ]; then
echo "Removing $file" >&2
rm -rf "$file"
fi
done
# Remove empty pkgconfig folders.
find $out/ -type d -name pkgconfig -print | while read -r dir; do
if [ -z "$(ls -A "$dir")" ]; then
echo "Cleaning up empty pkgconfig directory at $dir" >&2
rm -rf "$dir"
fi
done
'';

doInstallCheck = true;
postInstallCheck = ''
$out/bin/stp --version | grep '^STP version ${version}'
'';

meta = with lib; {
Expand Down
10 changes: 5 additions & 5 deletions pkgs/applications/science/logic/stp/stdint.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/include/stp/AST/ASTNode.h b/include/stp/AST/ASTNode.h
index 91acd726182c..0a17db23ffbf 100644
index a05c15d6..a823d95d 100644
--- a/include/stp/AST/ASTNode.h
+++ b/include/stp/AST/ASTNode.h
@@ -24,9 +24,10 @@ THE SOFTWARE.
#ifndef ASTNODE_H
#define ASTNODE_H
@@ -26,9 +26,10 @@ THE SOFTWARE.

#include <cstdint>

+#include "stp/AST/ASTInternal.h"
#include "stp/AST/NodeFactory/HashingNodeFactory.h"
#include "stp/NodeFactory/HashingNodeFactory.h"
+#include "stp/AST/UsefulDefs.h"
#include "stp/Util/Attributes.h"
-#include "ASTInternal.h"
Expand Down

0 comments on commit 14dff39

Please sign in to comment.