Skip to content

Commit

Permalink
add aur package build script
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonflylee committed Sep 20, 2024
1 parent 374306d commit a5719e7
Show file tree
Hide file tree
Showing 10 changed files with 348 additions and 14 deletions.
47 changes: 46 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ on:
arm_flatpak:
description: build flatpak (aarch64)
type: boolean
snap:
description: build snapcraft
type: boolean
deb:
description: build ubuntu deb
type: boolean
aur:
description: build archlinux package
type: boolean
mingw64:
description: build win64 mingw64
type: boolean
Expand Down Expand Up @@ -70,7 +76,8 @@ jobs:
Switchfin-windows-*.7z
Switchfin-macos-*/*.dmg
Switchfin-deko3d-*/*.nro
Switchfin-linux-*/*.flatpak
"*/*.flatpak"
"*/*.pkg.tar.*"
body: |
![download](https://img.shields.io/github/downloads/${{ github.repository }}/${{ github.ref_name }}/total?label=Downloads)
Expand Down Expand Up @@ -214,6 +221,44 @@ jobs:
name: Switchfin-${{ matrix.release }}-${{ steps.vars.outputs.sha_short }}
path: Switchfin-*.deb

build-snap:
runs-on: ubuntu-latest
if: ${{ inputs.snap }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build snap
run: |
docker run --rm --tty --network host -v $PWD:/work -w /work/scripts --privileged diddledani/snapcraft:core20
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: switchfin-snap-${{ steps.vars.outputs.sha_short }}
path: scripts/*.snap

build-aur:
runs-on: ubuntu-latest
if: ${{ inputs.aur || github.event_name != 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build aur
run: |
docker run --rm --tty --network host -v $PWD:/work -e PUID=$(id -u) -w /work/scripts/aur archlinux bash entrypoint.sh
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-aur-${{ steps.vars.outputs.sha_short }}
path: scripts/aur/*.pkg.tar.*

build-macos:
runs-on: macos-12
if: ${{ inputs.macos || github.event_name != 'workflow_dispatch' }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ build*/
/resources/forwarder.nsp
/resources/shaders/*.dksh
/scripts/*/*/*.tar.*
/scripts/aur/*.tar.*
/scripts/*/*/src
/scripts/switch/mpv-deko3d/deko3d.patch
/switchfin
.DS_Store
.DS_Store
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
if (CUSTOM_RESOURCES_DIR)
set(BRLS_RESOURCES_DIR ${CUSTOM_RESOURCES_DIR})
elseif (CMAKE_INSTALL)
set(BRLS_RESOURCES_DIR ${CMAKE_INSTALL_PREFIX}/share)
set(BRLS_RESOURCES_DIR ${CMAKE_INSTALL_PREFIX}/share/switchfin)
endif ()

# setting src and include
Expand Down
2 changes: 1 addition & 1 deletion app/include/view/video_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class VideoView : public brls::Box {
void hideVideoProgressSlider();
void hideVideoQuality();

static bool dismiss();
static bool close();

private:
/// OSD
Expand Down
8 changes: 4 additions & 4 deletions app/src/activity/player_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void PlayerView::setChapters(const std::vector<jellyfin::MediaChapter>& chaps, u

bool PlayerView::playIndex(int index) {
if (index < 0 || index >= (int)this->episodes.size()) {
return VideoView::dismiss();
return VideoView::close();
}
MPVCore::instance().reset();

Expand Down Expand Up @@ -207,7 +207,7 @@ void PlayerView::playMedia(const uint64_t seekTicks) {
ASYNC_RELEASE

if (r.MediaSources.empty()) {
Dialog::show(r.ErrorCode, []() { VideoView::dismiss(); });
Dialog::show(r.ErrorCode, []() { VideoView::close(); });
return;
}

Expand Down Expand Up @@ -251,11 +251,11 @@ void PlayerView::playMedia(const uint64_t seekTicks) {
}
}

VideoView::dismiss();
VideoView::close();
},
[ASYNC_TOKEN](const std::string& ex) {
ASYNC_RELEASE
Dialog::show(ex, []() { VideoView::dismiss(); });
Dialog::show(ex, []() { VideoView::close(); });
},
jellyfin::apiPlayback, this->itemId);
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/tab/remote_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class RemotePlayer : public brls::Box {

playSubscribeID = view->getPlayEvent()->subscribe([this, urls, c](int index) {
if (index < 0 || index >= (int)urls.size()) {
return VideoView::dismiss();
return VideoView::close();
}
auto& it = urls.at(index);
MPVCore::instance().reset();
Expand All @@ -88,7 +88,7 @@ class RemotePlayer : public brls::Box {

playSubscribeID = view->getPlayEvent()->subscribe([this, &mpv](int index) {
if (index < 0 || index >= (int)titles.size()) {
return VideoView::dismiss();
return VideoView::close();
}
view->setTitie(titles.at(index));
mpv.command("playlist-play-index", std::to_string(index).c_str());
Expand Down
8 changes: 4 additions & 4 deletions app/src/view/video_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ VideoView::VideoView() {
this->toggleOSD();
return true;
}
return dismiss();
return close();
},
true);

Expand Down Expand Up @@ -237,7 +237,7 @@ VideoView::VideoView() {
this->osdLockBox->addGestureRecognizer(new brls::TapGestureRecognizer(this->osdLockBox));

this->btnClose->registerClickAction([](...) {
brls::sync([]() { dismiss(); });
brls::sync([]() { close(); });
return true;
});
this->btnClose->addGestureRecognizer(new brls::TapGestureRecognizer(this->btnClose));
Expand Down Expand Up @@ -614,7 +614,7 @@ void VideoView::registerMpvEvent() {
this->btnVolumeIcon->setImageFromSVGRes("icon/ico-volume.svg");
break;
case MpvEventEnum::MPV_FILE_ERROR: {
Dialog::show("main/player/error"_i18n, []() { dismiss(); });
Dialog::show("main/player/error"_i18n, []() { close(); });
break;
}
default:;
Expand Down Expand Up @@ -774,7 +774,7 @@ bool VideoView::toggleVolume(brls::View* view) {
return true;
}

bool VideoView::dismiss() {
bool VideoView::close() {
return brls::Application::popActivity(brls::TransitionAnimation::NONE, []() {
auto mpvce = MPVCore::instance().getCustomEvent();
mpvce->fire(VIDEO_CLOSE, nullptr);
Expand Down
29 changes: 29 additions & 0 deletions scripts/aur/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pkgname=switchfin
pkgver=0.5.2
pkgrel=1
pkgdesc='Third-party native Jellyfin client'
arch=('x86_64' 'aarch64')
url='https:/dragonflylee/switchfin'
license=('GPL-3.0-or-later')
depends=('curl' 'dbus' 'gcc-libs' 'glibc' 'hicolor-icon-theme' 'libwebp' 'mpv' 'libxcb' 'tinyxml2' 'libpng')
makedepends=('cmake' 'git' 'libxi' 'libxinerama' 'ninja' 'python' 'wayland-protocols')
#source=("${pkgname}::git+$url.git")
#sha256sums=('SKIP')

build() {
cmake -B "${srcdir}/build" -G Ninja \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX='/usr' \
-D CMAKE_INSTALL=ON \
-D PLATFORM_DESKTOP=ON \
-D USE_SYSTEM_CURL=ON \
-D USE_SYSTEM_TINYXML2=ON \
-D GLFW_BUILD_WAYLAND=ON \
-D GLFW_BUILD_X11=ON \
-S "../../.."
cmake --build "${srcdir}/build"
}

package() {
DESTDIR="${pkgdir}" cmake --install "${srcdir}/build"
}
23 changes: 23 additions & 0 deletions scripts/aur/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -euo pipefail

FILE="$(basename "$0")"

# Enable the multilib repository
cat << EOM >> /etc/pacman.conf
[multilib]
Include = /etc/pacman.d/mirrorlist
EOM

pacman -Syu --noconfirm --needed base-devel

# Makepkg does not allow running as root
# Create a new user `builder`
# `builder` needs to have a home directory because some PKGBUILDs will try to
# write to it (e.g. for cache)
useradd builder -m -u $PUID
# When installing dependencies, makepkg will use sudo
# Give user `builder` passwordless sudo access
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

sudo -H -u builder makepkg -scCf --noconfirm
Loading

0 comments on commit a5719e7

Please sign in to comment.