From 97df691307e48c39170ac39b2394a7095d7f0ee5 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 3 Sep 2017 23:52:51 +0200 Subject: [PATCH] separate libosmo-mgcp-client from mgcp server code When osmo-mgw is built --with-mgcp-transcoding, linking the mgcp library also requires linking libgsm, even though e.g. osmo-msc never use it. Separate the MGCP client code from the MGCP server code to avoid this dep. The mgcp client code does use some definitions from mgcp.h and mgcp_common.c. For simplicity, link mgcp_common.c in both libosmo-legacy-mgcp as well as libosmo-mgcp-client. That means it is not possible to link both libosmo-legacy-mgcp and libosmo-mgcp-client in the same binary because of duplicate symbols, but currently that is sufficient. (An alternative would be code dup or yet another libosmo-mgcp-common library.) Add libosmo-mgcp-client to debian packaging. Related: OS#2488 Change-Id: I8e0b2d2a399b77086a36606f5e427271c6242df1 --- Makefile.am | 5 ++- configure.ac | 4 ++ debian/control | 22 +++++++++++ debian/rules | 1 + include/Makefile.am | 2 +- include/osmocom/Makefile.am | 1 + include/osmocom/legacy_mgcp/Makefile.am | 1 - include/osmocom/mgcp_client/Makefile.am | 3 ++ .../mgcpgw_client.h | 0 .../mgcpgw_client_internal.h | 0 libosmo-mgcp-client.pc.in | 10 +++++ src/Makefile.am | 1 + src/libosmo-legacy-mgcp/Makefile.am | 2 - src/libosmo-mgcp-client/Makefile.am | 37 ++++++++++++++++++ .../mgcpgw_client.c | 4 +- .../mgcpgw_client_vty.c | 2 +- tests/Makefile.am | 1 + tests/legacy_mgcp/Makefile.am | 16 -------- tests/mgcp_client/Makefile.am | 38 +++++++++++++++++++ .../mgcpgw_client_test.c | 4 +- .../mgcpgw_client_test.err | 0 .../mgcpgw_client_test.ok | 0 tests/testsuite.at | 10 ++--- 23 files changed, 133 insertions(+), 31 deletions(-) create mode 100644 include/osmocom/mgcp_client/Makefile.am rename include/osmocom/{legacy_mgcp => mgcp_client}/mgcpgw_client.h (100%) rename include/osmocom/{legacy_mgcp => mgcp_client}/mgcpgw_client_internal.h (100%) create mode 100644 libosmo-mgcp-client.pc.in create mode 100644 src/libosmo-mgcp-client/Makefile.am rename src/{libosmo-legacy-mgcp => libosmo-mgcp-client}/mgcpgw_client.c (99%) rename src/{libosmo-legacy-mgcp => libosmo-mgcp-client}/mgcpgw_client_vty.c (99%) create mode 100644 tests/mgcp_client/Makefile.am rename tests/{legacy_mgcp => mgcp_client}/mgcpgw_client_test.c (97%) rename tests/{legacy_mgcp => mgcp_client}/mgcpgw_client_test.err (100%) rename tests/{legacy_mgcp => mgcp_client}/mgcpgw_client_test.ok (100%) diff --git a/Makefile.am b/Makefile.am index c5c3137cd..8fb6e6cc9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,10 @@ SUBDIRS = \ $(NULL) pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libosmo-legacy-mgcp.pc +pkgconfig_DATA = \ + libosmo-legacy-mgcp.pc \ + libosmo-mgcp-client.pc \ + $(NULL) BUILT_SOURCES = $(top_srcdir)/.version EXTRA_DIST = git-version-gen osmoappdesc.py .version diff --git a/configure.ac b/configure.ac index 5482b8c07..86c3bc55e 100644 --- a/configure.ac +++ b/configure.ac @@ -118,15 +118,19 @@ AM_CONFIG_HEADER(bscconfig.h) AC_OUTPUT( libosmo-legacy-mgcp.pc + libosmo-mgcp-client.pc include/Makefile include/osmocom/Makefile include/osmocom/legacy_mgcp/Makefile + include/osmocom/mgcp_client/Makefile src/Makefile src/libosmo-legacy-mgcp/Makefile + src/libosmo-mgcp-client/Makefile src/osmo-bsc_mgcp/Makefile tests/Makefile tests/atlocal tests/legacy_mgcp/Makefile + tests/mgcp_client/Makefile doc/Makefile doc/examples/Makefile contrib/Makefile diff --git a/debian/control b/debian/control index af49dc795..6556370ad 100644 --- a/debian/control +++ b/debian/control @@ -47,3 +47,25 @@ Architecture: any Multi-Arch: same Depends: libosmo-legacy-mgcp0 (= ${binary:Version}), ${misc:Depends} Description: libosmo-legacy-mgcp: Osmocom's Media Gateway server library + +Package: libosmo-mgcp-client0 +Section: libs +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: libosmo-mgcp-client: Osmocom's Media Gateway Control Protocol client utilities + +Package: libosmo-mgcp-client-dbg +Section: debug +Architecture: any +Multi-Arch: same +Depends: libosmo-mgcp-client0 (= ${binary:Version}), ${misc:Depends} +Description: libosmo-mgcp-client: Osmocom's Media Gateway Control Protocol client utilities + +Package: libosmo-mgcp-client-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: libosmo-mgcp-client0 (= ${binary:Version}), ${misc:Depends} +Description: libosmo-mgcp-client: Osmocom's Media Gateway Control Protocol client utilities diff --git a/debian/rules b/debian/rules index ee680cc45..8976ede95 100755 --- a/debian/rules +++ b/debian/rules @@ -32,3 +32,4 @@ override_dh_autoreconf: override_dh_strip: dh_strip --dbg-package=osmo-mgw-dbg dh_strip --dbg-package=libosmo-legacy-mgcp-dbg + dh_strip --dbg-package=libosmo-mgcp-client-dbg diff --git a/include/Makefile.am b/include/Makefile.am index 73b1b3ef1..e2baf41b9 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,6 +5,6 @@ SUBDIRS = \ nobase_include_HEADERS = \ osmocom/legacy_mgcp/mgcp.h \ osmocom/legacy_mgcp/mgcp_internal.h \ - osmocom/legacy_mgcp/mgcpgw_client.h \ osmocom/legacy_mgcp/osmux.h \ + osmocom/mgcp_client/mgcpgw_client.h \ $(NULL) diff --git a/include/osmocom/Makefile.am b/include/osmocom/Makefile.am index 65144366b..be9f1ca78 100644 --- a/include/osmocom/Makefile.am +++ b/include/osmocom/Makefile.am @@ -1,3 +1,4 @@ SUBDIRS = \ legacy_mgcp \ + mgcp_client \ $(NULL) diff --git a/include/osmocom/legacy_mgcp/Makefile.am b/include/osmocom/legacy_mgcp/Makefile.am index 52f0b5b48..4a9550cb6 100644 --- a/include/osmocom/legacy_mgcp/Makefile.am +++ b/include/osmocom/legacy_mgcp/Makefile.am @@ -1,5 +1,4 @@ noinst_HEADERS = \ - mgcpgw_client_internal.h \ mgcp_transcode.h \ vty.h \ $(NULL) diff --git a/include/osmocom/mgcp_client/Makefile.am b/include/osmocom/mgcp_client/Makefile.am new file mode 100644 index 000000000..224a7dcc0 --- /dev/null +++ b/include/osmocom/mgcp_client/Makefile.am @@ -0,0 +1,3 @@ +noinst_HEADERS = \ + mgcpgw_client_internal.h \ + $(NULL) diff --git a/include/osmocom/legacy_mgcp/mgcpgw_client.h b/include/osmocom/mgcp_client/mgcpgw_client.h similarity index 100% rename from include/osmocom/legacy_mgcp/mgcpgw_client.h rename to include/osmocom/mgcp_client/mgcpgw_client.h diff --git a/include/osmocom/legacy_mgcp/mgcpgw_client_internal.h b/include/osmocom/mgcp_client/mgcpgw_client_internal.h similarity index 100% rename from include/osmocom/legacy_mgcp/mgcpgw_client_internal.h rename to include/osmocom/mgcp_client/mgcpgw_client_internal.h diff --git a/libosmo-mgcp-client.pc.in b/libosmo-mgcp-client.pc.in new file mode 100644 index 000000000..aee86dc7f --- /dev/null +++ b/libosmo-mgcp-client.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Osmocom Media Gateway Control Protocol Client library +Description: C Utility Library +Version: @VERSION@ +Libs: -L${libdir} -losmo-mgcp-client +Cflags: -I${includedir}/ diff --git a/src/Makefile.am b/src/Makefile.am index f47bc0034..922bbdaa1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,6 +22,7 @@ AM_LDFLAGS = \ # Libraries SUBDIRS = \ libosmo-legacy-mgcp \ + libosmo-mgcp-client \ $(NULL) # Programs diff --git a/src/libosmo-legacy-mgcp/Makefile.am b/src/libosmo-legacy-mgcp/Makefile.am index 42f25c0fe..32902b94b 100644 --- a/src/libosmo-legacy-mgcp/Makefile.am +++ b/src/libosmo-legacy-mgcp/Makefile.am @@ -41,8 +41,6 @@ libosmo_legacy_mgcp_la_SOURCES = \ mgcp_vty.c \ mgcp_osmux.c \ mgcp_sdp.c \ - mgcpgw_client.c \ - mgcpgw_client_vty.c \ $(NULL) if BUILD_MGCP_TRANSCODING libosmo_legacy_mgcp_la_SOURCES += \ diff --git a/src/libosmo-mgcp-client/Makefile.am b/src/libosmo-mgcp-client/Makefile.am new file mode 100644 index 000000000..02b91773c --- /dev/null +++ b/src/libosmo-mgcp-client/Makefile.am @@ -0,0 +1,37 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + -I$(top_builddir) \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMONETIF_CFLAGS) \ + $(COVERAGE_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(LIBOSMONETIF_LIBS) \ + $(COVERAGE_LDFLAGS) \ + $(NULL) + +# This is _NOT_ the library release version, it's an API version. +# Please read Chapter 6 "Library interface versions" of the libtool +# documentation before making any modification +MGCP_CLIENT_LIBVERSION=1:0:0 + +lib_LTLIBRARIES = \ + libosmo-mgcp-client.la \ + $(NULL) + +libosmo_mgcp_client_la_SOURCES = \ + mgcpgw_client.c \ + mgcpgw_client_vty.c \ + ../libosmo-legacy-mgcp/mgcp_common.c \ + $(NULL) + +libosmo_mgcp_client_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(MGCP_CLIENT_LIBVERSION) diff --git a/src/libosmo-legacy-mgcp/mgcpgw_client.c b/src/libosmo-mgcp-client/mgcpgw_client.c similarity index 99% rename from src/libosmo-legacy-mgcp/mgcpgw_client.c rename to src/libosmo-mgcp-client/mgcpgw_client.c index 810ba16c3..7ed4b07d1 100644 --- a/src/libosmo-legacy-mgcp/mgcpgw_client.c +++ b/src/libosmo-mgcp-client/mgcpgw_client.c @@ -24,10 +24,10 @@ #include #include -#include #include #include -#include +#include +#include #include #include diff --git a/src/libosmo-legacy-mgcp/mgcpgw_client_vty.c b/src/libosmo-mgcp-client/mgcpgw_client_vty.c similarity index 99% rename from src/libosmo-legacy-mgcp/mgcpgw_client_vty.c rename to src/libosmo-mgcp-client/mgcpgw_client_vty.c index d101ded9b..034c84c49 100644 --- a/src/libosmo-legacy-mgcp/mgcpgw_client_vty.c +++ b/src/libosmo-mgcp-client/mgcpgw_client_vty.c @@ -28,7 +28,7 @@ #include #include -#include +#include #define MGCPGW_STR "MGCP gateway configuration for RTP streams\n" diff --git a/tests/Makefile.am b/tests/Makefile.am index f6cb93855..ae51f8977 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS = \ legacy_mgcp \ + mgcp_client \ $(NULL) # The `:;' works around a Bash 3.2 bug when the output is not writeable. diff --git a/tests/legacy_mgcp/Makefile.am b/tests/legacy_mgcp/Makefile.am index e5f68883c..f04312486 100644 --- a/tests/legacy_mgcp/Makefile.am +++ b/tests/legacy_mgcp/Makefile.am @@ -20,13 +20,10 @@ AM_LDFLAGS = \ EXTRA_DIST = \ mgcp_test.ok \ mgcp_transcoding_test.ok \ - mgcpgw_client_test.ok \ - mgcpgw_client_test.err \ $(NULL) noinst_PROGRAMS = \ mgcp_test \ - mgcpgw_client_test \ $(NULL) if BUILD_MGCP_TRANSCODING noinst_PROGRAMS += \ @@ -62,16 +59,3 @@ mgcp_transcoding_test_LDADD = \ $(LIBRARY_GSM) \ -lm \ $(NULL) - -mgcpgw_client_test_SOURCES = \ - mgcpgw_client_test.c \ - $(NULL) - -mgcpgw_client_test_LDADD = \ - $(top_builddir)/src/libosmo-legacy-mgcp/libosmo-legacy-mgcp.la \ - $(LIBOSMOCORE_LIBS) \ - $(LIBOSMOVTY_LIBS) \ - $(LIBRARY_DL) \ - $(LIBOSMONETIF_LIBS) \ - $(LIBRARY_GSM) \ - $(NULL) diff --git a/tests/mgcp_client/Makefile.am b/tests/mgcp_client/Makefile.am new file mode 100644 index 000000000..225377072 --- /dev/null +++ b/tests/mgcp_client/Makefile.am @@ -0,0 +1,38 @@ +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir) \ + $(NULL) + +AM_CFLAGS = \ + -Wall \ + -ggdb3 \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMONETIF_CFLAGS) \ + $(COVERAGE_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + $(COVERAGE_LDFLAGS) \ + $(NULL) + +EXTRA_DIST = \ + mgcpgw_client_test.ok \ + mgcpgw_client_test.err \ + $(NULL) + +noinst_PROGRAMS = \ + mgcpgw_client_test \ + $(NULL) + +mgcpgw_client_test_SOURCES = \ + mgcpgw_client_test.c \ + $(NULL) + +mgcpgw_client_test_LDADD = \ + $(top_builddir)/src/libosmo-mgcp-client/libosmo-mgcp-client.la \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBRARY_DL) \ + $(LIBOSMONETIF_LIBS) \ + $(NULL) diff --git a/tests/legacy_mgcp/mgcpgw_client_test.c b/tests/mgcp_client/mgcpgw_client_test.c similarity index 97% rename from tests/legacy_mgcp/mgcpgw_client_test.c rename to tests/mgcp_client/mgcpgw_client_test.c index 51d5272a2..e90a4ed22 100644 --- a/tests/legacy_mgcp/mgcpgw_client_test.c +++ b/tests/mgcp_client/mgcpgw_client_test.c @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include void *ctx; diff --git a/tests/legacy_mgcp/mgcpgw_client_test.err b/tests/mgcp_client/mgcpgw_client_test.err similarity index 100% rename from tests/legacy_mgcp/mgcpgw_client_test.err rename to tests/mgcp_client/mgcpgw_client_test.err diff --git a/tests/legacy_mgcp/mgcpgw_client_test.ok b/tests/mgcp_client/mgcpgw_client_test.ok similarity index 100% rename from tests/legacy_mgcp/mgcpgw_client_test.ok rename to tests/mgcp_client/mgcpgw_client_test.ok diff --git a/tests/testsuite.at b/tests/testsuite.at index dd59f2c94..37347b39e 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -14,9 +14,9 @@ cat $abs_srcdir/legacy_mgcp/mgcp_transcoding_test.ok > expout AT_CHECK([$abs_top_builddir/tests/legacy_mgcp/mgcp_transcoding_test], [], [expout], [ignore]) AT_CLEANUP -AT_SETUP([legacy_mgcpgw_client]) -AT_KEYWORDS([legacy_mgcpgw_client]) -cat $abs_srcdir/legacy_mgcp/mgcpgw_client_test.ok > expout -cat $abs_srcdir/legacy_mgcp/mgcpgw_client_test.err > experr -AT_CHECK([$abs_top_builddir/tests/legacy_mgcp/mgcpgw_client_test], [], [expout], [experr]) +AT_SETUP([mgcpgw_client]) +AT_KEYWORDS([mgcpgw_client]) +cat $abs_srcdir/mgcp_client/mgcpgw_client_test.ok > expout +cat $abs_srcdir/mgcp_client/mgcpgw_client_test.err > experr +AT_CHECK([$abs_top_builddir/tests/mgcp_client/mgcpgw_client_test], [], [expout], [experr]) AT_CLEANUP