diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 183 |
1 files changed, 134 insertions, 49 deletions
@@ -1,52 +1,137 @@ -# Maintainer: Tom Bebbington <tophattedcoder@gmail.com> - -_pkgbase='citra' -pkgbase="$_pkgbase-nightly-bin" -pkgname=("$_pkgbase-nightly-bin" "$_pkgbase-qt-nightly-bin") -pkgrel=7 -pkgver=1330_20190812_2f0ea48 -pkgdesc="An experimental open-source Nintendo 3DS emulator/debugger" -provides=('citra' 'citra-qt') -license=('GPL') +# Maintainer: +# Contributor: Tom Bebbington <tophattedcoder@gmail.com> + +# options +if [ -n "$_srcinfo" ] || [ -n "$_pkgver" ] ; then + : ${_autoupdate:=false} +else + : ${_autoupdate:=true} +fi + +# basic info +_pkgname='citra-nightly' +pkgname="$_pkgname-bin" +pkgrel=1 +pkgver=2062.20231226.602f4f6 +pkgdesc="Nintendo 3DS emulator" +url="https://github.com/citra-emu/citra-nightly" +license=('GPL-2.0-or-later') arch=('x86_64') -url="https://github.com/citra-emu/citra-nightly/" -_nightly_id=$(echo $pkgver | cut -d'_' -f1) -_ref="$(echo $pkgver | cut -d'_' -f2)-$(echo $pkgver | cut -d'_' -f3)" - -source=( - "https://github.com/citra-emu/citra-nightly/releases/download/nightly-$_nightly_id/citra-linux-$_ref.tar.xz" - "https://raw.githubusercontent.com/citra-emu/citra/master/dist/citra.desktop" - "https://raw.githubusercontent.com/citra-emu/citra/master/dist/citra.svg" - "citra.bash" - "citra-qt.bash" -) -sha256sums=('77a1305e96a401d8e2671e36cbfed7e5913e9eb0eba35a17a32ee8651ad80e40' - '93bd8f799877eba7dd87ed7a4c29607d78c42b8769626c1d479f7e34fb7b39e2' - 'eeab12f3f13f06db7984d361eebcd977ce500b1f73c9bd7ce726712d477e6e14' - '068409ef70c25e8da3f0430c5ff62609d122f2f857525940da8cd792a228a822' - '61bcee69be306b58fd0bdf6327cdfc88260ba9f9d0694cf54e2d720965bc918b') - -package_citra-nightly-bin() { - depends=('sdl2' 'libpng' 'libpng12' 'libcurl-compat' 'bash') - - mkdir -p "${pkgdir}/usr/bin" - cp $srcdir/citra.bash "${pkgdir}/usr/bin/citra" - cd $srcdir/citra-linux-$_ref - mkdir -p "${pkgdir}/opt/citra" - cp citra "${pkgdir}/opt/citra" + +# main package +_main_package() { + _update_version + + makedepends=( + 'gendesk' + ) + + provides=( + 'citra' + 'citra-qt' + ) + conflicts=( + 'citra' + 'citra-qt' + + 'citra-git' + 'citra-qt-git' + ) + + options=(!strip !debug) + + local _version=${_pkgver%%.*} + local _date=$(echo "$_pkgver" | cut -d'.' -f2) + local _hash=${_pkgver##*.} + + _pkgsrc="citra-linux-appimage-$_date-$_hash" + _pkgext="tar.gz" + source+=("$_pkgsrc-$_pkgver.$_pkgext"::"$url/releases/download/nightly-$_version/$_pkgsrc.$_pkgext") + sha256sums+=('SKIP') +} + +# common functions +pkgver() { + printf '%s' "${_pkgver:?}" +} + +build() { + local _app + for _app in citra-qt citra-room citra ; do + local _appimage="$_pkgsrc/$_app.AppImage" + chmod +x "$_appimage" + "$_appimage" --appimage-extract + done + + rm -rf "squashfs-root/usr/optional" } -package_citra-qt-nightly-bin() { - depends=('qt5-base' 'shared-mime-info' 'desktop-file-utils' 'libcurl-compat' 'bash') - optdepends=('libxkbcommon-x11: for X11 support' - 'qt5-wayland: for Wayland support') - - mkdir -p $pkgdir/usr/bin - cp $srcdir/citra-qt.bash "${pkgdir}/usr/bin/citra-qt" - cd $srcdir/citra-linux-$_ref - mkdir -p $pkgdir/opt/citra - mv citra-qt $pkgdir/opt/citra - mkdir -p $pkgdir/usr/share/applications - cp $srcdir/citra.desktop $pkgdir/usr/share/applications - mkdir -p $pkgdir/usr/share/pixmaps - cp $srcdir/citra.svg $pkgdir/usr/share/pixmaps + +package() { + install -dm755 "$pkgdir/usr/bin" + install -dm755 "$pkgdir/usr/share/applications/" + + local _app + for _app in citra-qt citra-room citra ; do + # symlink + ln -sf "/opt/citra/bin/$_app" "$pkgdir/usr/bin/$_app" + + # desktop file + mv "squashfs-root/$_app.desktop" "$pkgdir/usr/share/applications/" + done + + # icon + install -Dm644 "$_pkgsrc/dist/citra.png" -t "$pkgdir/usr/share/pixmaps/" + + # move main files + install -dm755 "$pkgdir/opt" + mv "$srcdir/squashfs-root/usr" "$pkgdir/opt/citra" +} + +# update version +_update_version() { + : ${_pkgver:=${pkgver%%.r*}} + + if [[ "${_autoupdate::1}" != "t" ]] ; then + return + fi + + local _response=$(curl -Ssf "$url/releases") + local _regex='<a href="(.*/nightly-([0-9]+)/(citra-linux-appimage-([0-9]+)-(.*)\.tar\.gz))"' + + local _dl_path=$( + printf '%s' "$_response" \ + | grep -Eio "$_regex" \ + | sed -E "s&$_regex&\1&" + ) + local _filename=$( + printf '%s' "$_response" \ + | grep -Eio "$_regex" \ + | sed -E "s&$_regex&\3&" + ) + + local _version=$( + printf '%s' "$_response" \ + | grep -Eio "$_regex" \ + | sed -E "s&$_regex&\2&" + ) + local _date=$( + printf '%s' "$_response" \ + | grep -Eio "$_regex" \ + | sed -E "s&$_regex&\4&" + ) + local _hash=$( + printf '%s' "$_response" \ + | grep -Eio "$_regex" \ + | sed -E "s&$_regex&\5&" + ) + + local _pkgver_new=$(printf '%s.%s.%s' "$_version" "$_date" "$_hash") + + # update _pkgver + if [ "$_pkgver" != "${_pkgver_new:?}" ] ; then + _pkgver="${_pkgver_new:?}" + fi } + +# execute +_main_package |