Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 127 lines 3.2 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitLab, 5 fetchpatch, 6 gitUpdater, 7 testers, 8 # https://gitlab.com/ubports/development/core/lib-cpp/net-cpp/-/issues/5 9 boost186, 10 cmake, 11 curl, 12 doxygen, 13 graphviz, 14 gtest, 15 jsoncpp, 16 lomiri, 17 pkg-config, 18 process-cpp, 19 properties-cpp, 20 python3, 21 validatePkgConfig, 22}: 23 24let 25 pythonEnv = python3.withPackages ( 26 ps: with ps; [ 27 httpbin 28 ] 29 ); 30in 31stdenv.mkDerivation (finalAttrs: { 32 pname = "net-cpp"; 33 version = "3.1.1"; 34 35 src = fetchFromGitLab { 36 owner = "ubports"; 37 repo = "development/core/lib-cpp/net-cpp"; 38 rev = finalAttrs.version; 39 hash = "sha256-MSqdP3kGI9hDdxFv2a0yd5ZkFkf1lMurB+KDIZLR9jg="; 40 }; 41 42 outputs = [ 43 "out" 44 "dev" 45 "doc" 46 ]; 47 48 patches = [ 49 # Be more lenient with how quickly HTTP test server must be up, for slower hardware / archs 50 (fetchpatch { 51 url = "https://salsa.debian.org/ubports-team/net-cpp/-/raw/941d9eceaa66a06eabb1eb79554548b47d4a60ab/debian/patches/1007_wait-for-flask.patch"; 52 hash = "sha256-nsGkZBuqahsg70PLUxn5EluDjmfZ0/wSnOYimfAI4ag="; 53 }) 54 55 # Bump std version to 14 for gtest 1.13+ 56 (fetchpatch { 57 url = "https://salsa.debian.org/ubports-team/net-cpp/-/raw/f3a031eb7e4ce7df00781100f16de58a4709afcb/debian/patches/0001-Bump-std-version-to-14-needed-for-googletest-1.13.0.patch"; 58 hash = "sha256-3ykqCfZjtTx7zWQ5rkMhVp7D5fkpoCjl0CVFwwEd4U4="; 59 }) 60 61 # Fix newer flask rejecting large chunks by default 62 (fetchpatch { 63 url = "https://salsa.debian.org/ubports-team/net-cpp/-/raw/f2050b5318cba3860fa1042e9b81e1b792b972c4/debian/patches/1008_set-MAX-CONTENT-LENGTH-for-flask-server-to-let-it-accept-big-chunks-of-data.patch"; 64 hash = "sha256-lfMRjpmysrhzdG6OOSpBGvYJCi1hrERI/SRf+rAakbA="; 65 }) 66 ]; 67 68 postPatch = lib.optionalString finalAttrs.finalPackage.doCheck '' 69 # Use wrapped python. Removing just the /usr/bin doesn't seem to work? 70 substituteInPlace tests/httpbin.h.in \ 71 --replace '/usr/bin/python3' '${lib.getExe pythonEnv}' 72 ''; 73 74 strictDeps = true; 75 76 nativeBuildInputs = [ 77 cmake 78 doxygen 79 graphviz 80 validatePkgConfig 81 ]; 82 83 buildInputs = [ 84 boost186 85 curl 86 ]; 87 88 nativeCheckInputs = [ 89 pkg-config 90 pythonEnv 91 ]; 92 93 checkInputs = [ 94 lomiri.cmake-extras 95 gtest 96 jsoncpp 97 process-cpp 98 properties-cpp 99 ]; 100 101 cmakeFlags = [ 102 # https://gitlab.com/ubports/development/core/lib-cpp/net-cpp/-/issues/4 103 (lib.cmakeBool "ENABLE_WERROR" false) 104 ]; 105 106 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; 107 108 # Tests start HTTP server in separate process with fixed URL, parallelism breaks things 109 enableParallelChecking = false; 110 111 passthru = { 112 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 113 updateScript = gitUpdater { }; 114 }; 115 116 meta = with lib; { 117 description = "Simple yet beautiful networking API for C++11"; 118 homepage = "https://gitlab.com/ubports/development/core/lib-cpp/net-cpp"; 119 changelog = "https://gitlab.com/ubports/development/core/lib-cpp/net-cpp/-/blob/${finalAttrs.version}/ChangeLog"; 120 license = licenses.lgpl3Only; 121 teams = [ teams.lomiri ]; 122 platforms = platforms.linux; 123 pkgConfigModules = [ 124 "net-cpp" 125 ]; 126 }; 127})