fluent-bit: fix build on darwin
- Update fix-luajit-darwin.patch to apply to the current version. - Add a patch to fix compilation of cmetrics on darwin. - Use default stdenv instead of gccStdenv. The only requirement for GCC was the bundled luajit having 'DEFAULT_CC = gcc' hardcoded, but it has been fixed with the updated fix-luajit-darwin.patch by adding DEFAULT_CC=cc to the arguments.
This commit is contained in:
parent
46c3452a16
commit
09a54b14cd
|
@ -11,14 +11,17 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "sha256-b+MZuZQB/sl0HcioU1KCxH3TNiXYSPBfC9dBKqCVeXk=";
|
||||
};
|
||||
|
||||
patches = lib.optionals stdenv.isDarwin [
|
||||
./fix-cmetrics-darwin.patch
|
||||
./fix-luajit-darwin.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake flex bison ];
|
||||
|
||||
buildInputs = lib.optionals stdenv.isLinux [ systemd ];
|
||||
|
||||
cmakeFlags = [ "-DFLB_METRICS=ON" "-DFLB_HTTP_SERVER=ON" ];
|
||||
|
||||
patches = lib.optionals stdenv.isDarwin [ ./fix-luajit-darwin.patch ];
|
||||
|
||||
# _FORTIFY_SOURCE requires compiling with optimization (-O)
|
||||
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-O";
|
||||
|
||||
|
|
23
pkgs/tools/misc/fluent-bit/fix-cmetrics-darwin.patch
Normal file
23
pkgs/tools/misc/fluent-bit/fix-cmetrics-darwin.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
diff --git i/lib/cmetrics/src/cmt_time.c w/lib/cmetrics/src/cmt_time.c
|
||||
--- i/lib/cmetrics/src/cmt_time.c
|
||||
+++ w/lib/cmetrics/src/cmt_time.c
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <cmetrics/cmt_info.h>
|
||||
|
||||
/* MacOS */
|
||||
-#ifdef FLB_HAVE_CLOCK_GET_TIME
|
||||
+#ifdef CMT_HAVE_CLOCK_GET_TIME
|
||||
#include <mach/clock.h>
|
||||
#include <mach/mach.h>
|
||||
#endif
|
||||
@@ -41,8 +41,8 @@
|
||||
mach_timespec_t mts;
|
||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||
clock_get_time(cclock, &mts);
|
||||
- tm->tv_sec = mts.tv_sec;
|
||||
- tm->tv_nsec = mts.tv_nsec;
|
||||
+ tm.tv_sec = mts.tv_sec;
|
||||
+ tm.tv_nsec = mts.tv_nsec;
|
||||
mach_port_deallocate(mach_task_self(), cclock);
|
||||
#else /* __STDC_VERSION__ */
|
||||
clock_gettime(CLOCK_REALTIME, &tm);
|
|
@ -1,14 +1,29 @@
|
|||
diff -Naur fluent-bit.old/cmake/luajit.cmake fluent-bit.new/cmake/luajit.cmake
|
||||
--- fluent-bit.old/cmake/luajit.cmake
|
||||
+++ fluent-bit.new/cmake/luajit.cmake
|
||||
@@ -11,10 +11,6 @@
|
||||
set(LUAJIT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${FLB_PATH_LIB_LUAJIT})
|
||||
@@ -12,15 +12,7 @@
|
||||
set(LUAJIT_DEST ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
-if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
- set(CFLAGS "${CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
|
||||
-endif()
|
||||
-
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
- set(CFLAGS "${CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT} -fno-stack-check")
|
||||
- if (CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER_EQUAL 20
|
||||
- AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 21)
|
||||
- set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=11.0")
|
||||
- else()
|
||||
- set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=10.15")
|
||||
- endif()
|
||||
-else()
|
||||
- set(DEPLOYMENT_TARGET "")
|
||||
+ set(CFLAGS "${CFLAGS} -fno-stack-check")
|
||||
endif()
|
||||
|
||||
# luajit (UNIX)
|
||||
# =============
|
||||
ExternalProject_Add(luajit
|
||||
@@ -30,7 +22,7 @@
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
SOURCE_DIR ${LUAJIT_SRC}
|
||||
CONFIGURE_COMMAND ./configure
|
||||
- BUILD_COMMAND $(MAKE) CROSS=${CROSS_PREFIX} CFLAGS=${CFLAGS} BUILD_MODE=static "XCFLAGS=-fPIC" ${DEPLOYMENT_TARGET}
|
||||
+ BUILD_COMMAND $(MAKE) DEFAULT_CC=cc CROSS=${CROSS_PREFIX} CFLAGS=${CFLAGS} BUILD_MODE=static "XCFLAGS=-fPIC"
|
||||
INSTALL_COMMAND cp src/libluajit.a "${LUAJIT_DEST}/lib/libluajit.a")
|
||||
|
||||
# luajit (Windows)
|
||||
|
|
|
@ -5159,9 +5159,7 @@ with pkgs;
|
|||
icu = icu63;
|
||||
};
|
||||
|
||||
fluent-bit = callPackage ../tools/misc/fluent-bit {
|
||||
stdenv = gccStdenv;
|
||||
};
|
||||
fluent-bit = callPackage ../tools/misc/fluent-bit { };
|
||||
|
||||
flux = callPackage ../development/compilers/flux { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue