From 38b2834b899c96354ce00da621cdb881c090a815 Mon Sep 17 00:00:00 2001 From: Christian Spielberger <c.spielberger@commend.com> Date: Tue, 22 Dec 2020 14:57:56 +0100 Subject: [PATCH 1/2] mk: do not overwrite LIBRE_INC and LIBRE_SO One solution for cross-compiling rem and baresip is to specify LIBRE_INC and LIBRE_SO. The problem was that re.mk always cleared these variables, then detected re.h/libre.so in /usr/local or /usr and set LIBRE_INC and LIBRE_SO to these system paths. --- mk/re.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mk/re.mk b/mk/re.mk index 9f8a4e9f8..4e6dda410 100644 --- a/mk/re.mk +++ b/mk/re.mk @@ -8,6 +8,8 @@ # ARCH Target architecture # CC Compiler # CROSS_COMPILE Cross-compiler prefix (optional) +# LIBRE_INC Libre include path (optional) +# LIBRE_SO Libre library search path (optional) # EXTRA_CFLAGS Extra compiler flags appended to CFLAGS # EXTRA_LFLAGS Extra linker flags appended to LFLAGS # GCOV If non-empty, enable GNU Coverage testing @@ -725,8 +727,10 @@ rpm: tar LIBRE_PATH := ../re # Include path +ifeq ($(LIBRE_INC),) LIBRE_INC := $(shell [ -f $(LIBRE_PATH)/include/re.h ] && \ echo "$(LIBRE_PATH)/include") +endif ifeq ($(LIBRE_INC),) LIBRE_INC := $(shell [ -f /usr/local/include/re/re.h ] && \ echo "/usr/local/include/re") @@ -736,8 +740,10 @@ LIBRE_INC := $(shell [ -f /usr/include/re/re.h ] && echo "/usr/include/re") endif # Library path +ifeq ($(LIBRE_SO),) LIBRE_SO := $(shell [ -f $(LIBRE_PATH)/libre.a ] \ && echo "$(LIBRE_PATH)") +endif ifeq ($(LIBRE_SO),) LIBRE_SO := $(shell [ -f $(LIBRE_PATH)/libre$(LIB_SUFFIX) ] \ && echo "$(LIBRE_PATH)") From 3d797c2653eda8b4cfc4a9a7e54b77d58bde634e Mon Sep 17 00:00:00 2001 From: Christian Spielberger <c.spielberger@commend.com> Date: Tue, 22 Dec 2020 15:21:50 +0100 Subject: [PATCH 2/2] mk: do not overwrite LIBRE_PATH A simpler way for cross compilation could be to set LIBRE_PATH externally. This commit prevents that LIBRE_PATH is overwritten by re.mk and sets LIBRE_INC and LIBRE_SO correctly by means of LIBRE_PATH. These variables are added to the CFLAGS resp. to the "-L" argument of the linker command in baresip and rem Makefile. --- mk/re.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mk/re.mk b/mk/re.mk index 4e6dda410..5f84da75f 100644 --- a/mk/re.mk +++ b/mk/re.mk @@ -8,6 +8,7 @@ # ARCH Target architecture # CC Compiler # CROSS_COMPILE Cross-compiler prefix (optional) +# LIBRE_PATH Libre path (optional) # LIBRE_INC Libre include path (optional) # LIBRE_SO Libre library search path (optional) # EXTRA_CFLAGS Extra compiler flags appended to CFLAGS @@ -724,7 +725,9 @@ rpm: tar # - system installation # +ifeq ($(LIBRE_PATH),) LIBRE_PATH := ../re +endif # Include path ifeq ($(LIBRE_INC),) @@ -732,6 +735,10 @@ LIBRE_INC := $(shell [ -f $(LIBRE_PATH)/include/re.h ] && \ echo "$(LIBRE_PATH)/include") endif ifeq ($(LIBRE_INC),) +LIBRE_INC := $(shell [ -f $(LIBRE_PATH)/include/re/re.h ] && \ + echo "$(LIBRE_PATH)/include/re") +endif +ifeq ($(LIBRE_INC),) LIBRE_INC := $(shell [ -f /usr/local/include/re/re.h ] && \ echo "/usr/local/include/re") endif