#!/bin/bash -e FMT_VERSION="10.1.0" JSON_VERSION="3.11.2" ZLIB_VERSION="1.3" ZSTD_VERSION="1.5.5" LZ4_VERSION="1.9.4" BOOST_VERSION="1.83.0" cmake_install() { cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON "$@" ninja install } # $1: url $2: dir name $3: sha256sum download_extract() { local filename filename="$(basename "$1")" wget "$1" -O "$filename" echo "$3 $filename" > "$filename".sha256sum sha256sum -c "$filename".sha256sum bsdtar xf "$filename" pushd "$2" } info() { echo -e "\e[1m--> Downloading and building $1...\e[0m" } info "fmt ${FMT_VERSION}" download_extract "https://github.com/fmtlib/fmt/releases/download/${FMT_VERSION}/fmt-${FMT_VERSION}.zip" "fmt-${FMT_VERSION}" d725fa83a8b57a3cedf238828fa6b167f963041e8f9f7327649bddc68ae316f4 cmake_install -DFMT_DOC=OFF -DFMT_TEST=OFF popd info "nlohmann_json ${JSON_VERSION}" download_extract "https://github.com/nlohmann/json/releases/download/v${JSON_VERSION}/json.tar.xz" json 8c4b26bf4b422252e13f332bc5e388ec0ab5c3443d24399acb675e68278d341f cmake_install -DJSON_BuildTests=OFF popd info "zlib ${ZLIB_VERSION}" download_extract "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.xz" "zlib-${ZLIB_VERSION}" 8a9ba2898e1d0d774eca6ba5b4627a11e5588ba85c8851336eb38de4683050a7 cmake_install -DCMAKE_POLICY_DEFAULT_CMP0069=NEW # delete shared libraies as we can't use them in the final image rm -v /usr/local/lib/libz.so* popd info "zstd ${ZSTD_VERSION}" download_extract "https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz" "zstd-${ZSTD_VERSION}"/build/cmake 9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4 cmake_install -DZSTD_BUILD_PROGRAMS=OFF -DBUILD_TESTING=OFF -GNinja -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_SHARED=OFF popd info "lz4 ${LZ4_VERSION}" download_extract "https://github.com/lz4/lz4/archive/refs/tags/v${LZ4_VERSION}.tar.gz" "lz4-${LZ4_VERSION}/build/cmake" 0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b cmake_install -DLZ4_BUILD_CLI=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF # we need to adjust the exported name of the static library cat << EOF >> /usr/local/lib/cmake/lz4/lz4Targets.cmake # Injected commands by yuzu-room builder script add_library(lz4::lz4 ALIAS LZ4::lz4_static) EOF popd info "boost ${BOOST_VERSION}" download_extract "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION//\./_}.tar.gz" "boost_${BOOST_VERSION//\./_}" c0685b68dd44cc46574cce86c4e17c0f611b15e195be9848dfd0769a0a207628 # Boost use its own ad-hoc build system # we only enable what yuzu needs ./bootstrap.sh --with-libraries=context,container,system,headers ./b2 -j "$(nproc)" install --prefix=/usr/local popd # fake xbyak for non-amd64 (workaround a CMakeLists bug in yuzu) echo '!' > /usr/local/lib/libxbyak.a