Hi,
I've made a patch for apr util where I added a bundled vcpkg port to test
that the latest version can be built correctly according to vcpkg
requirements. The similar thing already exists in the trunk (apr-2) and
stable apr, but doesn't in the apr util.
However, there would be a problem when compiling against apr 1.7.5, due to
the missing header. I PR-ed to the official registry update to 1.7.6, but
they will publish it after approximately a few weeks, so the github
workflow won't work. I did not actually test the workflow, but it should
work, since I copied it from the trunk.
I'm attaching the patch to the email as `apr-util-vcpkg-port-v2.txt`.
This work is a little bit rough, and requires testing (I can't test github
workflow), but I'm still sharing it.
PS: I also support official vcpkg ports for apr during recent time :3
--
Timofei Zhakov
Index: .github/workflows/windows-vcpkg.yml
===================================================================
--- .github/workflows/windows-vcpkg.yml (nonexistent)
+++ .github/workflows/windows-vcpkg.yml (working copy)
@@ -0,0 +1,36 @@
+name: vcpkg
+
+on:
+ push:
+ branches: ["1.7.x"]
+
+jobs:
+ build:
+ strategy:
+ matrix:
+ os: [windows-latest]
+ triplet:
+ - x64-windows
+ port:
+ - apr-util
+ - apr-util[crypto,dbd-sqlite3,dbd-odbc,dbd-postgresql,xlate]
+ fail-fast: false
+
+ name: "${{ matrix.port }}:${{ matrix.triplet }} on ${{ matrix.os }}"
+ runs-on: ${{ matrix.os }}
+
+ env:
+ VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
+
+ steps:
+ - name: Export GitHub Actions cache environment variables
+ uses: actions/github-script@v7
+ with:
+ script: |
+ core.exportVariable('ACTIONS_CACHE_URL',
process.env.ACTIONS_CACHE_URL || '');
+ core.exportVariable('ACTIONS_RUNTIME_TOKEN',
process.env.ACTIONS_RUNTIME_TOKEN || '');
+
+ - uses: actions/checkout@v4
+
+ - name: vcpkg install
+ run: C:\vcpkg\vcpkg.exe install ${{ matrix.port }} --head
--overlay-ports ${{ github.workspace }}\build\vcpkg --triplet ${{
matrix.triplet }} --enforce-port-checks
Index: build/vcpkg/apr-util/portfile.cmake
===================================================================
--- build/vcpkg/apr-util/portfile.cmake (nonexistent)
+++ build/vcpkg/apr-util/portfile.cmake (working copy)
@@ -0,0 +1,46 @@
+#
+# Modify REF to latest commit id from https://github.com/apache/apr-util
+# Update SHA512 with actual SHA512
+#
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO apache/apr-util
+ REF 0cf97bf278a453b976ab4305de5661560514232c
+ SHA512 0
+ HEAD_REF 1.7.x
+)
+
+if (VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ crypto FEATURE_CRYPTO
+ xlate FEATURE_XLATE
+ dbd-odbc FEATURE_DBD_ODBC
+ dbd-sqlite3 FEATURE_DBD_SQLITE3
+ dbd-postgresql FEATURE_DBD_PGQL
+ )
+
+ vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DINSTALL_PDB=OFF
+ -DAPU_HAVE_CRYPTO=${FEATURE_CRYPTO}
+ -DAPU_HAVE_ICONV=${FEATURE_XLATE}
+ -DAPU_HAVE_ODBC=${FEATURE_DBD_ODBC}
+ -DAPU_HAVE_SQLITE3=${FEATURE_DBD_SQLITE3}
+ -DAPU_HAVE_PGSQL=${FEATURE_DBD_PGQL}
+ -DAPU_USE_EXPAT=ON
+ )
+
+ vcpkg_cmake_install()
+ vcpkg_copy_pdbs()
+
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+else()
+ # In development
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION
"${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Index: build/vcpkg/apr-util/vcpkg.json
===================================================================
--- build/vcpkg/apr-util/vcpkg.json (nonexistent)
+++ build/vcpkg/apr-util/vcpkg.json (working copy)
@@ -0,0 +1,54 @@
+{
+ "name": "apr-util",
+ "version": "1.7.0",
+ "description": "Apache Portable Runtime (APR) project mission is to create
and maintain software libraries that provide a predictable and consistent
interface to underlying platform-specific implementation",
+ "homepage": "https://apr.apache.org/",
+ "license": "Apache-2.0",
+ "dependencies": [
+ "apr",
+ "expat",
+ {
+ "name": "vcpkg-cmake",
+ "host": true,
+ "platform": "windows"
+ }
+ ],
+ "features": {
+ "crypto": {
+ "description": "Crypto support",
+ "dependencies": [
+ {
+ "name": "openssl",
+ "default-features": false,
+ "features": []
+ }
+ ]
+ },
+ "dbd-odbc": {
+ "description": "Build ODBC DBD driver"
+ },
+ "dbd-sqlite3": {
+ "description": "Build SQLite3 DBD driver",
+ "dependencies": [
+ "sqlite3"
+ ]
+ },
+ "dbd-postgresql": {
+ "description": "Build PostgreSQL DBD driver",
+ "dependencies": [
+ {
+ "name": "libpq",
+ "default-features": false,
+ "features": []
+ }
+ ]
+ },
+ "xlate": {
+ "description": "Xlate support",
+ "dependencies": [
+ "libiconv"
+ ]
+ }
+ },
+ "default-features": []
+}
Index: build/vcpkg/apr-util/portfile.cmake
===================================================================
--- build/vcpkg/apr-util/portfile.cmake (nonexistent)
+++ build/vcpkg/apr-util/portfile.cmake (working copy)
@@ -0,0 +1,46 @@
+#
+# Modify REF to latest commit id from https://github.com/apache/apr-util
+# Update SHA512 with actual SHA512
+#
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO apache/apr-util
+ REF 0cf97bf278a453b976ab4305de5661560514232c
+ SHA512 0
+ HEAD_REF 1.7.x
+)
+
+if (VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ crypto FEATURE_CRYPTO
+ xlate FEATURE_XLATE
+ dbd-odbc FEATURE_DBD_ODBC
+ dbd-sqlite3 FEATURE_DBD_SQLITE3
+ dbd-postgresql FEATURE_DBD_PGQL
+ )
+
+ vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DINSTALL_PDB=OFF
+ -DAPU_HAVE_CRYPTO=${FEATURE_CRYPTO}
+ -DAPU_HAVE_ICONV=${FEATURE_XLATE}
+ -DAPU_HAVE_ODBC=${FEATURE_DBD_ODBC}
+ -DAPU_HAVE_SQLITE3=${FEATURE_DBD_SQLITE3}
+ -DAPU_HAVE_PGSQL=${FEATURE_DBD_PGQL}
+ -DAPU_USE_EXPAT=ON
+ )
+
+ vcpkg_cmake_install()
+ vcpkg_copy_pdbs()
+
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+else()
+ # In development
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION
"${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Index: build/vcpkg/apr-util/vcpkg.json
===================================================================
--- build/vcpkg/apr-util/vcpkg.json (nonexistent)
+++ build/vcpkg/apr-util/vcpkg.json (working copy)
@@ -0,0 +1,54 @@
+{
+ "name": "apr-util",
+ "version": "1.7.0",
+ "description": "Apache Portable Runtime (APR) project mission is to create
and maintain software libraries that provide a predictable and consistent
interface to underlying platform-specific implementation",
+ "homepage": "https://apr.apache.org/",
+ "license": "Apache-2.0",
+ "dependencies": [
+ "apr",
+ "expat",
+ {
+ "name": "vcpkg-cmake",
+ "host": true,
+ "platform": "windows"
+ }
+ ],
+ "features": {
+ "crypto": {
+ "description": "Crypto support",
+ "dependencies": [
+ {
+ "name": "openssl",
+ "default-features": false,
+ "features": []
+ }
+ ]
+ },
+ "dbd-odbc": {
+ "description": "Build ODBC DBD driver"
+ },
+ "dbd-sqlite3": {
+ "description": "Build SQLite3 DBD driver",
+ "dependencies": [
+ "sqlite3"
+ ]
+ },
+ "dbd-postgresql": {
+ "description": "Build PostgreSQL DBD driver",
+ "dependencies": [
+ {
+ "name": "libpq",
+ "default-features": false,
+ "features": []
+ }
+ ]
+ },
+ "xlate": {
+ "description": "Xlate support",
+ "dependencies": [
+ "libiconv"
+ ]
+ }
+ },
+ "default-features": []
+}
Index: build/vcpkg/apr-util/portfile.cmake
===================================================================
--- build/vcpkg/apr-util/portfile.cmake (nonexistent)
+++ build/vcpkg/apr-util/portfile.cmake (working copy)
@@ -0,0 +1,46 @@
+#
+# Modify REF to latest commit id from https://github.com/apache/apr-util
+# Update SHA512 with actual SHA512
+#
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO apache/apr-util
+ REF 0cf97bf278a453b976ab4305de5661560514232c
+ SHA512 0
+ HEAD_REF 1.7.x
+)
+
+if (VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ crypto FEATURE_CRYPTO
+ xlate FEATURE_XLATE
+ dbd-odbc FEATURE_DBD_ODBC
+ dbd-sqlite3 FEATURE_DBD_SQLITE3
+ dbd-postgresql FEATURE_DBD_PGQL
+ )
+
+ vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DINSTALL_PDB=OFF
+ -DAPU_HAVE_CRYPTO=${FEATURE_CRYPTO}
+ -DAPU_HAVE_ICONV=${FEATURE_XLATE}
+ -DAPU_HAVE_ODBC=${FEATURE_DBD_ODBC}
+ -DAPU_HAVE_SQLITE3=${FEATURE_DBD_SQLITE3}
+ -DAPU_HAVE_PGSQL=${FEATURE_DBD_PGQL}
+ -DAPU_USE_EXPAT=ON
+ )
+
+ vcpkg_cmake_install()
+ vcpkg_copy_pdbs()
+
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+else()
+ # In development
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION
"${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Index: build/vcpkg/apr-util/vcpkg.json
===================================================================
--- build/vcpkg/apr-util/vcpkg.json (nonexistent)
+++ build/vcpkg/apr-util/vcpkg.json (working copy)
@@ -0,0 +1,54 @@
+{
+ "name": "apr-util",
+ "version": "1.7.0",
+ "description": "Apache Portable Runtime (APR) project mission is to create
and maintain software libraries that provide a predictable and consistent
interface to underlying platform-specific implementation",
+ "homepage": "https://apr.apache.org/",
+ "license": "Apache-2.0",
+ "dependencies": [
+ "apr",
+ "expat",
+ {
+ "name": "vcpkg-cmake",
+ "host": true,
+ "platform": "windows"
+ }
+ ],
+ "features": {
+ "crypto": {
+ "description": "Crypto support",
+ "dependencies": [
+ {
+ "name": "openssl",
+ "default-features": false,
+ "features": []
+ }
+ ]
+ },
+ "dbd-odbc": {
+ "description": "Build ODBC DBD driver"
+ },
+ "dbd-sqlite3": {
+ "description": "Build SQLite3 DBD driver",
+ "dependencies": [
+ "sqlite3"
+ ]
+ },
+ "dbd-postgresql": {
+ "description": "Build PostgreSQL DBD driver",
+ "dependencies": [
+ {
+ "name": "libpq",
+ "default-features": false,
+ "features": []
+ }
+ ]
+ },
+ "xlate": {
+ "description": "Xlate support",
+ "dependencies": [
+ "libiconv"
+ ]
+ }
+ },
+ "default-features": []
+}