Timur Davydov has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/42243?usp=email )


Change subject: build: install common/GSM/transceiver libraries for emscripten 
and add pkg-config files
......................................................................

build: install common/GSM/transceiver libraries for emscripten and add 
pkg-config files

Expose previously internal libs (libcommon, libGSM, libtransceiver_common)
when building with emscripten, install headers and generate .pc files.
Keep them noinst for native builds.

Change-Id: I2495c5b5c79f2fe74bef83902058e1d2207c1f3c
---
M .gitignore
M CommonLibs/Makefile.am
M GSM/Makefile.am
M Makefile.am
M Transceiver52M/Makefile.am
M Transceiver52M/arch/common/Makefile.am
M configure.ac
A libGSM.pc.in
A libcommon.pc.in
A libtransceiver_common.pc.in
10 files changed, 124 insertions(+), 20 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/43/42243/1

diff --git a/.gitignore b/.gitignore
index fc567db..1995586 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@
 *.o
 *.lo
 *.la
+*.pc
+*.wasm
+*.out.js
 Transceiver52M/osmo-trx-uhd
 Transceiver52M/osmo-trx-usrp1
 Transceiver52M/osmo-trx-lms
@@ -35,6 +38,7 @@

 # automake/autoconf
 *.in
+!*.pc.in
 .deps
 .libs
 .dirstamp
diff --git a/CommonLibs/Makefile.am b/CommonLibs/Makefile.am
index 4a0652d..477f416 100644
--- a/CommonLibs/Makefile.am
+++ b/CommonLibs/Makefile.am
@@ -25,8 +25,6 @@
 AM_CXXFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)
 AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)

-noinst_LTLIBRARIES = libcommon.la
-
 libcommon_la_SOURCES = \
        BitVector.cpp \
        LinkedLists.cpp \
@@ -37,14 +35,8 @@
        trx_rate_ctr.cpp \
        trx_vty.c \
        debug.c
-libcommon_la_LIBADD = \
-       $(LIBOSMOCORE_LIBS) \
-       $(LIBOSMOCTRL_LIBS) \
-       $(LIBOSMOVTY_LIBS) \
-       -lpthread \
-       $(NULL)

-noinst_HEADERS = \
+common_headers = \
        BitVector.h \
        PRBS.h \
        Interthread.h \
@@ -59,3 +51,21 @@
        debug.h \
        osmo_signal.h \
        config_defs.h
+
+if HAVE_EMSCRIPTEN
+lib_LTLIBRARIES = libcommon.la
+include_HEADERS = $(common_headers)
+
+libcommon_la_LDFLAGS = -rpath $(libdir)
+else
+noinst_LTLIBRARIES = libcommon.la
+noinst_HEADERS = $(common_headers)
+
+libcommon_la_LIBADD = \
+       $(LIBOSMOCORE_LIBS) \
+       $(LIBOSMOCTRL_LIBS) \
+       $(LIBOSMOVTY_LIBS) \
+       -lpthread \
+       $(NULL)
+endif
+
diff --git a/GSM/Makefile.am b/GSM/Makefile.am
index a2f5db0..4a6ae77 100644
--- a/GSM/Makefile.am
+++ b/GSM/Makefile.am
@@ -23,10 +23,19 @@
 AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
 #AM_CXXFLAGS = -O2 -g

-noinst_LTLIBRARIES = libGSM.la
-
 libGSM_la_SOURCES = \
        GSMCommon.cpp

-noinst_HEADERS = \
+gsm_headers = \
        GSMCommon.h
+
+if HAVE_EMSCRIPTEN
+lib_LTLIBRARIES = libGSM.la
+include_HEADERS = $(gsm_headers)
+
+libGSM_la_LDFLAGS = -rpath $(libdir)
+else
+noinst_LTLIBRARIES = libGSM.la
+noinst_HEADERS = $(gsm_headers)
+endif
+
diff --git a/Makefile.am b/Makefile.am
index 33d8bfa..d7eccc8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,6 +43,14 @@
        doc \
        $(NULL)

+if HAVE_EMSCRIPTEN
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = \
+       libcommon.pc \
+       libGSM.pc \
+       libtransceiver_common.pc
+endif
+
 BUILT_SOURCES = $(top_srcdir)/.version
 $(top_srcdir)/.version:
        echo $(VERSION) > $@-t && mv $@-t $@
diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index 0b63b16..5b1c945 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -27,8 +27,6 @@
 AM_CXXFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)
 AM_CFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)

-noinst_LTLIBRARIES = libtransceiver_common.la
-
 COMMON_SOURCES = \
        radioInterface.cpp \
        radioVector.cpp \
@@ -50,7 +48,7 @@
        radioInterfaceResamp.cpp \
        radioInterfaceMulti.cpp

-noinst_HEADERS = \
+transceiver_headers = \
        Complex.h \
        radioInterface.h \
        radioVector.h \
@@ -100,7 +98,7 @@
        ms/l1ctl_server_cb.cpp \
        ms/ms_trxcon_if.cpp

-noinst_HEADERS += \
+transceiver_headers += \
        ms/ms.h \
        ms/threadsched.h \
        ms/bladerf_specific.h \
@@ -116,6 +114,16 @@

 endif

+if HAVE_EMSCRIPTEN
+lib_LTLIBRARIES = libtransceiver_common.la
+include_HEADERS = $(transceiver_headers)
+
+libtransceiver_common_la_LDFLAGS = -rpath $(libdir)
+else
+noinst_LTLIBRARIES = libtransceiver_common.la
+noinst_HEADERS = $(transceiver_headers)
+endif
+
 bin_PROGRAMS =

 if DEVICE_UHD
