From dc4b77981789f706c350a57c2be71e8f46216050 Mon Sep 17 00:00:00 2001 From: paulc Date: Sun, 9 Jan 2005 06:05:02 +0000 Subject: [PATCH] Build system and packaging changes. The yate library is now versioned. git-svn-id: http://voip.null.ro/svn/yate@166 acf43c95-373e-0410-b603-e72c3f656dc1 --- Makefile.in | 62 ++++++++++++++++++++++++++-------------- configure.in | 7 ++++- engine/Engine.cpp | 12 +++++++- yate-config.8 | 72 +++++++++++++++++++++++++++++++++++++++++++++++ yate.8 | 19 ++++++++++--- yate.spec.in | 6 +++- 6 files changed, 150 insertions(+), 28 deletions(-) create mode 100644 yate-config.8 diff --git a/Makefile.in b/Makefile.in index 70364027..8d2b9038 100644 --- a/Makefile.in +++ b/Makefile.in @@ -19,7 +19,7 @@ LDCONFIG:=true MKDEPS := ./config.status PROGS:= yate -SLIBS:= libyate.so +SLIBS:= libyate.so.@PACKAGE_VERSION@ libyate.so INCS := telengine.h telephony.h GENS := yateversn.h LIBS := @@ -32,7 +32,7 @@ ENGOBJS := TelEngine.o String.o DataBlock.o ObjList.o \ OBJS := main.o LIBOBJS := $(ENGOBJS) $(TELOBJS) -CLEANS = $(PROGS) $(SLIBS) $(LIBS) $(OBJS) $(LIBOBJS) core +CLEANS = $(PROGS) $(SLIBS) $(LIBS) $(OBJS) $(LIBOBJS) yatepaths.h core COMPILE = $(CXX) $(DEFS) $(DEBUG) $(INCLUDES) $(CFLAGS) LINK = $(CXX) $(LDFLAGS) @@ -48,21 +48,42 @@ vardir = @localstatedir@/lib/yate moddir = @libdir@/yate confdir = @sysconfdir@/yate -.PHONY: all +.PHONY: all everything all: engine modules -.PHONY: clean +everything: all apidocs test + +.PHONY: clean distclean cvsclean clean-config-files clean-tables clean-apidocs clean: -rm $(CLEANS) 2>/dev/null $(MAKE) -C ./modules $@ $(MAKE) -C ./test $@ $(MAKE) -C ./contrib/iax $@ $(MAKE) -C ./contrib/qt $@ + $(MAKE) -C ./contrib/ysip $@ -.PHONY: engine +check-topdir: + @test -f configure || (echo "Must make this target in the top source directory"; exit 1) + +clean-config-files: check-topdir + -rm -rf auto*.cache + -rm -f @CONFIGURE_FILES@ + +clean-tables: check-topdir + -rm -f yate.spec + $(MAKE) -C ./tables -f Makefile.tables mrproper + +clean-apidocs: check-topdir + -rm docs/api/*.html + +distclean: check-topdir clean clean-config-files + +cvsclean: check-topdir clean clean-tables clean-apidocs clean-config-files + -rm -f configure + +.PHONY: engine modules test apidocs-build check-topdir engine: tables yatepaths.h $(LIBS) $(SLIBS) $(PROGS) -.PHONY: apidocs-build apidocs-build: check-topdir kdoc -C ./kdoc-filter.sh -d docs/api/ $(INCS) @@ -71,28 +92,23 @@ apidocs: @srcdir@/docs/api/index.html @srcdir@/docs/api/index.html: @srcdir@/telengine.h @srcdir@/telephony.h $(MAKE) apidocs-build -.PHONY: strip +.PHONY: strip sex love war strip: all -strip --strip-debug --discard-locals $(PROGS) $(SLIBS) -.PHONY: sex sex: strip @echo 'Stripped for you!' # Let's have a little fun -.PHONY: love love: @echo 'Not war?' -.PHONY: war war: @echo 'Please make love instead!' -.PHONY: test test: engine $(MAKE) -C ./test all -.PHONY: modules modules: engine $(MAKE) -C ./modules all @@ -105,13 +121,17 @@ yatepaths.h: $(MKDEPS) @echo '#define MOD_PATH "$(DESTDIR)$(moddir)"' > $@ @echo '#define CFG_PATH "$(DESTDIR)$(confdir)"' >> $@ -.PHONY: everything -everything: all apidocs test - .PHONY: install install-root install install-root: all apidocs @mkdir -p "$(DESTDIR)$(libdir)/" && \ - install $(SLIBS) "$(DESTDIR)$(libdir)/" && $(LDCONFIG) + for i in $(SLIBS) ; do \ + if [ -h "$$i" ]; then \ + f=`readlink "$$i"` ; \ + ln -sf "$$f" "$(DESTDIR)$(libdir)/$$i" ; \ + else \ + install $$i "$(DESTDIR)$(libdir)/" ; \ + fi \ + done && $(LDCONFIG) @mkdir -p "$(DESTDIR)$(bindir)/" && \ install $(PROGS) yate-config "$(DESTDIR)$(bindir)/" $(MAKE) -C ./modules install @@ -192,10 +212,6 @@ snapshot tarball: check-topdir clean tables apidocs $$wd; \ rm $$wd/tar-exclude -.PHONY: check-topdir -check-topdir: - @test -f configure || (echo "Must make this target in the top source directory"; exit 1) - Engine.o: @srcdir@/Engine.cpp $(MKDEPS) @srcdir@/telengine.h yateversn.h yatepaths.h $(COMPILE) -c $< @@ -220,7 +236,10 @@ Makefile: @srcdir@/Makefile.in $(MKDEPS) yate: $(OBJS) libyate.so $(LIBS) $(LINK) -o $@ $(LIBTHR) $^ -libyate.so: $(ENGOBJS) $(LIBS) +libyate.so: libyate.so.@PACKAGE_VERSION@ + ln -sf $^ $@ + +libyate.so.@PACKAGE_VERSION@: $(ENGOBJS) $(LIBS) $(LINK) -shared -o $@ -Wl,--soname=$@ $(LIBTHR) $^ $(LIBAUX) .PHONY: help @@ -228,4 +247,5 @@ help: @echo -e 'Usual make targets:\n\ all engine modules apidocs test everything\n\ install uninstall\n\ + clean distclean cvsclean\n\ snapshot tarball' diff --git a/configure.in b/configure.in index ebf64582..bba6bba7 100644 --- a/configure.in +++ b/configure.in @@ -100,8 +100,11 @@ PGSQL_INC="" AC_ARG_WITH(libpq,AC_HELP_STRING([--with-libpq=DIR],[use Postgress SQL from DIR (default /usr)]),[ac_cv_use_libpq=$withval],[ac_cv_use_libpq=/usr]) if [[ "x$ac_cv_use_libpq" != "xno" ]]; then AC_MSG_CHECKING([for Postgress SQL in $ac_cv_use_libpq]) -incpq="$ac_cv_use_libpq/include" libpq="$ac_cv_use_libpq/lib/libpq.so" +for i in include include/pgsql pgsql/include include/postgresql; do + incpq="$ac_cv_use_libpq/$i" + test -f "$incpq/libpq-fe.h" && break +done if [[ ! -f "$incpq/libpq-fe.h" ]]; then incpq="$incpq/pgsql" fi @@ -509,4 +512,6 @@ AC_CONFIG_FILES([yate.spec test/Makefile]) AC_CONFIG_FILES([yate-config],[chmod +x yate-config]) AC_CONFIG_FILES([run],[chmod +x run]) +CONFIGURE_FILES=`echo "$ac_config_files config.status config.log" | sed 's/yate\.spec *//'` +AC_SUBST(CONFIGURE_FILES) AC_OUTPUT diff --git a/engine/Engine.cpp b/engine/Engine.cpp index d579f5e7..0a35ea0c 100644 --- a/engine/Engine.cpp +++ b/engine/Engine.cpp @@ -103,6 +103,7 @@ bool Engine::s_dynplugin = false; int Engine::s_maxworkers = 10; int EnginePrivate::count = 0; +const char* s_cfgfile = "yate"; ObjList plugins; class SLib : public GenObject @@ -328,7 +329,7 @@ void Engine::loadPlugins() #ifdef DEBUG Debugger debug("Engine::loadPlugins()"); #endif - Configuration cfg(configFile("yate")); + Configuration cfg(configFile(s_cfgfile)); bool defload = cfg.getBoolValue("general","modload",true); const char *name = cfg.getValue("general","modpath"); if (name) @@ -559,6 +560,7 @@ static void usage(FILE *f) " -s Supervised, restart if crashes or locks up\n" " -l filename Log to file\n" " -p filename Write PID to file\n" +" -n configname Use specified configuration name (yate)\n" " -c pathname Path to conf files directory (" CFG_PATH ")\n" " -m pathname Path to modules directory (" MOD_PATH ")\n" #ifndef NDEBUG @@ -645,6 +647,14 @@ int Engine::main(int argc, const char **argv, const char **environ) pc = 0; pidfile=argv[++i]; break; + case 'n': + if (i+1 >= argc) { + noarg(argv[i]); + return ENOENT; + } + pc = 0; + s_cfgfile=argv[++i]; + break; case 'c': if (i+1 >= argc) { noarg(argv[i]); diff --git a/yate-config.8 b/yate-config.8 new file mode 100644 index 00000000..9e57cbf0 --- /dev/null +++ b/yate-config.8 @@ -0,0 +1,72 @@ +.\" +.\" YATE - Yet Another Telephony Engine +.\" +.\" This program is free software; you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation; either version 2 of the License, or +.\" (at your option) any later version. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program; if not, write to the Free Software +.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +.\" +.\" +.TH YATE-CONFIG 8 "March 2004" "YATE" "Telephony Engine" +.SH NAME +\fByate-config\fP \- retrieve metainformation about the YATE telephony engine +.SH SYNOPSIS +.B yate-config +.RI [options] +.SH DESCRIPTION +The +.B yate-config +program is used to retrieve information about the installed YATE engine. +It is typically used to compile and link modules against the engine's library. + +Here is a typical usage scenario in a Makefile: + +module.yate: module.cpp + g++ `yate-config --c-all --ldflags` module.cpp `yate-config --libs` + +.SH OPTIONS +.SS Version and paths +.TP +.B \-\-version +Reports the installed YATE version (in x.y.z format) +.TP +.B \-\-config +Returns the configuration files directory +.TP +.B \-\-modules +Returns the modules directory +.SS Compiler flags +.TP +.B \-\-cflags +Various C++ compiler flags +.TP +.B \-\-includes +Include option and path to the header files +.TP +.B \-\-c\-all +All compiler options \- the above two concatenated +.SS Linker flags +.TP +.B \-\-ldflags +Various linker flags +.TP +.B \-\-libs +Library option and libraries names +.TP +.B \-\-ld\-all +All linker options \- the above two concatenated +.SH AUTHORS +Paul Chitescu +.br +Diana Cionoiu +.SH SEE ALSO +.BR yate (8) diff --git a/yate.8 b/yate.8 index 5a1d538c..8e3aa401 100644 --- a/yate.8 +++ b/yate.8 @@ -24,7 +24,7 @@ .RI [options] .SH DESCRIPTION .B yate -is a telephony engine that supports PBX and IVR functions trough plugins. +is a telephony engine that supports client, PBX and IVR functions trough plugins. .SH OPTIONS .SS General .TP @@ -44,7 +44,19 @@ Daemonify, suppress output unless logged Supervised, restart if crashes or locks up .TP .B \-l filename -Log to file +Log to file \- should be used whenever running in daemon mode +.TP +.B \-p filename +Write PID of the supervisor or primary thread to file +.TP +.B \-n configname +Use specified configuration name, overrides default "yate" +.TP +.B \-c pathname +Path to conf files directory, overrides compiled-in value +.TP +.B \-m pathname +Path to modules directory, overrides compiled-in value .SS Debugging (may not be compiled in) .TP .B \-D[options] @@ -85,5 +97,4 @@ Paul Chitescu .br Diana Cionoiu .SH SEE ALSO -.\" .BR libyate (3), -.BR bayonne (8) +.BR yate-config (8) diff --git a/yate.spec.in b/yate.spec.in index 27058272..3828e67a 100644 --- a/yate.spec.in +++ b/yate.spec.in @@ -31,7 +31,7 @@ for small to large scale projects. %config /etc/yate/* /usr/lib/lib*.so* /usr/bin/yate -/usr/share/man/* +/usr/share/man/*/yate.* /etc/rc.d/init.d/yate %dir /usr/lib/yate /usr/lib/yate/* @@ -56,6 +56,7 @@ The yate-devel package includes the libraries and header files for YATE %doc /usr/share/doc/yate-%{version}/api/* /usr/include/* /usr/bin/yate-config +/usr/share/man/*/yate-config.* /usr/lib/pkgconfig/yate.pc %prep @@ -98,6 +99,9 @@ cp -p %{_builddir}/%{name}/yate.init %{buildroot}/etc/rc.d/init.d/yate rm -rf %{buildroot} %changelog +* Sun Jan 09 2005 Paul Chitescu +- Cleaned up the build and packaging system + * Wed Dec 15 2004 Paul Chitescu - Added custom requires/provides filters to supress modules dependencies