Working RPM build

This commit is contained in:
Imbus 2024-06-10 10:08:27 +02:00
parent 4da836c535
commit c2e9464a06
2 changed files with 91 additions and 0 deletions

56
SolutionTM.spec Normal file
View file

@ -0,0 +1,56 @@
# Generated by rust2rpm 26
%bcond_without check
# prevent library files from being installed
%global cargo_install_lib 0
%global crate SolutionTM
Name: SolutionTM
Version: 0.1.0
Release: %autorelease
Summary: Simple demonstration of the Iced GUI library
SourceLicense: MIT
# FIXME: paste output of %%cargo_license_summary here
License: MIT
# LICENSE.dependencies contains a full license breakdown
URL: no
Source: %{crate}-%{version}.tar.gz
Source: %{crate}-%{version}-vendor.tar.gz
BuildRequires: cargo-rpm-macros >= 26
BuildRequires: cargo >= 1.78
%global _description %{expand:
A simple demonstration of the Iced GUI library.}
%description %{_description}
%prep
%autosetup -n %{crate}-%{version} -p1 -a1
%cargo_prep -v vendor
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%{cargo_vendor_manifest}
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%files
%license LICENCE.txt
%license LICENSE.dependencies
%license cargo-vendor.txt
%{_bindir}/SolutionTM
%changelog
%autochangelog

35
build_rpm.sh Executable file
View file

@ -0,0 +1,35 @@
#!/bin/bash
# This is a simple script to build an RPM package from a spec file.
# We need to install the required dependencies to build RPM packages.
# We also need to set up the RPM build tree:
#
# $ sudo dnf install rpm-build rpmdevtools dnf-plugins-core
# $ rpmdev-setuptree
#
# To install the builddeps:
#
# $ sudo dnf builddep SolutionTM.spec
version=0.1.0
name=SolutionTM
source_tar=$name-$version.tar.gz
vendor_tar=$name-$version-vendor.tar.gz
# First, we need a tarball of the source code in this very repo.
git archive --format=tar.gz --prefix=$name-$version/ -o SolutionTM-$version.tar.gz HEAD
# If we want an unclean build, comment out the above line and use the following instead.
# git ls-files | tar --transform='s,^,$name-$version/,' -T - -czf $source_tar
# Then we need a vendor tarball of the dependencies.
cargo vendor --versioned-dirs --offline vendor
tar -cvzf $vendor_tar vendor
# Then we move the tarball to the SOURCES directory.
mv $source_tar ~/rpmbuild/SOURCES/
mv $vendor_tar ~/rpmbuild/SOURCES/
rpmbuild -ba $name.spec