rpcs3/.ci/build-freebsd.sh
Jan Beich 2593077361 CI: only use headers from bundled libc++ on FreeBSD
Linking different versions of libc++ can cause ABI issues but new C++
features are usually limited to headers.

ld: error: undefined symbol: operator new(unsigned long, std::align_val_t)
>>> referenced by string.cpp
>>>               string.cpp.o:(void* std::__1::__libcpp_operator_new[abi:ne190107]<unsigned long, std::align_val_t>(unsigned long, std::align_val_t)) in archive /tmp/cirrus-ci-build/libcxx_prefix/lib/libc++.a
>>> referenced by memory_string_searcher.cpp
>>>               memory_string_searcher.cpp.o:(memory_viewer_panel::OnSearch(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, unsigned int)) in archive rpcs3/rpcs3qt/librpcs3_ui.a
>>> referenced by game_list_frame.cpp
>>>               game_list_frame.cpp.o:(stx::auto_typemap<game_list_frame, 0u, 16u>::auto_typemap()) in archive rpcs3/rpcs3qt/librpcs3_ui.a
>>> referenced 23 more times
2025-02-13 13:37:36 +00:00

40 lines
1.4 KiB
Bash
Executable file

#!/bin/sh -ex
# Pull all the submodules except llvm and opencv
# Note: Tried to use git submodule status, but it takes over 20 seconds
# shellcheck disable=SC2046
git submodule -q update --init --depth 1 $(awk '/path/ && !/llvm/ && !/opencv/ { print $3 }' .gitmodules)
# Prefer newer Clang than in base system (see also .ci/install-freebsd.sh)
# libc++ isn't in llvm* packages, so download manually
fetch https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.7/llvm-project-19.1.7.src.tar.xz
tar xf llvm*.tar.xz
export CC=clang19 CXX=clang++19
cmake -B libcxx_build -G Ninja -S llvm*/libcxx \
-DLLVM_CCACHE_BUILD=ON \
-DLIBCXX_CXX_ABI=libcxxrt \
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
-DPython3_EXECUTABLE:FILEPATH="$(pkg query -x %Fp python3 | grep -Fm1 bin/python)" \
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/libcxx_prefix"
cmake --build libcxx_build
cmake --install libcxx_build
export CXXFLAGS="$CXXFLAGS -nostdinc++ -isystem$PWD/libcxx_prefix/include/c++/v1"
#export LDFLAGS="$LDFLAGS -nostdlib++ -L$PWD/libcxx_prefix/lib -l:libc++.a -lcxxrt"
CONFIGURE_ARGS="
-DWITH_LLVM=ON
-DUSE_SDL=OFF
-DUSE_PRECOMPILED_HEADERS=OFF
-DUSE_NATIVE_INSTRUCTIONS=OFF
-DUSE_SYSTEM_FFMPEG=ON
-DUSE_SYSTEM_CURL=ON
-DUSE_SYSTEM_LIBPNG=ON
-DUSE_SYSTEM_OPENCV=ON
"
# shellcheck disable=SC2086
cmake -B build -G Ninja $CONFIGURE_ARGS
cmake --build build
ccache --show-stats
ccache --zero-stats