[Openvpn-devel,master+release/2.5] vcpkg: link lzo statically

Message ID 20220216134227.147-1-lstipakov@gmail.com
State Accepted
Headers show
Series
  • [Openvpn-devel,master+release/2.5] vcpkg: link lzo statically
Related show

Commit Message

Lev Stipakov Feb. 16, 2022, 1:42 p.m.
From: Lev Stipakov <lev@openvpn.net>

Having .dll for a single executable doesn't make
much sense. Static linking removes 117kb .dll
and grows .exe size by only 4kb.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
---
 contrib/vcpkg-triplets/arm64-windows-ovpn.cmake | 3 ++-
 contrib/vcpkg-triplets/x64-windows-ovpn.cmake   | 3 ++-
 contrib/vcpkg-triplets/x86-windows-ovpn.cmake   | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

Comments

Gert Doering Feb. 17, 2022, 2:59 p.m. | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

That came out of the "shouldn't we simplify our build scripts to make
lz4 dynamic"... turns out that dynamic libs used by a single binary only
are particulary inefficient here.  Thus, going the other way :)

I have not tested this, just looked at it, and it looks reasonable
(and affects only .cmake stuff)

Your patch has been applied to the master branch.

commit cac1ebd859e9d60642d2375a2c0bdacac35ca12c (master)
commit eded6a32edcb7d4378140fcbf984fae4d8735029 (release/2.5)
Author: Lev Stipakov
Date:   Wed Feb 16 15:42:27 2022 +0200

     vcpkg: link lzo statically

     Signed-off-by: Lev Stipakov <lev@openvpn.net>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220216134227.147-1-lstipakov@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23807.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/contrib/vcpkg-triplets/arm64-windows-ovpn.cmake b/contrib/vcpkg-triplets/arm64-windows-ovpn.cmake
index dd3c6c0a..dc600056 100644
--- a/contrib/vcpkg-triplets/arm64-windows-ovpn.cmake
+++ b/contrib/vcpkg-triplets/arm64-windows-ovpn.cmake
@@ -2,6 +2,7 @@  set(VCPKG_TARGET_ARCHITECTURE arm64)
 set(VCPKG_CRT_LINKAGE dynamic)
 set(VCPKG_LIBRARY_LINKAGE dynamic)
 
-if(PORT STREQUAL "lz4")
+set(STATIC_PORTS lz4 lzo)
+if(PORT IN_LIST STATIC_PORTS)
     set(VCPKG_LIBRARY_LINKAGE static)
 endif()
diff --git a/contrib/vcpkg-triplets/x64-windows-ovpn.cmake b/contrib/vcpkg-triplets/x64-windows-ovpn.cmake
index 7036ed2d..76e5cd55 100644
--- a/contrib/vcpkg-triplets/x64-windows-ovpn.cmake
+++ b/contrib/vcpkg-triplets/x64-windows-ovpn.cmake
@@ -2,6 +2,7 @@  set(VCPKG_TARGET_ARCHITECTURE x64)
 set(VCPKG_CRT_LINKAGE dynamic)
 set(VCPKG_LIBRARY_LINKAGE dynamic)
 
-if(PORT STREQUAL "lz4")
+set(STATIC_PORTS lz4 lzo)
+if(PORT IN_LIST STATIC_PORTS)
     set(VCPKG_LIBRARY_LINKAGE static)
 endif()
diff --git a/contrib/vcpkg-triplets/x86-windows-ovpn.cmake b/contrib/vcpkg-triplets/x86-windows-ovpn.cmake
index 7d3bf340..643d7bdd 100644
--- a/contrib/vcpkg-triplets/x86-windows-ovpn.cmake
+++ b/contrib/vcpkg-triplets/x86-windows-ovpn.cmake
@@ -2,6 +2,7 @@  set(VCPKG_TARGET_ARCHITECTURE x86)
 set(VCPKG_CRT_LINKAGE dynamic)
 set(VCPKG_LIBRARY_LINKAGE dynamic)
 
-if(PORT STREQUAL "lz4")
+set(STATIC_PORTS lz4 lzo)
+if(PORT IN_LIST STATIC_PORTS)
     set(VCPKG_LIBRARY_LINKAGE static)
 endif()