File gitahead.spec of Package gitahead
#
# spec file for package gitahead
#
# Copyright (c) 2020 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 GitAhead
Name: gitahead
Version: 2.7.1
Release: 1%{?dist}
Group: Development/Tools/Version Control
Summary: Understand your Git history!
License: MIT
URL: https://gitahead.github.io/gitahead.com/
# 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
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.desktop
BuildRequires: cmake
# 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
BuildRequires: pkgconfig(openssl)
# BUG: cannot unbundle lua at this time; compile errors
# lua.h: No such file or directory
# BuildRequires: lua54-devel
# BuildRequires: lua54-lpeg
BuildRequires: pkgconfig(gnome-keyring-1)
# BUG: cannot unbundle hunspell at this time; compile errors
# BuildRequires: pkgconfig(hunspell)
# BUG: cannot unbundle cmark at this time; compile errors
# undefined reference to `cmark_markdown_to_html'
# BuildRequires: pkgconfig(libcmark)
# BUG: cannot unbundle libgit2 at this time; compile errors
# %%if 0%%{?suse_version}
# BuildRequires: pkgconfig(libgit2) > 1.7
# BuildRequires: pkgconfig(libgit2) < 1.8
# %%endif
# %%if 0%%{?fedora}
# BuildRequires: libgit2-devel > 1.7
# BuildRequires: libgit2-devel < 1.8
# %%endif
# %%if 0%%{?mageia}
# BuildRequires: lib64git2-devel > 1.7
# BuildRequires: lib64git2-devel < 1.8
# %%endif
# BUG: cannot unbundle scintilla at this time
# BuildRequires: pkgconfig(libscintilla5)
BuildRequires: pkgconfig(libsecret-1)
# BUG: cannot unbundle libssh2 at this time; link errors
# undefined reference to `libssh2_agent_init'
# undefined reference to `libssh2_agent_connect'
# undefined reference to `libssh2_agent_disconnect'
# undefined reference to `libssh2_agent_free'
# undefined reference to `libssh2_session_free'
# undefined reference to `libssh2_session_last_error'
# BuildRequires: pkgconfig(libssh2)
BuildRequires: cmake(Qt6Concurrent)
BuildRequires: cmake(Qt6Core)
BuildRequires: cmake(Qt6Core5Compat)
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
%description
GitAhead is a graphical Git client designed to help you understand and manage your source code history.
%prep
%setup -q
# Define the executable name, to reuse in later sed-patches
%__sed -i \
-e '/set(GITAHEAD_NAME/a\\nset(GITAHEAD_EXECUTABLE_NAME "%{name}")' \
CMakeLists.txt
# Use executable name for binary
# Install binary in bindir
# Install shared files in datadir
# Remove RPATH, with a dummy property
%__sed -i \
-e '/OUTPUT_NAME/s/${GITAHEAD_NAME}/${GITAHEAD_EXECUTABLE_NAME}/' \
-e 's:DESTINATION \.:DESTINATION ${CMAKE_INSTALL_BINDIR}:' \
-e 's:DESTINATION Resources:DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${GITAHEAD_EXECUTABLE_NAME}:' \
-e 's:INSTALL_RPATH "$ORIGIN":RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}:' \
src/app/CMakeLists.txt
# Install auxilary binaries in libexecdir
%__sed -i \
-e '/DESTINATION/s:\.:${CMAKE_INSTALL_LIBEXECDIR}/%{name}:' \
src/index/CMakeLists.txt \
src/update/CMakeLists.txt
# Relocate plugins for removal TEST
# Relocate qt.conf for removal TEST
# Relocate bundled libraries for removal
# Install icons in datadir, move during install phase
%__sed -i \
-e 's@DESTINATION $<${MAC}:${CONTENTS_DIR}/>Plugins/${DIR_NAME}@DESTINATION ${CMAKE_INSTALL_LIBDIR}@' \
-e 's@DESTINATION $<${MAC}:${CONTENTS_DIR}/Resources/>\.@DESTINATION ${CMAKE_INSTALL_LIBDIR}@' \
-e 's:DESTINATION \.:DESTINATION ${CMAKE_INSTALL_LIBDIR}:' \
-e 's:DESTINATION Resources:DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}:' \
pack/CMakeLists.txt
# Relocate bundled cmark CLI for removal
%__sed -i \
-e 's:RUNTIME DESTINATION bin:RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}:' \
dep/cmark/cmark/src/CMakeLists.txt
# Disable building bundled libgit2 CLI
%__sed -i -e '/BUILD_CLI/s/ON/OFF/' dep/libgit2/libgit2/CMakeLists.txt
# NOTE: Removing bundled dependencies as much as possible
# BUG: cannot unbundle cmark at this time; link errors
# undefined reference to `cmark_markdown_to_html'
# %%__sed -i -e '/add_subdirectory(cmark)/d' dep/CMakeLists.txt
%__sed -i -e '/add_subdirectory(git)/d' dep/CMakeLists.txt
# BUG: cannot unbundle hunspell at this time; compile errors
# hunspell.hxx: No such file or directory
# %%__sed -i -e '/add_subdirectory(hunspell)/d' dep/CMakeLists.txt
# BUG: cannot unbundle libgit2 at this time; compile errors
# %%__sed -i -e '/add_subdirectory(libgit2)/,$d' dep/libgit2/CMakeLists.txt
# BUG: cannot unbundle libssh2 at this time; link errors
# undefined reference to `libssh2_agent_init'
# undefined reference to `libssh2_agent_connect'
# undefined reference to `libssh2_agent_disconnect'
# undefined reference to `libssh2_agent_free'
# undefined reference to `libssh2_session_free'
# undefined reference to `libssh2_session_last_error'
# %%__sed -i -e '/add_subdirectory(libssh2)/d' dep/CMakeLists.txt
# BUG: cannot unbundle lua at this time; compile errors
# lua.h: No such file or directory
# %%__sed -i -e '/add_subdirectory(lpeg)/d' dep/CMakeLists.txt
# %%__sed -i -e '/add_subdirectory(lua)/d' dep/CMakeLists.txt
%__sed -i -e '/add_subdirectory(openssl)/d' dep/CMakeLists.txt
# BUG: cannot unbundle scintilla at this time
# %%__sed -i -e '/add_subdirectory(scintilla)/d' dep/CMakeLists.txt
%build
export CFLAGS="%{build_cflags} -Wno-error=return-type"
export CXXFLAGS="%{build_cxxflags} -Wno-error=return-type"
%cmake \
%if 0%{?sle_version}
%if 0%{sle_version} <= 150500
-DCMAKE_INSTALL_BINDIR:PATH=bin \
-DCMAKE_INSTALL_SBINDIR:PATH=sbin \
-DCMAKE_INSTALL_LIBEXECDIR:PATH=lib \
-DCMAKE_INSTALL_SYSCONFDIR:PATH=etc \
-DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib \
-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=var \
-DCMAKE_INSTALL_RUNSTATEDIR:PATH=run \
-DCMAKE_INSTALL_INCLUDEDIR:PATH=include \
-DCMAKE_INSTALL_DATAROOTDIR:PATH=share \
-DCMAKE_INSTALL_DOCDIR:PATH=share/doc/packages/gitahead \
-DCMAKE_INSTALL_MANDIR:PATH=share/man \
-DCMAKE_INSTALL_INFODIR:PATH=share/info \
%endif
%else
%if 0%{?fedora}
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
%endif
%endif
-DCMAKE_C_COMPILER:STRING=%{multi_gcc} \
-DCMAKE_CXX_COMPILER:STRING=%{multi_gxx} \
-DCMAKE_CXX_LINK_PIE_SUPPORTED:BOOL=ON
%cmake_build
%install
%cmake_install
# Relocate all icons
%__install -D -m644 %{buildroot}%{_datadir}/GitAhead.iconset/icon_16x16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/gitahead.png
%__install -D -m644 %{buildroot}%{_datadir}/GitAhead.iconset/icon_32x32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/gitahead.png
%__install -D -m644 %{buildroot}%{_datadir}/GitAhead.iconset/icon_64x64.png %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/gitahead.png
%__install -D -m644 %{buildroot}%{_datadir}/GitAhead.iconset/icon_128x128.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/gitahead.png
%__install -D -m644 %{buildroot}%{_datadir}/GitAhead.iconset/icon_256x256.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/gitahead.png
%__install -D -m644 %{buildroot}%{_datadir}/GitAhead.iconset/icon_512x512.png %{buildroot}%{_datadir}/icons/hicolor/512x512/apps/gitahead.png
%__rm -rf %{buildroot}%{_datadir}/GitAhead.iconset
# Add .desktop file
%__install -D -m 0644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop
# Remove all bundled headers
%__rm -rf %{buildroot}%{_includedir}
# Remove all bundled libraries, and other files
%__rm -rf %{buildroot}%{_libdir}
# Remove bundled manpages
%__rm -rf %{buildroot}%{_mandir}
# Remove bundled manpages
%__rm -rf %{buildroot}%{_docdir}
%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/
%changelog
* Tue Jul 15 2025 Boian Berberov
- Added changelog for openSUSE Leap 16