Browse code

vcpkg: switch to manifest

Add vcpkg manifest file which lists
dependencies and enable manifest usage in
project file.

This simplifies build process by eliminating
separate "vcpkg install" step to install dependencies.

Since vcpkg added openssl3 port, remove ours.

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

Lev Stipakov authored on 2022/05/05 21:14:49
Showing 8 changed files
... ...
@@ -290,19 +290,17 @@ jobs:
290 290
       - name: Install rst2html
291 291
         run: python -m pip install --upgrade pip rst2html
292 292
 
293
-      - name: Restore artifacts, or run vcpkg, build and cache artifacts
294
-        uses: lukka/run-vcpkg@v7.4
293
+      - name: Restore artifacts, or setup vcpkg (do not install any package)
294
+        uses: lukka/run-vcpkg@v10
295 295
         with:
296
-          vcpkgGitCommitId: 'a69b65229b3956b7f45abd81671b7330114bcaad'
297
-          vcpkgArguments: 'openssl3 lz4 lzo pkcs11-helper tap-windows6'
298
-          vcpkgTriplet: '${{ matrix.triplet }}-windows-ovpn'
299
-          cleanAfterBuild: false
296
+          vcpkgGitCommitId: '4b766c1cd17205e1b768c4fadfd5f867c1d0510e'
297
+          appendedCacheKey: '${{matrix.triplet}}'
300 298
 
301
-      - name: Build
299
+      - name: Run MSBuild consuming vcpkg.json
302 300
         working-directory: ${{env.GITHUB_WORKSPACE}}
303 301
         run: |
304
-          vcpkg integrate install
305
-          msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform="${{ matrix.plat }}" .
302
+            vcpkg integrate install
303
+            msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform="${{ matrix.plat }}" .
306 304
 
307 305
       - name: Archive artifacts
308 306
         uses: actions/upload-artifact@v2
... ...
@@ -44,6 +44,7 @@ m4/ltoptions.m4
44 44
 m4/ltsugar.m4
45 45
 m4/ltversion.m4
46 46
 m4/lt~obsolete.m4
47
+vcpkg_installed
47 48
 
48 49
 version.sh
49 50
 msvc-env-local.bat
