Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 85 lines 2.2 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, cmake 5, sqlite 6, httpSupport ? true, curl 7, cliSupport ? true 8, linenoiseSupport ? cliSupport, linenoise 9, enableLTO ? stdenv.cc.isGNU 10}: 11 12assert enableLTO -> stdenv.cc.isGNU; 13 14stdenv.mkDerivation rec { 15 pname = "dictu"; 16 version = "0.25.0"; 17 18 src = fetchFromGitHub { 19 owner = "dictu-lang"; 20 repo = pname; 21 rev = "v${version}"; 22 sha256 = "sha256-Tahi2K8Q/KPc9MN7yWhkqp/MzXfzJzrGSsvnTCyI03U="; 23 }; 24 25 nativeBuildInputs = [ cmake ]; 26 27 buildInputs = [ 28 sqlite 29 ] ++ lib.optional httpSupport curl 30 ++ lib.optional linenoiseSupport linenoise; 31 32 patches = [ 33 ./0001-force-sqlite-to-be-found.patch 34 ]; 35 36 postPatch = lib.optionalString (!enableLTO) '' 37 sed -i src/CMakeLists.txt \ 38 -e 's/-flto/${lib.optionalString stdenv.cc.isGNU "-Wno-error=format-truncation"}/' 39 ''; 40 41 cmakeFlags = [ 42 "-DBUILD_CLI=${if cliSupport then "ON" else "OFF"}" 43 "-DDISABLE_HTTP=${if httpSupport then "OFF" else "ON"}" 44 "-DDISABLE_LINENOISE=${if linenoiseSupport then "OFF" else "ON"}" 45 ] ++ lib.optionals enableLTO [ # TODO: LTO with LLVM 46 "-DCMAKE_AR=${stdenv.cc.cc}/bin/gcc-ar" 47 "-DCMAKE_RANLIB=${stdenv.cc.cc}/bin/gcc-ranlib" 48 ]; 49 50 doCheck = cliSupport; 51 52 preCheck = '' 53 cd .. 54 sed -i tests/runTests.du \ 55 -e '/http/d' 56 sed -i tests/path/realpath.du \ 57 -e 's/usr/build/g' 58 sed -i tests/path/isDir.du \ 59 -e 's,/usr/bin,/build/source,' \ 60 -e '/home/d' 61 ''; 62 63 checkPhase = '' 64 runHook preCheck 65 ./dictu tests/runTests.du 66 ''; 67 68 installPhase = '' 69 mkdir -p $out 70 cp -r /build/source/src/include $out/include 71 mkdir -p $out/lib 72 cp /build/source/build/src/libdictu_api* $out/lib 73 '' + lib.optionalString cliSupport '' 74 install -Dm755 /build/source/dictu $out/bin/dictu 75 ''; 76 77 meta = with lib; { 78 description = "High-level dynamically typed, multi-paradigm, interpreted programming language"; 79 homepage = "https://dictu-lang.com"; 80 license = licenses.mit; 81 maintainers = with maintainers; [ luc65r ]; 82 platforms = platforms.all; 83 broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/staging-next/dictu.x86_64-darwin 84 }; 85}