From e8f9fd5430134e11e98bc6bbaff3c40a8c1f20ec Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Wed, 8 Apr 2020 21:33:38 -0700 Subject: [PATCH] CI: Unify spacing for build scripts --- .ci/build-linux.sh | 43 ++++++++++++++---------- .ci/deploy-linux.sh | 81 +++++++++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 58 deletions(-) diff --git a/.ci/build-linux.sh b/.ci/build-linux.sh index 688fb12491..11543ee0c3 100755 --- a/.ci/build-linux.sh +++ b/.ci/build-linux.sh @@ -20,27 +20,34 @@ tar -xzf ./llvmlibs-linux.tar.gz -C llvmlibs mkdir build && cd build || exit 1 if [ "$COMPILER" = "gcc" ]; then - # These are set in the dockerfile - export CC=${GCC_BINARY} - export CXX=${GXX_BINARY} - export LINKER=gold - # We need to set the following variables for LTO to link properly - export AR=/usr/bin/gcc-ar-9 - export RANLIB=/usr/bin/gcc-ranlib-9 - export CFLAGS="-fuse-linker-plugin" + # These are set in the dockerfile + export CC=${GCC_BINARY} + export CXX=${GXX_BINARY} + export LINKER=gold + # We need to set the following variables for LTO to link properly + export AR=/usr/bin/gcc-ar-9 + export RANLIB=/usr/bin/gcc-ranlib-9 + export CFLAGS="-fuse-linker-plugin" else - export CC=${CLANG_BINARY} - export CXX=${CLANGXX_BINARY} - export LINKER=lld - export AR=/usr/bin/llvm-ar-$LLVMVER - export RANLIB=/usr/bin/llvm-ranlib-$LLVMVER + export CC=${CLANG_BINARY} + export CXX=${CLANGXX_BINARY} + export LINKER=lld + export AR=/usr/bin/llvm-ar-$LLVMVER + export RANLIB=/usr/bin/llvm-ranlib-$LLVMVER fi export CFLAGS="$CFLAGS -fuse-ld=${LINKER}" -cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_LLVM_SUBMODULE=OFF -DUSE_COTIRE=OFF -DLLVM_DIR=llvmlibs/lib/cmake/llvm/ -DUSE_NATIVE_INSTRUCTIONS=OFF \ - -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CFLAGS" -DCMAKE_AR=$AR -DCMAKE_RANLIB=$RANLIB \ - -G Ninja +cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_LLVM_SUBMODULE=OFF -DUSE_COTIRE=OFF \ + -DLLVM_DIR=llvmlibs/lib/cmake/llvm/ \ + -DUSE_NATIVE_INSTRUCTIONS=OFF \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + -DCMAKE_CXX_FLAGS="$CFLAGS" \ + -DCMAKE_AR="$AR" \ + -DCMAKE_RANLIB="$RANLIB" \ + -G Ninja ninja; build_status=$?; @@ -50,9 +57,9 @@ cd .. # Travis only deploys on master, and it publishes to GitHub releases. Azure publishes PRs as artifacts # only. { [ "$IS_AZURE" = "true" ] || - { [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; }; + { [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; }; } && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false" if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then - .ci/deploy-linux.sh + .ci/deploy-linux.sh fi diff --git a/.ci/deploy-linux.sh b/.ci/deploy-linux.sh index bffd7ae446..dcd26ba37e 100755 --- a/.ci/deploy-linux.sh +++ b/.ci/deploy-linux.sh @@ -3,8 +3,8 @@ cd build || exit 1 if [ "$DEPLOY_APPIMAGE" = "true" ]; then - DESTDIR=appdir ninja install - QT_APPIMAGE="linuxdeployqt.AppImage" + DESTDIR=appdir ninja install + QT_APPIMAGE="linuxdeployqt.AppImage" curl -sL "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" > "$QT_APPIMAGE" chmod a+x "$QT_APPIMAGE" @@ -16,51 +16,52 @@ if [ "$DEPLOY_APPIMAGE" = "true" ]; then cp "$(readlink -f /lib/x86_64-linux-gnu/libnsl.so.1)" ./appdir/usr/lib/libnsl.so.1 export PATH=/rpcs3/build/squashfs-root/usr/bin/:${PATH} - # Embed newer libstdc++ for distros that don't come with it (ubuntu 16.04) - mkdir -p appdir/usr/optional/ ; mkdir -p appdir/usr/optional/libstdc++/ - cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./appdir/usr/optional/libstdc++/ - rm ./appdir/AppRun - curl -sL https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous2/AppRun-patched-x86_64 -o ./appdir/AppRun - chmod a+x ./appdir/AppRun - curl -sL https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous2/exec-x86_64.so -o ./appdir/usr/optional/exec.so + # Embed newer libstdc++ for distros that don't come with it (ubuntu 16.04) + mkdir -p appdir/usr/optional/ ; mkdir -p appdir/usr/optional/libstdc++/ + cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./appdir/usr/optional/libstdc++/ + rm ./appdir/AppRun + curl -sL https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous2/AppRun-patched-x86_64 -o ./appdir/AppRun + chmod a+x ./appdir/AppRun + curl -sL https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous2/exec-x86_64.so -o ./appdir/usr/optional/exec.so - # Compile checker binary for AppImageKit-checkrt + # Compile checker binary for AppImageKit-checkrt - # This may need updating if you update the compiler or rpcs3 uses newer c++ features - # See https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/config/abi/pre/gnu.ver - # for which definitions correlate to which CXXABI version. - # Currently we target a minimum of GLIBCXX_3.4.26 and CXXABI_1.3.11 - printf "#include \nint main(){std::make_exception_ptr(0);std::pmr::get_default_resource();}" | $CXX -x c++ -std=c++2a -o ./appdir/usr/optional/checker - + # This may need updating if you update the compiler or rpcs3 uses newer c++ features + # See https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/config/abi/pre/gnu.ver + # for which definitions correlate to which CXXABI version. + # Currently we target a minimum of GLIBCXX_3.4.26 and CXXABI_1.3.11 + printf "#include \nint main(){std::make_exception_ptr(0);std::pmr::get_default_resource();}" | $CXX -x c++ -std=c++2a -o ./appdir/usr/optional/checker - - # Package it up and send it off - ./squashfs-root/usr/bin/appimagetool /rpcs3/build/appdir - ls + # Package it up and send it off + ./squashfs-root/usr/bin/appimagetool /rpcs3/build/appdir + ls - COMM_TAG="$(grep 'version{.*}' ../rpcs3/rpcs3_version.cpp | awk -F[\{,] '{printf "%d.%d.%d", $2, $3, $4}')" - COMM_COUNT="$(git rev-list --count HEAD)" - COMM_HASH="$(git rev-parse --short=8 HEAD)" - RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_linux64.AppImage" + COMM_TAG="$(grep 'version{.*}' ../rpcs3/rpcs3_version.cpp | awk -F[\{,] '{printf "%d.%d.%d", $2, $3, $4}')" + COMM_COUNT="$(git rev-list --count HEAD)" + COMM_HASH="$(git rev-parse --short=8 HEAD)" + RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_linux64.AppImage" - curl -sLO https://github.com/hcorion/uploadtool/raw/master/upload.sh - mv ./RPCS3*.AppImage "$RPCS3_APPIMAGE" + curl -sLO https://github.com/hcorion/uploadtool/raw/master/upload.sh + mv ./RPCS3*.AppImage "$RPCS3_APPIMAGE" - # If we're building using Azure Pipelines, let's copy over the AppImage artifact - if [ -n "$BUILD_ARTIFACTSTAGINGDIRECTORY" ]; then - cp "$RPCS3_APPIMAGE" ~/artifacts - fi + # If we're building using Azure Pipelines, let's copy over the AppImage artifact + if [ -n "$BUILD_ARTIFACTSTAGINGDIRECTORY" ]; then + cp "$RPCS3_APPIMAGE" ~/artifacts + fi - FILESIZE=$(stat -c %s ./rpcs3*.AppImage) - SHA256SUM=$(sha256sum ./rpcs3*.AppImage) - if [ -n "$GITHUB_TOKEN" ]; then - unset TRAVIS_REPO_SLUG - REPO_SLUG=RPCS3/rpcs3-binaries-linux \ - UPLOADTOOL_BODY="$SHA256SUM;${FILESIZE}B"\ - RELEASE_NAME=build-${TRAVIS_COMMIT}\ - RELEASE_TITLE=${COMM_TAG}-${COMM_COUNT}\ - REPO_COMMIT=d812f1254a1157c80fd402f94446310560f54e5f\ - bash upload.sh rpcs3*.AppImage - fi + FILESIZE=$(stat -c %s ./rpcs3*.AppImage) + SHA256SUM=$(sha256sum ./rpcs3*.AppImage) + if [ -n "$GITHUB_TOKEN" ]; then + unset TRAVIS_REPO_SLUG + REPO_SLUG=RPCS3/rpcs3-binaries-linux \ + UPLOADTOOL_BODY="$SHA256SUM;${FILESIZE}B"\ + RELEASE_NAME=build-${TRAVIS_COMMIT}\ + RELEASE_TITLE=${COMM_TAG}-${COMM_COUNT}\ + REPO_COMMIT=d812f1254a1157c80fd402f94446310560f54e5f\ + bash upload.sh rpcs3*.AppImage + fi fi + if [ "$DEPLOY_PPA" = "true" ]; then - export DEBFULLNAME="RPCS3 Build Bot" + export DEBFULLNAME="RPCS3 Build Bot" fi