Adding copr make files

This commit is contained in:
2026-04-27 09:55:25 -04:00
commit 7e2c7aa293
8 changed files with 230 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
outdir ?= .
.PHONY: srpm
srpm:
./scripts/build-srpm.sh "$(outdir)"
+12
View File
@@ -0,0 +1,12 @@
OUTDIR ?= $(CURDIR)/dist
.PHONY: srpm rpm clean
srpm:
./scripts/build-srpm.sh "$(OUTDIR)"
rpm:
./scripts/build-rpm.sh "$(OUTDIR)"
clean:
rm -rf "$(OUTDIR)"
+43
View File
@@ -0,0 +1,43 @@
# Element Desktop RPM packaging
This repository builds an RPM package from the upstream Element Desktop Linux
x86_64 tarball:
`https://packages.element.io/desktop/install/linux/glibc-x86-64/element-desktop.tar.gz`
## What it does
- Downloads the current upstream tarball.
- Derives the version from the tarball root directory.
- Repackages the prebuilt binaries into an RPM.
- Removes the upstream auto-update manifest so RPM remains the update path.
- Sets `resources/package-type` to `rpm`.
- Supports COPR SCM builds through `.copr/Makefile`.
## Local builds
Build a source RPM:
```sh
make srpm
```
Build a binary RPM and source RPM:
```sh
make rpm
```
Artifacts are written to `dist/`.
## COPR
Use COPR's SCM source type with:
- Clone URL: this repository
- Spec file: `SPECS/element-desktop.spec`
- SRPM build method: `make srpm`
COPR will invoke `.copr/Makefile`, which calls the same SRPM generation script
used for local builds. That script downloads the upstream tarball during the
SRPM stage, so no vendored source archive is required in git.
+12
View File
@@ -0,0 +1,12 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Element
Comment=Secure messaging and collaboration
Exec=element-desktop %U
Icon=element-desktop
Terminal=false
Categories=Network;InstantMessaging;Chat;
StartupWMClass=Element
MimeType=x-scheme-handler/element;x-scheme-handler/matrix;x-scheme-handler/matrix.to;
Keywords=Matrix;Chat;Messaging;Collaboration;
+55
View File
@@ -0,0 +1,55 @@
%{!?upstream_version:%global upstream_version 0}
%global debug_package %{nil}
Name: element-desktop
Version: %{upstream_version}
Release: 1%{?dist}
Summary: Secure messaging and collaboration desktop client
License: Apache-2.0 AND BSD-3-Clause AND MIT
URL: https://element.io/
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.desktop
BuildArch: x86_64
ExclusiveArch: x86_64
%description
Element Desktop is a Matrix client for secure messaging and collaboration.
This package repackages the upstream prebuilt Linux x86_64 tarball for RPM-
based distributions.
%prep
%autosetup -n %{name}-%{version}
%build
# Upstream ships prebuilt binaries in the source archive.
%install
install -d %{buildroot}%{_libdir}/%{name}
cp -a . %{buildroot}%{_libdir}/%{name}/
rm -f %{buildroot}%{_libdir}/%{name}/resources/app-update.yml
printf 'rpm\n' > %{buildroot}%{_libdir}/%{name}/resources/package-type
install -d %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/%{name} <<'EOF'
#!/bin/sh
exec %{_libdir}/%{name}/element-desktop "$@"
EOF
chmod 0755 %{buildroot}%{_bindir}/%{name}
install -Dpm 0644 %{SOURCE1} \
%{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dpm 0644 resources/build/icon.png \
%{buildroot}%{_datadir}/icons/hicolor/512x512/apps/%{name}.png
%files
%license LICENSE.electron.txt
%doc LICENSES.chromium.html
%{_bindir}/%{name}
%{_libdir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/512x512/apps/%{name}.png
%changelog
* Mon Apr 27 2026 Codex <codex@openai.com> - 0-1
- Initial RPM packaging for upstream Element Desktop tarballs
+34
View File
@@ -0,0 +1,34 @@
#!/bin/sh
set -eu
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
OUTDIR="${1:-$ROOT_DIR/dist}"
TOPDIR="$(mktemp -d)"
cleanup() {
rm -rf "$TOPDIR"
}
trap cleanup EXIT INT TERM
mkdir -p \
"$TOPDIR/BUILD" \
"$TOPDIR/BUILDROOT" \
"$TOPDIR/RPMS" \
"$TOPDIR/SOURCES" \
"$TOPDIR/SPECS" \
"$TOPDIR/SRPMS" \
"$OUTDIR"
"$ROOT_DIR/scripts/fetch-source.sh" "$TOPDIR/SOURCES" >/dev/null
version="$(cat "$TOPDIR/SOURCES/.upstream-version")"
cp "$ROOT_DIR/SPECS/element-desktop.spec" "$TOPDIR/SPECS/"
cp "$ROOT_DIR/SOURCES/element-desktop.desktop" "$TOPDIR/SOURCES/"
rpmbuild -ba \
--define "_topdir $TOPDIR" \
--define "upstream_version $version" \
"$TOPDIR/SPECS/element-desktop.spec"
cp "$TOPDIR/SRPMS/"*.src.rpm "$OUTDIR/"
find "$TOPDIR/RPMS" -type f -name '*.rpm' -exec cp {} "$OUTDIR/" \;
+34
View File
@@ -0,0 +1,34 @@
#!/bin/sh
set -eu
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
OUTDIR="${1:-$ROOT_DIR/dist}"
TOPDIR="$(mktemp -d)"
cleanup() {
rm -rf "$TOPDIR"
}
trap cleanup EXIT INT TERM
mkdir -p \
"$TOPDIR/BUILD" \
"$TOPDIR/BUILDROOT" \
"$TOPDIR/RPMS" \
"$TOPDIR/SOURCES" \
"$TOPDIR/SPECS" \
"$TOPDIR/SRPMS" \
"$OUTDIR"
"$ROOT_DIR/scripts/fetch-source.sh" "$TOPDIR/SOURCES" >/dev/null
version="$(cat "$TOPDIR/SOURCES/.upstream-version")"
cp "$ROOT_DIR/SPECS/element-desktop.spec" "$TOPDIR/SPECS/"
cp "$ROOT_DIR/SOURCES/element-desktop.desktop" "$TOPDIR/SOURCES/"
rpmbuild -bs \
--define "_topdir $TOPDIR" \
--define "upstream_version $version" \
"$TOPDIR/SPECS/element-desktop.spec"
cp "$TOPDIR/SRPMS/"*.src.rpm "$OUTDIR/"
printf '%s\n' "$OUTDIR"/element-desktop-"$version"-1*.src.rpm
+34
View File
@@ -0,0 +1,34 @@
#!/bin/sh
set -eu
SOURCE_URL="${SOURCE_URL:-https://packages.element.io/desktop/install/linux/glibc-x86-64/element-desktop.tar.gz}"
OUTDIR="${1:-}"
if [ -z "$OUTDIR" ]; then
echo "usage: $0 OUTDIR" >&2
exit 1
fi
mkdir -p "$OUTDIR"
tmpdir="$(mktemp -d)"
cleanup() {
rm -rf "$tmpdir"
}
trap cleanup EXIT INT TERM
archive="$tmpdir/element-desktop.tar.gz"
curl -fL "$SOURCE_URL" -o "$archive"
topdir="$(tar -tzf "$archive" | sed -n '1s#/##p')"
version="${topdir#element-desktop-}"
if [ -z "$version" ] || [ "$version" = "$topdir" ]; then
echo "failed to derive version from archive root: $topdir" >&2
exit 1
fi
dest="$OUTDIR/element-desktop-$version.tar.gz"
cp "$archive" "$dest"
printf '%s\n' "$version" > "$OUTDIR/.upstream-version"
printf '%s\n' "$dest"