From 002e3bac64d39b9924e07331fded5a7ddfbb93e8 Mon Sep 17 00:00:00 2001 From: Federico Fuga Date: Thu, 13 Jan 2022 10:37:37 +0100 Subject: [PATCH 1/5] Add files under debian/ necessary to build .deb packages --- debian/README.Debian | 6 ++++ debian/README.source | 10 +++++++ debian/changelog | 5 ++++ debian/control | 18 +++++++++++ debian/copyright | 40 +++++++++++++++++++++++++ debian/rules | 20 +++++++++++++ debian/socket.io-client-cpp-dev.dirs | 2 ++ debian/socket.io-client-cpp-dev.install | 0 debian/socket.io-client-cpp-docs.docs | 2 ++ debian/source/format | 1 + 10 files changed, 104 insertions(+) create mode 100644 debian/README.Debian create mode 100644 debian/README.source create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/socket.io-client-cpp-dev.dirs create mode 100644 debian/socket.io-client-cpp-dev.install create mode 100644 debian/socket.io-client-cpp-docs.docs create mode 100644 debian/source/format diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 00000000..70e3ef81 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,6 @@ +socket.io-client-cpp for Debian +------------------------------ + + + + -- Federico Fuga Wed, 12 Jan 2022 16:18:30 +0100 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 00000000..ecc1fd01 --- /dev/null +++ b/debian/README.source @@ -0,0 +1,10 @@ +socket.io-client-cpp for Debian +------------------------------ + + + + + + -- Federico Fuga Wed, 12 Jan 2022 16:18:30 +0100 + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..7e4957c2 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +socket.io-client-cpp (3.1.0-1) unstable; urgency=medium + + * Initial porting of project to Debian + + -- Federico Fuga Wed, 12 Jan 2022 16:18:30 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..460e5da4 --- /dev/null +++ b/debian/control @@ -0,0 +1,18 @@ +Source: socket.io-client-cpp +Priority: optional +Maintainer: Federico Fuga +Build-Depends: debhelper-compat (= 12) +Standards-Version: 4.4.1 +Section: libs +Homepage: https://github.com/socketio/socket.io-client-cpp +#Vcs-Browser: https://salsa.debian.org/debian/socket.io-client-cpp +#Vcs-Git: https://salsa.debian.org/debian/socket.io-client-cpp.git + +Package: socket.io-client-cpp-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: ${misc:Depends} +Description: Development files for the Socket.io-client-cpp library, a C++11 library for Socket.io + Socket.IO is a bidirectional and low-latency communication for every platform. + This package contains the development files for a C++11 client library. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..3c3eec7a --- /dev/null +++ b/debian/copyright @@ -0,0 +1,40 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: socket.io-client-cpp +Upstream-Contact: +Source: https://github.com/socketio/socket.io-client-cpp + +Files: * +Copyright: Copyright (c) 2015, Melo Yao +License: MIT + +Files: debian/* +Copyright: 2022 Federico Fuga +License: MIT + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. +# +# If you need, there are some extra license texts available in two places: +# /usr/share/debhelper/dh_make/licenses/ +# /usr/share/common-licenses/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..d7ce6f70 --- /dev/null +++ b/debian/rules @@ -0,0 +1,20 @@ +#!/usr/bin/make -f +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ + +override_dh_auto_configure: + dh_auto_configure -- \ + -DCMAKE_BUILD_TYPE=Release diff --git a/debian/socket.io-client-cpp-dev.dirs b/debian/socket.io-client-cpp-dev.dirs new file mode 100644 index 00000000..44188162 --- /dev/null +++ b/debian/socket.io-client-cpp-dev.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/include diff --git a/debian/socket.io-client-cpp-dev.install b/debian/socket.io-client-cpp-dev.install new file mode 100644 index 00000000..e69de29b diff --git a/debian/socket.io-client-cpp-docs.docs b/debian/socket.io-client-cpp-docs.docs new file mode 100644 index 00000000..73190411 --- /dev/null +++ b/debian/socket.io-client-cpp-docs.docs @@ -0,0 +1,2 @@ +README.source +README.Debian diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) From 0334d6066b4295673f605809374fe80a2faa506e Mon Sep 17 00:00:00 2001 From: Federico Fuga Date: Thu, 13 Jan 2022 11:11:11 +0100 Subject: [PATCH 2/5] Fix debian files for native building --- debian/README.Debian | 3 ++- debian/README.source | 10 ---------- debian/changelog | 2 +- debian/control | 2 +- debian/copyright | 9 --------- debian/source/format | 2 +- 6 files changed, 5 insertions(+), 23 deletions(-) delete mode 100644 debian/README.source diff --git a/debian/README.Debian b/debian/README.Debian index 70e3ef81..39be9523 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -1,6 +1,7 @@ socket.io-client-cpp for Debian ------------------------------ - +The source of this library is managed through git, and depends on a few submodules. +This porting includes all those modules, that are statically linked. -- Federico Fuga Wed, 12 Jan 2022 16:18:30 +0100 diff --git a/debian/README.source b/debian/README.source deleted file mode 100644 index ecc1fd01..00000000 --- a/debian/README.source +++ /dev/null @@ -1,10 +0,0 @@ -socket.io-client-cpp for Debian ------------------------------- - - - - - - -- Federico Fuga Wed, 12 Jan 2022 16:18:30 +0100 - diff --git a/debian/changelog b/debian/changelog index 7e4957c2..f5eece2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,4 +2,4 @@ socket.io-client-cpp (3.1.0-1) unstable; urgency=medium * Initial porting of project to Debian - -- Federico Fuga Wed, 12 Jan 2022 16:18:30 +0100 + -- Federico Fuga Thu, 13 Jan 2022 11:03:37 +0100 diff --git a/debian/control b/debian/control index 460e5da4..1a79f260 100644 --- a/debian/control +++ b/debian/control @@ -13,6 +13,6 @@ Section: libdevel Architecture: any Multi-Arch: same Depends: ${misc:Depends} -Description: Development files for the Socket.io-client-cpp library, a C++11 library for Socket.io +Description: Development files for the Socket.io-client-cpp library Socket.IO is a bidirectional and low-latency communication for every platform. This package contains the development files for a C++11 client library. diff --git a/debian/copyright b/debian/copyright index 3c3eec7a..e60169d0 100644 --- a/debian/copyright +++ b/debian/copyright @@ -29,12 +29,3 @@ License: MIT CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. -# Please avoid picking licenses with terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. -# -# If you need, there are some extra license texts available in two places: -# /usr/share/debhelper/dh_make/licenses/ -# /usr/share/common-licenses/ diff --git a/debian/source/format b/debian/source/format index 163aaf8d..89ae9db8 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) From 39f43464828629ab399bcc6c698e446e944db865 Mon Sep 17 00:00:00 2001 From: Federico Fuga Date: Thu, 13 Jan 2022 12:14:29 +0100 Subject: [PATCH 3/5] Automatically clone submodules if asio/asio/README is not present --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 907563ab..52ac1c6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,13 @@ MESSAGE(SEND_ERROR "CMAKE_BUILD_TYPE must be either Release or Debug") return() endif() +if (NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/asio/asio/README) + message("Updating submodules") + execute_process( + COMMAND git submodule update --init + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +endif() + aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src ALL_SRC) aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/internal ALL_SRC) file(GLOB ALL_HEADERS ${CMAKE_CURRENT_LIST_DIR}/src/*.h ) From ee5ae02020a97427192d9b1e5510fc69b6f2b4c7 Mon Sep 17 00:00:00 2001 From: Federico Fuga Date: Thu, 13 Jan 2022 18:48:38 +0100 Subject: [PATCH 4/5] Fix #311, removed unnecessary check for CMAKE_BUILD_TYPE The check for Release or Debug in CMAKE_BUILD_TYPE breaks some assumption in Debian packaging. Since the check is useless, it has been removed. --- CMakeLists.txt | 154 ++++++++++++++++++++++++------------------------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52ac1c6f..d4c1f59c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,17 @@ cmake_minimum_required(VERSION 3.4 FATAL_ERROR) -PROJECT(sioclient) +PROJECT(sioclient + VERSION 3.1.0 + ) option(BUILD_SHARED_LIBS "Build the shared library" OFF) -option(BUILD_UNIT_TESTS "Builds unit tests target" OFF) - -set(MAJOR 1) -set(MINOR 6) -set(PATCH 0) - -if(NOT CMAKE_BUILD_TYPE ) -MESSAGE(STATUS "not define build type, set to release" ) -set(CMAKE_BUILD_TYPE Release ) -elseif(NOT (${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )) -MESSAGE(SEND_ERROR "CMAKE_BUILD_TYPE must be either Release or Debug") -return() -endif() +option(BUILD_UNIT_TESTS "Builds unit tests target" OFF) + +if (NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/asio/asio/README) + message("Updating submodules") + execute_process( + COMMAND git submodule update --init + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +endif () if (NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/asio/asio/README) message("Updating submodules") @@ -25,84 +22,87 @@ endif() aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src ALL_SRC) aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src/internal ALL_SRC) -file(GLOB ALL_HEADERS ${CMAKE_CURRENT_LIST_DIR}/src/*.h ) -set(SIO_INCLUDEDIR ${CMAKE_CURRENT_LIST_DIR}) + +file(GLOB ALL_HEADERS ${CMAKE_CURRENT_LIST_DIR}/src/*.h) add_definitions( - # These will force ASIO to compile without Boost - -DBOOST_DATE_TIME_NO_LIB - -DBOOST_REGEX_NO_LIB - -DASIO_STANDALONE - # These will force WebsocketPP to compile with C++11 - -D_WEBSOCKETPP_CPP11_STL_ - -D_WEBSOCKETPP_CPP11_FUNCTIONAL_ + # These will force ASIO to compile without Boost + -DBOOST_DATE_TIME_NO_LIB + -DBOOST_REGEX_NO_LIB + -DASIO_STANDALONE + # These will force WebsocketPP to compile with C++11 + -D_WEBSOCKETPP_CPP11_STL_ + -D_WEBSOCKETPP_CPP11_FUNCTIONAL_ ) add_library(sioclient ${ALL_SRC}) -target_include_directories(sioclient PRIVATE - ${CMAKE_CURRENT_LIST_DIR}/src - ${CMAKE_CURRENT_LIST_DIR}/lib/websocketpp - ${CMAKE_CURRENT_LIST_DIR}/lib/rapidjson/include - ${CMAKE_CURRENT_LIST_DIR}/lib/asio/asio/include -) + +target_include_directories(sioclient PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src + ${CMAKE_CURRENT_LIST_DIR}/lib/websocketpp + ${CMAKE_CURRENT_LIST_DIR}/lib/rapidjson/include + ${CMAKE_CURRENT_LIST_DIR}/lib/asio/asio/include + ) if (CMAKE_VERSION VERSION_GREATER "3.1") -set_property(TARGET sioclient PROPERTY CXX_STANDARD 11) -set_property(TARGET sioclient PROPERTY CXX_STANDARD_REQUIRED ON) -else() -set_property(TARGET sioclient APPEND_STRING PROPERTY COMPILE_FLAGS "-std=c++11") -endif() -if(BUILD_SHARED_LIBS) -set_target_properties(sioclient - PROPERTIES - SOVERSION ${MAJOR} - VERSION ${MAJOR}.${MINOR}.${PATCH} - ) -endif() + set_property(TARGET sioclient PROPERTY CXX_STANDARD 11) + set_property(TARGET sioclient PROPERTY CXX_STANDARD_REQUIRED ON) +else () + set_property(TARGET sioclient APPEND_STRING PROPERTY COMPILE_FLAGS "-std=c++11") +endif () + +if (BUILD_SHARED_LIBS) + set_target_properties(sioclient + PROPERTIES + SOVERSION ${MAJOR} + VERSION ${MAJOR}.${MINOR}.${PATCH} + ) +endif () + list(APPEND TARGET_LIBRARIES sioclient) find_package(OpenSSL) -if(OPENSSL_FOUND) -add_library(sioclient_tls ${ALL_SRC}) -target_include_directories(sioclient_tls PRIVATE - ${CMAKE_CURRENT_LIST_DIR}/src - ${CMAKE_CURRENT_LIST_DIR}/lib/websocketpp - ${CMAKE_CURRENT_LIST_DIR}/lib/rapidjson/include - ${CMAKE_CURRENT_LIST_DIR}/lib/asio/asio/include - ${OPENSSL_INCLUDE_DIR} -) +if (OPENSSL_FOUND) + add_library(sioclient_tls ${ALL_SRC}) + target_include_directories(sioclient_tls PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/src + ${CMAKE_CURRENT_LIST_DIR}/lib/websocketpp + ${CMAKE_CURRENT_LIST_DIR}/lib/rapidjson/include + ${CMAKE_CURRENT_LIST_DIR}/lib/asio/asio/include + ${OPENSSL_INCLUDE_DIR} + ) -if (CMAKE_VERSION VERSION_GREATER "3.1") -set_property(TARGET sioclient_tls PROPERTY CXX_STANDARD 11) -set_property(TARGET sioclient_tls PROPERTY CXX_STANDARD_REQUIRED ON) -target_link_libraries(sioclient_tls PRIVATE ${OPENSSL_LIBRARIES} ) -else() -set_property(TARGET sioclient_tls APPEND_STRING PROPERTY COMPILE_FLAGS "-std=c++11") -endif() -target_compile_definitions(sioclient_tls PRIVATE -DSIO_TLS) -if(BUILD_SHARED_LIBS) -set_target_properties(sioclient_tls - PROPERTIES - SOVERSION ${MAJOR} - VERSION ${MAJOR}.${MINOR}.${PATCH} - ) -endif() -list(APPEND TARGET_LIBRARIES sioclient_tls) + if (CMAKE_VERSION VERSION_GREATER "3.1") + set_property(TARGET sioclient_tls PROPERTY CXX_STANDARD 11) + set_property(TARGET sioclient_tls PROPERTY CXX_STANDARD_REQUIRED ON) + target_link_libraries(sioclient_tls PRIVATE ${OPENSSL_LIBRARIES}) + else () + set_property(TARGET sioclient_tls APPEND_STRING PROPERTY COMPILE_FLAGS "-std=c++11") + endif () + target_compile_definitions(sioclient_tls PRIVATE -DSIO_TLS) + if (BUILD_SHARED_LIBS) + set_target_properties(sioclient_tls + PROPERTIES + SOVERSION ${MAJOR} + VERSION ${MAJOR}.${MINOR}.${PATCH} + ) + endif () + list(APPEND TARGET_LIBRARIES sioclient_tls) -endif() +endif () include(GNUInstallDirs) -install(FILES ${ALL_HEADERS} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -) +install(FILES ${ALL_HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) install(TARGETS ${TARGET_LIBRARIES} - DESTINATION ${CMAKE_INSTALL_LIBDIR} -) + DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) -if(BUILD_UNIT_TESTS) -message(STATUS "Building with unit test support.") -enable_testing() -add_subdirectory(test) -endif() +if (BUILD_UNIT_TESTS) + message(STATUS "Building with unit test support.") + enable_testing() + add_subdirectory(test) +endif () From 67fc694f0f2dd7c0fc173715d1ccf5fc3583ee2b Mon Sep 17 00:00:00 2001 From: Federico Fuga Date: Thu, 13 Jan 2022 19:06:39 +0100 Subject: [PATCH 5/5] Debian package: Remove workaround due to Issue #311 --- debian/rules | 4 ---- 1 file changed, 4 deletions(-) diff --git a/debian/rules b/debian/rules index d7ce6f70..f1415823 100755 --- a/debian/rules +++ b/debian/rules @@ -14,7 +14,3 @@ %: dh $@ - -override_dh_auto_configure: - dh_auto_configure -- \ - -DCMAKE_BUILD_TYPE=Release