#!/bin/bash # Slackware build script for citra # Copyright 2022-2024 Nathaniel Russell # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=citra PRGVER=${PRGVER:-"69e758d73852ccb38577dd93ff7ae0402f681e60"} VERSION=${VERSION:-0.2090} BOOST=${BOOST:-3c27c785ad0f8a742af02e620dc225673f3a12d8} CATCH=${CATCH:-3f0283de7a9c43200033da996ff9093be3ac84dc} CPPJWT=${CPPJWT:-e12ef06218596b52d9b5d6e1639484866a8e7067} CRYPTOPP=${CRYPTOPP:-af7d1050bf2287072edd629be133da458a3cf978} CRYPTOCMAKE=${CRYPTOCMAKE:-a99c80c26686e44eddf0432140ae397f3efbd0b3} CUBEB=${CUBEB:-799e775484b8fce7e986ee7a4f4b651fec2bca07} DDSKTX=${DDSKTX:-42dd8aa6ded90b1ec06091522774feff51e83fc5} DISCORDRPC=${DISCORDRPC:-20cc99aeffa08a4834f156b6ab49ed68618cf94a} DYNARMIC=${DYNARMIC:-30f1a3c6289075ef4af08f5ec502be2fc8627a0c} ENET=${ENET:-4f8e9bdc4ce6d1f61a6274b0e557065a38190952} EXTSOUNDTOUCH=${EXTSOUNDTOUCH:-2.3.2} FAAD2=${FAAD2:-09b3c850c606e7fedd06597223e54344e8d23c8c} FMTLIB=${FMTLIB:-2dd4fa8742fdac36468f8d8ea3e06e78215551f8} GOOGLETEST=${GOOGLETEST:-40412d85124f7c6f3d88454583c4633e5e10fc8c} GLSLANG=${GLSLANG:-1e4955adbcd9b3f5eaf2129e918ca057baed6520} HEADERS=${HEADERS:-3b3e28dbe6d033395ce2967fa8030825e7b89de7} INIH=${INIH:-5e1d9e2625842dddb3f9c086a50f22e4f45dfc2b} LIBARE=${LIBARE:-deec5f75ee1a8ccbe32c8780b1d17284fc87b0f1} LIBRESSL=${LIBRESSL:-d4fc7348a3fbe9c659a373e28a3b50f052f7c50a} LIBUSB=${LIBUSB:-54350bd83fbcc9555abc57988d6fd73f3b9e9ff8} LIBYUV=${LIBYUV:-6900494d90ae095d44405cd4cc3f346971fa69c9} LODEPNG=${LODEPNG:-18964554bc769255401942e0e6dfd09f2fab2093} NIHSTRO=${NIHSTRO:-fd69de1a1b960ec296cc67d32257b0f9e2d89ac6} OAKNUT=${OAKNUT:-6b1d57ea7ed4882d32a91eeaa6557b0ecb4da152} OPENAL=${OPENAL:-d9fed51aa6391debc31dbbca550f055c980afe70} SANITIZERSCMAKE=${SANITIZERSCMAKE:-aab6948fa863bc1cbe5d0850bc46b9ef02ed4c1a} SDL2=${SDL2:-ac13ca9ab691e13e8eebe9684740ddcb0d716203} SIRIT=${SIRIT:-4ab79a8c023aa63caaa93848b09b9fe8b183b1a9} SPIRV=${SPIRV:-c214f6f2d1a7253bb0e9f195c2dc5b0659dc99ef} TEAKRA=${TEAKRA:-01db7cdd00aabcce559a8dddce8798dabb71949b} VULHEADER=${VULHEADER:-217e93c664ec6704ec2d8c36fa116c1a4a1e2d40} VULMEM=${VULMEM:-0e89587db3ebee4d463f191bd296374c5fafc8ea} XBYAK=${XBYAK:-a1ac3750f9a639b5a6c6d6c7da4259b8d6790989} ZSTD=${ZSTD:-63779c798237346c2b245c546c40b72a5a5913fe} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} DEPS=$TMP/$PRGNAM-$PRGVER/externals if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$PRGVER tar xvf $CWD/$PRGNAM-$PRGVER.tar.?z # citra has quite a few external dependencies, we need to extract them to the correct location. tar xvf $CWD/ext-boost-$BOOST.tar.gz -C \ $DEPS/boost --strip-components 1 tar xvf $CWD/Catch2-$CATCH.tar.gz -C \ $DEPS/catch2 --strip-components 1 tar xvf $CWD/cpp-jwt-$CPPJWT.tar.gz -C \ $DEPS/cpp-jwt --strip-components 1 tar xvf $CWD/cryptopp-$CRYPTOPP.tar.gz -C \ $DEPS/cryptopp --strip-components 1 tar xvf $CWD/cryptopp-cmake-$CRYPTOCMAKE.tar.gz -C \ $DEPS/cryptopp-cmake --strip-components 1 tar xvf $CWD/cubeb-$CUBEB.tar.gz -C \ $DEPS/cubeb --strip-components 1 tar xvf $CWD/googletest-$GOOGLETEST.tar.gz -C \ $DEPS/cubeb/googletest --strip-components 1 tar xvf $CWD/discord-rpc-$DISCORDRPC.tar.gz -C \ $DEPS/discord-rpc --strip-components 1 tar xvf $CWD/dds-ktx-$DDSKTX.tar.gz -C \ $DEPS/dds-ktx --strip-components 1 tar xvf $CWD/dynarmic-$DYNARMIC.tar.gz -C \ $DEPS/dynarmic --strip-components 1 tar xvf $CWD/enet-$ENET.tar.gz -C \ $DEPS/enet --strip-components 1 tar xvf $CWD/soundtouch-$EXTSOUNDTOUCH.tar.gz -C \ $DEPS/soundtouch --strip-components 1 tar xvf $CWD/fmt-$FMTLIB.tar.gz -C \ $DEPS/fmt --strip-components 1 tar xvf $CWD/inih-$INIH.tar.gz -C \ $DEPS/inih/inih --strip-components 1 tar xvf $CWD/ext-libressl-portable-$LIBRESSL.tar.gz -C \ $DEPS/libressl --strip-components 1 tar xvf $CWD/libusb-$LIBUSB.tar.gz -C \ $DEPS/libusb/libusb --strip-components 1 tar xvf $CWD/libyuv-$LIBYUV.tar.gz -C \ $DEPS/libyuv --strip-components 1 tar xvf $CWD/lodepng-$LODEPNG.tar.gz -C \ $DEPS/lodepng/lodepng --strip-components 1 tar xvf $CWD/nihstro-$NIHSTRO.tar.gz -C \ $DEPS/nihstro --strip-components 1 tar xvf $CWD/openal-soft-$OPENAL.tar.gz -C \ $DEPS/openal-soft --strip-components 1 tar xvf $CWD/sanitizers-cmake-$SANITIZERSCMAKE.tar.gz -C \ $DEPS/cubeb/cmake/sanitizers-cmake --strip-components 1 tar xvf $CWD/SDL-$SDL2.tar.gz -C \ $DEPS/sdl2/SDL --strip-components 1 tar xvf $CWD/teakra-$TEAKRA.tar.gz -C \ $DEPS/teakra --strip-components 1 tar xvf $CWD/xbyak-$XBYAK.tar.gz -C \ $DEPS/xbyak --strip-components 1 tar xvf $CWD/zstd-$ZSTD.tar.gz -C \ $DEPS/zstd --strip-components 1 tar xvf $CWD/faad2-$FAAD2.tar.gz -C \ $DEPS/faad2/faad2 --strip-components 1 tar xvf $CWD/glslang-$GLSLANG.tar.gz -C \ $DEPS/glslang --strip-components 1 tar xvf $CWD/ext-library-headers-$HEADERS.tar.gz -C \ $DEPS/library-headers --strip-components 1 tar xvf $CWD/libadrenotools-$LIBARE.tar.gz -C \ $DEPS/libadrenotools --strip-components 1 tar xvf $CWD/oaknut-$OAKNUT.tar.gz -C \ $DEPS/oaknut --strip-components 1 tar xvf $CWD/sirit-$SIRIT.tar.gz -C \ $DEPS/sirit --strip-components 1 tar xvf $CWD/Vulkan-Headers-$VULHEADER.tar.gz -C \ $DEPS/vulkan-headers --strip-components 1 tar xvf $CWD/VulkanMemoryAllocator-$VULMEM.tar.gz -C \ $DEPS/vma --strip-components 1 tar xvf $CWD/SPIRV-Headers-$SPIRV.tar.gz -C \ $DEPS/sirit/externals/SPIRV-Headers --strip-components 1 # citra checks for external components by checking for their .git files. # Since these are not included when we downloaded the commit tarballs, we'll create them. echo "gitdir: ../../.git/modules/boost" > $DEPS/boost/.git echo "gitdir: ../../.git/modules/catch2" > $DEPS/catch2/.git echo "gitdir: ../../.git/modules/cpp-jwt" > $DEPS/cpp-jwt/.git echo "gitdir: ../../.git/modules/cryptopp" > $DEPS/cryptopp/.git echo "gitdir: ../../.git/modules/cryptopp-cmake" > $DEPS/cryptopp-cmake/.git echo "gitdir: ../../.git/modules/cubeb" > $DEPS/cubeb/.git echo "gitdir: ../../.git/modules/discord-rpc" > $DEPS/discord-rpc/.git echo "gitdir: ../../.git/modules/dds-ktx" > $DEPS/dds-ktx/.git echo "gitdir: ../../.git/modules/dynarmic" > $DEPS/dynarmic/.git echo "gitdir: ../../.git/modules/enet" > $DEPS/enet/.git echo "gitdir: ../../.git/modules/soundtouch" > $DEPS/soundtouch/.git echo "gitdir: ../../.git/modules/fmt" > $DEPS/fmt/.git echo "gitdir: ../../../.git/modules/inih" > $DEPS/inih/inih/.git echo "gitdir: ../../.git/modules/libressl" > $DEPS/libressl/.git echo "gitdir: ../../../.git/modules/libusb" > $DEPS/libusb/libusb/.git echo "gitdir: ../../.git/modules/libyuv" > $DEPS/libyuv/.git echo "gitdir: ../../../.git/modules/lodepng" > $DEPS/lodepng/lodepng/.git echo "gitdir: ../../.git/modules/nihstro" > $DEPS/nihstro/.git echo "gitdir: ../../.git/modules/openal-soft" > $DEPS/openal-soft/.git echo "gitdir: ../../.git/modules/sdl2/SDL" > $DEPS/sdl2/SDL/.git echo "gitdir: ../../.git/modules/teakra" > $DEPS/teakra/.git echo "gitdir: ../../.git/modules/xbyak" > $DEPS/xbyak/.git echo "gitdir: ../../.git/modules/zstd" > $DEPS/zstd/.git echo "gitdir: ../../.git/modules/faad2" > $DEPS/faad2/faad2/.git echo "gitdir: ../../.git/modules/glslang" > $DEPS/glslang/.git echo "gitdir: ../../.git/modules/library-headers" > $DEPS/library-headers/.git echo "gitdir: ../../.git/modules/libadrenotools" > $DEPS/libadrenotools/.git echo "gitdir: ../../.git/modules/oaknut" > $DEPS/oaknut/.git echo "gitdir: ../../.git/modules/sirit" > $DEPS/sirit/.git echo "gitdir: ../../.git/modules/sirit/externals/SPIRV-Headers" > $DEPS/sirit/externals/SPIRV-Headers/.git echo "gitdir: ../../.git/modules/vulkan-headers" > $DEPS/vulkan-headers/.git echo "gitdir: ../../.git/modules/vma" > $DEPS/vma/.git cd $PRGNAM-$PRGVER sed -i 's|DEPENDS "${GIT_DIR}/index" "${OpenAL_SOURCE_DIR}/version.cmake"|DEPENDS "${OpenAL_SOURCE_DIR}/version.cmake"|g' externals/openal-soft/CMakeLists.txt chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ -o -perm 511 \) -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; mkdir -p build cd build cmake \ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DLIB_SUFFIX=${LIBDIRSUFFIX} \ -DMAN_INSTALL_DIR=/usr/man \ -DCMAKE_BUILD_TYPE=Release .. make make install/strip DESTDIR=$PKG cd .. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true mv $PKG/usr/share/man $PKG/usr find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done # Install hicolor for size in $(find /usr/share/icons/hicolor -type d -mindepth 1 -maxdepth 1 -exec basename {} \;); do if [ -d assets/unix-icons/hicolor/${size} ]; then cp -a assets/unix-icons/hicolor/${size} $PKG/usr/share/icons/hicolor/${size} fi done mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ CONTRIBUTING* README* license.txt \ $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/qt-config.ini > $PKG/usr/doc/$PRGNAM-$VERSION/qt-config.ini.sample cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE