Files
amnezia-client/recipes/openvpn-pt-android/patches/0001-fix-cloak-go-build.patch
Yaroslav Gurov 009ca981d5 feat: initial conan support and build process refactoring (#2260)
* feat: initial conan support

* feat: add awg-go and awg-apple recipes

* feat: macos full feature conan build, except ss and cloak

* feat: conan android initial support

* fix: android libssh fixes

* conan: android additional recipes and fixes

* feat: openvpn add support android

* fix: awg android connection establish

* conan: apple full-featured support

* chore: bump min macos version

* chore: get rid of manual deploy recursive copying

* conan: beautify makefile-based recipes

* conan: add geosite.dat and geoip.dat

* conan: use lib linking instead of QT_EXTRA_LIBS for OVPN

* conan: address lack of SONAME of libck-ovpn-plugin.so correctly

* conan: windows initial support

* conan: make awg-windows and wintun be interpret as exes

* conan: fix version for v2ray-rules-dat

* feat: conan and platform bootstrap rework in cmake

* feat: 16kb support for Android

* chore(conan): recipes cleanup

* feat: support of drivers for windows

* feat: support full-featured cmake install

* chore: exclude qtkeychain from the target build

* fix: install for apple systems

* fix: provide flags for cloak plugin for openvpn-pt-android

* chore: bump android deps for 16kb support

* feat(conan): patch cloak to properly provide env for golang

* chore: remove redundant hint from conan find

* feat: linux <-> conan features

* feat: linux initial packaging support

* feat: linux cpack support

* feat: cpack windows full-featured build

* feat: productbuild cpack support

* feat: rework CI/CD for macos

* feat: rework CI/CD for Linux

* fix: libncap automake args

* fix: CI/CD correct QT paths

* fix: windows rework CI/CD

* fix: windows artifact upload

* chore: remove MacOS-old from build targets

* feat: add conan to all mobile and NE builds

* feat: support default amnezia conan remote

* fix: use Release instead of release on Android

* feat: get rid of 3rd-prebuilt

* feat: conan CI/CD upload

* fix: CI/CD change windows toolset versions

* fix: remove MSVC version from CI/CD

* feat: conan CI/CD add Release and Debug build types

* feat: add multiple xcode versions for conan CI/CD

* fix: correct conan CI/CD clang versions

* feat: separate prebuilt baking, and add some for NE

* feat: rework keychain on ios/macos even more

* fix: add desktop Qt for iOS

* feat: add QT_HOST_PATH to build.sh

* fix: add deploy definition to cmake

* fix: android adjustments for toolchains and CI/CD

* fix: add needs for Android CI/CD

* fix: Android CI/CD use android-28

* fix: modernize translations, and CI/CD fixes

* fix: gradle min sdk compilation error

* fix: CI/CD add installers to all jobs

* fix: parse android platform more precisely

* fix: adjust aab path in CI/CD

* feat: CI/CD do not execute artifact build if there is nothing changed

* fix: CI/CD use common jobs even if previous were failed

* fix: Apple CI/CD use set-key-partition-list for keychains

* fix: Apple CI/CD do not specify any keychain (use default)

* fix: build aab as a different step in build script

* chore: beautify build.sh script

* feat: CI/CD build separate APKs per ABI

* fix: Android CI/CD upload artifact in separate steps

* chore: recipes cleanup

* feat: add hints for conan on MacOS

* fix: add main.cpp and tests back to CMakeLists.txt

* chore: xrayProtocol codestyle changes

* fix: openssl set proper X509 request version

* fix: make openvpn protocol rely only on client while configuring

* chore: get rid of old scripts

* chore: readme update describing build process more precisely

* feat: windows build script add multiprocessing capabilities

* chore: bump Qt version in README

* feat: add generator option and use Ninja by default in CI/CD for linux/macos

---------

Co-authored-by: NickVs2015 <nv@amnezia.org>
2026-05-04 22:59:24 +08:00

66 lines
2.7 KiB
Diff

From 5a96e1a9a5116917969afdd7adebfa895ff42617 Mon Sep 17 00:00:00 2001
From: Yaroslav Gurov <ygurov@proton.me>
Date: Mon, 30 Mar 2026 17:38:11 +0200
Subject: [PATCH] fix cloak go build
---
cloak.cmake | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/cloak.cmake b/cloak.cmake
index 8199ebc..d8ef1cb 100644
--- a/cloak.cmake
+++ b/cloak.cmake
@@ -9,36 +9,32 @@ list(APPEND CMAKE_PROGRAM_PATH "/usr/local/go/bin")
find_program(GO_EXEC go)
set(BUILD_CMD_ARGS build)
-list(APPEND BUILD_CMD_ARGS -buildmode=c-shared -o ${CMAKE_CURRENT_BINARY_DIR}/${CLOAK_LIB} ${CMAKE_GO_FLAGS} ./...)
-
-set(PREPARE_ENV_ARGS env)
-list(APPEND PREPARE_ENV_ARGS -w CGO_ENABLED=1 GOOS=android)
-
+list(APPEND BUILD_CMD_ARGS -buildmode=c-shared -v -o ${CMAKE_CURRENT_BINARY_DIR}/${CLOAK_LIB} ./...)
string(REGEX MATCH "[0-9]+$" ANDROID_API_LEVEL ${ANDROID_PLATFORM})
message(WARNING "build cloak plugin abi=${ANDROID_ABI}, ANDROID_API_LEVEL=${ANDROID_API_LEVEL}")
+list(APPEND GO_ENV CGO_ENABLED=1 GOOS=android)
+list(APPEND GO_ENV "CC=${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET}")
if ("${ANDROID_ABI}" STREQUAL "x86")
- list(APPEND PREPARE_ENV_ARGS GOARCH=386)
- list(APPEND PREPARE_ENV_ARGS CC=${ANDROID_TOOLCHAIN_ROOT}/bin/i686-linux-android${ANDROID_API_LEVEL}-clang)
+ list(APPEND GO_ENV GOARCH=386)
elseif ("${ANDROID_ABI}" STREQUAL "x86_64")
- list(APPEND PREPARE_ENV_ARGS GOARCH=amd64)
- list(APPEND PREPARE_ENV_ARGS CC=${ANDROID_TOOLCHAIN_ROOT}/bin/x86_64-linux-android${ANDROID_API_LEVEL}-clang)
+ list(APPEND GO_ENV GOARCH=amd64)
elseif ("${ANDROID_ABI}" STREQUAL "arm64-v8a")
- list(APPEND PREPARE_ENV_ARGS GOARCH=arm64)
- list(APPEND PREPARE_ENV_ARGS CC=${ANDROID_TOOLCHAIN_ROOT}/bin/aarch64-linux-android${ANDROID_API_LEVEL}-clang)
+ list(APPEND GO_ENV GOARCH=arm64)
elseif ("${ANDROID_ABI}" STREQUAL "armeabi-v7a")
- list(APPEND PREPARE_ENV_ARGS GOARCH=arm)
- list(APPEND PREPARE_ENV_ARGS GOARM=7)
- list(APPEND PREPARE_ENV_ARGS CC=${ANDROID_TOOLCHAIN_ROOT}/bin/armv7a-linux-androideabi${ANDROID_API_LEVEL}-clang)
+ list(APPEND GO_ENV GOARCH=arm)
+ list(APPEND GO_ENV GOARM=7)
endif ()
+string(REPLACE -mthumb -marm GO_C_FLAGS ${CMAKE_C_FLAGS})
+list(APPEND GO_ENV "CGO_CFLAGS=${GO_C_FLAGS}")
+list(APPEND GO_ENV "CGO_LDFLAGS=${GO_C_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CLOAK_LIB}
DEPENDS ${CLOAK_SRCS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cloak/cmd/ck-ovpn-plugin
- COMMAND ${GO_EXEC} ${PREPARE_ENV_ARGS}
- COMMAND ${GO_EXEC} ${BUILD_CMD_ARGS}
+ COMMAND ${CMAKE_COMMAND} -E env ${GO_ENV} ${GO_EXEC} ${BUILD_CMD_ARGS}
COMMENT "Building Go library")
add_custom_target(${TARGET} DEPENDS ${CLOAK_LIB} ${HEADER})
--
2.50.1 (Apple Git-155)