2024-01-02 11:29:13 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitLab
|
|
|
|
, fetchpatch
|
|
|
|
, gitUpdater
|
|
|
|
, testers
|
|
|
|
, boost
|
|
|
|
, cmake
|
|
|
|
, curl
|
|
|
|
, doxygen
|
|
|
|
, graphviz
|
|
|
|
, gtest
|
|
|
|
, jsoncpp
|
|
|
|
, lomiri
|
|
|
|
, pkg-config
|
|
|
|
, process-cpp
|
|
|
|
, properties-cpp
|
|
|
|
, python3
|
2024-02-07 01:22:34 +00:00
|
|
|
, validatePkgConfig
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pythonEnv = python3.withPackages (ps: with ps; [
|
|
|
|
httpbin
|
|
|
|
]);
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "net-cpp";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "3.1.1";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "ubports";
|
|
|
|
repo = "development/core/lib-cpp/net-cpp";
|
|
|
|
rev = finalAttrs.version;
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-MSqdP3kGI9hDdxFv2a0yd5ZkFkf1lMurB+KDIZLR9jg=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"dev"
|
|
|
|
"doc"
|
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Be more lenient with how quickly HTTP test server must be up, for slower hardware / archs
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://salsa.debian.org/ubports-team/net-cpp/-/raw/941d9eceaa66a06eabb1eb79554548b47d4a60ab/debian/patches/1007_wait-for-flask.patch";
|
|
|
|
hash = "sha256-nsGkZBuqahsg70PLUxn5EluDjmfZ0/wSnOYimfAI4ag=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = lib.optionalString finalAttrs.finalPackage.doCheck ''
|
|
|
|
# Use wrapped python. Removing just the /usr/bin doesn't seem to work?
|
|
|
|
substituteInPlace tests/httpbin.h.in \
|
|
|
|
--replace '/usr/bin/python3' '${lib.getExe pythonEnv}'
|
|
|
|
'';
|
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
doxygen
|
|
|
|
graphviz
|
2024-02-07 01:22:34 +00:00
|
|
|
validatePkgConfig
|
2024-01-02 11:29:13 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
curl
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pkg-config
|
|
|
|
pythonEnv
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
lomiri.cmake-extras
|
|
|
|
gtest
|
|
|
|
jsoncpp
|
|
|
|
process-cpp
|
|
|
|
properties-cpp
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
# https://gitlab.com/ubports/development/core/lib-cpp/net-cpp/-/issues/4
|
2024-02-07 01:22:34 +00:00
|
|
|
(lib.cmakeBool "ENABLE_WERROR" false)
|
2024-01-02 11:29:13 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
|
|
|
|
|
|
|
# Tests start HTTP server in separate process with fixed URL, parallelism breaks things
|
|
|
|
enableParallelChecking = false;
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
updateScript = gitUpdater { };
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Simple yet beautiful networking API for C++11";
|
|
|
|
homepage = "https://gitlab.com/ubports/development/core/lib-cpp/net-cpp";
|
2024-02-07 01:22:34 +00:00
|
|
|
changelog = "https://gitlab.com/ubports/development/core/lib-cpp/net-cpp/-/blob/${finalAttrs.version}/ChangeLog";
|
2024-01-02 11:29:13 +00:00
|
|
|
license = licenses.lgpl3Only;
|
|
|
|
maintainers = teams.lomiri.members;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
pkgConfigModules = [
|
|
|
|
"net-cpp"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|