makedeb


citra 9365.1-9


An experimental open-source Nintendo 3DS emulator/debugger

Viewing /PKGBUILD.

View raw.

Click here to go back to the Git tree for citra.

# Maintainer: bunnylo1 <bunnylo12@yahoo.com>

pkgbase="citra"
pkgname=($pkgbase "$pkgbase-qt")
pkgver=9365.1
pkgrel=9
pkgdesc="An experimental open-source Nintendo 3DS emulator/debugger"
arch=('any')
url="https://github.com/citra-emu/citra/"
license=('GPL2')
depends=('ffmpeg')
makedepends=('git' 'clang|gcc' 'cmake' 'shared-mime-info' 'desktop-file-utils'
'libsdl2-dev' 'libssl-dev' 'qt6-base-dev' 'qt6-base-private-dev' 
'libavcodec-dev' 'qt6-multimedia-dev')


# Clang generates weird object files when LTO is enabled, breaking static libraries (.a).
# Force-disable LTO if we are using clang.
if [ "$CXX" = "clang++" ]; then
	options=('!lto')
fi

prepare() {
    cd "$startdir"
    
    if [ ! -d "$pkgbase" ]
    then
		git clone --recursive https://github.com/citra-emu/citra $pkgbase
	fi

    ln -sfv "$startdir"/"$pkgbase" "$srcdir"/"$pkgbase"

	cd "$srcdir/$pkgbase"

	if [[ -d build ]]; then
		rm -rf build
	fi
	mkdir build

	git submodule init
	for external in boost catch cpp-jwt cubeb discord-rpc dynarmic enet fmt libressl nihistro soundtouch teakra xbyak zstd inih libusb cryptopp lodepng; do
		git config submodule.$external.url "$srcdir/$external"
	done
	git -c protocol.file.allow=always submodule update

	# agh, submodule has submodules
	cd externals/cubeb
	git submodule init
	git config submodule.cmake/sanitizers-cmake.url "$srcdir/sanitizers-cmake"
	git config submodule.googletest.url "$srcdir/googletest"
	git -c protocol.file.allow=always submodule update
}

build() {
	mkdir -p "$srcdir/$pkgbase/build"
	cd "$srcdir/$pkgbase/build"

	# Bump the expression nesting limit for clang
	if [ "$CXX" = "clang++" ]; then
		CXXFLAGS+=" -fbracket-depth=649"
	fi

	cmake .. \
	  -DCMAKE_INSTALL_PREFIX=/usr \
	  -DCMAKE_BUILD_TYPE=Release \
	  -DENABLE_FFMPEG_AUDIO_DECODER=ON \
	  -DUSE_SYSTEM_CURL=ON
	make
}

package_citra() {
	depends=(
    'libsdl2-2.0-0'
     'libpng16-16')

	install -Dm755 "$srcdir/$pkgbase/build/bin/Release/citra" "$pkgdir/usr/bin/citra"
}

package_citra-qt() {
	depends=(
    'libsdl2-2.0-0'
    'libssl3'
    'libqt6core6a'
    'libqt6multimedia6'
    'libqt6opengl6'
    'libavcodec59'
    'shared-mime-info'
    'desktop-file-utils'
     )
    optdepends=('libxkbcommon-x11: for X11 support'
	            'qt5-wayland: for Wayland support')

	cd "$srcdir/$_pkgbase/build"
	make DESTDIR="$pkgdir/" install
	rm "$pkgdir/usr/bin/citra"

        # Remove leftover files from tsl.
        rm -r "$pkgdir/usr/include/tsl" "$pkgdir/usr/share/cmake/tsl-robin-map"
}