Merge pull request #163695 from DeterminateSystems/prometheus-cpp

This commit is contained in:
Sandro 2022-03-14 23:40:14 +01:00 committed by GitHub
commit 73ad5f9e14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 61 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";

View file

@ -1,4 +1,5 @@
{ lib, stdenv
{ lib
, stdenv
, fetchFromGitHub
, cmake
, gbenchmark
@ -10,13 +11,13 @@
stdenv.mkDerivation rec {
pname = "prometheus-cpp";
version = "0.9.0";
version = "1.0.0";
src = fetchFromGitHub {
owner = "jupp0r";
repo = pname;
rev = "v${version}";
sha256 = "1pjz29ywzfg3blhg2v8fn7gjvq46k3bqn7y0xvmn468ixxhv21fi";
sha256 = "L6CXRup3kU1lY5UnwPbaOwEtCeAySNmFCPmHwsk6cRE=";
};
nativeBuildInputs = [ cmake ];

View file

@ -24,7 +24,6 @@
, openssl
, pcre
, perl
, prometheus-cpp
, python2
, re2
, zlib
@ -109,7 +108,6 @@ stdenv.mkDerivation rec {
{ f = "libssl"; p = openssl; }
{ f = "lz4"; p = lz4; }
{ f = "pcre"; p = pcre; }
{ f = "prometheus-cpp"; p = prometheus-cpp; }
{ f = "re2"; p = re2; }
]}
@ -123,8 +121,9 @@ stdenv.mkDerivation rec {
ln -s ${nlohmann_json.src}/single_include/nlohmann/json.hpp .
popd
pushd prometheus-cpp/prometheus-cpp/3rdparty
replace_dep . "${civetweb.src}" civetweb
pushd prometheus-cpp
tar xf v0.9.0.tar.gz
replace_dep prometheus-cpp/3rdparty "${civetweb.src}" civetweb
popd
sed -i s_/usr/bin/env_${coreutils}/bin/env_g libssl/openssl/config