]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Build-System] Allow full path or git clone url (with arguments) in modules.conf...
authorAndrey Volk <andywolk@gmail.com>
Thu, 2 Apr 2020 19:17:32 +0000 (23:17 +0400)
committerAndrey Volk <andywolk@gmail.com>
Thu, 4 Jun 2020 18:41:55 +0000 (22:41 +0400)
--- modules.conf ---
/full/path/to/out-of-tree/mod_tobuild
mod_somewherethere|https://github.com/your_account/your_mod_repo.git -b branch

configure.ac
src/mod/Makefile.am

index 13cea786fcfbfbffb095fc418629445c30c6b0c8..7c7df126f5ba4dc06783dc4e9bcd02564d96489f 100644 (file)
@@ -1267,7 +1267,7 @@ if test "$cross_compiling" != "yes" && test -f /usr/lib/pkg-config/libldns.pc; t
 fi
 
 module_enabled() {
-  grep -v -e "\#" -e "^\$" modules.conf | sed -e "s|^.*/||" | grep "^${1}\$" >/dev/null
+  grep -v -e "\#" -e "^\$" modules.conf | sed 's/|.*//' | sed -e "s|^.*/||" | grep "^${1}\$" >/dev/null
 }
 
 AC_ARG_WITH(png,
@@ -2057,8 +2057,8 @@ AM_CONDITIONAL(HAVE_G729, [ test -d ${switch_srcdir}/libs/libg729 ])
 #LIBS+=> core.log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat core.log;fi;if test "$$error" = "yes";then exit 1;fi
 LIBTOOL='$(SHELL) $(switch_builddir)/libtool'
 TOUCH_TARGET='if test -f "$@";then touch "$@";fi;'
-CONF_MODULES='$$(grep -v "\#" $(switch_builddir)/modules.conf | sed -e "s|^.*/||" | sort | uniq )'
-CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed -e "s|^.*/||" | sort | uniq )'
+CONF_MODULES='$$(grep -v "\#" $(switch_builddir)/modules.conf | sed "s/|.*//" | sed -e "s|^.*/||" | sort | uniq )'
+CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed "s/|.*//" | sed -e "s|^.*/||" | sort | uniq )'
 OUR_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
 OUR_CLEAN_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
 OUR_INSTALL_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
index 9bbf5b7c402e326e99a373bc8df874280285161a..b9b1e1dd39bb6576b823d07a510a7a52ed8b127d 100644 (file)
@@ -19,21 +19,51 @@ $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODUL
        modname=`echo $@ | sed -e 's|-.*||' | sed -e 's|^.*/||'`; \
        enabled=`echo $(CONF_MODULES) | grep -w $$modname`; \
        if ! test -z "$$enabled"; then \
-               confmoddir=`cat $(switch_builddir)/modules.conf | sed -e 's| ||' | grep $$modname$$ | sed -e 's|#||' | head -n 1`; \
+               confmoddir=`cat $(switch_builddir)/modules.conf | sed -e 's| ||' | sed 's/|.*//' | grep $$modname$$ | sed -e 's|#||' | head -n 1`; \
+               modsource=`cat $(switch_builddir)/modules.conf | grep "$$modname.*|" | sed 's/.*|//' | head -n 1`; \
                if test -z "$$confmoddir" ; then \
                        moddir=$@ ; \
                        buildmoddir=$(switch_builddir)/src/mod/$@ ;\
                else  \
-                       if test -d  "$(switch_srcdir)/src/mod/$$confmoddir" ; then \
-                               moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; \
-                               buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \
-                       else \
+                       if [[ $$confmoddir == /* ]]; then \
                                moddir="$$confmoddir" ; \
-                               buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \
+                               buildmoddir="$$moddir" ; \
+                       else \
+                               if test -d  "$(switch_srcdir)/src/mod/$$confmoddir" ; then \
+                                       moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; \
+                                       buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \
+                               else \
+                                       if ! test -z "$$modsource" ; then \
+                                               moddir="$(switch_srcdir)/src/mod/outoftree/$$confmoddir" ; \
+                                               buildmoddir="$(switch_builddir)/src/mod/outoftree/$$confmoddir" ; \
+                                               if ! test -d "$$buildmoddir"; then \
+                                                       echo "Cloning from git: $$modsource" ; \
+                                                       mkdir -p $$buildmoddir ; \
+                                                       git clone $$modsource $$buildmoddir ; \
+                                               fi ; \
+                                               if ! test -d "$$buildmoddir"; then \
+                                                       echo ; echo "WARNING There is no $$buildmoddir...failing ;" ; \
+                                                       fail=yes ; \
+                                               fi ; \
+                                       else \
+                                               moddir="$$confmoddir" ; \
+                                               buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \
+                                       fi ; \
+                               fi ; \
+                       fi ; \
+               fi ; \
+               if test -f  "$$buildmoddir/bootstrap.sh" -a ! -f  "$$buildmoddir/configure" -a ! -f  "$$buildmoddir/configure.sh" ; then \
+                       cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) PKG_CONFIG_PATH=$(switch_builddir)/build/standalone_module:$PKG_CONFIG_PATH eval $$buildmoddir/bootstrap.sh ; \
+               fi ; \
+               if test -f  "$$buildmoddir/configure.sh" -a ! -f "$$buildmoddir/Makefile" ; then \
+                       cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) PKG_CONFIG_PATH=$(switch_builddir)/build/standalone_module:$PKG_CONFIG_PATH eval $$buildmoddir/configure.sh ; \
+               else \
+                       if test -f  "$$buildmoddir/configure" -a ! -f "$$buildmoddir/Makefile" ; then \
+                               cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) PKG_CONFIG_PATH=$(switch_builddir)/build/standalone_module:$PKG_CONFIG_PATH eval $$buildmoddir/configure ; \
                        fi ; \
                fi ; \
                if test -z "$$target" ; then target="all" ; fi ; \
-               if ! test -f $$moddir/$$modname.c && ! test -f $$moddir/$$modname.cpp && test $$modname != "mod_com_g729" ;     \
+               if ! test -z "$$fail" || ! test -f $$moddir/$$modname.c && ! test -f $$moddir/$$modname.cpp && test $$modname != "mod_com_g729" ;       \
                then echo ; echo "WARNING $$modname is not a valid FreeSWITCH module dir, skipping it..." ; else \
                        if test "$$target" != "print_tests" ; then echo; echo making $$target $$modname ; fi;\
                        test -d "$$buildmoddir" || mkdir -p $$buildmoddir ; \