Skip to content

Commit

Permalink
Merge pull request #1270 from dgreatwood/fallbackHttplibMacOS
Browse files Browse the repository at this point in the history
Fix: Enable use of subproject httplib in macOS despite nofallback
  • Loading branch information
kiplingw authored Dec 13, 2024
2 parents 6e59eb2 + cc7215c commit c7c0548
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
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

0 comments on commit c7c0548

Please sign in to comment.