From c081b00e47f9c27fa66012d1c247a87cc722935c Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 26 Aug 2024 23:08:36 +1000 Subject: [PATCH] feat: initial setup - add Makefile - add spec file --- .drone.yml | 36 ++++++++++++++++++++++++++++++++++ Makefile | 31 ++++++++++++++++++++++++++++++ README.md | 2 ++ jellyfin-web.spec | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 .drone.yml create mode 100644 Makefile create mode 100644 jellyfin-web.spec diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..8a045fb --- /dev/null +++ b/.drone.yml @@ -0,0 +1,36 @@ +kind: pipeline +type: docker +name: almalinux8 + +trigger: + event: + include: + - push + - pull_request + +steps: + - name: build + image: git.query.consul/unkin/almalinux8:latest + commands: + # Install the required packages using custom repositories + - dnf module install -y nodejs:20 + - dnf install -y gcc gcc-c++ make patch autoconf automake libtool rpm-build nodejs npm git curl wget which + + # Run the `make` command + - make build + + - name: upload + image: git.query.consul/unkin/almalinux8:latest + environment: + GITEA_PASSWORD: + from_secret: gitea_password + commands: + - > + for rpm in /drone/src/rpmbuild/RPMS/*/*.rpm; do + curl --user droneci:$GITEA_PASSWORD --upload-file $rpm https://git.query.consul/api/packages/unkin/rpm/almalinux/el8/upload + done + when: + branch: + - master + event: + - push diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9fc6888 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +.PHONY: all prep download build clean + +NAME := jellyfin-web +RPMBUILD := /drone/src/rpmbuild +SOURCES := $(RPMBUILD)/SOURCES +SPECS := $(RPMBUILD)/SPECS +SPECFILE := $(NAME).spec + +# Extract the version from the spec file +VERSION := $(shell grep "^Version:" $(SPECFILE) | awk '{print $$2}') + +all: build + +prep: + @echo "Creating rpmbuild directories..." + @mkdir -p $(RPMBUILD)/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + +download: prep + @echo "Downloading sources..." + @wget -O $(SOURCES)/$(NAME)-$(VERSION).tar.gz https://github.com/jellyfin/jellyfin-web/archive/refs/tags/v$(VERSION).tar.gz + @echo "Sources downloaded." + +build: $(SPECFILE) download + @echo "Building RPM..." + @rpmbuild -ba --define "_topdir $(RPMBUILD)" $(SPECFILE) + @echo "RPM built." + +clean: + @echo "Cleaning up..." + @rm -rf $(RPMBUILD) + @echo "Clean up done." diff --git a/README.md b/README.md index 2674db5..e58ea3c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # RPMBuild: jellyfin-web +[![Build Status](https://droneci.query.consul/api/badges/unkin/rpmbuild-jellyfin-web/status.svg)](https://droneci.query.consul/unkin/rpmbuild-jellyfin-web) + ## Overview This project provides an RPM package that installs the jellyfin-web package. diff --git a/jellyfin-web.spec b/jellyfin-web.spec new file mode 100644 index 0000000..f02a230 --- /dev/null +++ b/jellyfin-web.spec @@ -0,0 +1,49 @@ +%global debug_package %{nil} + +Name: jellyfin-web +Version: 10.9.10 +Release: 1%{?dist} +Summary: The Free Software Media System web client +License: GPLv2 +URL: https://jellyfin.org +Source0: %{name}-%{version}.tar.gz + +BuildArch: noarch +%if 0%{?rhel} > 0 && 0%{?rhel} < 8 +BuildRequires: nodejs +%else +BuildRequires: git +%if 0%{?fedora} >= 37 +BuildRequires: nodejs-npm +%else +BuildRequires: npm +%endif +%endif + +%description +Jellyfin is a free software media system that puts you in control of managing and streaming your media. + + +%prep +%autosetup -n jellyfin-web-%{version} -b 0 + +%if 0%{?rhel} > 0 && 0%{?rhel} < 8 +# Required for CentOS build +chown root:root -R . +%endif + +%build +npm ci --no-audit --unsafe-perm + +%install +%{__mkdir} -p %{buildroot}%{_libdir}/jellyfin/jellyfin-web +%{__cp} -r dist/* %{buildroot}%{_libdir}/jellyfin/jellyfin-web + +%files +%defattr(644,root,root,755) +%{_libdir}/jellyfin/jellyfin-web +%license LICENSE + +%changelog +* Mon Aug 26 2024 Ben Vincent - 10.9.10 +- Initial package