File gittyup.spec of Package gittyup

#
# spec file for package gittyup
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2024, 2025 Boian Berberov
#
# 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/
#

%global         up_name    Gittyup
%global         topsrcdir  %{up_name}-%{version}



Name:           gittyup
Version:        1.4.0
Release:        0%{?dist}
Group:          Development/Tools/Version Control
Summary:        Understand your Git history!
License:        MIT
URL:            https://murmele.github.io/Gittyup/

Source0:        %{topsrcdir}.tar.gz
# BUG: Cannot use upstream git archive because the repo contains submodules
#      Have to use the tar_scm _service configuration
#      See https://github.com/dear-github/dear-github/issues/214
#      Also, build issue with libgit2 from archive
# Source0:        https://github.com/Murmele/%{up_name}/archive/refs/tags/%{name}_v%{version}.tar.gz
# Source10:       https://github.com/stinb/libgit2/archive/7861f401ea25e1ceaf7323c1585de4d633e0ec39.tar.gz
# Source11:       https://github.com/orbitalquark/scintillua/archive/refs/tags/scintillua_4.4.5-2.tar.gz
# Source12:       https://github.com/ScintillaOrg/lexilla/archive/refs/tags/rel-4-4-6.tar.gz

BuildRequires:  cmake >= 3.12
BuildRequires:  cmark

# BEGIN multibuild BuildRequires: GCC all
%if 0%{?is_opensuse}
	%if 0%{?sle_version}
		%if 0%{?sle_version} == 150600
BuildRequires:  gcc13
BuildRequires:  gcc13-c++
%global         multi_gcc  gcc-13
%global         multi_gpp  gcc-13 -E
%global         multi_gxx  g++-13
		%else
			%if 0%{?sle_version} == 150500
BuildRequires:  gcc12
BuildRequires:  gcc12-c++
%global         multi_gcc  gcc-12
%global         multi_gpp  gcc-12 -E
%global         multi_gxx  g++-12
			%else
BuildRequires:  gcc     >= 10
BuildRequires:  gcc-c++ >= 10
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
			%endif
		%endif
	%else
BuildRequires:  gcc
BuildRequires:  gcc-c++
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
	%endif
%else
BuildRequires:  gcc
BuildRequires:  gcc-c++
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
%endif
# END   multibuild BuildRequires: GCC all


# NOTE: git-core is not a hard dependency
# BuildRequires:  git-core

%if ( 0%{?is_opensuse} && ( ! 0%{?sle_version} ) ) || 0%{?fedora} || 0%{?mageia}
# FIXME: Using bundled if unavailable
BuildRequires:  pkgconfig(lua) >= 5.4
BuildRequires:  pkgconfig(lua) <  5.5
%endif

Suggests:       libsecret-1
Suggests:       gnome-keyring-1

BuildRequires:  pkgconfig(hunspell)

%if ( 0%{?is_opensuse} && "%{_repository}" != "openSUSE_Slowroll" ) || 0%{?mageia} || 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
# FIXME: Using bundled if unavailable
BuildRequires:  pkgconfig(libcmark)
%endif

# BUG: cannot unbundle libgit2 at this time; compile errors
# BuildRequires:  pkgconfig(libgit2)
BuildRequires:  pkgconfig(libssh2)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  cmake(Qt6Concurrent)
BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6DBus)
BuildRequires:  cmake(Qt6Gui)
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6PrintSupport)
BuildRequires:  cmake(Qt6Test)
BuildRequires:  cmake(Qt6Widgets)

Requires(post):   desktop-file-utils
Requires(postun): desktop-file-utils

Suggests:       qt6-translations

%description
Gittyup is a graphical Git client designed to help you understand and manage your source code history. Gittyup is a fork of GitAhead.



%prep
%setup -q -n %{topsrcdir}

# # Setup bundled libgit2
# @__rpmuncompress -x @{SOURCE10}
# @__mv libgit2-*/* dep/libgit2/
# @__rm -rf libgit2-*
#
# # Setup bundled scintillua
# @__rpmuncompress -x @{SOURCE11}
# @__mv scintillua-*/* dep/scintilla/scintillua/
# @__rm -rf scintillua-*
#
# # Setup bundled lexilla
# @__rpmuncompress -x @{SOURCE12}
# @__mv lexilla-*/* dep/scintilla/lexilla/
# @__rm -rf lexilla-*

