From patchwork Fri Feb 14 12:52:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4142 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:9b51:b0:5e7:b9eb:58e8 with SMTP id b17csp173137max; Fri, 14 Feb 2025 04:52:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVMWiYQxIv/RyCzdSAXRuMc2nK7/MVx8lMvj03Cpg6uyL7x8W3SF32UlzEynjUwrRAKYZVyAX7o1qw=@openvpn.net X-Google-Smtp-Source: AGHT+IHxy+Ok1kb1/Ut9QI5OcC3qElUZSsS9agynBpI3qjGjqRj61NutyPbQSsRxN6JWyEuYfjAU X-Received: by 2002:a05:6808:80cc:b0:3f3:b0ae:7998 with SMTP id 5614622812f47-3f3cd601076mr8738365b6e.17.1739537577852; Fri, 14 Feb 2025 04:52:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739537577; cv=none; d=google.com; s=arc-20240605; b=PcJlGbQ6T4sCmaZjJbmSnDl3RX1o8pO/D58HiAJwDcsRg6QiEugIdIG2V9Qk9fC39c WxZn0JhXRSnsnl0KJQ1VMKW9MwGqTw4eA8Ld2JcFVaBBXPngcsNFreVW6YROKsCMWDY/ EV8AME8wQlJL5/glSgP8hjSJTO2UMkKNObAc+X7giMt52tXBDXBny8kPortaj0aEwqS9 dQ5XMoSqSvf62m1jVBHEhlE3H18Vh2WINUvHfMhBH7AQiUr2a89LcyFyGWWtO9sJyaV0 EpJM2yrJOuN22GtJeagbZPh+W+Oy4+e8OxsNsxI+aPLIDKBRcStQ7Ad8nWC/7twtJc/X vkgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=oFWRttEYuDozIG6KYjMqjv+AHfjDGq6FvWGwYg5lIuo=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=OV49RXzoYNScWrxvFUCZaqrxjPMnwNOXkzPT4/mynJPTaW8PTvHEZu+cUdFcFIHe6Q jOpsOt+uuWoZr3VPpb2+gwn4ZVB5Alf3evZjISYVoGi4pJX9RnGDrbodp+VuNNU19P/J BdC6Y+8Zhxg3qE13WBgLM6wM3rmtca0FHJzyPGtwOEvZ3/GE8coOpru1GSrxGPv6IPf8 KkhHJhwPKqCeS0novlTXla1dE+PTT43b397SN/uVzeSw2Zhr4Dwll/czw0Ok+N3SAbGP IF45qMtaEsBruMfG7/mxrpiKC7Y9CYOF7QBtUlfUunYFDoLc5v8hig6aKbNIQctxZ8Kd mZJg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=EscaoqHy; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Ffc1ShaL; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-3f3daa23745si2778412b6e.254.2025.02.14.04.52.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Feb 2025 04:52:57 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=EscaoqHy; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Ffc1ShaL; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tivBe-0002pV-Ie; Fri, 14 Feb 2025 12:52:55 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tivBa-0002pD-MM for openvpn-devel@lists.sourceforge.net; Fri, 14 Feb 2025 12:52:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kevUTua1haIXO08jFeCS1n/wrlMqrpgwSa6QMFt2aeI=; b=EscaoqHyW+x6qxDX5QoCSPdHHF zy9CJSPwYCWQUK7ulKaRAs0e+GOWGMUYD7IIMjv3gnSIwG49Mm1oAzDGrHEz3RTaO2r6EBptahNyK Epm/6ixDwCpJ29YCrX7ZMo/HyVT7gjT+hA9ad1zimgv7yCGMdfTvJ4uGs6y4F2JEpIow=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=kevUTua1haIXO08jFeCS1n/wrlMqrpgwSa6QMFt2aeI=; b=Ffc1ShaLbagbnC1cy2tTSbRvL4 4VplJSMbzjAlUKJCpIa9CU6xSA36EPleLVI0UYz7eHxMahteqVkYaYUbU+5SGxJoYIiZir7xbpqfO Jd1NjJ1M6EPfQleArPVKoUHTZjCmaYIriiMpcOuT+S21AawO7O6Wl+XUGz6Kqv+rnmsY=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tivBa-0006Ri-MB for openvpn-devel@lists.sourceforge.net; Fri, 14 Feb 2025 12:52:51 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 51ECqdbM017570 for ; Fri, 14 Feb 2025 13:52:39 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 51ECqdnR017569 for openvpn-devel@lists.sourceforge.net; Fri, 14 Feb 2025 13:52:39 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 14 Feb 2025 13:52:38 +0100 Message-ID: <20250214125238.17558-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Arne Schwabe There is a mode to build with a real Android NDK that requires setting up cmake to build with the NDK and so. For quick&dirty compile tests that do not actually use the Android NDK on Linux, -DFAKE_AN [...] Content analysis details: (0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in bl.score.senderscore.com] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1tivBa-0006Ri-MB Subject: [Openvpn-devel] [PATCH v3] Add Android cmake building X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1824037355261370056?= X-GMAIL-MSGID: =?utf-8?q?1824037355261370056?= From: Arne Schwabe There is a mode to build with a real Android NDK that requires setting up cmake to build with the NDK and so. For quick&dirty compile tests that do not actually use the Android NDK on Linux, -DFAKE_ANDROID on Linux can be used to compile a binary using TARGET_ANDROID. Change-Id: If6afa1108f9234f98afdbe0de7b7320403871772 Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/895 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/CMakeLists.txt b/CMakeLists.txt index 5081e81..b04adce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ option(ENABLE_LZO "BUILD with lzo" ON) option(ENABLE_PKCS11 "BUILD with pkcs11-helper" ON) option(USE_WERROR "Treat compiler warnings as errors (-Werror)" ON) +option(FAKE_ANDROID "Target Android but do not use actual cross compile/Android cmake to build for simple compile checks on Linux") set(PLUGIN_DIR /usr/local/lib/openvpn/plugins CACHE FILEPATH "Location of the plugin directory") @@ -122,7 +123,14 @@ set(CMAKE_C_STANDARD 11) # Set the various defines for config.h.cmake.in -if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +if (${CMAKE_SYSTEM_NAME} STREQUAL "Android" OR ${FAKE_ANDROID}) + set(TARGET_ANDROID YES) + set(ENABLE_ASYNC_PUSH YES) + set(ENABLE_SITNL YES) + set(HAVE_LINUX_TYPES_H 1) + # Wacky workaround as OpenSSL package detection is otherwise broken (https://stackoverflow.com/questions/45958214/android-cmake-could-not-find-openssl) + list(APPEND CMAKE_FIND_ROOT_PATH ${OPENSSL_ROOT_DIR}) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(TARGET_LINUX YES) set(ENABLE_ASYNC_PUSH YES) set(ENABLE_LINUXDCO YES) diff --git a/config.h.cmake.in b/config.h.cmake.in index 74a53a6..2f7b43d 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -432,6 +432,9 @@ /* Are we running WIN32? */ #cmakedefine TARGET_WIN32 +/* Are we targeting Android? */ +#cmakedefine TARGET_ANDROID + #define TARGET_ALIAS "@CMAKE_SYSTEM_NAME@" /* Enable GNU extensions on systems that have them. */