diff --git a/Makefile b/Makefile index bea56fa49..e8285c750 100644 --- a/Makefile +++ b/Makefile @@ -147,8 +147,10 @@ endif ifneq (,$(findstring $(OS),Darwin FreeBSD)) NPROCS := $(shell sysctl -n hw.ncpu) LEGACY_BUILD := 1 - export CC=gcc - export CXX=g++ + CC ?= cc + CXX ?= c++ + export CC + export CXX endif export MAKEOPT := -j${NPROCS} @@ -385,11 +387,7 @@ SYS_ARCH := $(shell uname -m) REL_ARCH = $(subst x86_64,amd64,$(subst aarch64,arm64,$(SYS_ARCH))) RPM_ARCH = .$(SYS_ARCH) DEB_ARCH = _$(REL_ARCH) -ifeq ($(UNAME_S),Darwin) REL_VERS := $(shell echo ${GIT_VERSION} | sed -E 's/^v//' | grep -Eo '^[0-9\.]+') -else -REL_VERS := $(shell echo ${GIT_VERSION} | grep -Po '(?<=^v|^)[\d\.]+') -endif RPM_VERS := -$(REL_VERS)-1 DEB_VERS := _$(REL_VERS) @@ -411,7 +409,7 @@ amd64-fedora: fedora42 fedora42-clang fedora42-dbg fedora43 fedora43-clang fedor amd64-opensuse: opensuse15 opensuse15-clang opensuse15-dbg opensuse16 opensuse16-clang opensuse16-dbg amd64-ubuntu: ubuntu22 ubuntu22-clang ubuntu22-dbg ubuntu24 ubuntu24-clang ubuntu24-dbg amd64-pkglist: - @${MAKE} -nk amd64-packages 2>/dev/null | grep -Po '(?<=binaries/)proxysql\S+$$' + @${MAKE} -nk amd64-packages 2>/dev/null | grep -Eo 'proxysql[^ ]*' | sed 's/^/binaries\///' arm64-%: SYS_ARCH := aarch64 arm64-packages: arm64-centos arm64-debian arm64-ubuntu arm64-fedora arm64-opensuse arm64-almalinux @@ -422,7 +420,7 @@ arm64-fedora: fedora42 fedora43 arm64-opensuse: opensuse15 opensuse16 arm64-ubuntu: ubuntu22 ubuntu24 arm64-pkglist: - @${MAKE} -nk arm64-packages 2>/dev/null | grep -Po '(?<=binaries/)proxysql\S+$$' + @${MAKE} -nk arm64-packages 2>/dev/null | grep -Eo 'proxysql[^ ]+' | sed 's/^/binaries\//' almalinux%: build-almalinux% ; centos%: build-centos% ; @@ -435,12 +433,12 @@ ubuntu%: build-ubuntu% ; .PHONY: build-% .NOTPARALLEL: build-% build-%: BLD_NAME=$(patsubst build-%,%,$@) -build-%: PKG_VERS=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+'),debian ubuntu),$(DEB_VERS),$(RPM_VERS)) -build-%: PKG_TYPE=$(if $(filter $(shell echo $(BLD_NAME) | grep -Po '\-de?bu?g|\-test|\-tap'),-dbg -debug -test -tap),-dbg,) +build-%: PKG_VERS=$(if $(filter $(shell echo ${BLD_NAME} | grep -Eo '[a-z]+'),debian ubuntu),$(DEB_VERS),$(RPM_VERS)) +build-%: PKG_TYPE=$(if $(filter $(shell echo $(BLD_NAME) | grep -Eo '\-de?bu?g|\-test|\-tap'),-dbg -debug -test -tap),-dbg,) build-%: PKG_NAME=$(firstword $(subst -, ,$(BLD_NAME))) -build-%: PKG_COMP=$(if $(filter $(shell echo $(BLD_NAME) | grep -Po '\-clang'),-clang),-clang,) -build-%: PKG_ARCH=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+'),debian ubuntu),$(DEB_ARCH),$(RPM_ARCH)) -build-%: PKG_KIND=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+'),debian ubuntu),deb,rpm) +build-%: PKG_COMP=$(if $(filter $(shell echo $(BLD_NAME) | grep -Eo '\-clang'),-clang),-clang,) +build-%: PKG_ARCH=$(if $(filter $(shell echo ${BLD_NAME} | grep -Eo '[a-z]+'),debian ubuntu),$(DEB_ARCH),$(RPM_ARCH)) +build-%: PKG_KIND=$(if $(filter $(shell echo ${BLD_NAME} | grep -Eo '[a-z]+'),debian ubuntu),deb,rpm) build-%: PKG_FILE=binaries/proxysql$(PKG_VERS)$(PKG_TYPE)-$(PKG_NAME)$(PKG_COMP)$(PKG_ARCH).$(PKG_KIND) build-%: @echo 'building $@' diff --git a/include/proxysql_utils.h b/include/proxysql_utils.h index 261aaf9cd..0ac6cab5c 100644 --- a/include/proxysql_utils.h +++ b/include/proxysql_utils.h @@ -27,7 +27,7 @@ #define ETIME ETIMEDOUT #endif -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(__FreeBSD__) using std::conjunction; #elif defined(CXX17) template struct conjunction : std::true_type { }; diff --git a/lib/log_utils.cpp b/lib/log_utils.cpp index bcfafd8cc..43419c460 100644 --- a/lib/log_utils.cpp +++ b/lib/log_utils.cpp @@ -112,7 +112,7 @@ LogBufferThreadContext::LogBufferThreadContext() : dist(0.0, 1.0) { std::seed_seq seed{ rd(), static_cast(std::chrono::high_resolution_clock::now().time_since_epoch().count()), - static_cast(pthread_self()) + static_cast(reinterpret_cast(pthread_self())) }; rng.seed(seed); } diff --git a/lib/proxy_protocol_info.cpp b/lib/proxy_protocol_info.cpp index 8874373d6..49d75ea62 100644 --- a/lib/proxy_protocol_info.cpp +++ b/lib/proxy_protocol_info.cpp @@ -3,6 +3,9 @@ #include #include #include +#ifdef __FreeBSD__ +#include +#endif static bool DEBUG_ProxyProtocolInfo = false; diff --git a/lib/proxysql_utils.cpp b/lib/proxysql_utils.cpp index 1a0c6e30a..331902586 100644 --- a/lib/proxysql_utils.cpp +++ b/lib/proxysql_utils.cpp @@ -23,6 +23,10 @@ #ifdef __linux__ #include #endif +#ifdef __FreeBSD__ +#include +#include +#endif using std::function; using std::string;