diff --git a/.github/workflows/package-obs.yml b/.github/workflows/package-obs.yml new file mode 100644 index 0000000..07b48cb --- /dev/null +++ b/.github/workflows/package-obs.yml @@ -0,0 +1,48 @@ +name: build Linux packages with Open Build Service + +on: + pull_request: + branches: [ "master" ] +env: + CARGO_TERM_COLOR: always + +jobs: + build-obs-binary: + strategy: + matrix: + include: + - repo: Fedora_39 + spec: librashader.spec + - repo: xUbuntu_23.10 + spec: librashader.spec + - repo: Arch + spec: PKGBUILD + runs-on: ubuntu-latest + container: + image: fedora:39 + options: --privileged + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install OSC and dependencies + env: + OBS_CONFIG: ${{ secrets.OBS_CONFIG }} + run: | + sudo dnf install -y osc obs-service-obs_scm obs-service-cargo_vendor cargo python3-zstandard + mkdir -p ~/.config/osc + echo "$OBS_CONFIG" > ~/.config/osc/oscrc + - name: Checkout Open Build Service repository + run: | + osc co home:chyyran:librashader/librashader + - name: Copy spec from repository + run: | + cp -r ./pkg/obs/ home:chyyran:librashader/librashader/ + sed -r -i 's/()(.+)(<\/param>)/${{ github.sha }}<\/param>/g' home:chyyran:librashader/librashader/_service + - name: Vendor sources for Open Build Service + run: | + cd home:chyyran:librashader/librashader/ + osc service mr + - name: Build package + run: | + cd home:chyyran:librashader/librashader/ + osc build --no-verify --trust-all-projects ${{ matrix.repo }} x86_64 ${{ matrix.spec }} diff --git a/.github/workflows/publish-obs.yml b/.github/workflows/publish-obs.yml new file mode 100644 index 0000000..98e1859 --- /dev/null +++ b/.github/workflows/publish-obs.yml @@ -0,0 +1,78 @@ +name: publish packages using Open Build Service + +on: + push: + branches: [ "master" ] +env: + CARGO_TERM_COLOR: always + +jobs: + build-obs-binary: + strategy: + matrix: + include: + - repo: Fedora_39 + spec: librashader.spec + - repo: xUbuntu_23.10 + spec: librashader.spec + - repo: Arch + spec: PKGBUILD + runs-on: ubuntu-latest + container: + image: fedora:39 + options: --privileged + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install OSC and dependencies + env: + OBS_CONFIG: ${{ secrets.OBS_CONFIG }} + run: | + sudo dnf install -y osc obs-service-obs_scm obs-service-cargo_vendor cargo python3-zstandard + mkdir -p ~/.config/osc + echo "$OBS_CONFIG" > ~/.config/osc/oscrc + - name: Checkout Open Build Service repository + run: | + osc co home:chyyran:librashader/librashader + - name: Copy spec from repository + run: | + cp -r ./pkg/obs/ home:chyyran:librashader/librashader/ + sed -r -i 's/()(.+)(<\/param>)/${{ github.sha }}<\/param>/g' home:chyyran:librashader/librashader/_service + - name: Vendor sources for Open Build Service + run: | + cd home:chyyran:librashader/librashader/ + osc service mr + - name: Build package + run: | + cd home:chyyran:librashader/librashader/ + osc build --no-verify --trust-all-projects ${{ matrix.repo }} x86_64 ${{ matrix.spec }} + publish-obs: + needs: build-obs-binary + runs-on: ubuntu-latest + container: fedora:39 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install OSC and dependencies + env: + OBS_CONFIG: ${{ secrets.OBS_CONFIG }} + run: | + sudo dnf install -y osc obs-service-obs_scm obs-service-cargo_vendor cargo python3-zstandard + mkdir -p ~/.config/osc + echo "$OBS_CONFIG" > ~/.config/osc/oscrc + - name: Checkout Open Build Service repository + run: | + osc co home:chyyran:librashader/librashader + - name: Copy spec from repository + run: | + cp -r ./pkg/obs/ home:chyyran:librashader/librashader/ + sed -r -i 's/()(.+)(<\/param>)/${{ github.sha }}<\/param>/g' home:chyyran:librashader/librashader/_service + - name: Vendor sources for Open Build Service + run: | + cd home:chyyran:librashader/librashader/ + osc service mr + - name: Commit source artifacts to Open Build Service + run: | + cd home:chyyran:librashader/librashader/ + osc ar + osc commit -f -m "git-rev ${{ github.sha }}" \ No newline at end of file diff --git a/pkg/obs/PKGBUILD b/pkg/obs/PKGBUILD new file mode 100644 index 0000000..a9774a5 --- /dev/null +++ b/pkg/obs/PKGBUILD @@ -0,0 +1,33 @@ +pkgname=librashader +pkgver=0.2.0~beta.2 +pkgrel=0 +pkgdesc="RetroArch shader runtime" +arch=('x86_64' 'aarch64') +url="https://github.com/SnowflakePowered/librashader" +license=('MPL-2.0') +groups=('') +depends=('vulkan-icd-loader' 'shaderc' 'cmake' 'gcc' 'rust' 'patchelf' 'ninja') +provides=("$pkgname=$pkgver" 'librashader.so') +backup=('') +source=("$pkgname-$pkgver.tar.xz" 'vendor.tar.xz' 'cargo_config') +cksums=("SKIP" "SKIP" "SKIP") +profile="optimized" + +build() { + cd $pkgname-$pkgver + mkdir .cargo + cp "$srcdir/cargo_config" .cargo/config + cp -r "$srcdir/vendor" "vendor" + cp "$srcdir/Cargo.lock" "Cargo.lock" + RUSTC_BOOTSTRAP=1 cargo run -p librashader-build-script -- --profile ${profile} + +} + +package() { + mkdir -p $pkgdir/usr/lib + mkdir -p $pkgdir/usr/include/librashader + patchelf --set-soname librashader.so.1 $srcdir/$pkgname-$pkgver/target/$profile/librashader.so + install -m 0755 $srcdir/$pkgname-$pkgver/target/${profile}/librashader.so $pkgdir/usr/lib/librashader.so + cp $srcdir/$pkgname-$pkgver/target/${profile}/librashader.h $pkgdir/usr/include/librashader/librashader.h + cp $srcdir/$pkgname-$pkgver/include/librashader_ld.h $pkgdir/usr/include/librashader/librashader_ld.h +} diff --git a/pkg/obs/_service b/pkg/obs/_service new file mode 100644 index 0000000..e7ff240 --- /dev/null +++ b/pkg/obs/_service @@ -0,0 +1,17 @@ + + + git + https://github.com/SnowflakePowered/librashader + master + + + librashader + xz + + + + *.tar + xz + + + \ No newline at end of file diff --git a/pkg/obs/librashader.spec b/pkg/obs/librashader.spec new file mode 100644 index 0000000..1eb2d09 --- /dev/null +++ b/pkg/obs/librashader.spec @@ -0,0 +1,51 @@ +Name: librashader +%define lname librashader0 +%define profile optimized +Summary: RetroArch shaders for all +License: MPL-2.0 +Version: 0.2.0~beta.2 +Release: 0 +URL: https://github.com/SnowflakePowered/%{name} +Source0: librashader-%{version}.tar.xz +Source1: vendor.tar.xz +Source2: cargo_config +BuildRequires: pkgconfig(vulkan) +BuildRequires: pkgconfig(shaderc) +BuildRequires: ninja-build +BuildRequires: patchelf +BuildRequires: cmake +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: cargo +BuildRequires: rust +Requires: vulkan + +%description +RetroArch shader runtime + +Summary: RetroArch shader runtime +Provides: librashader + +%prep +%setup -qa1 +mkdir .cargo # cargo automatically uses this dir +cp %{SOURCE2} .cargo/config # and automatically uses this config + +%build +RUSTC_BOOTSTRAP=1 cargo run -p librashader-build-script -- --profile %{profile} + +%install +mkdir -p %{buildroot}/%{_libdir} +mkdir -p %{buildroot}/%{_includedir}/librashader +patchelf --set-soname librashader.so.1 target/%{profile}/librashader.so +install -m 0755 target/%{profile}/librashader.so %{buildroot}%{_libdir}/librashader.so +cp target/%{profile}/librashader.h %{buildroot}%{_includedir}/librashader/librashader.h +cp include/librashader_ld.h %{buildroot}%{_includedir}/librashader/librashader_ld.h + + +%files +%{_libdir}/librashader.so +%if !0%{?suse_version} +%{_libdir}/librashader.so.1 +%endif +%{_includedir}/librashader/ diff --git a/test/shaders_slang b/test/shaders_slang index a6e1145..e04aa57 160000 --- a/test/shaders_slang +++ b/test/shaders_slang @@ -1 +1 @@ -Subproject commit a6e11453ad8c62931c62eeb79d51c70887b40bba +Subproject commit e04aa575febae5927db6b445a3c47b8f4221df78