mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-28 19:00:46 +00:00
civetweb: add configurable build flags, use versionCheckHook at installCheckPhase (#561959)
This commit is contained in:
@@ -4,6 +4,12 @@
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
cmake,
|
||||
zlib,
|
||||
versionCheckHook,
|
||||
|
||||
withZlib ? false,
|
||||
withUnixSockets ? false,
|
||||
withWebSockets ? false,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
@@ -32,11 +38,18 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
|
||||
doInstallCheck = true;
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
versionCheckProgramArg = "-I";
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
];
|
||||
|
||||
buildInputs = lib.optional withZlib zlib;
|
||||
|
||||
# The existence of the "build" script causes `mkdir -p build` to fail:
|
||||
# mkdir: cannot create directory 'build': File exists
|
||||
preConfigure = ''
|
||||
@@ -60,12 +73,22 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
# Workaround CMake 4 compat
|
||||
(lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.5")
|
||||
];
|
||||
|
||||
(lib.cmakeBool "CIVETWEB_ENABLE_WEBSOCKETS" withWebSockets)
|
||||
|
||||
(lib.cmakeBool "CIVETWEB_ENABLE_ZLIB" withZlib)
|
||||
]
|
||||
|
||||
# Support for listening for HTTP requests on a Unix domain socket.
|
||||
++ lib.optional withUnixSockets "-DCMAKE_C_FLAGS=-DUSE_X_DOM_SOCKET";
|
||||
# NOTE Once 1.17 is released, we can use a CMake flag:
|
||||
# (lib.cmakeBool "CIVETWEB_ENABLE_X_DOM_SOCKET" withUnixSockets)
|
||||
|
||||
meta = {
|
||||
description = "Embedded C/C++ web server";
|
||||
mainProgram = "civetweb";
|
||||
homepage = "https://github.com/civetweb/civetweb";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ jlesquembre ];
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user