[packages/starship] Initial
arekm
arekm at pld-linux.org
Fri May 1 14:40:10 CEST 2026
commit 8eed179019963e76f684a8196d5a94e3c3aa77b6
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Fri May 1 14:39:44 2026 +0200
Initial
create-crates.sh | 69 ++++++++++++++++++++++++++++++++
starship.spec | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 186 insertions(+)
---
diff --git a/starship.spec b/starship.spec
new file mode 100644
index 0000000..3c6437c
--- /dev/null
+++ b/starship.spec
@@ -0,0 +1,117 @@
+%define crates_ver 1.25.1
+
+Summary: The minimal, blazing-fast, and infinitely customizable cross-shell prompt
+Name: starship
+Version: 1.25.1
+Release: 1
+License: ISC
+Group: Applications/Shells
+Source0: https://github.com/starship/starship/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: bb8175f295eb734cad5c26fddc2a5eea
+# cd starship-%{version}
+# cargo vendor
+# cd ..
+# tar cJf starship-crates-%{version}.tar.xz starship-%{version}/{vendor,Cargo.lock}
+Source1: %{name}-crates-%{crates_ver}.tar.xz
+# Source1-md5: ca10f1e32ae9968b2387b3b4b09cc6c7
+URL: https://starship.rs/
+BuildRequires: cargo
+BuildRequires: rpm-build >= 4.6
+BuildRequires: rpmbuild(macros) >= 2.050
+BuildRequires: rust >= 1.90
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
+%{?rust_req}
+ExclusiveArch: %{rust_arches}
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Starship is the minimal, blazing-fast, and infinitely customizable
+prompt for any shell. Shows the information you need, while staying
+sleek and minimal. Quick installation available for Bash, Fish, ZSH,
+Ion, Tcsh, Elvish, Nu, Xonsh, Cmd and PowerShell.
+
+%package -n bash-completion-starship
+Summary: Bash completion for starship
+Group: Applications/Shells
+Requires: %{name} = %{version}-%{release}
+Requires: bash-completion >= 1:2.0
+BuildArch: noarch
+
+%description -n bash-completion-starship
+Bash completion for starship.
+
+%package -n fish-completion-starship
+Summary: fish-completion for starship
+Group: Applications/Shells
+Requires: %{name} = %{version}-%{release}
+Requires: fish
+BuildArch: noarch
+
+%description -n fish-completion-starship
+fish-completion for starship.
+
+%package -n zsh-completion-starship
+Summary: Zsh completion for starship
+Group: Applications/Shells
+Requires: %{name} = %{version}-%{release}
+Requires: zsh
+BuildArch: noarch
+
+%description -n zsh-completion-starship
+Zsh completion for starship.
+
+%prep
+%setup -q -a1
+
+%{__mv} %{name}-%{crates_ver}/* .
+sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock
+
+# use our offline registry
+export CARGO_HOME="$(pwd)/.cargo"
+
+mkdir -p "$CARGO_HOME"
+cat >.cargo/config <<EOF
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = '$PWD/vendor'
+EOF
+
+%build
+export CARGO_HOME="$(pwd)/.cargo"
+
+%cargo_build --frozen
+
+%install
+rm -rf $RPM_BUILD_ROOT
+export CARGO_HOME="$(pwd)/.cargo"
+
+install -d $RPM_BUILD_ROOT{%{bash_compdir},%{fish_compdir},%{zsh_compdir}}
+
+%cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD
+%{cargo_objdir}/starship completions bash > $RPM_BUILD_ROOT%{bash_compdir}/starship
+%{cargo_objdir}/starship completions fish > $RPM_BUILD_ROOT%{fish_compdir}/starship.fish
+%{cargo_objdir}/starship completions zsh > $RPM_BUILD_ROOT%{zsh_compdir}/_starship
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md SECURITY.md
+%attr(755,root,root) %{_bindir}/starship
+
+%files -n bash-completion-starship
+%defattr(644,root,root,755)
+%{bash_compdir}/starship
+
+%files -n fish-completion-starship
+%defattr(644,root,root,755)
+%{fish_compdir}/starship.fish
+
+%files -n zsh-completion-starship
+%defattr(644,root,root,755)
+%{zsh_compdir}/_starship
diff --git a/create-crates.sh b/create-crates.sh
new file mode 100755
index 0000000..297913a
--- /dev/null
+++ b/create-crates.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+for cmd in bsdtar rpm-specdump cargo perl; do
+ if ! command -v $cmd > /dev/null 2> /dev/null; then
+ not_installed="$not_installed$cmd "
+ fi
+done
+
+if [ -n "$not_installed" ]; then
+ echo "ERROR: required commands not found: $not_installed" >&2
+ exit 1
+fi
+
+pkg_dir=$(readlink -f $(dirname "$0"))
+pkg_name=$(basename "$pkg_dir")
+
+if [ ! -f "$pkg_dir/$pkg_name.spec" ]; then
+ echo "ERROR: unable to determine package name" >&2
+ exit 1
+fi
+
+spec_dump=$(rpm-specdump "$pkg_dir/$pkg_name.spec")
+pkg_version=$(echo "$spec_dump" | grep PACKAGE_VERSION | cut -f3 -d' ')
+pkg_src=$(basename $(echo "$spec_dump" | grep SOURCEURL0 | cut -f3- -d' '))
+crates_file="$pkg_name-crates-$pkg_version.tar.xz"
+cargo_package=${force_cargo_package:-$pkg_name}
+
+if [ -e "$pkg_dir/$crates_file" ]; then
+ echo "ERROR: crates file $crates_file already exists" >&2
+ exit 1
+fi
+
+if [ ! -f "$pkg_dir/$pkg_src" ]; then
+ echo "ERROR: source file $pkg_src not found" >&2
+ exit 1
+fi
+
+tmpdir=$(mktemp -d)
+
+rm_tmpdir() {
+ if [ -n "$tmpdir" -a -d "$tmpdir" ]; then
+ rm -rf "$tmpdir"
+ fi
+}
+
+trap rm_tmpdir EXIT INT HUP
+
+cd "$tmpdir"
+bsdtar xf "$pkg_dir/$pkg_src"
+src_dir=$(ls)
+if [ $(echo "$src_dir" | wc -l) -ne 1 ]; then
+ echo "ERROR: unexpected source structure:\n$src_dir" >&2
+ exit 1
+fi
+
+cd "$src_dir"
+cargo vendor
+if [ $? -ne 0 ]; then
+ echo "ERROR: cargo vendor failed" >&2
+ exit 1
+fi
+
+# replace cargo package version with @@VERSION@@
+perl -pi -e 'BEGIN { undef $/;} s/(\[\[package\]\]\nname\s*=\s*"'"$cargo_package"'"\nversion\s*=\s*")[^"]+/$1\@\@VERSION\@\@/m' Cargo.lock
+
+cd ..
+tar cJf "$pkg_dir/$crates_file" "$src_dir"/{Cargo.lock,vendor}
+
+# vim: expandtab shiftwidth=2 tabstop=2
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/starship.git/commitdiff/8eed179019963e76f684a8196d5a94e3c3aa77b6
More information about the pld-cvs-commit
mailing list