mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-12-04 06:01:26 +09:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f7bc1957a | ||
|
|
61b081fa3a | ||
|
|
c31088929f | ||
|
|
a04a131105 | ||
|
|
c63d35009d | ||
|
|
525c285745 |
No files matched your search
@@ -20,6 +20,9 @@ execute_process(
|
||||
execute_process(
|
||||
COMMAND ${CONAN_COMMAND} export "${CMAKE_SOURCE_DIR}/recipes/go" --version 1.23.12
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${CONAN_COMMAND} export "${CMAKE_SOURCE_DIR}/recipes/go" --version 1.25.0
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CONAN_COMMAND} remote add amnezia "https://artifactory.amnezia.org/artifactory/api/conan/client-prebuilts" --force
|
||||
|
||||
@@ -2,7 +2,7 @@ from conan import ConanFile
|
||||
from conan.tools.files import get, copy, apply_conandata_patches, export_conandata_patches
|
||||
from conan.tools.layout import basic_layout
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.env import Environment
|
||||
from conan.tools.env import Environment, VirtualBuildEnv
|
||||
|
||||
import os
|
||||
import stat
|
||||
@@ -37,6 +37,7 @@ class AmneziaLibxray(ConanFile):
|
||||
)
|
||||
|
||||
def generate(self):
|
||||
VirtualBuildEnv(self).generate()
|
||||
env = Environment()
|
||||
ndk_path_str = self.conf.get("tools.android:ndk_path")
|
||||
if ndk_path_str:
|
||||
@@ -44,6 +45,9 @@ class AmneziaLibxray(ConanFile):
|
||||
if len(ndk_path.parts) > 2:
|
||||
sdk_path = ndk_path.parents[1]
|
||||
env.define("ANDROID_HOME", str(sdk_path))
|
||||
env.define("GODEBUG", "http2client=0")
|
||||
env.define("GOPROXY", "https://proxy.golang.org|direct")
|
||||
env.define("GOSUMDB", "off")
|
||||
env.vars(self).save_script("conan_provide_androidhome")
|
||||
|
||||
def _patch_sources(self):
|
||||
@@ -54,12 +58,15 @@ class AmneziaLibxray(ConanFile):
|
||||
|
||||
def build(self):
|
||||
self._patch_sources()
|
||||
self.run("./build.sh android")
|
||||
if self.settings_build.os == "Windows":
|
||||
self.run("bash build.sh android")
|
||||
else:
|
||||
self.run("./build.sh android")
|
||||
|
||||
def package(self):
|
||||
copy(self, "libxray.aar", src=self.build_folder, dst=os.path.join(self.package_folder, "aar"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_extra_variables", {
|
||||
"AMNEZIA_LIBXRAY_PATH": os.path.join(self.package_folder, "aar", "libxray.aar"),
|
||||
"AMNEZIA_LIBXRAY_PATH": Path(self.package_folder, "aar", "libxray.aar").as_posix(),
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
patches:
|
||||
"3.1.20260814":
|
||||
- patch_file: "patches/0001-windows-pin-GO_PLATFORM-elf-cleaner-via-msys2-gcc.patch"
|
||||
@@ -1,17 +1,38 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain
|
||||
from conan.tools.files import copy, replace_in_file
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, load, replace_in_file, rmdir, save
|
||||
from conan.tools.env import VirtualBuildEnv
|
||||
from conan.errors import ConanException, ConanInvalidConfiguration
|
||||
from conan.tools.scm import Git
|
||||
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
|
||||
class AwgAndroid(ConanFile):
|
||||
name = "awg-android"
|
||||
version = "3.1.20260814"
|
||||
settings = "os", "arch", "build_type", "compiler"
|
||||
|
||||
_WINDOWS_GO_HOST_PLATFORM = "windows-amd64"
|
||||
|
||||
# Go used to build libwg-go on every platform (downloaded by the Makefile
|
||||
# on Linux/macOS, provided by conan on Windows); must satisfy the `go`
|
||||
# directives of tunnel/tools/libwg-go/go.mod and its dependencies,
|
||||
# otherwise `go build` (with GOTOOLCHAIN=local) refuses to build.
|
||||
_GO_VERSION = "1.25.0"
|
||||
_GO_TARBALL_SHA256 = {
|
||||
"darwin-amd64": "5bd60e823037062c2307c71e8111809865116714d6f6b410597cf5075dfd80ef",
|
||||
"darwin-arm64": "544932844156d8172f7a28f77f2ac9c15a23046698b6243f633b0a0b00c0749c",
|
||||
"linux-amd64": "2852af0cb20a13139b3448992e69b868e50ed0f8a1e5940ee1de9e19a123b613",
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def configure(self):
|
||||
self.settings.rm_safe("compiler.libcxx")
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
@@ -21,28 +42,65 @@ class AwgAndroid(ConanFile):
|
||||
|
||||
def build_requirements(self):
|
||||
self.tool_requires("cmake/[>=3.4.1 <4]")
|
||||
if platform.system() == "Windows":
|
||||
self.tool_requires("ninja/[*]")
|
||||
self.tool_requires(f"go/{self._GO_VERSION}")
|
||||
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
|
||||
self.tool_requires("msys2/cci.latest")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.os != "Android":
|
||||
raise ConanInvalidConfiguration(f"{self.name} v{self.version} does not support {self.settings.os}")
|
||||
|
||||
def source(self):
|
||||
for entry in os.listdir(self.source_folder):
|
||||
if entry == "patches":
|
||||
continue
|
||||
path = os.path.join(self.source_folder, entry)
|
||||
shutil.rmtree(path) if os.path.isdir(path) else os.remove(path)
|
||||
git = Git(self)
|
||||
git.clone(
|
||||
url="https://github.com/amnezia-vpn/amneziawg-android.git",
|
||||
target=".",
|
||||
target="checkout",
|
||||
args=["--recurse-submodules", "--branch", f"v{self.version}"]
|
||||
)
|
||||
checkout_dir = os.path.join(self.source_folder, "checkout")
|
||||
for entry in os.listdir(checkout_dir):
|
||||
shutil.move(os.path.join(checkout_dir, entry), os.path.join(self.source_folder, entry))
|
||||
os.rmdir(checkout_dir)
|
||||
|
||||
def generate(self):
|
||||
venv = VirtualBuildEnv(self)
|
||||
# Never let `go` auto-download another toolchain: it would silently
|
||||
# replace the runtime-patched Go prepared for this build, and with
|
||||
# GOSUMDB=off the download cannot be verified and fails anyway.
|
||||
venv.environment().define("GOTOOLCHAIN", "local")
|
||||
# sum.golang.org is sometimes unreachable from CI runners entirely
|
||||
# ("connection refused"); go.sum already pins the exact hashes we
|
||||
# need, so the extra public-transparency-log check isn't required.
|
||||
venv.environment().define("GOSUMDB", "off")
|
||||
venv.generate()
|
||||
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["GRADLE_USER_HOME"] = os.path.join(self.build_folder, "gradle_user_home")
|
||||
tc.variables["CMAKE_LIBRARY_OUTPUT_DIRECTORY"] = os.path.join(self.build_folder, "out")
|
||||
tc.variables["GRADLE_USER_HOME"] = Path(os.path.join(self.build_folder, "gradle_user_home")).as_posix()
|
||||
tc.variables["CMAKE_LIBRARY_OUTPUT_DIRECTORY"] = Path(os.path.join(self.build_folder, "out")).as_posix()
|
||||
# not to warn in case of strtok() usage
|
||||
tc.extra_cflags = ["-Wno-deprecated-declarations"]
|
||||
tc.generate()
|
||||
|
||||
def _patch_sources(self):
|
||||
if platform.system() == 'Windows':
|
||||
for rel_path in (
|
||||
os.path.join("tunnel", "tools", "CMakeLists.txt"),
|
||||
os.path.join("tunnel", "tools", "libwg-go", "Makefile"),
|
||||
):
|
||||
abs_path = os.path.join(self.source_folder, rel_path)
|
||||
content = load(self, abs_path)
|
||||
if "\r\n" in content:
|
||||
save(self, abs_path, content.replace("\r\n", "\n"))
|
||||
|
||||
self._sync_makefile_go_version()
|
||||
|
||||
if platform.system() == 'Darwin':
|
||||
replace_in_file(self,
|
||||
os.path.join(self.source_folder, "tunnel", "tools", "libwg-go", "Makefile"),
|
||||
@@ -64,6 +122,58 @@ class AwgAndroid(ConanFile):
|
||||
'sha256sum -c',
|
||||
'shasum -a 256 -c'
|
||||
)
|
||||
elif platform.system() == 'Windows':
|
||||
apply_conandata_patches(self)
|
||||
self._prepare_patched_go_for_windows()
|
||||
|
||||
def _sync_makefile_go_version(self):
|
||||
makefile_path = os.path.join(self.source_folder, "tunnel", "tools", "libwg-go", "Makefile")
|
||||
content = load(self, makefile_path)
|
||||
content, n = re.subn(r"^GO_VERSION := \S+", f"GO_VERSION := {self._GO_VERSION}",
|
||||
content, count=1, flags=re.MULTILINE)
|
||||
if n != 1:
|
||||
raise ConanException("Could not find GO_VERSION in libwg-go/Makefile; "
|
||||
"upstream may have restructured it, recipe needs updating")
|
||||
for go_platform, sha256 in self._GO_TARBALL_SHA256.items():
|
||||
content, n = re.subn(rf"^GO_HASH_{go_platform} := \S+", f"GO_HASH_{go_platform} := {sha256}",
|
||||
content, count=1, flags=re.MULTILINE)
|
||||
if n != 1:
|
||||
raise ConanException(f"Could not find GO_HASH_{go_platform} in libwg-go/Makefile; "
|
||||
"upstream may have restructured it, recipe needs updating")
|
||||
save(self, makefile_path, content)
|
||||
|
||||
def _prepare_patched_go_for_windows(self):
|
||||
# _sync_makefile_go_version has pinned GO_VERSION in the Makefile to
|
||||
# self._GO_VERSION, so the paths below match what make expects
|
||||
go_version = self._GO_VERSION
|
||||
build_dir = os.path.join(self.build_folder, "generated-src")
|
||||
go_dir = os.path.join(build_dir, f"go-{go_version}")
|
||||
prepared_marker = os.path.join(go_dir, ".prepared")
|
||||
|
||||
if os.path.exists(prepared_marker):
|
||||
return
|
||||
gradle_user_home = os.path.join(self.build_folder, "gradle_user_home")
|
||||
tarball_path = os.path.join(gradle_user_home, "caches", "golang",
|
||||
f"go{go_version}.{self._WINDOWS_GO_HOST_PLATFORM}.tar.gz")
|
||||
os.makedirs(os.path.dirname(tarball_path), exist_ok=True)
|
||||
save(self, tarball_path, "")
|
||||
|
||||
goroot_output = StringIO()
|
||||
self.run("go env GOROOT", env="conanbuild", stdout=goroot_output)
|
||||
goroot = goroot_output.getvalue().strip()
|
||||
|
||||
os.makedirs(build_dir, exist_ok=True)
|
||||
if os.path.isdir(go_dir):
|
||||
rmdir(self, go_dir)
|
||||
shutil.copytree(goroot, go_dir)
|
||||
|
||||
# the same command the Makefile runs on Linux/macOS after unpacking Go
|
||||
diff_path = os.path.join(self.source_folder, "tunnel", "tools", "libwg-go",
|
||||
"goruntime-boottime-over-monotonic.diff")
|
||||
self.run('patch -p1 -f -N -r- -d "{}" -i "{}"'.format(
|
||||
Path(go_dir).as_posix(), Path(diff_path).as_posix()), env="conanbuild")
|
||||
|
||||
save(self, prepared_marker, "")
|
||||
|
||||
def build(self):
|
||||
self._patch_sources()
|
||||
@@ -81,6 +191,6 @@ class AwgAndroid(ConanFile):
|
||||
self.cpp_info.set_property("cmake_target_name", "amnezia::awg-android")
|
||||
self.cpp_info.libs = [ "wg-go" ]
|
||||
self.cpp_info.set_property("cmake_extra_variables", {
|
||||
"AMNEZIA_ANDROID_LIBWG_PATH": os.path.join(self.package_folder, "bin", "libwg.so"),
|
||||
"AMNEZIA_ANDROID_LIBWG_QUICK_PATH": os.path.join(self.package_folder, "bin", "libwg-quick.so"),
|
||||
"AMNEZIA_ANDROID_LIBWG_PATH": Path(os.path.join(self.package_folder, "bin", "libwg.so")).as_posix(),
|
||||
"AMNEZIA_ANDROID_LIBWG_QUICK_PATH": Path(os.path.join(self.package_folder, "bin", "libwg-quick.so")).as_posix(),
|
||||
})
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
From 1b2c3d4e5f60718293a4b5c6d7e8f9001a2b3c4d Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 27 Aug 2026 16:57:59 +0300
|
||||
Subject: [PATCH] windows: pin GO_PLATFORM, build elf-cleaner with msys2 gcc
|
||||
|
||||
uname under msys2 reports msys_nt-* instead of windows, so GO_PLATFORM
|
||||
computed by the Makefile is pinned from the outside. elf-cleaner is
|
||||
built with gcc from msys2 (there is no `cc` shim on Windows); msys2 gcc
|
||||
targets the POSIX emulation layer, so the mmap-based elf-cleaner code
|
||||
works unchanged.
|
||||
|
||||
The -DPACKAGE_NAME="..." defines cannot be passed on the command line:
|
||||
ninja quotes the embedded quotes as \" and the msys2 (cygwin) argv
|
||||
re-parser then collapses everything after the first \" into one
|
||||
argument ("gcc: fatal error: no input files"). The defines live in
|
||||
config-windows.h instead, pulled in with -include via a path relative
|
||||
to the working directory, because the cygwin preprocessor does not
|
||||
understand absolute C:/ paths in -include. The header also defines
|
||||
_GNU_SOURCE so newlib exposes asprintf().
|
||||
---
|
||||
tunnel/tools/CMakeLists.txt | 13 +++++++------
|
||||
tunnel/tools/elf-cleaner/config-windows.h | 10 ++++++++++
|
||||
2 files changed, 17 insertions(+), 6 deletions(-)
|
||||
create mode 100644 tunnel/tools/elf-cleaner/config-windows.h
|
||||
|
||||
diff --git a/tunnel/tools/CMakeLists.txt b/tunnel/tools/CMakeLists.txt
|
||||
index 8557c5ab..0e2a08b5 100644
|
||||
--- a/tunnel/tools/CMakeLists.txt
|
||||
+++ b/tunnel/tools/CMakeLists.txt
|
||||
@@ -30,17 +30,18 @@
|
||||
TARGET=${CMAKE_C_COMPILER_TARGET}
|
||||
DESTDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
||||
BUILDDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../generated-src
|
||||
+ GO_PLATFORM=windows-amd64
|
||||
)
|
||||
|
||||
# Strip unwanted ELF sections to prevent DT_FLAGS_1 warnings on old Android versions
|
||||
file(GLOB ELF_CLEANER_SOURCES elf-cleaner/*.c elf-cleaner/*.cpp)
|
||||
-add_custom_target(elf-cleaner COMMENT "Building elf-cleaner" VERBATIM COMMAND cc
|
||||
- -O2 -DPACKAGE_NAME="elf-cleaner" -DPACKAGE_VERSION="" -DCOPYRIGHT=""
|
||||
- -o "${CMAKE_CURRENT_BINARY_DIR}/elf-cleaner" ${ELF_CLEANER_SOURCES}
|
||||
+add_custom_target(elf-cleaner COMMENT "Building elf-cleaner" VERBATIM WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMAND gcc
|
||||
+ -O2 -include elf-cleaner/config-windows.h
|
||||
+ -o "${CMAKE_CURRENT_BINARY_DIR}/elf-cleaner.exe" ${ELF_CLEANER_SOURCES} -lstdc++
|
||||
)
|
||||
-add_custom_command(TARGET libwg.so POST_BUILD VERBATIM COMMAND "${CMAKE_CURRENT_BINARY_DIR}/elf-cleaner"
|
||||
+add_custom_command(TARGET libwg.so POST_BUILD VERBATIM COMMAND "${CMAKE_CURRENT_BINARY_DIR}/elf-cleaner.exe"
|
||||
--api-level "${ANDROID_NATIVE_API_LEVEL}" "$<TARGET_FILE:libwg.so>")
|
||||
add_dependencies(libwg.so elf-cleaner)
|
||||
-add_custom_command(TARGET libwg-quick.so POST_BUILD VERBATIM COMMAND "${CMAKE_CURRENT_BINARY_DIR}/elf-cleaner"
|
||||
+add_custom_command(TARGET libwg-quick.so POST_BUILD VERBATIM COMMAND "${CMAKE_CURRENT_BINARY_DIR}/elf-cleaner.exe"
|
||||
--api-level "${ANDROID_NATIVE_API_LEVEL}" "$<TARGET_FILE:libwg-quick.so>")
|
||||
add_dependencies(libwg-quick.so elf-cleaner)
|
||||
diff --git a/tunnel/tools/elf-cleaner/config-windows.h b/tunnel/tools/elf-cleaner/config-windows.h
|
||||
new file mode 100644
|
||||
index 0000000..9c1d0aa
|
||||
--- /dev/null
|
||||
+++ b/tunnel/tools/elf-cleaner/config-windows.h
|
||||
@@ -0,0 +1,10 @@
|
||||
+#ifndef ELF_CLEANER_CONFIG_WINDOWS_H
|
||||
+#define ELF_CLEANER_CONFIG_WINDOWS_H
|
||||
+/* msys2 gcc: make newlib expose asprintf() also in C++ mode */
|
||||
+#ifndef _GNU_SOURCE
|
||||
+#define _GNU_SOURCE 1
|
||||
+#endif
|
||||
+#define PACKAGE_NAME "elf-cleaner"
|
||||
+#define PACKAGE_VERSION ""
|
||||
+#define COPYRIGHT ""
|
||||
+#endif
|
||||
--
|
||||
2.44.0.windows.1
|
||||
|
||||
@@ -24,6 +24,31 @@ sources:
|
||||
x86_64:
|
||||
url: "https://go.dev/dl/go1.23.12.windows-amd64.zip"
|
||||
sha256: "07c35866cdd864b81bb6f1cfbf25ac7f87ddc3a976ede1bf5112acbb12dfe6dc"
|
||||
"1.25.0":
|
||||
Macos:
|
||||
x86_64:
|
||||
url: "https://go.dev/dl/go1.25.0.darwin-amd64.tar.gz"
|
||||
sha256: "5bd60e823037062c2307c71e8111809865116714d6f6b410597cf5075dfd80ef"
|
||||
armv8:
|
||||
url: "https://go.dev/dl/go1.25.0.darwin-arm64.tar.gz"
|
||||
sha256: "544932844156d8172f7a28f77f2ac9c15a23046698b6243f633b0a0b00c0749c"
|
||||
Linux:
|
||||
x86:
|
||||
url: "https://go.dev/dl/go1.25.0.linux-386.tar.gz"
|
||||
sha256: "8c602dd9d99bc9453b3995d20ce4baf382cc50855900a0ece5de9929df4a993a"
|
||||
x86_64:
|
||||
url: "https://go.dev/dl/go1.25.0.linux-amd64.tar.gz"
|
||||
sha256: "2852af0cb20a13139b3448992e69b868e50ed0f8a1e5940ee1de9e19a123b613"
|
||||
armv8:
|
||||
url: "https://go.dev/dl/go1.25.0.linux-arm64.tar.gz"
|
||||
sha256: "05de75d6994a2783699815ee553bd5a9327d8b79991de36e38b66862782f54ae"
|
||||
Windows:
|
||||
x86:
|
||||
url: "https://go.dev/dl/go1.25.0.windows-386.zip"
|
||||
sha256: "df9f39db82a803af0db639e3613a36681ab7a42866b1384b3f3a1045663961a7"
|
||||
x86_64:
|
||||
url: "https://go.dev/dl/go1.25.0.windows-amd64.zip"
|
||||
sha256: "89efb4f9b30812eee083cc1770fdd2913c14d301064f6454851428f9707d190b"
|
||||
"1.26.0":
|
||||
Macos:
|
||||
x86_64:
|
||||
|
||||
@@ -2,7 +2,7 @@ from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.apple import fix_apple_shared_install_name, is_apple_os, XCRun
|
||||
from conan.tools.build import build_jobs
|
||||
from conan.tools.files import chdir, copy, get, replace_in_file, rm, rmdir, save
|
||||
from conan.tools.files import chdir, copy, get, load, replace_in_file, rm, rmdir, save
|
||||
from conan.tools.gnu import AutotoolsToolchain
|
||||
from conan.tools.layout import basic_layout
|
||||
from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path
|
||||
@@ -10,6 +10,7 @@ from conan.tools.scm import Version
|
||||
|
||||
import fnmatch
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
|
||||
required_conan_version = ">=1.57.0"
|
||||
@@ -510,6 +511,33 @@ class OpenSSLConan(ConanFile):
|
||||
return self.dependencies.build["strawberryperl"].conf_info.get("user.strawberryperl:perl", check_type=str)
|
||||
return "perl"
|
||||
|
||||
def _patch_makefile_long_link_lines(self):
|
||||
makefile_path = os.path.join(self.source_folder, "Makefile")
|
||||
content = load(self, makefile_path)
|
||||
|
||||
pattern = re.compile(
|
||||
r"^\t\$\(CC\) (?P<flags>[^\n]*?) -Wl,-soname=(?P<name>\S+) \\\n"
|
||||
r"\t\t-o (?P=name) -Wl,--version-script=(?P<ldscript>\S+) \\\n"
|
||||
r"(?P<rest>(?:\t\t[^\n]*\\\n)*\t\t[^\n]*\n)",
|
||||
re.MULTILINE,
|
||||
)
|
||||
|
||||
def build_replacement(m):
|
||||
name = m.group("name")
|
||||
flags = m.group("flags")
|
||||
ldscript = m.group("ldscript")
|
||||
rest = m.group("rest").rstrip("\n")
|
||||
rsp = f"{name}.rsp"
|
||||
return (
|
||||
f"\t$(file >{rsp},{rest})\n"
|
||||
f"\t$(CC) {flags} -Wl,-soname={name} "
|
||||
f"-o {name} -Wl,--version-script={ldscript} @{rsp}\n"
|
||||
)
|
||||
|
||||
new_content, count = pattern.subn(build_replacement, content)
|
||||
if count:
|
||||
save(self, makefile_path, new_content)
|
||||
|
||||
def _make(self):
|
||||
with chdir(self, self.source_folder):
|
||||
args = " ".join(self._configure_args)
|
||||
@@ -518,6 +546,8 @@ class OpenSSLConan(ConanFile):
|
||||
self._replace_runtime_in_file(os.path.join("Configurations", "10-main.conf"))
|
||||
|
||||
self.run(f"{self._perl} ./Configure {args}", env="conanbuild")
|
||||
if self.settings.os == "Android" and self.settings_build.os == "Windows":
|
||||
self._patch_makefile_long_link_lines()
|
||||
if self._use_nmake:
|
||||
# When `--prefix=/`, the scripts derive `\` without escaping, which
|
||||
# causes issues on Windows
|
||||
@@ -530,6 +560,16 @@ class OpenSSLConan(ConanFile):
|
||||
replace_in_file(self, mkinstallvars_pl, "$values{$k} = $v;", """$v->[0] =~ s|\\\\|/|g; $values{$k} = $v;""")
|
||||
else:
|
||||
replace_in_file(self, mkinstallvars_pl, "$ENV{$k} = $v;", """$v =~ s|\\\\|/|g; $ENV{$k} = $v;""")
|
||||
if self.settings.os == "Android":
|
||||
# Android shared libs are named libcrypto_3.so/libssl_3.so (no
|
||||
# libcrypto.so symlink), so the `-lcrypto` in engine link lines
|
||||
# resolves to the static archive; build the archives first,
|
||||
# otherwise a parallel make can link engines against a
|
||||
# half-assembled libcrypto.a (undefined ossl_* symbols).
|
||||
# The bare .a file targets don't pull in build_generated (the
|
||||
# mandatory generated headers), so run it explicitly first.
|
||||
self._run_make(targets=["build_generated"])
|
||||
self._run_make(targets=["libcrypto.a", "libssl.a"])
|
||||
self._run_make()
|
||||
|
||||
def _make_install(self):
|
||||
@@ -682,4 +722,4 @@ class OpenSSLConan(ConanFile):
|
||||
self.cpp_info.components["ssl"].set_property("pkg_config_name", "libssl")
|
||||
|
||||
openssl_modules_dir = os.path.join(self.package_folder, "lib", "ossl-modules")
|
||||
self.runenv_info.define_path("OPENSSL_MODULES", openssl_modules_dir)
|
||||
self.runenv_info.define_path("OPENSSL_MODULES", openssl_modules_dir)
|
||||
@@ -1,10 +1,13 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain
|
||||
from conan.tools.env import VirtualBuildEnv
|
||||
from conan.tools.files import copy, apply_conandata_patches, export_conandata_patches
|
||||
from conan.tools.scm import Git
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
class OpenvpnPtAndroid(ConanFile):
|
||||
name = "openvpn-pt-android"
|
||||
@@ -28,6 +31,10 @@ class OpenvpnPtAndroid(ConanFile):
|
||||
raise ConanInvalidConfiguration(f"{self.name} only supports Android, got {self.settings.os}")
|
||||
|
||||
def source(self):
|
||||
if os.path.isdir(self.source_folder):
|
||||
for entry in os.listdir(self.source_folder):
|
||||
path = os.path.join(self.source_folder, entry)
|
||||
shutil.rmtree(path) if os.path.isdir(path) else os.remove(path)
|
||||
git = Git(self)
|
||||
git.clone(
|
||||
url="https://github.com/amnezia-vpn/openvpn-pt-android.git",
|
||||
@@ -36,6 +43,13 @@ class OpenvpnPtAndroid(ConanFile):
|
||||
)
|
||||
|
||||
def generate(self):
|
||||
venv = VirtualBuildEnv(self)
|
||||
# sum.golang.org is sometimes unreachable from CI runners entirely
|
||||
# ("connection refused"); go.sum already pins the exact hashes we
|
||||
# need, so the extra public-transparency-log check isn't required.
|
||||
venv.environment().define("GOSUMDB", "off")
|
||||
venv.generate()
|
||||
|
||||
tc = CMakeToolchain(self)
|
||||
tc.generate()
|
||||
|
||||
@@ -53,5 +67,5 @@ class OpenvpnPtAndroid(ConanFile):
|
||||
self.cpp_info.set_property("cmake_target_name", "amnezia::openvpn-pt-android")
|
||||
self.cpp_info.libs = [ "ovpn3", "ovpnutil", "rsapss" ]
|
||||
self.cpp_info.set_property("cmake_extra_variables", {
|
||||
"OPENVPN_PT_ANDROID_LIBCK_OVPN_PLUGIN_PATH": os.path.join(self.package_folder, "lib", "libck-ovpn-plugin.so")
|
||||
"OPENVPN_PT_ANDROID_LIBCK_OVPN_PLUGIN_PATH": Path(self.package_folder, "lib", "libck-ovpn-plugin.so").as_posix()
|
||||
})
|
||||
Reference in new issue
Block a user