diff --git a/.travis.yml b/.travis.yml index 33f0cda..9f7e1d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,22 @@ language: cpp before_install: - export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/openssl/include" - export LDFLAGS="$LDFLAGS -L/usr/local/opt/openssl/lib" + # - export OPENSSL_ROOT_DIR="/usr/local/opt" + # - export OPENSSL_INCLUDE_DIR="/usr/local/opt/openssl/include" - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew outdated openssl || brew upgrade openssl; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink protobuf; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install mysql sqlite hiredis; fi +#script: +# - mkdir build +# - cd build +# - cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install +# - cmake --build . +# - cmake --build . --target install +# - cd .. +# - ./configure && make && make test + jobs: include: - name: ubuntu focal AMD64 C @@ -147,6 +158,7 @@ jobs: - libmysqlclient-dev - libhiredis-dev + notifications: slack: secure: N12+BCGiTDzfKkYnjF+666ZhREuBncfPpWge9AdG6DwusyGza+hNrjfRRHjF8WfGQj+X8ogFoF1lVFDC27lwH1ElOv4GJHShnGbtsWv10Va1GdDafDeC5JorUNWHlsDHC1AZkNUj9n2KAZTSbN076gUaNhwsXob/B1MEnNKXibitDdyE2FC6wCRu6ckXM4UiEXoG/a7lHS4m9dKt2xDUNK8vwhtRdCkip9YW8rUFdiwqMScdr9OdF8YWiKJIUYV7LC7eXF0YqslWTJkeIMEEnvotLs4JNytFz1wNPzTiY8hM4nPM0YwC1oPhFWlBodQ1x+dBX3vxitnque0gVhj/p6Eij0amM3tirgONw/r2V9JToE6vfh6ERAWIVzI/+tmqcEbZZvwcgafZphlT9W/8Gzy/av/zTpdfaTUEYnsuQRCA87FPIFAAVjzSmT3llY6WQXFB+UU0T0ZE42PkPqhR3zpjqt7nDXf2g1ZY5ZRkWRvznyqBdrVx0Ld8AKnv/Ynk/KqiJqV94DUMhGzAadqbYrDL/87eiDtW4lBpCl7cQnfEI7besdduNzWlgmJ93CU1kyruK37/w+D1jyBnc1ppQTj1+B2GanB0weY7ViNqyQmN+tam7EmM+9R8VKMi8EO0xlvb1YFL18NtrCMMMEsZRHj823g68lFntUWs5oGsFMI= diff --git a/CMakeLists.txt b/CMakeLists.txt index b32b69f..76ff6eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ cmake_minimum_required(VERSION 3.5) project(coturn) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) +# TODO: Modify this when the version is released SET(BUILD_VERSION "4.5.2") # Find Git Version Patch @@ -35,9 +36,10 @@ message("BUILD_VERSION:${BUILD_VERSION}") set(VERSION ${BUILD_VERSION}) if(NOT DEFINED CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") + set(CMAKE_BUILD_TYPE "Release") endif(NOT DEFINED CMAKE_BUILD_TYPE) -if("Debug" STREQUAL CMAKE_BUILD_TYPE) +string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type) +if("debug" STREQUAL build_type) add_definitions(-D_DEBUG) endif() @@ -60,6 +62,18 @@ include(CheckIncludeFile) include(CheckIncludeFileCXX) include(CheckFunctionExists) +# Create install runtime target +add_custom_target(install-runtime + COMMAND + "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=Runtime + -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake" +) +# Create uninstall runtime target +add_custom_target(uninstall-runtime + COMMAND + "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=Runtime + -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" +) # Create will be delete files CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" @@ -72,3 +86,31 @@ ADD_CUSTOM_TARGET(uninstall add_subdirectory(src) +install(DIRECTORY man DESTINATION . + COMPONENT Runtime) +install(DIRECTORY turndb/ + DESTINATION share/turnserver + COMPONENT Runtime) +install(DIRECTORY turndb/ + DESTINATION doc/turnserver + COMPONENT Runtime) +install(FILES + LICENSE + README.turnserver + README.turnadmin + README.turnutils + INSTALL + postinstall.txt + DESTINATION doc/turnserver + COMPONENT Runtime) +install(FILES examples/etc/turnserver.conf + DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} + COMPONENT Runtime + RENAME turnserver.conf.default + ) +install(DIRECTORY + examples/etc + examples/scripts + DESTINATION share/examples/turnserver + PATTERN "rfc5769.sh" EXCLUDE + ) diff --git a/INSTALL b/INSTALL index 40ce960..2245e27 100644 --- a/INSTALL +++ b/INSTALL @@ -55,6 +55,8 @@ examples and documentation. III. BUILD +1) Use autoconfigure build + If you are sure that you system is ready for the build (see the section "Extra libraries and Utilities" below) then you can build the system. First, you have to run the configure script: @@ -152,6 +154,60 @@ NOTE: On most modern systems, the build will produce dynamically linked executables. If you want statically linked executables, you have to modify, accordingly, the Makefile.in template file. +2) Use cmake build + +If you are sure that you system is ready for the build (see the section +"Extra libraries and Utilities" below) and cmake tools then you can build +the system. +First, create build directory. you have to run the follow script: + + $ cd coturn + $ mkdir build + +Then you have to run the configure script: + + $ cmake .. + +It will create a Makefile customized for your system. + +By default, the generated Makefile will install everything to: + + - /usr on Solaris. + - /usr/pkg on NetBSD. + - /usr/local everywhere else. + +The binaries will be copied to the bin subdirectory of the installation +destination, config files copied to etc subdirectory. The default SQLite database +will be created in var/db/turndb. There will be +also documents, examples and some other files, in separate directories. + +You can change the root configured destination directory by +setting CMAKE_INSTALL_PREFIX variable in the +configure command line. For example: + + $ cmake .. -DCMAKE_INSTALL_PREFIX=/opt + +Build the project: + + $ cmake --build . + +Install all files(runtime programmes and develop library): + + $ cmake --build . --target install + +Remove all installed: + + $ cmake --build . --target uninstall + +If you want to only install runtime programmes(programmes, configure files, +script files and database): + + $ cmake --build . --target install-runtime + +Remove all installed: + + $ cmake --build . --target uninstall-runtime + IV. OPENSSL If you are using the OpenSSL that is coming with your system, and you are diff --git a/src/apps/common/CMakeLists.txt b/src/apps/common/CMakeLists.txt index d66953c..359dfd7 100644 --- a/src/apps/common/CMakeLists.txt +++ b/src/apps/common/CMakeLists.txt @@ -43,6 +43,7 @@ add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES}) target_link_libraries(${PROJECT_NAME} PUBLIC ${COMMON_LIBS}) target_compile_definitions(${PROJECT_NAME} PUBLIC ${COMMON_DEFINED}) +target_compile_options(${PROJECT_NAME} PUBLIC -Wno-deprecated-declarations) # See: http://www.it1352.com/478094.html target_include_directories(${PROJECT_NAME} PUBLIC @@ -62,7 +63,9 @@ set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT Runtime ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/src/apps/natdiscovery/CMakeLists.txt b/src/apps/natdiscovery/CMakeLists.txt index 0935b63..c7df4d1 100644 --- a/src/apps/natdiscovery/CMakeLists.txt +++ b/src/apps/natdiscovery/CMakeLists.txt @@ -10,4 +10,5 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} PRIVATE turnclient) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime ) diff --git a/src/apps/oauth/CMakeLists.txt b/src/apps/oauth/CMakeLists.txt index 3f14067..18ce938 100644 --- a/src/apps/oauth/CMakeLists.txt +++ b/src/apps/oauth/CMakeLists.txt @@ -10,4 +10,5 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} PRIVATE turnclient) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime ) diff --git a/src/apps/peer/CMakeLists.txt b/src/apps/peer/CMakeLists.txt index f920e7b..3ff8057 100644 --- a/src/apps/peer/CMakeLists.txt +++ b/src/apps/peer/CMakeLists.txt @@ -10,4 +10,5 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} PRIVATE turnclient) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime ) diff --git a/src/apps/relay/CMakeLists.txt b/src/apps/relay/CMakeLists.txt index 2f1a57d..73fbe9b 100644 --- a/src/apps/relay/CMakeLists.txt +++ b/src/apps/relay/CMakeLists.txt @@ -94,6 +94,16 @@ target_link_libraries(${PROJECT_NAME} PRIVATE turn_server ${turnserver_LIBS}) target_include_directories(${PROJECT_NAME} PRIVATE ${turnserver_include_dirs}) target_compile_definitions(${PROJECT_NAME} PRIVATE ${turnserver_DEFINED}) +add_custom_target(turnadmin ALL + COMMAND + ${CMAKE_COMMAND} -E create_symlink $ turnadmin + DEPENDS ${PROJECT_NAME}) + INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime ) + +INSTALL(FILES $/turnadmin + DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime) diff --git a/src/apps/rfc5769/CMakeLists.txt b/src/apps/rfc5769/CMakeLists.txt index 9c42828..492e194 100644 --- a/src/apps/rfc5769/CMakeLists.txt +++ b/src/apps/rfc5769/CMakeLists.txt @@ -10,4 +10,5 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} PRIVATE turnclient) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime ) diff --git a/src/apps/stunclient/CMakeLists.txt b/src/apps/stunclient/CMakeLists.txt index ddb41e6..3e64b3b 100644 --- a/src/apps/stunclient/CMakeLists.txt +++ b/src/apps/stunclient/CMakeLists.txt @@ -10,4 +10,5 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} PRIVATE turnclient) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime ) diff --git a/src/apps/uclient/CMakeLists.txt b/src/apps/uclient/CMakeLists.txt index 47422c0..86e6eef 100644 --- a/src/apps/uclient/CMakeLists.txt +++ b/src/apps/uclient/CMakeLists.txt @@ -12,4 +12,5 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} PRIVATE turnclient) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime ) diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 818f8db..3bcc644 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -33,7 +33,9 @@ set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT Runtime ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/turn/client INCLUDES DESTINATION diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index fcc21ee..8c2261f 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -36,7 +36,9 @@ set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT Runtime LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT Runtime ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}