solution-rpm/build_rpm.sh

35 lines
1 KiB
Bash
Raw Normal View History

2024-06-10 10:08:27 +02:00
#!/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