New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
haproxy: Cleaning up and enable LUA and PCRE #23901
Conversation
`preConfigure` line became too long to edit comfortably. Split up flags into ones necessary during both build and install phase and install phase only.
Quoting the README: "If your system supports PCRE (Perl Compatible Regular Expressions), then you really should build with libpcre which is between 2 and 10 times faster than other libc implementations."
Fails on OS X with:
I have no clue why this is not working. The files in ifneq ($(USE_LUA),)
check_lua_lib = $(shell echo "int main(){}" | $(CC) -o /dev/null -x c - $(2) -l$(1) 2>/dev/null && echo $(1))
BUILD_OPTIONS += $(call ignore_implicit,USE_LUA)
OPTIONS_CFLAGS += -DUSE_LUA $(if $(LUA_INC),-I$(LUA_INC))
LUA_LD_FLAGS := -Wl,--export-dynamic $(if $(LUA_LIB),-L$(LUA_LIB))
ifeq ($(LUA_LIB_NAME),)
# Try to automatically detect the Lua library
LUA_LIB_NAME := $(firstword $(foreach lib,lua5.3 lua53 lua,$(call check_lua_lib,$(lib),$(LUA_LD_FLAGS))))
ifeq ($(LUA_LIB_NAME),)
$(error unable to automatically detect the Lua library name, you can enforce its name with LUA_LIB_NAME=<name> (where <name> can be lua5.3, lua53, lua, ...))
endif
endif Darwin-support was added by @pmahoney. Can you look into this? |
According to the Makefile there is a dedicated TARGET for Darwin which implies USE_KQUEUE. This should do the trick but I'm not a Darwin user so I can't test it : makeFlags = [
"PREFIX=\${out}"
"TARGET=${if stdenv.isSunOS then "solaris" else if stdenv.isLinux then "linux2628" else if stdenv.isDarwin then "osx" else "generic"}"
];
buildFlags = [
"USE_LUA=yes"
"LUA_LIB=${pkgs.lua5_3}/lib"
"LUA_INC=${pkgs.lua5_3}/include"
"USE_PCRE=yes"
"USE_PCRE_JIT=yes"
"USE_OPENSSL=yes"
"USE_ZLIB=yes"
(stdenv.lib.optionalString stdenv.isDarwin "CC=cc LUA_LIB_NAME=liblua.dylib")
]; |
@c0bw3b That patch still fails with this.
|
@@ -1,4 +1,4 @@ | |||
{ stdenv, pkgs, fetchurl, openssl, zlib }: | |||
{ stdenv, pkgs, fetchurl, lua5_3, openssl, pcre, zlib }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be nice to have useLua
and usePcre
options so this can be customized with an override.
Thanks for trying the build on Darwin @LnL7. I guess it means no Lua support for Options could be a way to tackle this. But PCRE (at least) should be there by default. |
PCRE is enabled by default as it brings. LUA support does not compile on Darwin (see NixOS#23901). Hence, it is disabled on this platform by default.
Closing in favor of #24248. |
Both are enabled by default. Except for LUA on Darwin where compilation fails. (See NixOS#23901.)
Motivation for this change
This solves #23806.
By the way I also enabled PCRE. Quoting the haproxy README: "If your system supports PCRE (Perl Compatible Regular Expressions), then you really should build with libpcre which is between 2 and 10 times faster than other libc implementations."
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)