diff --git a/Transceiver52M/arch/common/Makefile.am 
b/Transceiver52M/arch/common/Makefile.am
index 6b37906..c0ddd7b 100644
--- a/Transceiver52M/arch/common/Makefile.am
+++ b/Transceiver52M/arch/common/Makefile.am
@@ -11,5 +11,8 @@

 libarch_common_la_SOURCES = \
         convolve_base.c \
-        convert_base.c \
-        fft.c
+        convert_base.c
+
+if NOT_HAVE_EMSCRIPTEN
+        libarch_common_la_SOURCES += fft.c
+endif
diff --git a/configure.ac b/configure.ac
index ff73d09..3e131c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,19 @@
 AC_PATH_PROG([RM_PROG], [rm])
 AC_LANG([C++])

+dnl Detect emscripten compiler
+case "$CC" in
+*emcc*)
+       emscripten=yes
+       ;;
+*)
+       emscripten=no
+       ;;
+esac
+AM_CONDITIONAL(HAVE_EMSCRIPTEN, test "x$emscripten" = "xyes")
+AM_CONDITIONAL(NOT_HAVE_EMSCRIPTEN, test "x$emscripten" != "xyes")
+AC_SUBST([HAVE_EMSCRIPTEN], [$emscripten])
+
 dnl patching ${archive_cmds} to affect generation of file "libtool" to fix 
linking with clang
 AS_CASE(["$LD"],[*clang*],
   [AS_CASE(["${host_os}"],
@@ -66,8 +79,13 @@
 PKG_PROG_PKG_CONFIG([0.20])

 AC_LIBTOOL_WIN32_DLL
-AC_ENABLE_SHARED       dnl do build shared libraries
-AC_DISABLE_STATIC      dnl don't build static libraries
+if test "x$emscripten" = "xyes"; then
+    AC_DISABLE_SHARED  dnl don't build shared libraries (emscripten)
+    AC_ENABLE_STATIC   dnl do build static libraries (emscripten)
+else
+    AC_ENABLE_SHARED   dnl do build shared libraries
+    AC_DISABLE_STATIC  dnl don't build static libraries
+fi
 AC_PROG_LIBTOOL

 dnl Checks for header files.
@@ -285,8 +303,10 @@
 AM_CONDITIONAL(ARCH_ARM_A15, [test "x$with_neon_vfpv4" = "xyes"])
 AM_CONDITIONAL(ENABLE_MS_TRX, [test "x$with_mstrx" = "xyes"])

+if test "x$emscripten" != "xyes"; then
 PKG_CHECK_MODULES(LIBUSB, libusb-1.0)
 PKG_CHECK_MODULES(FFTWF, fftw3f)
+fi

 # Generate manuals
 AC_ARG_ENABLE(manuals,
@@ -354,6 +374,9 @@

 dnl Output files
 AC_CONFIG_FILES([\
+    libcommon.pc \
+    libGSM.pc \
+    libtransceiver_common.pc \
     Makefile \
     CommonLibs/Makefile \
     GSM/Makefile \
diff --git a/libGSM.pc.in b/libGSM.pc.in
new file mode 100644
index 0000000..d877ca6
--- /dev/null
+++ b/libGSM.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Osmocom TRX GSM Library
+Description: GSM helpers for osmo-trx
+Version: @VERSION@
+Requires:
+Requires.private:
+Libs: -L${libdir} -lGSM
+Libs.private:
+Cflags: -I${includedir}/
diff --git a/libcommon.pc.in b/libcommon.pc.in
new file mode 100644
index 0000000..b169021
--- /dev/null
+++ b/libcommon.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Osmocom TRX Common Library
+Description: Common utility library for osmo-trx
+Version: @VERSION@
+Requires:
+Requires.private: libosmocore libosmoctrl libosmovty
+Libs: -L${libdir} -lcommon
+Libs.private: @LIBOSMOCORE_LIBS@ @LIBOSMOCTRL_LIBS@ @LIBOSMOVTY_LIBS@ 
@PTHREAD_LIBS@
+Cflags: -I${includedir}/ @LIBOSMOCORE_CFLAGS@ @LIBOSMOCTRL_CFLAGS@ 
@LIBOSMOVTY_CFLAGS@ @PTHREAD_CFLAGS@
diff --git a/libtransceiver_common.pc.in b/libtransceiver_common.pc.in
new file mode 100644
index 0000000..5da57d0
--- /dev/null
+++ b/libtransceiver_common.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Osmocom TRX Transceiver Common Library
+Description: Transceiver common code for osmo-trx
+Version: @VERSION@
+Requires:
+Requires.private: libosmocore libosmoctrl libosmovty
+Libs: -L${libdir} -ltransceiver_common
+Libs.private: @LIBOSMOCORE_LIBS@ @LIBOSMOCTRL_LIBS@ @LIBOSMOVTY_LIBS@ 
@PTHREAD_LIBS@
+Cflags: -I${includedir}/ @LIBOSMOCORE_CFLAGS@ @LIBOSMOCTRL_CFLAGS@ 
@LIBOSMOVTY_CFLAGS@ @PTHREAD_CFLAGS@

--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/42243?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I2495c5b5c79f2fe74bef83902058e1d2207c1f3c
Gerrit-Change-Number: 42243
Gerrit-PatchSet: 1
Gerrit-Owner: Timur Davydov <[email protected]>

Reply via email to