From a2001c00e634fcaa141fa30c57112c506c6d1518 Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Sun, 26 Aug 2018 14:18:42 -0400 Subject: [PATCH] Create --disable-binary-modules option. This new option can be passed for ./configure or ./tests/CI/buildAsterisk.sh to prevent download/install of binary modules. Normally enabling the categories MENUSELECT_CODECS or MENUSELECT_RES will result in binary modules being enabled even if the build target is incompatible with those modules. This includes CI scripts which enable categories before disabling specific modules. If more binary modules are offered in the future this will help avoid accidentally downloading them if unwanted or incompatible. Adding a binary module will only require creating a new menuselect entry similar to the existing ones, it will not be necessary to modify the CI scripts. Change-Id: I6b1bd1c75a2e48f05b8b8a45b7a7a2d00a079166 --- build_tools/menuselect-deps.in | 1 + codecs/codecs.xml | 5 +++++ configure | 16 ++++++++++++++++ configure.ac | 11 +++++++++++ res/res.xml | 1 + tests/CI/buildAsterisk.sh | 7 ++++++- 6 files changed, 40 insertions(+), 1 deletion(-) diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in index e62c183b73..161c67b39a 100644 --- a/build_tools/menuselect-deps.in +++ b/build_tools/menuselect-deps.in @@ -82,3 +82,4 @@ HAVE_ADDRESS_SANITIZER=@AST_ADDRESS_SANITIZER@ HAVE_LEAK_SANITIZER=@AST_LEAK_SANITIZER@ HAVE_THREAD_SANITIZER=@AST_THREAD_SANITIZER@ HAVE_UNDEFINED_SANITIZER=@AST_UNDEFINED_SANITIZER@ +NO_BINARY_MODULES=@PBX_NO_BINARY_MODULES@ diff --git a/codecs/codecs.xml b/codecs/codecs.xml index 0b4e2a4740..996a3559b7 100644 --- a/codecs/codecs.xml +++ b/codecs/codecs.xml @@ -1,5 +1,6 @@ external + no_binary_modules xmlstarlet bash res_format_attr_opus @@ -7,24 +8,28 @@ external + no_binary_modules xmlstarlet bash no external + no_binary_modules xmlstarlet bash no external + no_binary_modules xmlstarlet bash no external + no_binary_modules xmlstarlet bash no diff --git a/configure b/configure index b24fedb9dd..c453501382 100755 --- a/configure +++ b/configure @@ -1201,6 +1201,7 @@ AST_DOWNLOAD_CACHE AST_DEVMODE_STRICT AST_DEVMODE NOISY_BUILD +PBX_NO_BINARY_MODULES PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC @@ -1351,6 +1352,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking with_gnu_ld +enable_binary_modules enable_dev_mode with_download_cache with_sounds_cache @@ -2089,6 +2091,8 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-binary-modules + Block installation of binary modules. --enable-dev-mode Turn on developer mode --enable-coverage Turn on code coverage tracking (for gcov) --disable-xmldoc Explicitly disable XML documentation @@ -8914,6 +8918,18 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +PBX_NO_BINARY_MODULES=0 +# Check whether --enable-binary-modules was given. +if test "${enable_binary_modules+set}" = set; then : + enableval=$enable_binary_modules; case "${enableval}" in + y|ye|yes) PBX_NO_BINARY_MODULES=0 ;; + n|no) PBX_NO_BINARY_MODULES=1 ;; + *) as_fn_error $? "bad value ${enableval} for --disable-binary-modules" "$LINENO" 5 ;; + esac +fi + + + # Check whether --enable-dev-mode was given. if test "${enable_dev_mode+set}" = set; then : enableval=$enable_dev_mode; case "${enableval}" in diff --git a/configure.ac b/configure.ac index 8537aca7c2..431b3da341 100644 --- a/configure.ac +++ b/configure.ac @@ -385,6 +385,17 @@ AX_PTHREAD AC_LANG(C) +PBX_NO_BINARY_MODULES=0 +AC_ARG_ENABLE([binary-modules], + [AS_HELP_STRING([--disable-binary-modules], + [Block installation of binary modules.])], + [case "${enableval}" in + y|ye|yes) PBX_NO_BINARY_MODULES=0 ;; + n|no) PBX_NO_BINARY_MODULES=1 ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-binary-modules) ;; + esac]) +AC_SUBST(PBX_NO_BINARY_MODULES) + AC_ARG_ENABLE([dev-mode], [AS_HELP_STRING([--enable-dev-mode], [Turn on developer mode])], diff --git a/res/res.xml b/res/res.xml index a340cc2fdc..ace1792650 100644 --- a/res/res.xml +++ b/res/res.xml @@ -1,5 +1,6 @@ external + no_binary_modules xmlstarlet bash no diff --git a/tests/CI/buildAsterisk.sh b/tests/CI/buildAsterisk.sh index 60f091761e..992dc94bdf 100755 --- a/tests/CI/buildAsterisk.sh +++ b/tests/CI/buildAsterisk.sh @@ -3,6 +3,7 @@ CIDIR=$(dirname $(readlink -fn $0)) COVERAGE=0 REF_DEBUG=0 +DISABLE_BINARY_MODULES=0 source $CIDIR/ci.functions gen_cats() { @@ -78,6 +79,10 @@ common_config_args+=" --enable-dev-mode" if [ $COVERAGE -eq 1 ] ; then common_config_args+=" --enable-coverage" fi +if [ "$BRANCH_NAME" == "master" -o $DISABLE_BINARY_MODULES -eq 1 ] ; then + common_config_args+=" --disable-binary-modules" +fi + export WGET_EXTRA_ARGS="--quiet" runner ./configure ${common_config_args} > ${OUTPUT_DIR:+${OUTPUT_DIR}/}configure.txt @@ -115,7 +120,7 @@ if [ $TESTED_ONLY -eq 1 ] ; then mod_disables+=" res_ael_share res_calendar res_config_ldap res_config_pgsql res_corosync" mod_disables+=" res_http_post res_pktccops res_rtp_multicast res_snmp res_xmpp" fi -[ "$BRANCH_NAME" == "master" ] && mod_disables+=" codec_opus codec_silk codec_g729a codec_siren7 codec_siren14" + runner menuselect/menuselect `gen_mods disable $mod_disables` menuselect.makeopts mod_enables="app_voicemail app_directory FILE_STORAGE"