asterisk-13.x: change LOW_MEMORY and -march=native treatment
authorSebastian Kemper <sebastian_ml@gmx.net>
Wed, 10 Jan 2018 22:19:48 +0000 (23:19 +0100)
committerSebastian Kemper <sebastian_ml@gmx.net>
Wed, 10 Jan 2018 22:19:50 +0000 (23:19 +0100)
- LOW_MEMORY is known to cause sporadic crashes, disable it by default.
- Prevent Asterisk from adding -march=native to CFLAGS.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
net/asterisk-13.x/Config.in [new file with mode: 0644]
net/asterisk-13.x/Makefile

diff --git a/net/asterisk-13.x/Config.in b/net/asterisk-13.x/Config.in
new file mode 100644 (file)
index 0000000..fd38585
--- /dev/null
@@ -0,0 +1,11 @@
+menu "Advanced configuration"
+       depends on PACKAGE_asterisk13
+
+config ASTERISK13_LOW_MEMORY
+       bool "Optimize Asterisk 13 for low memory usage"
+       default n
+       help
+         Warning: this feature is known to cause problems with some modules.
+         Disable it if you experience problems like segmentation faults.
+
+endmenu
index ffcea6e6142ade732cacba400adf654a24f6b39b..64f171dddee3703aa3105b7a321807d8c75158a1 100644 (file)
@@ -50,6 +50,10 @@ define Package/asterisk13/install/sounds
        $(CP) $(PKG_INSTALL_DIR)/usr/share/asterisk/sounds/en/$(2) $(1)/usr/share/asterisk/sounds/
 endef
 
+define Package/$(PKG_NAME)/config
+       source "$(SOURCE)/Config.in"
+endef
+
 define BuildAsterisk13Module
   define Package/asterisk13-$(1)
   $$(call Package/asterisk13/Default)
@@ -269,6 +273,19 @@ define Build/Compile
        $(MAKE) -C "$(PKG_BUILD_DIR)/menuselect" \
                CFLAGS="$(HOST_CFLAGS) -I$(STAGING_DIR_HOST)/include/libxml2" \
                LDFLAGS="$(HOST_LDFLAGS) -lxml2"
+       $(MAKE) -C "$(PKG_BUILD_DIR)" menuselect-tree
+       cd "$(PKG_BUILD_DIR)" && \
+               ./menuselect/menuselect \
+                       --disable BUILD_NATIVE \
+                       $(if $(CONFIG_ASTERISK13_LOW_MEMORY),--enable LOW_MEMORY) \
+                       menuselect.makeopts
+       # Hack:
+       # When changing anything in MENUSELECT_CFLAGS the file ".lastclean"
+       # gets deleted. E.g. when compiling on x86 for x86 "--disable
+       # BUILD_NATIVE" changes MENUSELECT_CFLAGS and the file gets removed.
+       # But that will result in a rebuild attempt of menuselect which will
+       # likely fail. Prevent that by recreating ".lastclean".
+       $(CP) "$(PKG_BUILD_DIR)/.cleancount" "$(PKG_BUILD_DIR)/.lastclean"
        $(call Build/Compile/Default,all install samples)
 endef