build(obs): add openbuildservice
This commit is contained in:
parent
81ba694ba4
commit
797625903a
48
.github/workflows/package-obs.yml
vendored
Normal file
48
.github/workflows/package-obs.yml
vendored
Normal file
|
@ -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 name="revision">)(.+)(<\/param>)/<param name="revision">${{ 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 }}
|
78
.github/workflows/publish-obs.yml
vendored
Normal file
78
.github/workflows/publish-obs.yml
vendored
Normal file
|
@ -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 name="revision">)(.+)(<\/param>)/<param name="revision">${{ 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 name="revision">)(.+)(<\/param>)/<param name="revision">${{ 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 }}"
|
33
pkg/obs/PKGBUILD
Normal file
33
pkg/obs/PKGBUILD
Normal file
|
@ -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
|
||||
}
|
17
pkg/obs/_service
Normal file
17
pkg/obs/_service
Normal file
|
@ -0,0 +1,17 @@
|
|||
<services>
|
||||
<service name="obs_scm" mode="manual">
|
||||
<param name="scm">git</param>
|
||||
<param name="url">https://github.com/SnowflakePowered/librashader</param>
|
||||
<param name="revision">master</param>
|
||||
</service>
|
||||
<service name="cargo_vendor" mode="manual">
|
||||
<param name="srcdir">librashader</param>
|
||||
<param name="compression">xz</param>
|
||||
</service>
|
||||
<service name="tar" mode="buildtime"/>
|
||||
<service name="recompress" mode="buildtime">
|
||||
<param name="file">*.tar</param>
|
||||
<param name="compression">xz</param>
|
||||
</service>
|
||||
<service name="set_version" mode="buildtime"/>
|
||||
</services>
|
51
pkg/obs/librashader.spec
Normal file
51
pkg/obs/librashader.spec
Normal file
|
@ -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/
|
|
@ -1 +1 @@
|
|||
Subproject commit a6e11453ad8c62931c62eeb79d51c70887b40bba
|
||||
Subproject commit e04aa575febae5927db6b445a3c47b8f4221df78
|
Loading…
Reference in a new issue