# Set directory names to the package name
%__sed -i \
	-e '/set(L10N_INSTALL_DIR/s:LOCALEDIR}/${GITTYUP_NAME}:DATAROOTDIR}/${GITTYUP_EXECUTABLE_NAME}/translations:' \
	-e '/set(QT_TRANSLATIONS_DIR/s:"/usr/share/qt/translations":${CMAKE_INSTALL_DATAROOTDIR}/qt5/translations:' \
	-e '/set(RESOURCES_DIR/s:${GITTYUP_NAME}:${GITTYUP_EXECUTABLE_NAME}:' \
	CMakeLists.txt

# Remove RPATH
%__sed -i -e'/set_target_properties(gittyup PROPERTIES INSTALL_RPATH "$ORIGIN")/d' src/app/CMakeLists.txt

# Install auxilary binaries in libexecdir
%__sed -i -e '/DESTINATION/s:${CMAKE_INSTALL_BINDIR}:${CMAKE_INSTALL_LIBEXECDIR}/%{name}:' \
	src/index/CMakeLists.txt \
	src/update/CMakeLists.txt



%build
# BUG: cannot unbundle libgit2 at this time; compile errors
#	-DUSE_SYSTEM_LIBGIT2=ON
# NOTE: Don't build git2
# 	-DBUILD_CLI=OFF
%cmake \
	-DFLATPAK=OFF \
	-DDEBUG_FLATPAK=OFF \
	\
	-DENABLE_UPDATE_OVER_GUI=OFF \
	\
	-DUSE_SYSTEM_OPENSSL=ON \
	-DBUILD_CLI=OFF \
	-DUSE_SYSTEM_LIBSSH2=ON \
	-DUSE_SYSTEM_GIT=ON \
	-DUSE_SYSTEM_QT=ON \
%if ( 0%{?is_opensuse} && ( ! 0%{?sle_version} ) ) || 0%{?fedora} || 0%{?mageia}
	-DUSE_SYSTEM_LUA=ON \
%else
	-DUSE_SYSTEM_LUA=OFF \
%endif
	-DUSE_SYSTEM_HUNSPELL=ON \
%if ( 0%{?is_opensuse} && "%{_repository}" != "openSUSE_Slowroll" ) || 0%{?mageia} || 0%{?fedora}  || 0%{?rhel_version} || 0%{?centos_version}
	-DUSE_SYSTEM_CMARK=ON \
%else
	-DUSE_SYSTEM_CMARK=OFF \
%endif
	-DENABLE_TESTS=OFF \
	-DENABLE_SHA256=ON \
	\
	-DCMAKE_C_COMPILER:STRING=%{multi_gcc} \
	-DCMAKE_CXX_COMPILER:STRING=%{multi_gxx} \
	-DCMAKE_CXX_LINK_PIE_SUPPORTED:BOOL=ON

%cmake_build



%install
%cmake_install

# Remove all bundled headers
%__rm -rf %{buildroot}%{_includedir}

# Remove all bundled libraries
%__rm -rf %{buildroot}%{_libdir}

# We'll install the license ourselves
%__rm -rf %{buildroot}%{_datadir}/licenses



%post
%desktop_database_post



%postun
%desktop_database_postun



%files
%license LICENSE.md
%doc     README.md
%{_bindir}/%{name}
%{_libexecdir}/%{name}/
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/

%if 0%{?is_opensuse} && "%{_repository}" != "openSUSE_Slowroll" || 0%{?mageia} || 0%{?fedora}  || 0%{?rhel_version} || 0%{?centos_version}
# Do nothing
%else
%{_bindir}/cmark
%{_mandir}/man1/cmark.1*
%{_mandir}/man3/cmark.3*
%endif



%changelog

* Tue Jul 15 2025 Boian Berberov
- Added changelog for openSUSE Leap 16
openSUSE Build Service is sponsored by