1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00
rpcs3/.ci/build-linux.sh

66 lines
2.1 KiB
Bash
Raw Normal View History

#!/bin/sh -ex
2018-07-16 03:12:43 +02:00
2021-04-04 10:34:12 +02:00
if [ -z "$CIRRUS_CI" ]; then
cd rpcs3 || exit 1
fi
2018-07-16 03:12:43 +02:00
2023-08-30 19:09:23 +02:00
git config --global --add safe.directory '*'
# Pull all the submodules except llvm
# Note: Tried to use git submodule status, but it takes over 20 seconds
# shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ && !/SPIRV/ { print $3 }' .gitmodules)
2018-07-16 03:12:43 +02:00
mkdir build && cd build || exit 1
2018-07-16 03:12:43 +02:00
if [ "$COMPILER" = "gcc" ]; then
2020-04-09 06:33:38 +02:00
# These are set in the dockerfile
2022-07-16 21:10:50 +02:00
export CC="${GCC_BINARY}"
export CXX="${GXX_BINARY}"
2020-04-09 06:33:38 +02:00
export LINKER=gold
# We need to set the following variables for LTO to link properly
2022-07-16 21:10:50 +02:00
export AR=/usr/bin/gcc-ar-"$GCCVER"
export RANLIB=/usr/bin/gcc-ranlib-"$GCCVER"
2020-04-09 06:33:38 +02:00
export CFLAGS="-fuse-linker-plugin"
2018-07-16 03:12:43 +02:00
else
2022-07-16 21:10:50 +02:00
export CC="${CLANG_BINARY}"
export CXX="${CLANGXX_BINARY}"
2020-04-09 06:33:38 +02:00
export LINKER=lld
2022-07-16 21:10:50 +02:00
export AR=/usr/bin/llvm-ar-"$LLVMVER"
export RANLIB=/usr/bin/llvm-ranlib-"$LLVMVER"
2018-07-16 03:12:43 +02:00
fi
2020-03-19 08:49:40 +01:00
export CFLAGS="$CFLAGS -fuse-ld=${LINKER}"
2020-04-09 06:33:38 +02:00
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_NATIVE_INSTRUCTIONS=OFF \
-DUSE_PRECOMPILED_HEADERS=OFF \
2020-04-09 06:33:38 +02:00
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CFLAGS" \
-DCMAKE_AR="$AR" \
-DCMAKE_RANLIB="$RANLIB" \
2020-10-29 00:44:21 +01:00
-DUSE_SYSTEM_CURL=ON \
2023-05-05 18:39:27 +02:00
-DUSE_SDL=ON \
2023-05-16 20:24:55 +02:00
-DUSE_SYSTEM_FFMPEG=OFF \
2024-01-25 06:16:02 +01:00
-DUSE_DISCORD_RPC=ON \
-DOpenGL_GL_PREFERENCE=LEGACY \
2023-04-29 19:59:16 +02:00
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
-DSTATIC_LINK_LLVM=ON \
2020-04-09 06:33:38 +02:00
-G Ninja
2018-07-16 03:12:43 +02:00
ninja; build_status=$?;
2018-07-16 03:12:43 +02:00
cd ..
shellcheck .ci/*.sh
2021-04-04 10:34:12 +02:00
# If it compiled succesfully let's deploy.
# Azure and Cirrus publish PRs as artifacts only.
{ [ "$CI_HAS_ARTIFACTS" = "true" ];
} && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false"
if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then
2020-04-09 06:33:38 +02:00
.ci/deploy-linux.sh
fi