Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

souffle: add darwin support #208373

Merged
merged 2 commits into from
Jan 19, 2023
Merged
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
14 changes: 12 additions & 2 deletions pkgs/development/compilers/souffle/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub
{ lib, stdenv, fetchFromGitHub, fetchpatch
, bash-completion, perl, ncurses, zlib, sqlite, libffi
, mcpp, cmake, bison, flex, doxygen, graphviz
, makeWrapper
Expand All @@ -19,6 +19,17 @@ stdenv.mkDerivation rec {
sha256 = "sha256-wdTBSmyA2I+gaSV577NNKA2oY2fdVTGmvV7h15NY1tU=";
};

patches = [
./threads.patch
(fetchpatch {
name = "missing-override.patch";
url = "https://github.com/souffle-lang/souffle/commit/da2d778f0cca94f206686546fa56b9ffc738ad75.patch";
sha256 = "Oefm3vRRwOyom94oGSOK2w9m23gkbJ++9gcWrdLlkyk=";
})
];

hardeningDisable = lib.optionals stdenv.isDarwin [ "strictoverflow" ];

nativeBuildInputs = [ bison cmake flex mcpp doxygen graphviz makeWrapper perl ];
buildInputs = [ bash-completion ncurses zlib sqlite libffi ];
# these propagated inputs are needed for the compiled Souffle mode to work,
Expand All @@ -35,7 +46,6 @@ stdenv.mkDerivation rec {
outputs = [ "out" ];

meta = with lib; {
broken = stdenv.isDarwin;
description = "A translator of declarative Datalog programs into the C++ language";
homepage = "https://souffle-lang.github.io/";
platforms = platforms.unix;
Expand Down
31 changes: 31 additions & 0 deletions pkgs/development/compilers/souffle/threads.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73d5c3c84..e4b0dbfd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,13 +104,6 @@ option(SOUFFLE_CUSTOM_GETOPTLONG "Enable/Disable custom getopt_long implementati
cmake_dependent_option(SOUFFLE_USE_LIBCPP "Link to libc++ instead of libstdc++" ON
"CMAKE_CXX_COMPILER_ID STREQUAL Clang" OFF)

-# Using Clang? Likely want to use `lld` too.
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=lld")
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
-endif()
-
# Add aditional modules to CMake
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

@@ -247,7 +240,11 @@ endif()
# pthreads
# --------------------------------------------------
set(THREADS_PREFER_PTHREAD_FLAG ON)
-find_package(Threads REQUIRED)
+set(CMAKE_THREAD_LIBS_INIT "-lpthread")
+set(CMAKE_HAVE_THREADS_LIBRARY 1)
+set(CMAKE_USE_WIN32_THREADS_INIT 0)
+set(CMAKE_USE_PTHREADS_INIT 1)
+set(THREADS_PREFER_PTHREAD_FLAG ON)

# --------------------------------------------------
# OpenMP