diff --git a/CMakeLists.txt b/CMakeLists.txt index 24bee5a23..11a92622e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,11 @@ option(BUILD_P2P "Build P2P, links against S2C and SSL, unfinished" FALSE) option(BUILD_PYTHON "Build components requiring Python" FALSE) option(BUILD_QPID_PROTON "Build components requiring qpid-proton (AMQP)" TRUE) option(RESIP_ASSERT_SYSLOG "Log assertion failures with Syslog" TRUE) +option(REGENERATE_MEDIA_SAMPLES "Regenerate the header files containing raw audio samples (requires sox, xxd)" TRUE) + +# This must be enabled when building with the Android ndkports tools. +# It should not be enabled for any other case. +option(USE_NDKPORTS_HACKS "Android ndkports build: use hardcoded paths to dependencies" FALSE) # # Libtool / autotools is able to build both the static and shared @@ -259,8 +264,26 @@ endif() # OpenSSL if(WITH_SSL) - # SSL support is requested, so make it mandatory when calling find_package - find_package(OpenSSL REQUIRED) + if(USE_NDKPORTS_HACKS) + if(NOT ANDROID_ABI) + message(FATAL_ERROR "ndkports hack requested but ANDROID_ABI not set") + endif() + #set(distribution_DIR ${CMAKE_SOURCE_DIR}/../../../../distribution) + #set(OPENSSL_ROOT_DIR ${distribution_DIR}/openssl/${ANDROID_ABI}) + set(OPENSSL_ROOT_DIR /src/openssl/build/port/aar/prefab/modules) + + set(CRYPTO_LIBRARIES_DIR "${OPENSSL_ROOT_DIR}/crypto/libs/android.${ANDROID_ABI}") + set(SSL_LIBRARIES_DIR "${OPENSSL_ROOT_DIR}/ssl/libs/android.${ANDROID_ABI}") + set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/ssl/include) + set(OPENSSL_LIBRARIES + "${SSL_LIBRARIES_DIR}/libssl.so" + "${CRYPTO_LIBRARIES_DIR}/libcrypto.so") + # FIXME - check if those libraries and headers really exist + set(OPENSSL_FOUND TRUE) + else() + # SSL support is requested, so make it mandatory when calling find_package + find_package(OpenSSL REQUIRED) + endif() set_def(USE_SSL) else() # Explicitly set OPENSSL_FOUND to false since we didn't even run diff --git a/README_RPM-based-Linux.txt b/README_RPM-based-Linux.txt index 7e9437bdf..834737ed6 100644 --- a/README_RPM-based-Linux.txt +++ b/README_RPM-based-Linux.txt @@ -82,7 +82,7 @@ Install reSIProcate build environment dependencies sudo dnf install git \ gcc-c++ \ - libtool automake autoconf \ + cmake \ python3-devel python3-pycxx-devel \ libdb-cxx libdb-cxx-devel \ cppunit cppunit-devel \ @@ -191,8 +191,8 @@ the repository: Configuring the source tree --------------------------- -The project is currently built using GNU Autotools. We provide a -wrapper script for autotools on each major GNU/Linux distribution. +The project is currently built using CMake. We provide a +wrapper script for CMake on each major GNU/Linux distribution. The wrapper script for Fedora and RHEL-based systems is: @@ -209,7 +209,7 @@ system, you need to add the configure switch: Compiling the code in the source tree ------------------------------------- -After running the autotools configure command or using the wrapper +After running the CMake configure command or using the wrapper script described above, it is possible to start compiling the code. To compile with 65 threads, on a system with 64 CPU cores, you could use the following command: @@ -219,18 +219,16 @@ use the following command: Running the unit tests ---------------------- -The autotools "make check" target is used. +The CMake "make test" target is used. - make check + make test Running the binaries or unit tests in the GDB debugger ------------------------------------------------------ -To use the debugger, we need help from libtool to match -the binary and libraries in our source tree. gdb will not -work if you try to run it directly. Here is an example: +Here is an example: - libtool --mode=execute gdb --args \ + gdb --args \ apps/reConServer/reConServer \ apps/reConServer/reConServer.config @@ -248,6 +246,6 @@ Create a reSIProcate release tarball: Finally, tell rpmbuild to compile the tarball to RPMs. rpmbuild uses the spec file resiprocate.spec inside the tarball: - rpmbuild -tb resiprocate-1.13.0~alpha1.tar.gz + rpmbuild -tb resiprocate-1.13.0.tar.gz diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 39fcb166d..ee6da2253 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -13,5 +13,7 @@ endif() if(NETSNMP_AGENT_FOUND) add_subdirectory(registration-agent) endif() -add_subdirectory(echoTest) +if(USE_GSTREAMER) + add_subdirectory(echoTest) +endif() diff --git a/build/debian.sh b/build/debian.sh index a566cc407..c9e52aec6 100755 --- a/build/debian.sh +++ b/build/debian.sh @@ -20,8 +20,6 @@ else exit 1 fi -autoreconf --install - source build/distcc-setup # -Wweak-vtables : use with clang to find classes without a key function @@ -69,43 +67,7 @@ LDFLAGS='-fPIC -pie -Wl,-z,relro -Wl,-z,now -lcares' \ -DDEFAULT_BRIDGE_MAX_IN_OUTPUTS=20 \ -DBUILD_P2P=OFF \ -DBUILD_PYTHON=ON \ - -DPYCXX_SRCDIR=/usr/src/CXX \ -DBUILD_QPID_PROTON=ON \ -DRESIP_ASSERT_SYSLOG=ON \ . -# ./configure \ -# ${DISTCC} \ -# --with-popt \ -# --enable-ipv6 \ -# --enable-dtls \ -# $RADIUS_LIB \ -# --with-ssl \ -# --enable-assert-syslog \ -# --with-c-ares \ -# --with-fmt \ -# --with-mysql \ -# --with-postgresql \ -# --with-repro \ -# --with-return \ -# --enable-dso-plugins \ -# --with-python \ -# DEPS_PYTHON_VERSION=`python3 -c "import sys; print('%d.%d' % (sys.version_info[0], sys.version_info[1]))"` \ -# DEPS_PYTHON_CFLAGS="`/usr/bin/python3-config --cflags`" \ -# DEPS_PYTHON_LIBS="`/usr/bin/python3-config --ldflags`" \ -# PYCXX_SRCDIR=/usr/src/CXX \ -# --with-rend \ -# --with-tfm \ -# --with-apps \ -# --with-ichat-gw \ -# --with-recon \ -# --with-sipxtapi \ -# --with-kurento \ -# --with-soci-postgresql \ -# --with-soci-mysql \ -# --with-qpid-proton \ -# --with-geoip \ -# --with-sigcomp \ -# --with-netsnmp \ -# --with-gstreamer - diff --git a/build/fedora.sh b/build/fedora.sh index 284cbff21..e562d8769 100755 --- a/build/fedora.sh +++ b/build/fedora.sh @@ -20,8 +20,6 @@ set -e RADIUS_LIB=--with-radcli #RADIUS_LIB=--with-freeradius -autoreconf --install - source build/distcc-setup CFLAGS='-fPIC -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-deprecated' \ @@ -67,38 +65,8 @@ LDFLAGS='-fPIC -pie -Wl,-z,relro -Wl,-z,now -lcares' \ -DDEFAULT_BRIDGE_MAX_IN_OUTPUTS=20 \ -DBUILD_P2P=OFF \ -DBUILD_PYTHON=ON \ - -DPYCXX_SRCDIR=/usr/src/CXX \ -DBUILD_QPID_PROTON=ON \ -DRESIP_ASSERT_SYSLOG=ON \ . -# ./configure \ -# ${DISTCC} \ -# --with-popt \ -# --enable-ipv6 \ -# --enable-dtls \ -# $RADIUS_LIB \ -# --with-ssl \ -# --enable-assert-syslog \ -# --with-c-ares \ -# --with-fmt \ -# --with-mysql \ -# --with-postgresql \ -# --with-repro \ -# --with-return \ -# --enable-dso-plugins \ -# --with-python \ -# DEPS_PYTHON_VERSION=`python3 -c "import sys; print('%d.%d' % (sys.version_info[0], sys.version_info[1]))"` \ -# DEPS_PYTHON_CFLAGS="`/usr/bin/python3-config --cflags`" \ -# DEPS_PYTHON_LIBS="`/usr/bin/python3-config --ldflags`" \ -# PYCXX_SRCDIR=/usr/src/CXX \ -# --with-apps \ -# --with-recon \ -# --with-kurento \ -# --with-soci-postgresql \ -# --with-soci-mysql \ -# --with-qpid-proton \ -# --with-geoip \ -# --with-netsnmp \ -# --with-gstreamer diff --git a/build/release-tarball.sh b/build/release-tarball.sh index b9938e087..d5f5cf954 100755 --- a/build/release-tarball.sh +++ b/build/release-tarball.sh @@ -83,6 +83,7 @@ cmake \ -DPYCXX_SRCDIR=/usr/src/CXX \ -DBUILD_QPID_PROTON=ON \ -DRESIP_ASSERT_SYSLOG=ON \ + -DREGENERATE_MEDIA_SAMPLES=ON \ . #autoreconf --install && \ # ./configure --with-popt --enable-ipv6 --enable-dtls --with-radcli --with-ssl \ diff --git a/media/samples/CMakeLists.txt b/media/samples/CMakeLists.txt index 50211bd20..73cb3c07f 100644 --- a/media/samples/CMakeLists.txt +++ b/media/samples/CMakeLists.txt @@ -3,14 +3,18 @@ # and if we don't run sox and xxd, we should copy the cached versions # to ${PROJECT_BINARY_DIR} function(wav_to_header) - add_custom_command( - DEPENDS ${ARGV0}.wav - OUTPUT ${ARGV0}.h - COMMAND sox ${ARGV0}.wav -r 8k -e signed -b 16 -c 1 ${ARGV0}.raw - COMMAND xxd -i -u ${ARGV0}.raw ${ARGV0}.h.0 - COMMAND sed -e 's/_raw//g' ${ARGV0}.h.0 > ${ARGV0}.h - COMMAND ${CMAKE_COMMAND} -E rm ${ARGV0}.raw ${ARGV0}.h.0 - ) + if(REGENERATE_MEDIA_SAMPLES) + add_custom_command( + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}.wav + OUTPUT ${ARGV0}.h + COMMAND sox ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}.wav -r 8k -e signed -b 16 -c 1 ${ARGV0}.raw + COMMAND xxd -i -u ${ARGV0}.raw ${ARGV0}.h.0 + COMMAND sed -e 's/_raw//g' ${ARGV0}.h.0 > ${ARGV0}.h + COMMAND ${CMAKE_COMMAND} -E rm ${ARGV0}.raw ${ARGV0}.h.0 + ) + else() + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + endif() endfunction() wav_to_header(playback_prompt) diff --git a/repro/plugins/example/CMakeLists.txt b/repro/plugins/example/CMakeLists.txt index 03adda478..7f3c4de22 100644 --- a/repro/plugins/example/CMakeLists.txt +++ b/repro/plugins/example/CMakeLists.txt @@ -3,4 +3,6 @@ add_library(example MODULE ExamplePlugin.cxx ) +target_link_libraries(example PUBLIC repro ${Python3_LIBRARIES} ${PYCXX_LIBRARIES}) + install(TARGETS example DESTINATION ${INSTALL_REPRO_PLUGIN_DIR}) diff --git a/repro/plugins/pyroute/CMakeLists.txt b/repro/plugins/pyroute/CMakeLists.txt index 9fe6f9214..8775fd149 100644 --- a/repro/plugins/pyroute/CMakeLists.txt +++ b/repro/plugins/pyroute/CMakeLists.txt @@ -13,6 +13,6 @@ add_library(pyroute MODULE target_include_directories(pyroute PUBLIC ${Python3_INCLUDE_DIRS} ${PYCXX_INCLUDE_DIRS}) -target_link_libraries(pyroute PUBLIC ${Python3_LIBRARIES} ${PYCXX_LIBRARIES}) +target_link_libraries(pyroute PUBLIC repro ${Python3_LIBRARIES} ${PYCXX_LIBRARIES}) install(TARGETS pyroute DESTINATION ${INSTALL_REPRO_PLUGIN_DIR}) diff --git a/resip/recon/CMakeLists.txt b/resip/recon/CMakeLists.txt index 7a59db80a..044adcec4 100644 --- a/resip/recon/CMakeLists.txt +++ b/resip/recon/CMakeLists.txt @@ -152,9 +152,7 @@ target_add_conditional_sources(recon USE_LIBWEBRTC target_include_directories(recon PUBLIC $) target_include_directories(recon PUBLIC ${SIPXTAPI_INCLUDE_DIRS}) target_link_libraries(recon PUBLIC dum) -if(USE_SIPXTAPI) - target_link_libraries(recon PUBLIC reflow ${SIPXTAPI_LIBRARIES}) -endif() +target_link_libraries(recon PUBLIC reflow ${SIPXTAPI_LIBRARIES}) if(USE_KURENTO) target_link_libraries(recon PUBLIC kurentoclient) endif() @@ -166,7 +164,10 @@ version_libname(recon) install(TARGETS recon DESTINATION ${CMAKE_INSTALL_LIBDIR}) install_and_preserve_hierarchy(${CMAKE_INSTALL_INCLUDEDIR}/recon ${INCLUDES}) -add_subdirectory(MOHParkServer) - -add_subdirectory(test) +# FIXME - revise the code in these directories to eliminate +# dependency on sipXtapi +if(USE_SIPXTAPI) + add_subdirectory(MOHParkServer) + add_subdirectory(test) +endif() diff --git a/resip/stack/CMakeLists.txt b/resip/stack/CMakeLists.txt index f6a9ac518..7f448bd5e 100644 --- a/resip/stack/CMakeLists.txt +++ b/resip/stack/CMakeLists.txt @@ -359,24 +359,27 @@ set(GPERF_OPTS -C -D -E -L C++ -t --key-positions='*' --compare-strncmp) # and if we don't run gperf, we should copy the cached versions # to ${PROJECT_BINARY_DIR} function(run_gperf) - add_custom_command( - DEPENDS ${ARGV0}.gperf - OUTPUT gen/${ARGV0}.cxx - COMMAND gperf ${GPERF_OPTS} ${ARGV1} -Z ${ARGV0} ${ARGV0}.gperf > gen/${ARGV0}.cxx - ) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen) + if(RUN_GPERF) + add_custom_command( + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}.gperf + OUTPUT gen/${ARGV0}.cxx + COMMAND gperf ${GPERF_OPTS} ${ARGV1} -Z ${ARGV0} ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}.gperf > ${CMAKE_CURRENT_BINARY_DIR}/gen/${ARGV0}.cxx + ) + else() + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/gen/${ARGV0}.cxx DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/gen) + endif() endfunction() # With autotools, we would not run gperf automatically on every build. # It is not always available on every platform. # With CMake, we now take the inverse approach, it is run on every build # but it can be disabled by changing RUN_GPERF to False -if(RUN_GPERF) - run_gperf(DayOfWeekHash) - run_gperf(HeaderHash --ignore-case) - run_gperf(MethodHash) - run_gperf(MonthHash) - run_gperf(ParameterHash --ignore-case) -endif() +run_gperf(DayOfWeekHash) +run_gperf(HeaderHash --ignore-case) +run_gperf(MethodHash) +run_gperf(MonthHash) +run_gperf(ParameterHash --ignore-case) target_add_conditional_sources(resip TRUE gen/DayOfWeekHash.cxx diff --git a/resiprocate.spec.in b/resiprocate.spec.in index 978bfda08..d0803959f 100644 --- a/resiprocate.spec.in +++ b/resiprocate.spec.in @@ -1,5 +1,5 @@ -Name: @PACKAGE@ -Version: @VERSION@ +Name: @CMAKE_PROJECT_NAME@ +Version: @PROJECT_VERSION@ Release: 1%{?dist} Summary: SIP and TURN stacks, with SIP proxy and TURN server implementations License: VSL @@ -218,7 +218,11 @@ SRTP1=-DUSE_SRTP1=OFF %endif export LDFLAGS="${LDFLAGS} -L%{_libdir}/mysql -L%{_libdir}/libdb4" CPPFLAGS="`net-snmp-config --base-cflags`" CXXFLAGS="%{optflags} -I%{_includedir}/libdb4 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -I/usr/include/soci" +# FIXME - enable FMT +# FIXME - enable GStreamer - requires gst-webrtc header tweak %cmake \ + -DENABLE_LOG_REPOSITORY_DETAILS=OFF \ + -DRUN_GPERF=ON \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_FLAGS="${CPPFLAGS} ${CXXFLAGS}" \ -DCMAKE_C_FLAGS="${CPPFLAGS} ${CFLAGS}" \ @@ -226,7 +230,7 @@ CPPFLAGS="`net-snmp-config --base-cflags`" CXXFLAGS="%{optflags} -I%{_includedir -DWITH_SSL=ON \ -DUSE_POPT=ON \ -DUSE_SIGCOMP=OFF \ - -DUSE_FMT=ON \ + -DUSE_FMT=OFF \ -DVERSIONED_SONAME=ON \ -DENABLE_ANDROID=OFF \ -DUSE_IPV6=ON \ @@ -257,16 +261,12 @@ CPPFLAGS="`net-snmp-config --base-cflags`" CXXFLAGS="%{optflags} -I%{_includedir -DDEFAULT_BRIDGE_MAX_IN_OUTPUTS=20 \ -DBUILD_P2P=OFF \ -DBUILD_PYTHON=ON \ - -DPYCXX_SRCDIR=/usr/src/CXX \ -DBUILD_QPID_PROTON=ON \ -DRESIP_ASSERT_SYSLOG=ON -sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool -sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -rm -rf resip/stack/gen/*.cxx -make %{?_smp_mflags} +%cmake_build %install -make DESTDIR=%{buildroot} install +%cmake_install %if %use_systemd install -p -D -m644 repro/pkg/common/repro.service %{buildroot}%{_unitdir}/repro.service install -p -D -m644 apps/reConServer/pkg/common/reconserver.service %{buildroot}%{_unitdir}/reconserver.service diff --git a/rutil/CMakeLists.txt b/rutil/CMakeLists.txt index 4ebd934dc..de1d29547 100644 --- a/rutil/CMakeLists.txt +++ b/rutil/CMakeLists.txt @@ -230,10 +230,12 @@ target_include_directories(rutil PUBLIC $ target_include_directories(rutil PUBLIC ${ARES_INCLUDE_DIRS}) target_include_directories(rutil PUBLIC ${QPIDPROTON_INCLUDE_DIRS}) target_include_directories(rutil PUBLIC ${Python3_INCLUDE_DIRS} ${PYCXX_INCLUDE_DIRS}) +target_include_directories(rutil PUBLIC ${OPENSSL_INCLUDE_DIR}) target_link_libraries(rutil ${OPENSSL_LIBRARIES} ${ARES_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(rutil ${QPIDPROTON_LIBRARIES}) target_link_libraries(rutil ${Python3_LIBRARIES} ${PYCXX_LIBRARIES}) target_link_libraries(rutil ${LIBRADIUS_LIBRARIES}) +target_link_libraries(rutil ${FMT_LIBRARIES}) if(ENABLE_ANDROID) target_link_libraries(rutil log) endif()