Files
TrustTunnelClient/conanfile.py
T
Nikita Gorskikh 72461d0994 Pull request #2: Put the open-source part of the VPN client library here
Merge in ADGUARD-CORE-LIBS/vpn-libs from feature/add_opensource_vpn_client to master

Squashed commit of the following:

commit 0b68e8bebcb5ab4ab76aa5d63267f224c5bd56f2
Author: Sergei Gunchenko <s.gunchenko@adguard.com>
Date:   Mon Aug 1 19:28:49 2022 +0300

    common/src/utils.cpp edited online with Bitbucket

commit 237afe76b1e03c8e95fd7564b100d72956598550
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 16:58:00 2022 +0300

    Maybe fix conan-upload-recipes

commit 940c4abfc8808b7e464a37302d7eca5215eda14e
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 16:57:52 2022 +0300

    Un-simplify conan export script

commit c6ee05e3642d27daadf6b1d49374b187bdeec818
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 16:51:12 2022 +0300

    Debug

commit b3956633a8ad4d6ada4559b2fc4fb0d4d09e97ea
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 16:49:27 2022 +0300

    Maybe fix upload-conan-recipes 2

commit 447f05addd243bce179d99812309c3f9bb1b7412
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 16:42:20 2022 +0300

    Maybe fix upload-conan-recipes

commit 8ff27ec486c4176676d3c186dfda13e652fb0344
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 15:39:37 2022 +0300

    Check subprocess return in conan_export.py

commit 5652549b863232f573e18c71844323e3298bf080
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 15:22:30 2022 +0300

    Fix bamboo spec

commit 28ae435a1500afd0e288c33695003f9feb59100f
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 15:20:16 2022 +0300

    Get rid of version.h, use increment_version.sh from native_libs_common

commit 01f4f4892d3718ee48e25192259239c6e95183cd
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 15:16:02 2022 +0300

    Fix conandata.yml

commit b4163a3dfdbdd5dc2817988a8325d21754165e83
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 15:10:30 2022 +0300

    Simplify conan export script

commit 03343cd1ae47a1e60fddb09e58bacf498f765991
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 14:57:26 2022 +0300

    Fix bamboo spec

commit 9ba118b74ddc41e1ccd3d7c754120e03e86699ee
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 14:56:19 2022 +0300

    Update changelog

commit ce1c14cdcf18ab1032d12555db1efaa177ef6101
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 14:55:36 2022 +0300

    Fix increment_version.sh and increment version

commit 56186e50fd51925f6fb7dc17e9d1fc7a5831a2c8
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 14:53:19 2022 +0300

    Add versioning system from native_libs_common

commit e6570a1afdda8da0afad51c94e8d1b7375739fea
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 14:20:13 2022 +0300

    Add missing includes

commit 5e708c71553f31e7998dcc5d310e1abecef44ab4
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 14:17:52 2022 +0300

    Add license

commit 09ee4698adc2514a23962f0549f9a571d40f4f96
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 13:30:12 2022 +0300

    Pull variable out of namespace ag

commit 7bfc263756c175c6ac85fd8310c387c666a5038b
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 12:25:21 2022 +0300

    Update native_libs_common to 2.0.10

commit 68025494e7c781cdfd8ee1f4ef801014c8179d67
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date:   Mon Aug 1 12:25:05 2022 +0300

    Permanently add /Oy- and -fno-omit-frame-pointer compiler flags

... and 123 more commits
2022-08-03 13:13:43 +03:00

89 lines
3.3 KiB
Python

from conans import ConanFile, CMake
class VpnLibsConan(ConanFile):
name = "vpn-libs"
license = "GPL-3.0-or-later"
author = "AdguardTeam"
url = "https://github.com/AdguardTeam/VpnLibs"
description = "A VPN client library that provides client network traffic tunnelling to an AdGuard VPN server"
settings = "os", "compiler", "build_type", "arch"
options = {
"commit_hash": "ANY",
"sanitize": "ANY"
}
default_options = {
"commit_hash": None, # None means `master`
"sanitize": None, # None means none
}
generators = "cmake"
def requirements(self):
for req in self.conan_data["requirements"]:
self.requires(req)
def build_requirements(self):
self.build_requires("gtest/1.11.0")
self.build_requires("cxxopts/3.0.0")
self.build_requires("nlohmann_json/3.10.5")
def configure(self):
self.options["gtest"].build_gmock = False
self.options["dns-libs"].commit_hash = "1ce2d08acaadaf9cc730f04fc62ddd07bea8e159"
# Resolve conflict between pcre2 required from dns-libs and pcre2 required form native_libs_common
self.options["pcre2"].build_pcre2grep = False
# Commit hash should only be used with native_libs_common/777
# self.options["native_libs_common"].commit_hash = "72731a36771d550ffae8c1223e0a129fefc2384c"
def source(self):
self.run("git clone https://github.com/AdguardTeam/VpnLibs.git source_subfolder")
if self.options.commit_hash:
self.run("cd source_subfolder && git checkout %s" % self.options.commit_hash)
def build(self):
cmake = CMake(self)
cmake.definitions["CMAKE_C_FLAGS"] = ""
cmake.definitions["CMAKE_CXX_FLAGS"] = ""
# A better way to pass these was not found :(
if self.settings.os == "Linux":
if self.settings.compiler.libcxx:
cmake.definitions["CMAKE_CXX_FLAGS"] = "-stdlib=%s" % self.settings.compiler.libcxx
if self.settings.compiler.version:
cmake.definitions["CMAKE_CXX_COMPILER_VERSION"] = self.settings.compiler.version
if self.options.sanitize:
cmake.definitions["CMAKE_C_FLAGS"] += f" -fno-omit-frame-pointer -fsanitize={self.options.sanitize}"
cmake.definitions["CMAKE_CXX_FLAGS"] += f" -fno-omit-frame-pointer -fsanitize={self.options.sanitize}"
cmake.configure(source_folder="source_subfolder")
cmake.build(target="vpnlibs_common")
cmake.build(target="vpnlibs_core")
cmake.build(target="vpnlibs_net")
cmake.build(target="vpnlibs_tcpip")
def package(self):
MODULES = [
"common",
"core",
"net",
"tcpip",
]
for m in MODULES:
self.copy("*.h", dst="include", src="source_subfolder/%s/include" % m)
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.dylib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = [
"vpnlibs_core",
"vpnlibs_net",
"vpnlibs_tcpip",
"vpnlibs_common",
]