Skip to content

Commit 4b547c3

Browse files
committed
Apply the patch for vcpkg to disable IPv6 for curl's macOS build
1 parent 7908cc3 commit 4b547c3

File tree

4 files changed

+77
-5
lines changed

4 files changed

+77
-5
lines changed

.github/workflows/ci-pr-validation.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
fetch-depth: 0
4747
submodules: recursive
4848

49+
- name: Apply the patch for vcpkg
50+
run: ./build-support/apply-vcpkg-macos-curl-patch.sh
51+
4952
- name: Install dependencies
5053
run: |
5154
export ARCH=${{ matrix.arch }}
@@ -70,7 +73,7 @@ jobs:
7073
clang++ win-examples/example.cc -o dynamic.out -std=c++11 -arch ${{ matrix.arch }} -I $PULSAR_DIR/include -L $PULSAR_DIR/lib -Wl,-rpath $PULSAR_DIR/lib -lpulsar
7174
./dynamic.out
7275
echo "Build with static library"
73-
clang++ win-examples/example.cc -o static.out -std=c++11 -arch ${{ matrix.arch }} -I $PULSAR_DIR/include $PULSAR_DIR/lib/libpulsarwithdeps.a -framework SystemConfiguration -framework CoreServices -framework CoreFoundation
76+
clang++ win-examples/example.cc -o static.out -std=c++11 -arch ${{ matrix.arch }} -I $PULSAR_DIR/include $PULSAR_DIR/lib/libpulsarwithdeps.a
7477
./static.out
7578
7679
check-completion:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
cd `dirname $0`/..
22+
set -ex
23+
24+
cd vcpkg
25+
# Ensure the vcpkg binary is available
26+
./bootstrap-vcpkg.sh
27+
git apply ../build-support/vcpkg-curl-patch.diff
28+
git commit -m "Disable IPv6 for macOS in curl"
29+
./vcpkg x-add-version --all
30+
git add versions/
31+
git commit -m "Update version"
32+
COMMIT_ID=$(git log --pretty=oneline | head -n 1 | awk '{print $1}')
33+
34+
# Update the vcpkg.json
35+
cd ..
36+
sed -i.bak "s/.*builtin-baseline.*/ \"builtin-baseline\": \"$COMMIT_ID\",/" vcpkg.json
37+
sed -i.bak "s/\"version>=\": \"8\.4\.0\"/\"version>=\": \"8.4.0#1\"/" vcpkg.json
38+
39+
# "builtin-baseline": "b051745c68faa6f65c493371d564c4eb8af34dad",
40+
# "version>=": "8.4.0"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake
2+
index bdc544e9e..340d93865 100644
3+
--- a/ports/curl/portfile.cmake
4+
+++ b/ports/curl/portfile.cmake
5+
@@ -64,6 +64,10 @@ if(VCPKG_TARGET_IS_WINDOWS)
6+
list(APPEND OPTIONS -DENABLE_UNICODE=ON)
7+
endif()
8+
9+
+if(VCPKG_TARGET_IS_OSX)
10+
+ list(APPEND OPTIONS -DENABLE_IPV6=OFF)
11+
+endif()
12+
+
13+
vcpkg_cmake_configure(
14+
SOURCE_PATH "${SOURCE_PATH}"
15+
OPTIONS
16+
diff --git a/ports/curl/vcpkg.json b/ports/curl/vcpkg.json
17+
index e028d3897..a63858e34 100644
18+
--- a/ports/curl/vcpkg.json
19+
+++ b/ports/curl/vcpkg.json
20+
@@ -1,6 +1,7 @@
21+
{
22+
"name": "curl",
23+
"version": "8.4.0",
24+
+ "port-version": 1,
25+
"description": "A library for transferring data with URLs",
26+
"homepage": "https://curl.se/",
27+
"license": "curl AND ISC AND BSD-3-Clause",

pkg/mac/build-static-library.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,27 @@
2121
set -e
2222
cd `dirname $0`/../..
2323

24+
if [[ -z $ARCH ]]; then
25+
ARCH=$(uname -m)
26+
echo "Use default ARCH: $ARCH"
27+
fi
2428
if [[ $ARCH == "x86_64" ]]; then
2529
export VCPKG_TRIPLET=x64-osx
26-
cp -f vcpkg-triplets/x64-osx.cmake vcpkg/triplets/x64-osx.cmake
2730
elif [[ $ARCH == "arm64" ]]; then
2831
export VCPKG_TRIPLET=arm64-osx
29-
cp -f vcpkg-triplets/arm64-osx.cmake vcpkg/triplets/community/arm64-osx.cmake
3032
else
3133
echo "Invalid ARCH: $ARCH"
3234
exit 1
3335
fi
34-
CMAKE_OSX_ARCHITECTURES=$ARCH
3536

3637
INSTALL_DIR=$PWD/pkg/mac/.install
3738
set -x
3839
cmake -B build-osx \
3940
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
4041
-DINTEGRATE_VCPKG=ON \
42+
-DVCPKG_OVERLAY_TRIPLETS=$PWD/vcpkg-triplets \
4143
-DVCPKG_TARGET_TRIPLET=$VCPKG_TRIPLET \
42-
-DCMAKE_OSX_ARCHITECTURES=$CMAKE_OSX_ARCHITECTURES \
44+
-DCMAKE_OSX_ARCHITECTURES=$ARCH \
4345
-DCMAKE_BUILD_TYPE=Release \
4446
-DBUILD_TESTS=OFF \
4547
-DBUILD_PERF_TOOLS=OFF \

0 commit comments

Comments
 (0)