Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Enable use of subproject httplib in macOS despite nofallback #1270

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions bldscripts/nfbmesbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

#
# SPDX-FileCopyrightText: 2024 Duncan Greatwood
#
# SPDX-License-Identifier: Apache-2.0
#

# Execute this script from the parent directory by invoking:
# bldscripts/nfbmesbuild.sh

# Does the same as mesbuild.sh except with the --wrap-mode=nofallback
# option set

MY_SCRIPT_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

source $MY_SCRIPT_DIR/helpers/messetdirvars.sh
source $MY_SCRIPT_DIR/helpers/adjbuilddirformesbuild.sh

MESON_BUILD_DIR="$MESON_BUILD_DIR.nfb"

if [ -e "${MESON_BUILD_DIR}" ]
then
echo "Using existing build dir ${MESON_BUILD_DIR}"
else
meson setup ${MESON_BUILD_DIR} \
--wrap-mode=nofallback \
--buildtype=release \
-DPISTACHE_USE_SSL=true \
-DPISTACHE_BUILD_EXAMPLES=true \
-DPISTACHE_BUILD_TESTS=true \
-DPISTACHE_BUILD_DOCS=false \
-DPISTACHE_USE_CONTENT_ENCODING_DEFLATE=true \
-DPISTACHE_USE_CONTENT_ENCODING_BROTLI=true \
-DPISTACHE_USE_CONTENT_ENCODING_ZSTD=true \
--prefix="${MESON_PREFIX_DIR}"
fi

meson compile -C ${MESON_BUILD_DIR}
21 changes: 20 additions & 1 deletion tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,26 @@
curl_dep = dependency('libcurl')
gtest_main_dep = dependency('gtest', main: true, fallback: ['gtest', 'gtest_main_dep'])
gmock_dep = dependency('gmock', version: '>=1.11.0', fallback: ['gtest', 'gmock_dep'])
cpp_httplib_dep = dependency('cpp-httplib', fallback: ['cpp-httplib', 'cpp_httplib_dep'])

# On macOS, meson doesn't seem to find cpp-httplib even when
# cpp-httplib has been installed in the system (i.e. even when
# cpp-httplib has been installed with brew); I don't know why. This
# causes a particular issue with Pistache's brew formula, since brew's
# "std_meson_args", used by the formula, includes
# "--wrap-mode=nofallback", preventing meson from using our httplib
# subproject as a fallback (brew wants us to use brew to install each
# dependency, in preference to using a subproject). We workaround the
# issue here by effectively doing the fallback to the cpp-httplib
# subproject without using meson dependency's "fallback:" option.
if host_machine.system() == 'darwin' and get_option('wrap_mode') == 'nofallback'
cpp_httplib_dep = dependency('cpp-httplib', required: false)
if not cpp_httplib_dep.found()
cpp_httplib_dep = subproject('cpp-httplib').get_variable('cpp_httplib_dep')
endif
else
cpp_httplib_dep = dependency('cpp-httplib', fallback: ['cpp-httplib', 'cpp_httplib_dep'])
endif

brotli_dep = dependency('', required: false)
zstd_dep = dependency('', required: false)

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.23.20241204
0.4.24.20241212
Loading