aboutsummaryrefslogtreecommitdiff
path: root/packaging
diff options
context:
space:
mode:
authorjakob.stendahl <jakob.stendahl@infomedia.dk>2024-06-17 09:08:15 +0200
committerjakob.stendahl <jakob.stendahl@infomedia.dk>2024-06-17 09:12:46 +0200
commit1a9b46180fa1e796f2ed0bf965141490900ec77e (patch)
treeba3e3a8ca2bcce34ed28581fec170b06eb16a456 /packaging
parentd82a5f6e1bc878b0e6a695f88eb69404ca6d571d (diff)
downloadtextgraph-1a9b46180fa1e796f2ed0bf965141490900ec77e.tar.gz
textgraph-1a9b46180fa1e796f2ed0bf965141490900ec77e.zip
Don't use the tg alias by default, add fedora build script
Diffstat (limited to 'packaging')
-rw-r--r--packaging/FEDORA/textgraph.spec17
-rwxr-xr-xpackaging/package-debian.sh4
-rwxr-xr-xpackaging/package-fedora.sh33
3 files changed, 40 insertions, 14 deletions
diff --git a/packaging/FEDORA/textgraph.spec b/packaging/FEDORA/textgraph.spec
index 0873f69..2a92c6a 100644
--- a/packaging/FEDORA/textgraph.spec
+++ b/packaging/FEDORA/textgraph.spec
@@ -15,10 +15,11 @@ Version: %{package_version}
Release: %{package_release}
Summary: Text graphing utility
-#License: GPLv3
+License: GPLv3
Source: %{name}-%{version}.tar.gz
BuildRequires: cargo-rpm-macros >= 24
+BuildRequires: rust-libc-devel
%description
Text graphing utility
@@ -28,21 +29,13 @@ Text graphing utility
%cargo_prep
%build
-# This is not best practice, but it was somewhat annoying to actually get all
-# dependencies vendored/packaged properly.
-# currently this app doesn't have any cargo dependencies, but keeping it for reference
-#sed -i '/^\[source\.crates-io\]/,/^$/d' %{cargo_config}
-#sed -i '/^\[source\.local-registry\]/,/^$/d' %{cargo_config}
-#sed -i '/^\[net\]/,/^$/d' %{cargo_config}
-#echo "[net]" >> %{cargo_config}
-#echo "git-fetch-with-cli = true" >> %{cargo_config}
%cargo_build
%install
%cargo_install
mkdir -p %{buildroot}%{_mandir}/man1
-install tg.1 %{buildroot}%{_mandir}/man1/tg.1
+install textgraph.1 %{buildroot}%{_mandir}/man1/textgraph.1
%if %{with check}
%check
@@ -51,8 +44,8 @@ install tg.1 %{buildroot}%{_mandir}/man1/tg.1
%files
%doc README.md
-%{_bindir}/tg
-%{_mandir}/man1/tg.1.gz
+%{_bindir}/textgraph
+%{_mandir}/man1/textgraph.1.gz
%changelog
%autochangelog
diff --git a/packaging/package-debian.sh b/packaging/package-debian.sh
index 3bea609..51d3962 100755
--- a/packaging/package-debian.sh
+++ b/packaging/package-debian.sh
@@ -17,8 +17,8 @@ mandir=${dir}/usr/share/man/man1
mkdir -p ${mandir}
cp -r packaging/DEBIAN ${dir}/DEBIAN
-cp target/release/textgraph ${bindir}/tg
-cp tg.1 ${mandir}/tg.1
+cp target/release/textgraph ${bindir}/textgraph
+cp textgraph.1 ${mandir}/textgraph.1
cd ${tmpdir}
dpkg-deb --build textgraph
diff --git a/packaging/package-fedora.sh b/packaging/package-fedora.sh
new file mode 100755
index 0000000..d91c018
--- /dev/null
+++ b/packaging/package-fedora.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+set -x
+
+DIST=fc40
+ARCH=x86_64
+RPMBUILD=rpmbuild
+BUILDROOT=${HOME}/rpmbuild/
+SPECFILE=packaging/FEDORA/textgraph.spec
+SOURCEDIR=$(pwd)
+VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' Cargo.toml)
+BUILDROOT_SPECFILE="${BUILDROOT}/SPECS/textgraph.spec"
+
+rpmdev-setuptree
+
+echo "Making tarball"
+tarwd=$(dirname "${SOURCEDIR}")
+tarfile=$(basename "${SOURCEDIR}")
+tar -czf "textgraph-${VERSION}.tar.gz" -C "${tarwd}" --transform "s|${tarfile}|textgraph-${VERSION}|" ${tarfile}
+cp "textgraph-${VERSION}.tar.gz" "${BUILDROOT}/SOURCES/textgraph-${VERSION}.tar.gz"
+
+echo "Copy specfile"
+cp "${SPECFILE}" "${BUILDROOT_SPECFILE}"
+
+
+echo "Install dependencies"
+sudo dnf builddep "${BUILDROOT_SPECFILE}"
+
+echo "Running spmbuild"
+rpmbuild -ba "${BUILDROOT_SPECFILE}" \
+ --define "package_version ${VERSION}" \
+ --define "package_release 1.${DIST}"
+
+