From 24b13d2bd70622d2e542d9489efa72fae62c302e Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sat, 3 Feb 2018 13:44:25 +0100 Subject: [PATCH 1/5] kamailio-5.x: remove KAM_MODULES use Adding KAM_MODULES variable is not needed. Remove it and call BuildPackage from BuildKamailio5Module instead. For this to work PKG_MAKE_ARGS and Build/Compile need to be moved up, before the module evals. Signed-off-by: Sebastian Kemper --- net/kamailio-5.x/Makefile | 68 +++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/net/kamailio-5.x/Makefile b/net/kamailio-5.x/Makefile index 48ee802..9e9a825 100644 --- a/net/kamailio-5.x/Makefile +++ b/net/kamailio-5.x/Makefile @@ -1,6 +1,6 @@ # -# Copyright (C) 2017 OpenWrt.org -# Copyright (C) 2017 Jiri Slachta +# Copyright (C) 2017 - 2018 OpenWrt.org +# Copyright (C) 2017 - 2018 Jiri Slachta # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -102,9 +102,40 @@ $(foreach d,$(5),$(call Package/kamailio5/install/dbfiles,$$(1),$(d));) endef INCL_MODULES+=$(1) - KAM_MODULES+=kamailio5-mod-$(subst _,-,$(1)) + +$$(eval $$(call BuildPackage,kamailio5-mod-$(subst _,-,$(1)))) endef +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/ \ + include_modules="$(INCL_MODULES)" \ + cfg_target:=/etc/kamailio/ \ + TLS_HOOKS=1 \ + extra_defs="-DUSE_PTHREAD_MUTEX " \ + CFLAGS="$(TARGET_CFLAGS)" \ + LOCALBASE="$(STAGING_DIR)/usr" \ + SYSBASE="$(STAGING_DIR)/usr" \ + PCREDEFS:="$(TARGET_CPPFLAGS)" \ + PCRELIBS:="$(TARGET_LDFLAGS)" \ + CROSS_COMPILE=$(TARGET_CROSS) \ + CC="$(TARGET_CC)" \ + ARCH="$(ARCH)" \ + DESTDIR=$(PKG_INSTALL_DIR) \ + EXTRA_LIBS="-L$(STAGING_DIR)/usr/lib/" \ + quiet=verbose + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) $(PKG_MAKE_ARGS) all + $(MAKE) -C $(PKG_BUILD_DIR) $(PKG_MAKE_ARGS) install +endef + +$(eval $(call BuildPackage,kamailio5)) + ################################ # Kamailio module parameters # Params: @@ -222,34 +253,3 @@ $(eval $(call BuildKamailio5Module,xcap_client,XCAP Client,,+libcurl)) $(eval $(call BuildKamailio5Module,xlog,Advanced logger,,)) $(eval $(call BuildKamailio5Module,xmlrpc,XML RPC module,,+libxml2)) $(eval $(call BuildKamailio5Module,xmpp,SIP-to-XMPP Gateway,,+kamailio5-mod-tm +libexpat)) - -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/ \ - include_modules="$(INCL_MODULES)" \ - cfg_target:=/etc/kamailio/ \ - TLS_HOOKS=1 \ - extra_defs="-DUSE_PTHREAD_MUTEX " \ - CFLAGS="$(TARGET_CFLAGS)" \ - LOCALBASE="$(STAGING_DIR)/usr" \ - SYSBASE="$(STAGING_DIR)/usr" \ - PCREDEFS:="$(TARGET_CPPFLAGS)" \ - PCRELIBS:="$(TARGET_LDFLAGS)" \ - CROSS_COMPILE=$(TARGET_CROSS) \ - CC="$(TARGET_CC)" \ - ARCH="$(ARCH)" \ - DESTDIR=$(PKG_INSTALL_DIR) \ - EXTRA_LIBS="-L$(STAGING_DIR)/usr/lib/" \ - quiet=verbose - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) $(PKG_MAKE_ARGS) all - $(MAKE) -C $(PKG_BUILD_DIR) $(PKG_MAKE_ARGS) install -endef - -$(eval $(call BuildPackage,kamailio5)) -$(foreach m,$(KAM_MODULES),$(eval $(call BuildPackage,$(m)))) From 07bcdd9fa76f6019542cdb55af127743c1f6239a Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sat, 3 Feb 2018 13:48:58 +0100 Subject: [PATCH 2/5] kamailio-5.x: improve module depends Currently the Makefile pulls in depends even for packages which are not selected. Fix this by prefixing the depends with the respective PACKAGE_* item. Signed-off-by: Sebastian Kemper --- net/kamailio-5.x/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/kamailio-5.x/Makefile b/net/kamailio-5.x/Makefile index 9e9a825..0640544 100644 --- a/net/kamailio-5.x/Makefile +++ b/net/kamailio-5.x/Makefile @@ -93,7 +93,7 @@ define BuildKamailio5Module define Package/kamailio5-mod-$(subst _,-,$(1)) $$(call Package/kamailio5/Default) TITLE:=$(2) for Kamailio5 - DEPENDS:=kamailio5 $(4) + DEPENDS:=kamailio5 $(patsubst +%,+PACKAGE_kamailio5-mod-$(subst _,-,$(1)):%,$(4)) endef define Package/kamailio5-mod-$(subst _,-,$(1))/install From 706ea18d8c91ab3bc9ebffb6ea38f1766ab48a92 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sat, 3 Feb 2018 13:56:25 +0100 Subject: [PATCH 3/5] kamailio-5.x: improve module selection Currently INCL_MODULES is filled with all modules. This commit changes this so that only the modules that are selected are added to it. To further limit the number of modules built group_include="standard" is added. This way only the modules of the standard group plus the modules selected in menuconfig are built. The "standard" group only includes modules without any depends. This fixes build failures on targets where not all depends are available, i.e. postgresql on ARC. Now these modules can be properly prevented from being built. Signed-off-by: Sebastian Kemper --- net/kamailio-5.x/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/kamailio-5.x/Makefile b/net/kamailio-5.x/Makefile index 0640544..a8d099d 100644 --- a/net/kamailio-5.x/Makefile +++ b/net/kamailio-5.x/Makefile @@ -28,6 +28,8 @@ TARGET_CFLAGS += $(FPIC) -DVERSION_NODATE=1 PREBUILT_STAMP=$(STAGING_DIR)/stamp/.$(PKG_NAME)_prebuilt TAR_CMD:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components 1 $(TAR_OPTIONS) +INCL_MODULES:= + define Package/kamailio5/Default SECTION:=net CATEGORY:=Network @@ -94,6 +96,9 @@ define BuildKamailio5Module $$(call Package/kamailio5/Default) TITLE:=$(2) for Kamailio5 DEPENDS:=kamailio5 $(patsubst +%,+PACKAGE_kamailio5-mod-$(subst _,-,$(1)):%,$(4)) + ifneq ($$(CONFIG_PACKAGE_kamailio5-mod-$(subst _,-,$(1))),) + INCL_MODULES+=$(1) + endif endef define Package/kamailio5-mod-$(subst _,-,$(1))/install @@ -101,8 +106,6 @@ $(call Package/kamailio5/install/module,$$(1),$(1)) $(foreach d,$(5),$(call Package/kamailio5/install/dbfiles,$$(1),$(d));) endef - INCL_MODULES+=$(1) - $$(eval $$(call BuildPackage,kamailio5-mod-$(subst _,-,$(1)))) endef @@ -113,7 +116,8 @@ PKG_MAKE_ARGS:= \ data_dir=/usr/share/kamailio/ \ lib_dir=/usr/lib/kamailio/ \ modules_dir=/usr/lib/kamailio/ \ - include_modules="$(INCL_MODULES)" \ + group_include="standard" \ + include_modules="$$(INCL_MODULES)" \ cfg_target:=/etc/kamailio/ \ TLS_HOOKS=1 \ extra_defs="-DUSE_PTHREAD_MUTEX " \ From 8763b0703f92a6df73ad2bc15d55b2e40a905975 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sat, 3 Feb 2018 14:02:36 +0100 Subject: [PATCH 4/5] kamailio-5.x: add CPPFLAGS to CFLAGS Pass CPPFLAGS in the CFLAGS as otherwise the build system will ignore them. This way FORTIFY_SOURCE headers are passed to the compiler. Signed-off-by: Sebastian Kemper --- net/kamailio-5.x/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/kamailio-5.x/Makefile b/net/kamailio-5.x/Makefile index a8d099d..b9531b1 100644 --- a/net/kamailio-5.x/Makefile +++ b/net/kamailio-5.x/Makefile @@ -121,7 +121,7 @@ PKG_MAKE_ARGS:= \ cfg_target:=/etc/kamailio/ \ TLS_HOOKS=1 \ extra_defs="-DUSE_PTHREAD_MUTEX " \ - CFLAGS="$(TARGET_CFLAGS)" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ LOCALBASE="$(STAGING_DIR)/usr" \ SYSBASE="$(STAGING_DIR)/usr" \ PCREDEFS:="$(TARGET_CPPFLAGS)" \ From d50b56ba15d702a87685928ab9d649ad89b27279 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sat, 3 Feb 2018 14:06:41 +0100 Subject: [PATCH 5/5] kamailio-5.x: disable mod-db-postgres on ARC postgresql does not build on ARC. This commit makes sure that it is not pulled in. Signed-off-by: Sebastian Kemper --- net/kamailio-5.x/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/kamailio-5.x/Makefile b/net/kamailio-5.x/Makefile index b9531b1..9882dbc 100644 --- a/net/kamailio-5.x/Makefile +++ b/net/kamailio-5.x/Makefile @@ -105,7 +105,6 @@ define BuildKamailio5Module $(call Package/kamailio5/install/module,$$(1),$(1)) $(foreach d,$(5),$(call Package/kamailio5/install/dbfiles,$$(1),$(d));) endef - $$(eval $$(call BuildPackage,kamailio5-mod-$(subst _,-,$(1)))) endef @@ -171,7 +170,7 @@ $(eval $(call BuildKamailio5Module,corex,Legacy functions,,)) $(eval $(call BuildKamailio5Module,ctl,BINRPC transport interface,,)) $(eval $(call BuildKamailio5Module,db_flatstore,fast write-only text DB-backend,,)) $(eval $(call BuildKamailio5Module,db_mysql,MySQL DB-backend,,+libmysqlclient,mysql)) -$(eval $(call BuildKamailio5Module,db_postgres,PostgreSQL DB-backend,,+libpq,postgres)) +$(eval $(call BuildKamailio5Module,db_postgres,PostgreSQL DB-backend,,@!arc +libpq,postgres)) $(eval $(call BuildKamailio5Module,db_sqlite,SQLite DB-backend,,+libsqlite3,db_sqlite)) $(eval $(call BuildKamailio5Module,db_text,Text DB-backend,,,dbtext/kamailio)) $(eval $(call BuildKamailio5Module,db_unixodbc,UnixODBC DB-backend,,+unixodbc))