50 51
deleted file mode 100644
... ...
@@ -1,166 +0,0 @@
1
-# based on openssl port from vcpkg official repo
2
-
3
-if(EXISTS ${CURRENT_INSTALLED_DIR}/include/openssl/ssl.h)
4
-    message(FATAL_ERROR "Can't build '${PORT}' if another SSL library is installed. Please remove existing one and try install '${PORT}' again if you need it.")
5
-endif()
6
-
7
-vcpkg_from_github(
8
-    OUT_SOURCE_PATH SOURCE_PATH
9
-    REPO openssl/openssl
10
-    REF openssl-3.0.2
11
-    SHA512 d69c87b8250da813f282ead0bd005ebde663e77595ee8d99560d25f345570da2fa552b57c372956d461e3b631a19d6d60bebafe6ff89aeebbb5d34ad516b62ac
12
-)
13
-
14
-vcpkg_find_acquire_program(PERL)
15
-get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
16
-vcpkg_add_to_path("${PERL_EXE_PATH}")
17
-
18
-vcpkg_find_acquire_program(NASM)
19
-get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY)
20
-vcpkg_add_to_path(PREPEND "${NASM_EXE_PATH}")
21
-
22
-vcpkg_find_acquire_program(JOM)
23
-
24
-set(OPENSSL_SHARED no-shared)
25
-if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
26
-    set(OPENSSL_SHARED shared)
27
-endif()
28
-
29
-# see ${SOURCE_PATH}/INSTALL.md
30
-list(APPEND CONFIGURE_OPTIONS
31
-    no-zlib
32
-    no-ui-console   # Don't build with the User Interface (UI) console method
33
-    no-makedepend   # Don't generate dependencies
34
-    no-module       # Don't build any dynamically loadable engines
35
-    no-tests        # Don't build test programs or run any tests
36
-    enable-legacy   # link statically legacy provider instead of generating legacy.dll
37
-    -utf-8
38
-    -FS
39
-    ${OPENSSL_SHARED}
40
-)
41
-
42
-set(CONFIGURE_COMMAND "${PERL}" Configure ${CONFIGURE_OPTIONS})
43
-
44
-if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
45
-    set(OPENSSL_ARCH VC-WIN32)
46
-elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
47
-    set(OPENSSL_ARCH VC-WIN64A)
48
-elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
49
-    set(OPENSSL_ARCH VC-WIN32-ARM)
50
-elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
51
-    set(OPENSSL_ARCH VC-WIN64-ARM)
52
-else()
53
-    message(FATAL_ERROR "Unsupported target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
54
-endif()
55
-
56
-set(OPENSSL_MAKEFILE "makefile")
57
-
58
-file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
59
-                    "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
60
-
61
-if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
62
-
63
-    # Copy openssl sources.
64
-    message(STATUS "Copying openssl release source files...")
65
-    file(GLOB OPENSSL_SOURCE_FILES ${SOURCE_PATH}/*)
66
-    foreach(SOURCE_FILE ${OPENSSL_SOURCE_FILES})
67
-        file(COPY ${SOURCE_FILE} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
68
-    endforeach()
69
-    message(STATUS "Copying openssl release source files... done")
70
-    set(SOURCE_PATH_RELEASE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
71
-
72
-    set(OPENSSLDIR_RELEASE ${CURRENT_PACKAGES_DIR})
73
-
74
-    message(STATUS "Configure ${TARGET_TRIPLET}-rel")
75
-    vcpkg_execute_required_process(
76
-        COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_RELEASE}" "--openssldir=${OPENSSLDIR_RELEASE}"
77
-        WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
78
-        LOGNAME configure-perl-${TARGET_TRIPLET}-rel
79
-    )
80
-    message(STATUS "Configure ${TARGET_TRIPLET}-rel done")
81
-
82
-    message(STATUS "Build ${TARGET_TRIPLET}-rel")
83
-    # Openssl's buildsystem has a race condition which will cause JOM to fail at some point.
84
-    # This is ok; we just do as much work as we can in parallel first, then follow up with a single-threaded build.
85
-    execute_process(
86
-        COMMAND ${JOM} -k -j ${VCPKG_CONCURRENCY} -f ${OPENSSL_MAKEFILE}
87
-        WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
88
-        OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-0-out.log
89
-        ERROR_FILE ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-0-err.log
90
-    )
91
-    vcpkg_execute_required_process(
92
-        COMMAND nmake -f ${OPENSSL_MAKEFILE} install_dev install_runtime install_ssldirs
93
-        WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
94
-        LOGNAME build-${TARGET_TRIPLET}-rel-1)
95
-
96
-    message(STATUS "Build ${TARGET_TRIPLET}-rel done")
97
-endif()
98
-
99
-if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
100
-    # Copy openssl sources.
101
-    message(STATUS "Copying openssl debug source files...")
102
-    file(GLOB OPENSSL_SOURCE_FILES ${SOURCE_PATH}/*)
103
-    foreach(SOURCE_FILE ${OPENSSL_SOURCE_FILES})
104
-        file(COPY ${SOURCE_FILE} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
105
-    endforeach()
106
-    message(STATUS "Copying openssl debug source files... done")
107
-    set(SOURCE_PATH_DEBUG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
108
-
109
-    set(OPENSSLDIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug)
110
-
111
-    message(STATUS "Configure ${TARGET_TRIPLET}-dbg")
112
-    vcpkg_execute_required_process(
113
-        COMMAND ${CONFIGURE_COMMAND} debug-${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_DEBUG}" "--openssldir=${OPENSSLDIR_DEBUG}"
114
-        WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
115
-        LOGNAME configure-perl-${TARGET_TRIPLET}-dbg
116
-    )
117
-    message(STATUS "Configure ${TARGET_TRIPLET}-dbg done")
118
-
119
-    message(STATUS "Build ${TARGET_TRIPLET}-dbg")
120
-    execute_process(
121
-        COMMAND "${JOM}" -k -j ${VCPKG_CONCURRENCY} -f "${OPENSSL_MAKEFILE}"
122
-        WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
123
-        OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-dbg-0-out.log
124
-        ERROR_FILE ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-dbg-0-err.log
125
-    )
126
-    vcpkg_execute_required_process(
127
-        COMMAND nmake -f "${OPENSSL_MAKEFILE}" install_dev install_runtime install_ssldirs
128
-        WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
129
-        LOGNAME build-${TARGET_TRIPLET}-dbg-1)
130
-
131
-    message(STATUS "Build ${TARGET_TRIPLET}-dbg done")
132
-endif()
133
-
134
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/certs")
135
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/private")
136
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/certs")
137
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/private")
138
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
139
-
140
-file(REMOVE
141
-    "${CURRENT_PACKAGES_DIR}/ct_log_list.cnf"
142
-    "${CURRENT_PACKAGES_DIR}/ct_log_list.cnf.dist"
143
-    "${CURRENT_PACKAGES_DIR}/openssl.cnf.dist"
144
-    "${CURRENT_PACKAGES_DIR}/debug/bin/openssl.exe"
145
-    "${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf"
146
-    "${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf.dist"
147
-    "${CURRENT_PACKAGES_DIR}/debug/openssl.cnf"
148
-    "${CURRENT_PACKAGES_DIR}/debug/openssl.cnf.dist"
149
-)
150
-
151
-file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/openssl/")
152
-file(RENAME "${CURRENT_PACKAGES_DIR}/bin/openssl.exe" "${CURRENT_PACKAGES_DIR}/tools/openssl/openssl.exe")
153
-file(RENAME "${CURRENT_PACKAGES_DIR}/openssl.cnf" "${CURRENT_PACKAGES_DIR}/tools/openssl/openssl.cnf")
154
-
155
-vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/openssl")
156
-
157
-if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
158
-    # They should be empty, only the exes deleted above were in these directories
159
-    file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin/")
160
-    file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin/")
161
-endif()
162
-
163
-vcpkg_copy_pdbs()
164
-
165
-file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
166
-file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
167 1
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-The package openssl3 is compatible with built-in CMake targets:
2
-
3
-    find_package(OpenSSL REQUIRED)
4
-    target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)
5 1
deleted file mode 100644
... ...
@@ -1,7 +0,0 @@
1
-{
2
-  "name": "openssl3",
3
-  "version-semver": "3.0.2",
4
-  "description": "TLS/SSL and crypto library",
5
-  "homepage": "https://www.openssl.org/",
6
-  "license": "Apache-2.0"
7
-}
... ...
@@ -22,7 +22,7 @@ vcpkg_build_nmake(
22 22
     PROJECT_NAME Makefile.w32-vc
23 23
     OPTIONS
24 24
         OPENSSL=1
25
-        OPENSSL_HOME=${CURRENT_PACKAGES_DIR}/../openssl3_${TARGET_TRIPLET}
25
+        OPENSSL_HOME=${CURRENT_PACKAGES_DIR}/../openssl_${TARGET_TRIPLET}
26 26
 )
27 27
 
28 28
 file(INSTALL ${SOURCE_PATH}/include/pkcs11-helper-1.0 DESTINATION ${CURRENT_PACKAGES_DIR}/include/)
... ...
@@ -124,26 +124,35 @@
124 124
   <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
125 125
     <VcpkgEnabled>true</VcpkgEnabled>
126 126
     <VcpkgTriplet>arm64-windows-ovpn</VcpkgTriplet>
127
+    <VcpkgAdditionalInstallOptions>--overlay-triplets=$(SolutionDir)contrib\vcpkg-triplets --overlay-ports=$(SolutionDir)contrib\vcpkg-ports</VcpkgAdditionalInstallOptions>
127 128
   </PropertyGroup>
128 129
   <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
129 130
     <VcpkgEnabled>true</VcpkgEnabled>
130 131
     <VcpkgTriplet>arm64-windows-ovpn</VcpkgTriplet>
132
+    <VcpkgAdditionalInstallOptions>--overlay-triplets=$(SolutionDir)contrib\vcpkg-triplets --overlay-ports=$(SolutionDir)contrib\vcpkg-ports</VcpkgAdditionalInstallOptions>
131 133
   </PropertyGroup>
132 134
   <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
133 135
     <VcpkgEnabled>true</VcpkgEnabled>
134 136
     <VcpkgTriplet>x86-windows-ovpn</VcpkgTriplet>
137
+    <VcpkgAdditionalInstallOptions>--overlay-triplets=$(SolutionDir)contrib\vcpkg-triplets --overlay-ports=$(SolutionDir)contrib\vcpkg-ports</VcpkgAdditionalInstallOptions>
135 138
   </PropertyGroup>
136 139
   <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
137 140
     <VcpkgEnabled>true</VcpkgEnabled>
138 141
     <VcpkgTriplet>x86-windows-ovpn</VcpkgTriplet>
142
+    <VcpkgAdditionalInstallOptions>--overlay-triplets=$(SolutionDir)contrib\vcpkg-triplets --overlay-ports=$(SolutionDir)contrib\vcpkg-ports</VcpkgAdditionalInstallOptions>
139 143
   </PropertyGroup>
140 144
   <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
141 145
     <VcpkgEnabled>true</VcpkgEnabled>
142 146
     <VcpkgTriplet>x64-windows-ovpn</VcpkgTriplet>
147
+    <VcpkgAdditionalInstallOptions>--overlay-triplets=$(SolutionDir)contrib\vcpkg-triplets --overlay-ports=$(SolutionDir)contrib\vcpkg-ports</VcpkgAdditionalInstallOptions>
143 148
   </PropertyGroup>
144 149
   <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
145 150
     <VcpkgEnabled>true</VcpkgEnabled>
146 151
     <VcpkgTriplet>x64-windows-ovpn</VcpkgTriplet>
152
+    <VcpkgAdditionalInstallOptions>--overlay-triplets=$(SolutionDir)contrib\vcpkg-triplets --overlay-ports=$(SolutionDir)contrib\vcpkg-ports</VcpkgAdditionalInstallOptions>
153
+  </PropertyGroup>
154
+  <PropertyGroup Label="Vcpkg">
155
+    <VcpkgEnableManifest>true</VcpkgEnableManifest>
147 156
   </PropertyGroup>
148 157
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
149 158
     <ClCompile>
150 159
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+{
1
+  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
2
+  "name": "openvpn",
3
+  "version": "2.6",
4
+  "dependencies": [
5
+    "openssl",
6
+    "tap-windows6",
7
+    "lzo",
8
+    "lz4",
9
+    "pkcs11-helper"
10
+  ],
11
+  "builtin-baseline": "4b766c1cd17205e1b768c4fadfd5f867c1d0510e"
12
+}