Blob Blame Raw
# Enable LTO
%global optflags        %{optflags} -flto=$(nproc)
%global build_ldflags   %{build_ldflags} -flto

%global commit  58b87308a937d4128eb07506d8c4b63bcceb9d2f
%global appname org.corectrl.corectrl

Name:           corectrl
Version:        1.0.6
Release:        1%{?dist}
Summary:        Friendly hardware control

# The entire source code is GPLv3+ except bundled libs:
# Boost:        tests/3rdparty/catch
#               tests/3rdparty/trompeloeil
# BSD:          3rdparty/fmt
# MIT:          3rdparty/easyloggingpp
#               3rdparty/pugixml
#               3rdparty/units
# Public Domain FindBotan.cmake
License:        GPLv3+ and Boost and BSD and MIT and Public Domain
URL:            https://gitlab.com/corectrl/corectrl
Source0:        %{url}/-/archive/v%{version}/%{name}-%{version}.tar.gz
Source1:        README.fedora.md

BuildRequires:  cmake
BuildRequires:  cmake(KF5Archive)
BuildRequires:  cmake(KF5Auth)
BuildRequires:  cmake(KF5CoreAddons)
BuildRequires:  cmake(Qt5Charts)
BuildRequires:  cmake(Qt5Concurrent)
BuildRequires:  cmake(Qt5Core)
BuildRequires:  cmake(Qt5DBus)
BuildRequires:  cmake(Qt5LinguistTools)
BuildRequires:  cmake(Qt5Multimedia)
BuildRequires:  cmake(Qt5Network)
BuildRequires:  cmake(Qt5Svg)
BuildRequires:  cmake(Qt5Widgets)
BuildRequires:  desktop-file-utils
BuildRequires:  extra-cmake-modules
BuildRequires:  gcc-c++
BuildRequires:  libappstream-glib
BuildRequires:  ninja-build
BuildRequires:  pkgconfig(botan-2)
BuildRequires:  pkgconfig(x11)
Requires:       dbus-common
Requires:       hicolor-icon-theme
Requires:       polkit%{?_isa}
Requires:       qca-qt5-ossl%{?_isa}
Requires:       qt5-qtquickcontrols2%{?_isa}
# --- Used to gather more information ---
# For glxinfo
Recommends:     mesa-demos%{?_isa}
# For lscpu
Recommends:     util-linux%{?_isa}
# For vulkaninfo
Recommends:     vulkan-tools%{?_isa}
# https://gitlab.com/corectrl/corectrl/issues/13
Provides:       bundled(easyloggingpp) = 9.96.7
Provides:       bundled(fmt) = 5.2.1
Provides:       bundled(pugixml) = 1.9
Provides:       bundled(units)
# Temporary added
Obsoletes:      %{name}-devel

%description
CoreCtrl is a Free and Open Source GNU/Linux application that allows you to
control with ease your computer hardware using application profiles. It aims
to be flexible, comfortable and accessible to regular users.

• For setup instructions run:

  xdg-open %{_docdir}/%{name}/README.fedora.md

• or go to the project wiki:

  https://gitlab.com/corectrl/corectrl/wikis

%prep
%autosetup -p1 -n %{name}-v%{version}-%{commit}
# 'lib64' path fix
sed -e 's@DESTINATION lib@DESTINATION %{_lib}@g' -i src/CMakeLists.txt
# lib soversion fix
echo "set_property(TARGET corectrl_lib PROPERTY SOVERSION 0)" >> src/CMakeLists.txt

mkdir -p %{_target_platform}

%build
pushd %{_target_platform}
    %cmake -G Ninja \
    -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \
    ..
popd
%ninja_build -C %{_target_platform}

%install
%ninja_install -C %{_target_platform}
# Install 'README.fedora.md'
mkdir -p %{buildroot}%{_docdir}/%{name}/
install -p -m 644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}/

find README.md -type f -perm /111 -exec chmod 644 {} \;
find    %{buildroot}/%{_datadir}/. -type f -executable -exec chmod -x "{}" \;
# Useless symlink without headers
rm      %{buildroot}/%{_libdir}/libcorectrl.so

%check
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/%{appname}.appdata.xml
desktop-file-validate %{buildroot}%{_datadir}/applications/%{appname}.desktop

%files
%license COPYING LICENSE
%doc README.md README.fedora.md
%{_bindir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/dbus-1/system-services/*.service
%{_datadir}/dbus-1/system.d/*.conf
%{_datadir}/icons/hicolor/*/apps/*.svg
%{_datadir}/polkit-1/actions/*.policy
%{_libdir}/libcorectrl.so.0*
%{_libexecdir}/kf5/kauth/*
%{_metainfodir}/%{appname}.appdata.xml

%if 0%{?fedora} < 30
%{_sysconfdir}/dbus-1/system.d/*.conf
%endif

%changelog
* Sat Aug 10 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 1.0.6-1
- Update to 1.0.6

* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Tue Jul 23 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 1.0.5-1
- Update to 1.0.5
- App summary more descriptive now (upstream suggestion)

* Wed Jul 17 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 1.0.4-4
- Update to 1.0.4

* Mon Jul 15 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 1.0.3-15
- Initial package
- Thanks to Dead_Mozay <dead_mozay@opensuse.org> for initial spec file
- Thanks to Vitaly Zaitsev <vitaly@easycoding.org> for significant help with packaging and review