From 60ea8ff6763f4fe8b5d6482b81be6ff95e3a276a Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Fri, 10 Apr 2020 13:52:17 +0200 Subject: [PATCH] kamailio-5.x: update build setup This switches the Makefile away from calling "make" manually to using OpenWrt default build defines. This way PKG_BUILD_PARALLEL and PKG_INSTALL can be used. To achieve this the flags are added to MAKE_FLAGS. The flags are also tidied up as per example from Alpine Linux. Like this the build is cleaner, for instance this gets rid of the wrong share directory ("//share/kamailio" instead of "/usr/share/kamailio") and things like multi-slashes in directory names (ex. "///usr/lib/kamailio/modules"). lib_target was removed after verifying that the correct RPATH "/usr/lib/kamailio" is still in place without it. CFLAGS is replaced by CC_EXTRA_OPTS (same is already done for LDFLAGS). This way upstream source can add flags like "-Wall" to OpenWrt builds. Extra flags LOCALBASE, SYSBASE and CROSS get removed as they aren't needed anymore with the "Alpine Linux" flags. Signed-off-by: Sebastian Kemper --- net/kamailio-5.x/Makefile | 43 +++++++++++++++------------------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/net/kamailio-5.x/Makefile b/net/kamailio-5.x/Makefile index 412f72f..3fd6870 100644 --- a/net/kamailio-5.x/Makefile +++ b/net/kamailio-5.x/Makefile @@ -21,8 +21,9 @@ PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=COPYING PKG_MAINTAINER:=Jiri Slachta -# Defining PKG_BUILD_PARALLEL to 1 would be a noop due to the way we call make -#PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +PKG_BUILD_PARALLEL:=1 MODULES_AVAILABLE:= \ acc \ @@ -388,9 +389,6 @@ endef # "ims_diameter_server" -> libkamailio_ims # "carrierroute" -> libtrie -# "lib_target" is specified in order for the modules to get a proper -# RPATH, as otherwise they would not find the internal libraries. - EXTRA_MODULES:= \ $(if $(CONFIG_PACKAGE_kamailio5-mod-carrierroute),,carrierroute) \ $(if $(CONFIG_PACKAGE_kamailio5-mod-ims-diameter-server),,ims_diameter_server) \ @@ -408,35 +406,26 @@ ifeq ($(call qstrip,$(CONFIG_ARCH)),mips) CPU_MIPS2:=mips32 24kc 34kc 74kc endif -PKG_MAKE_ARGS:= \ - prefix=/ \ - cfg_dir=/etc/kamailio/ \ - bin_dir=/usr/sbin/ \ - data_dir=/usr/share/kamailio/ \ - lib_dir=/usr/lib/kamailio/ \ - modules_dir=/usr/lib/kamailio/ \ +MAKE_FLAGS += \ + $(if $(findstring $(call qstrip,$(CONFIG_CPU_TYPE)),$(CPU_MIPS2)),ARCH="mips2",ARCH="$(ARCH)") \ + CC_EXTRA_OPTS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + LD="$(TARGET_CC)" \ + LD_EXTRA_OPTS="$(TARGET_LDFLAGS)" \ + LIBDIR=lib \ + PREFIX=/usr \ + cfg_prefix="$(PKG_INSTALL_DIR)" \ + cfg_target=/etc/kamailio \ group_include="standard" \ include_modules="$$(INCL_MODULES) $(EXTRA_MODULES)" \ - cfg_target=/etc/kamailio/ \ - lib_target=/usr/lib/kamailio/ \ - run_target=/var/run/kamailio/ \ - CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ - LD_EXTRA_OPTS="$(TARGET_LDFLAGS)" \ - LOCALBASE="$(STAGING_DIR)/usr" \ - SYSBASE="$(STAGING_DIR)/usr" \ - CROSS_COMPILE=$(TARGET_CROSS) \ - CC="$(TARGET_CC)" \ - $(if $(findstring $(call qstrip,$(CONFIG_CPU_TYPE)),$(CPU_MIPS2)),ARCH="mips2",ARCH="$(ARCH)") \ - DESTDIR=$(PKG_INSTALL_DIR) \ - quiet=verbose + quiet=verbose \ + run_prefix="" define Build/Configure endef define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) $(PKG_MAKE_ARGS) cfg - $(MAKE) -C $(PKG_BUILD_DIR) quiet=verbose all - $(MAKE) -C $(PKG_BUILD_DIR) quiet=verbose install + $(call Build/Compile/Default,cfg) + $(call Build/Compile/Default,all) endef $(eval $(call BuildPackage,kamailio5)) -- 2.30.2