File gitbutler.spec of Package gitbutler

#
# spec file for package gitbutler
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           gitbutler
Version:        0.18.3
Release:        0
Summary:        Git client for simultaneous branches on top of your existing workflow
License:        MIT
URL:            https://gitbutler.com/
Source0:        https://github.com/gitbutlerapp/gitbutler/archive/release%2F%{version}/gitbutler-release-%{version}.tar.gz
# Generated with npx pnpm-lock-to-npm-lock pnpm-lock.yaml in the extraced tarball directory
Source10:       package-lock.json
Source11:       node_modules.spec.inc
%include        %{_sourcedir}/node_modules.spec.inc
BuildRequires:  local-npm-registry
BuildRequires:  cargo-tauri
BuildRequires:  cmake
BuildRequires:  gtk4-devel
BuildRequires:  jq
BuildRequires:  libgit2-devel
BuildRequires:  libopenssl-devel
BuildRequires:  nodejs
BuildRequires:  npm
BuildRequires:  pnpm
BuildRequires:  rust-cargo
BuildRequires:  webkit2gtk-4_1-devel

%prep
%autosetup -p1 -n gitbutler-release-%{version}
local-npm-registry %{_sourcedir} install --also=dev

# jq '.
# 		| (.build.beforeBuildCommand |= "")
# 		| (.bundle.createUpdaterArtifacts |= false)
# 		| (.version |= $pkgver)
# 		| (.bundle.externalBin |= $externalbin)
# 	' \
# 	--arg pkgver "$pkgver" \
# 	--argjson externalbin '["gitbutler-git-setsid", "gitbutler-git-askpass", "but"]' \
# 	crates/gitbutler-tauri/tauri.conf.release.json \
# 	> tauri.conf.arch.json

%build
export RUSTFLAGS+=' --cfg tokio_unstable'
export RUSTC_BOOTSTRAP=1
export CARGO_TARGET_DIR="$PWD/target"
export OPENSSL_NO_VENDOR=true
export LIBGIT2_NO_VENDOR=1
export TURBO_TELEMETRY_DISABLED=1

# keep in sync with crates/gitbutler-tauri/tauri.conf.release.json
pnpm build:desktop -- --mode production
cargo build \
	--release \
	--bins \
	-p gitbutler-git \
	-p but
# keep in sync with crates/gitbutler-tauri/inject-git-binaries.sh
for bin in target/release/{gitbutler-git-{askpass,setsid},but}; do
	cp -av "$bin" "crates/gitbutler-tauri/${bin##*/}-$(rustc --print host-tuple)"
done
# tauri does not have "bare files" bundler, piggyback on the deb one
cargo tauri build \
	--bundles deb \
	--config tauri.conf.arch.json

%install
cd "$_archive"
cp -vdR --preserve=mode,timestamps \
	target/release/bundle/deb/*/data \
	-T "$pkgdir"

# rename the .desktop file to match the Tauri app ID, in order to
# provide expected behavior w/ enableGTKAppId in tauri.conf.json
mv "$pkgdir/usr/share/applications"/{GitButler.desktop,com.gitbutler.app.desktop}

install -Dm644 LICENSE.md \
	-t "$pkgdir/usr/share/licenses/$pkgname"

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}

%changelog

openSUSE Build Service is sponsored by