-
Notifications
You must be signed in to change notification settings - Fork 6
/
prepare-cpp_stl
executable file
·47 lines (42 loc) · 2.01 KB
/
prepare-cpp_stl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
. ./config
git clone --depth 1 https://github.com/kaitai-io/kaitai_struct_cpp_stl_runtime "$CPP_STL_RUNTIME_DIR"
git -C "$CPP_STL_RUNTIME_DIR" rev-parse HEAD
# On AppVeyor/Windows, pull some prereq libraries
if [ -n "$APPVEYOR" ]; then
vcpkg install boost-test:$ARCH-windows zlib:$ARCH-windows libiconv:$ARCH-windows
fi
# On GitHub Actions for macOS, install prereqs from brew
if [ -n "$GITHUB_ACTIONS" ] && [ "$RUNNER_OS" = macOS ]; then
# NB: since commit
# https://github.com/Homebrew/homebrew-core/commit/c67b591208748bb8d07e79806c4963bbe1a9c866 made
# on 2024-04-26, we can no longer use just `brew install boost`
# (https://formulae.brew.sh/formula/boost), because it got updated to Boost 1.85, which then
# broke our `cpp_stl_98/clang14-macos-x86_64` CI job. Boost 1.85 apparently can no longer be
# compiled with `-std=c++98` because we were suddenly getting syntax errors in
# `/usr/local/include/boost/bind/mem_fn.hpp`. This is consistent with the
# [changelog](https://www.boost.org/users/history/version_1_85_0.html):
#
# > [Bind](https://www.boost.org/libs/bind/):
# > * C++03 is no longer supported; a C++11 compiler is required. (This includes GCC 4.7 or
# > later, and MSVC 12.0 (VS 2013) or later.)
#
# Fortunately, https://formulae.brew.sh/formula/[email protected] is available, so we use that.
brew install \
make
# Following the advice of `brew install [email protected]`:
# ```
# ==> Caveats
# [email protected] is keg-only, which means it was not symlinked into /usr/local,
# because this is an alternate version of another formula.
# For compilers to find [email protected] you may need to set:
# export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
# export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
# ```
boost_prefix=$(brew --prefix [email protected])
echo LDFLAGS="-L${boost_prefix}/lib" >> "$GITHUB_ENV"
echo CPPFLAGS="-I${boost_prefix}/include" >> "$GITHUB_ENV"
# the `BOOST_ROOT` environment variable is needed for CMake to find Boost
echo BOOST_ROOT="${boost_prefix}" >> "$GITHUB_ENV"
fi