3
0
Fork 0
forked from mirrors/nixpkgs

dictu: init at 0.19.0

This commit is contained in:
Lucas Ransan 2021-08-03 14:02:38 +02:00
parent 9d865ef9f6
commit 92e201e938
No known key found for this signature in database
GPG key ID: 37E8293E1B8B2307
3 changed files with 132 additions and 0 deletions

View file

@ -0,0 +1,46 @@
From bb4767f8fc413ca4cb42879a9a226fd26f10e094 Mon Sep 17 00:00:00 2001
From: Lucas Ransan <lucas@ransan.tk>
Date: Tue, 3 Aug 2021 20:39:11 +0200
Subject: [PATCH] force sqlite to be found
---
src/CMakeLists.txt | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a0f3fee..58b4d0b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,7 @@ set(INCLUDE_DIR include/)
list(FILTER sources EXCLUDE REGEX "(main|linenoise|utf8).c")
list(FILTER headers EXCLUDE REGEX "(linenoise|utf8).h")
-find_library(SQLITE_LIB SQLite3)
+find_package(SQLite3 REQUIRED)
set(THREADS)
if(DISABLE_HTTP)
@@ -20,16 +20,10 @@ else()
list(APPEND libraries curl)
endif()
-if(NOT SQLITE_LIB)
- set(THREADS_PREFER_PTHREAD_FLAG ON)
- find_package(Threads REQUIRED)
- set(THREADS Threads::Threads)
-else()
- list(FILTER sources EXCLUDE REGEX "sqlite3.c")
- list(FILTER headers EXCLUDE REGEX "sqlite3.h")
- list(APPEND libraries ${SQLITE_LIB})
- add_compile_definitions(INCLUDE_SQLITE_LIB)
-endif()
+list(FILTER sources EXCLUDE REGEX "sqlite3.c")
+list(FILTER headers EXCLUDE REGEX "sqlite3.h")
+list(APPEND libraries ${SQLite3_LIBRARIES})
+add_compile_definitions(SQLite3_INCLUDE_DIR)
if(WIN32)
# ws2_32 is required for winsock2.h to work correctly
--
2.32.0

View file

@ -0,0 +1,84 @@
{ stdenv
, lib
, fetchFromGitHub
, cmake
, sqlite
, httpSupport ? true, curl
, cliSupport ? true
, linenoiseSupport ? cliSupport, linenoise
, enableLTO ? stdenv.cc.isGNU
}:
assert enableLTO -> stdenv.cc.isGNU;
stdenv.mkDerivation rec {
pname = "dictu";
version = "0.19.0";
src = fetchFromGitHub {
owner = "dictu-lang";
repo = pname;
rev = "v${version}";
sha256 = "5Sfmzz4I0dhcbz14LmXx5cHELRFENunLbZmU93uSEJo=";
};
nativeBuildInputs = [ cmake ];
buildInputs = [
sqlite
] ++ lib.optional httpSupport curl
++ lib.optional linenoiseSupport linenoise;
patches = [
./0001-force-sqlite-to-be-found.patch
];
postPatch = lib.optionalString (!enableLTO) ''
sed -i src/CMakeLists.txt \
-e 's/-flto/${lib.optionalString stdenv.cc.isGNU "-Wno-error=format-truncation"}/'
'';
cmakeFlags = [
"-DBUILD_CLI=${if cliSupport then "ON" else "OFF"}"
"-DDISABLE_HTTP=${if httpSupport then "OFF" else "ON"}"
"-DDISABLE_LINENOISE=${if linenoiseSupport then "OFF" else "ON"}"
] ++ lib.optionals enableLTO [ # TODO: LTO with LLVM
"-DCMAKE_AR=${stdenv.cc.cc}/bin/gcc-ar"
"-DCMAKE_RANLIB=${stdenv.cc.cc}/bin/gcc-ranlib"
];
doCheck = cliSupport;
preCheck = ''
cd ..
sed -i tests/runTests.du \
-e '/http/d'
sed -i tests/path/realpath.du \
-e 's/usr/build/g'
sed -i tests/path/isDir.du \
-e 's,/usr/bin,/build/source,' \
-e '/home/d'
'';
checkPhase = ''
runHook preCheck
./dictu tests/runTests.du
'';
installPhase = ''
mkdir -p $out
cp -r /build/source/src/include $out/include
mkdir -p $out/lib
cp /build/source/build/src/libdictu_api* $out/lib
'' + lib.optionalString cliSupport ''
install -Dm755 /build/source/dictu $out/bin/dictu
'';
meta = with lib; {
description = "High-level dynamically typed, multi-paradigm, interpreted programming language";
homepage = "https://dictu-lang.com";
license = licenses.mit;
maintainers = with maintainers; [ luc65r ];
platforms = platforms.all;
};
}

View file

@ -10848,6 +10848,8 @@ in
devpi-server = callPackage ../development/tools/devpi-server {};
dictu = callPackage ../development/compilers/dictu { };
dotty = callPackage ../development/compilers/scala/dotty.nix { jre = jre8;};
ecl = callPackage ../development/compilers/ecl { };