## START: Set by rpmautospec
## (rpmautospec version 0.3.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 34;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global commit 0e858d33fd28d98d2689d0ebb92c975729a9f7bc
%global shortcommit %%(c=%%{commit}; echo ${c:0:7})
%global date 20210528

Name:		gpick
Version:	0.2.6
Release:	%autorelease -b 4 -s %{date}git%{shortcommit}
Summary:	Advanced color picker

License:	BSD
URL:		http://gpick.org

%{?shortcommit:
Source:		https://github.com/thezbyg/%{name}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz}
%{!?shortcommit:
Source:		https://github.com/thezbyg/%{name}/archive/%{name}-%{version}.tar.gz#/%{name}-%{version}.tar.gz}

BuildRequires:	gcc-c++
BuildRequires:	boost-devel
BuildRequires:	cmake
BuildRequires:	desktop-file-utils 
BuildRequires:	gcc-c++
BuildRequires:	gettext
BuildRequires:	libappstream-glib
BuildRequires:  make
BuildRequires:	pkgconfig(dbus-glib-1)
BuildRequires:	pkgconfig(expat)
BuildRequires:	pkgconfig(gtk+-3.0)
BuildRequires:	pkgconfig(libcurl)
BuildRequires:	pkgconfig(lua)
BuildRequires:	pkgconfig(openthreads)
BuildRequires:	ragel


%description
Advanced color picker

%prep
%{?shortcommit:
%autosetup -p1 -n %{name}-%{commit}}
%{!?shortcommit:
%autosetup -n %name-%{name}-%{version}}
mkdir .git

# Delete external libraries and only use system dependencies to build GPick
rm -rf extern
echo "INTERNAL_EXPAT=False" >> user-config.py
echo "INTERNAL_LUA=False" >> user-config.py
echo "LOCALEDIR=\"%{_datadir}/locale\"" >> user-config.py

%build
%cmake \
	-DCFLAGS="%{optflags} -Wl,--as-needed" \
	-DCXXFLAGS="%%{optflags} -Wl,--as-needed --std=c++17" \
	-DLDFLAGS="%%{optflags} -Wl,--as-needed"
%cmake_build

%install
%cmake_install

# copy libraries
#mkdir -p %%{buildroot}%%{_libdir}
#cp -p %%{_builddir}/%%{name}-%%{version}/*.so %%{buildroot}%%{_libdir}

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

%files -f %{name}.lang
%doc %{_docdir}/%{name}/copyright
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_metainfodir}/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/%{name}.xml
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_mandir}/man1/%{name}.1.*

%changelog
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-37.20210528git0e858d3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Mon Feb 20 2023 Jonathan Wakely <jwakely@redhat.com> - 0.2.6-36.20210528git0e858d3
- Rebuilt for Boost 1.81

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-35.20210528git0e858d3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-34.20210528git0e858d3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Wed May 04 2022 Thomas Rodgers <trodgers@redhat.com> - 0.2.6-33.20210528git0e858d3
- Rebuilt for Boost 1.78

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-32.20210528git0e858d3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Wed Aug 11 2021 Jonathan Wakely <jwakely@redhat.com> - 0.2.6-31.20210528git0e858d3
- Rebuilt for Boost 1.76

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-30.20210528git0e858d3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Fri Jan 22 2021 Jonathan Wakely <jwakely@redhat.com> - 0.2.6-2
- Rebuilt for Boost 1.75

* Mon Dec 28 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 0.2.6-1
- Update to 0.2.6

* Wed Sep 30 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 0.2.6-0.rc1.20200513git.1
- Update to git snapshot 20200513

* Wed Sep 23 2020 Jeff Law <law@redhat.com> - 0.2.6-0.rc1.20181011git.2.5
- Use cmake_in_source_build to fix FTBFS due to recent cmake macro changes

* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-0.rc1.20181011git.2.4
- Second attempt - Rebuilt for
  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-0.rc1.20181011git.2.3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Thu May 28 2020 Jonathan Wakely <jwakely@redhat.com> - 0.2.6-0.rc1.20181011git.2.2
- Rebuilt for Boost 1.73

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-0.rc1.20181011git.2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild