Skip to content

Commit

Permalink
On 1.7.x branch: Merge 1.7.x-vcpkg branch:
Browse files Browse the repository at this point in the history
  * Add vcpkg port files and GitHub Actions workflow to test it.

git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1917458 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Ivan Zhakov committed May 1, 2024
2 parents 8e1bf5a + 237e151 commit ab4273d
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Vcpkg (Windows)

on:
push:
branches: [ "1.7.x*" ]

jobs:
build:
strategy:
matrix:
os: [windows-latest]
triplet:
- x64-windows
- x64-windows-static
- x64-windows-static-md
- x86-windows
- x86-windows-static
port:
- apr
- apr[core]
- apr[private-headers]
fail-fast: false

name: "${{ matrix.port }}:${{ matrix.triplet }} on ${{ matrix.os }}"
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
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@v3

- name: Vcpkg Install
run: C:\vcpkg\vcpkg.exe install ${{ matrix.port }} --head --overlay-ports ${{ github.workspace }}\build\vcpkg --triplet ${{ matrix.triplet }} --enforce-port-checks
53 changes: 53 additions & 0 deletions build/vcpkg/apr/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
set(VERSION 1.7.5)
#
# Modify REF to latest commit id from https://github.com/apache/apr
# Update SHA512 with actual SHA512
#
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO apache/apr
REF 6445e8804008922f8018aa238aa4d6bba608c49a
SHA512 0
HEAD_REF 1.7.x
)

if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
private-headers INSTALL_PRIVATE_H
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" APR_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" APR_BUILD_SHARED)

if (FEATURE_MINIMAL_BUILD)
set(APU_USE_EXPAT OFF)
else()
set(APU_USE_EXPAT ON)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DAPR_BUILD_STATIC=${APR_BUILD_STATIC}
-DAPR_BUILD_SHARED=${APR_BUILD_SHARED}
-DAPR_BUILD_TESTAPR=OFF
-DINSTALL_PDB=OFF
-DAPR_INSTALL_PRIVATE_H=${INSTALL_PRIVATE_H}
)

vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME "apr"
CONFIG_PATH "lib/cmake/apr")

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)

25 changes: 25 additions & 0 deletions build/vcpkg/apr/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "apr",
"version": "1.7.5",
"port-version": 5,
"description": "The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.",
"homepage": "https://apr.apache.org/",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true,
"platform": "windows"
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"private-headers": {
"description": "Install non-standard files required for building Apache httpd"
}
},
"default-features": []
}

0 comments on commit ab4273d

Please sign in to comment.