Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resiprocate: add 1.13.1 #20465

Merged
merged 7 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/resiprocate/cmake/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.13.1":
url: "https://github.com/resiprocate/resiprocate/archive/refs/tags/resiprocate-1.13.1.tar.gz"
sha256: "df8d0cbf17793077d59c2863b23a6da8e9c77aba88327d1a494accaded1ef605"
126 changes: 126 additions & 0 deletions recipes/resiprocate/cmake/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import os

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd, cross_building
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
franramirez688 marked this conversation as resolved.
Show resolved Hide resolved
from conan.tools.files import copy, get, rm, rmdir
from conan.tools.gnu import PkgConfigDeps
from conan.tools.microsoft import is_msvc

required_conan_version = ">=2.0.9"


class ResiprocateConan(ConanFile):
name = "resiprocate"
description = (
"The project is dedicated to maintaining a complete, correct, "
"and commercially usable implementation of SIP and a few related protocols."
)
license = "VSL-1.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/resiprocate/resiprocate/wiki/"
topics = ("sip", "voip", "communication", "signaling")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_cares": [True, False],
"with_ssl": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_cares": True,
"with_ssl": True,
}
implements = ["auto_shared_fpic"]

def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
if self.options.with_cares:
self.requires("c-ares/[>=1.27 <2]")
if self.options.with_ssl:
self.requires("openssl/[>=1.1 <4]")

def validate(self):
gjasny marked this conversation as resolved.
Show resolved Hide resolved
check_min_cppstd(self, 11)
if is_msvc(self) and self.options.shared:
raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Visual Studio and msvc.")

def build_requirements(self):
self.tool_requires("cmake/[>=3.21 <4]")
if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str):
self.tool_requires("pkgconf/[>=2.2 <3]")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_DSO_PLUGINS"] = False
tc.variables["BUILD_QPID_PROTON"] = False
tc.variables["BUILD_RECON"] = False
tc.variables["BUILD_REFLOW"] = False
tc.variables["BUILD_REND"] = False
tc.variables["BUILD_REPRO"] = False
tc.variables["BUILD_RETURN"] = False
tc.variables["BUILD_TESTING"] = False
tc.variables["BUILD_TFM"] = False
tc.variables["ENABLE_LOG_REPOSITORY_DETAILS"] = False
tc.variables["REGENERATE_MEDIA_SAMPLES"] = False
tc.variables["RESIP_ASSERT_SYSLOG"] = False
tc.variables["USE_CONTRIB"] = False
tc.variables["USE_DTLS"] = self.options.with_ssl
tc.variables["USE_KURENTO"] = False
tc.variables["USE_MAXMIND_GEOIP"] = False
tc.variables["USE_NUGET"] = False
tc.variables["USE_POPT"] = False
tc.variables["VERSIONED_SONAME"] = False
tc.variables["WITH_C_ARES"] = self.options.with_cares
tc.variables["WITH_SSL"] = self.options.with_ssl
if self.settings.os in ["Linux"]:
tc.preprocessor_definitions["RESIP_RANDOM_THREAD_LOCAL"] = True
if cross_building(self):
tc.cache_variables["HAVE_CLOCK_GETTIME_MONOTONIC"] = not self.settings.os in ["Windows"]
tc.generate()
tc = PkgConfigDeps(self)
tc.generate()
tc = CMakeDeps(self)
tc.generate()
tc = VirtualBuildEnv(self)
tc.generate(scope="build")
franramirez688 marked this conversation as resolved.
Show resolved Hide resolved

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()

rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "share"))
rm(self, "*.la", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))

def package_info(self):
resiprocate_lib = "resiprocate" if self.settings.os == "Windows" else "resip"
self.cpp_info.libs = [resiprocate_lib, "rutil", "dum"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AbrilRBS is working on this to split these libraries into several components. She'll update the PR soon

if not self.options.with_cares:
self.cpp_info.libs.append("resipares")
if is_apple_os(self):
self.cpp_info.frameworks.extend(["CoreFoundation", "CoreServices", "Security"])
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.extend(["m", "pthread"])
elif self.settings.os in ["Windows"]:
self.cpp_info.system_libs.extend(["winmm", "ws2_32"])
8 changes: 8 additions & 0 deletions recipes/resiprocate/cmake/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

find_package(resiprocate REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE resiprocate::resiprocate)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
26 changes: 26 additions & 0 deletions recipes/resiprocate/cmake/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")
71 changes: 71 additions & 0 deletions recipes/resiprocate/cmake/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include <resip/stack/SipMessage.hxx>
#include <resip/stack/Helper.hxx>
#include <rutil/Logger.hxx>
#include <iostream>

#define RESIPROCATE_SUBSYSTEM Subsystem::TEST

using namespace resip;

std::string sipRawData = "INVITE sip:[email protected] SIP/2.0\r\n"
"Record-Route: <sip:[email protected];lr>\r\n"
"Via: SIP/2.0/UDP 10.0.0.10;branch=z9hG4bK3af7.0a6e92f4.0\r\n"
"Via: SIP/2.0/UDP 192.168.0.2:5060;branch=z9hG4bK12ee92cb;rport=5060\r\n"
"From: \"78128210000\" <sip:[email protected]>;tag=as149b2d97\r\n"
"To: <sip:[email protected]>\r\n"
"Contact: <sip:[email protected]>\r\n"
"Call-ID: [email protected]\r\n"
"CSeq: 103 INVITE\r\n"
"Max-Forwards: 16\r\n"
"Date: Wed, 10 Jan 2001 13:16:23 GMT\r\n"
"Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY\r\n"
"Supported: replaces\r\n"
"Content-Type: application/sdp\r\n"
"Content-Length: 394\r\n"
"\r\n"
"v=0\r\n"
"o=root 3303 3304 IN IP4 10.0.0.10\r\n"
"s=session\r\n"
"c=IN IP4 10.0.0.10\r\n"
"t=0 0\r\n"
"m=audio 40358 RTP/AVP 0 8 101\r\r\n"
"a=rtpmap:0 PCMU/8000\r\n"
"a=rtpmap:8 PCMA/8000\r\n"
"a=rtpmap:101 telephone-event/8000\r\n"
"a=fmtp:101 0-16\r\n"
"a=silenceSupp:off - - - -\r\n"
"a=sendrecv\r\n";

int main(int argc, char* argv[])
{
Log::initialize(Log::Cout, Log::Warning, argv[0]);

SipMessage* msg = SipMessage::make(Data(Data::Share, sipRawData.data()), true);
if (!msg)
{
return 1;
}

std::cout << std::string(msg->methodStr().data()) << std::endl;
std::string headers = "";
for (int i = 0; i < Headers::Type::MAX_HEADERS; i++)
{
auto rawHeader = msg->getRawHeader(static_cast<Headers::Type>(i));
if (!rawHeader)
{
continue;
}
for (auto value : *rawHeader)
{
headers += std::string(value.getBuffer(), value.getLength());
}
headers += "\r\n";
}

std::cout << headers << std::endl;
std::cout << std::string(msg->getRawBody().getBuffer(), msg->getRawBody().getLength()) << std::endl;

delete msg;
return 0;
}

2 changes: 2 additions & 0 deletions recipes/resiprocate/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"1.13.1":
folder: cmake
"1.12.0":
folder: all