civetweb: use cmake

prometheus-cpp 1.0.0 depends on civetweb's cmake files being available:
    CMake Error at pull/CMakeLists.txt:11 (find_package):
      Could not find a package configuration file provided by "civetweb" with any
      of the following names:

        civetwebConfig.cmake
        civetweb-config.cmake

      Add the installation prefix of "civetweb" to CMAKE_PREFIX_PATH or set
      "civetweb_DIR" to a directory containing one of the above files.  If
      "civetweb" provides a separate development package or SDK, be sure it has
      been installed.

Cmake also properly handles setting the prefix, libdir, and includedir
paths, so that patch was dropped.
This commit is contained in:
Cole Helbling 2022-03-11 09:54:14 -08:00
parent 1c35a82e11
commit af7cb945a6
2 changed files with 18 additions and 54 deletions

View file

@ -1,33 +0,0 @@
diff -u a/Makefile b/Makefile
--- a/Makefile 2020-12-27 18:48:53.934098765 +0100
+++ b/Makefile 2020-12-27 18:50:44.022674117 +0100
@@ -19,13 +19,13 @@
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
PREFIX ?= /usr/local
EXEC_PREFIX = $(PREFIX)
-BINDIR = $(EXEC_PREFIX)/bin
+BINDIR ?= $(EXEC_PREFIX)/bin
DATAROOTDIR = $(PREFIX)/share
DOCDIR = $(DATAROOTDIR)/doc/$(CPROG)
SYSCONFDIR ?= $(PREFIX)/etc
HTMLDIR = $(DOCDIR)
-INCLUDEDIR = $(DESTDIR)$(PREFIX)/include
-LIBDIR = $(DESTDIR)$(EXEC_PREFIX)/lib
+INCLUDEDIR ?= $(DESTDIR)$(PREFIX)/include
+LIBDIR ?= $(DESTDIR)$(EXEC_PREFIX)/lib
PID_FILE ?= /var/run/$(CPROG).pid
# build tools
@@ -337,10 +337,10 @@
install -m 755 $(CPROG) "$(BINDIR)/"
install-headers:
- install -m 644 $(HEADERS) "$(INCLUDEDIR)"
+ install -m 644 $(HEADERS) "$(INCLUDEDIR)/"
install-lib: lib$(CPROG).a
- install -m 644 $< "$(LIBDIR)"
+ install -m 644 $< "$(LIBDIR)/"
install-slib: lib$(CPROG).so
$(eval version=$(shell grep -w "define CIVETWEB_VERSION" include/civetweb.h | sed 's|.*VERSION "\(.*\)"|\1|g'))

View file

@ -1,5 +1,7 @@
{ lib, stdenv
{ lib
, stdenv
, fetchFromGitHub
, cmake
}:
stdenv.mkDerivation rec {
@ -13,33 +15,28 @@ stdenv.mkDerivation rec {
sha256 = "sha256-Qh6BGPk7a01YzCeX42+Og9M+fjXRs7kzNUCyT4mYab4=";
};
makeFlags = [
"WITH_CPP=1"
"PREFIX=${placeholder "out"}"
"LIBDIR=${placeholder "out"}/lib"
"INCLUDEDIR=${placeholder "dev"}/include"
];
patches = [
./0001-allow-setting-paths-in-makefile.patch
];
outputs = [ "out" "dev" ];
strictDeps = true;
outputs = [ "out" "dev" ];
installTargets = [
"install-headers"
"install-lib"
"install-slib"
"install"
nativeBuildInputs = [
cmake
];
preInstall = ''
mkdir -p $dev/include
mkdir -p $out/lib
# The existence of the "build" script causes `mkdir -p build` to fail:
# mkdir: cannot create directory 'build': File exists
preConfigure = ''
rm build
'';
cmakeFlags = [
"-DCIVETWEB_ENABLE_CXX=ON"
"-DBUILD_SHARED_LIBS=ON"
# The civetweb unit tests rely on downloading their fork of libcheck.
"-DCIVETWEB_BUILD_TESTING=OFF"
];
meta = {
description = "Embedded C/C++ web server";
homepage = "https://github.com/civetweb/civetweb";