%global nm_version 1.2
%global nma_version 1.0
%global glib_required_version 2.63.1
%global gtk_required_version 3.11.3
%global geoclue_version 2.3.1
%global libhandy_version 1.5.90

Name:           gnome-initial-setup
Version:        42.2
Release:        1
Summary:        A easy way to prepare a new system
License:        GPLv2+
URL:            https://wiki.gnome.org/Design/OS/InitialSetup
Source0:        https://download.gnome.org/sources/%{name}/42/%{name}-%{version}.tar.xz
Source1:        vendor.conf
Patch9000:      0001-gnome-initial-setup-remove-link-Macau-to-Macao.patch

BuildRequires:  libsecret-devel gnome-common meson gcc
BuildRequires:  krb5-devel desktop-file-utils libpwquality-devel
BuildRequires:  pkgconfig(libnm) >= %{nm_version} pkgconfig(gstreamer-1.0)
BuildRequires:  pkgconfig(libnma) >= %{nma_version} pkgconfig(cheese)
BuildRequires:  pkgconfig(accountsservice) pkgconfig(fontconfig)
BuildRequires:  pkgconfig(gnome-desktop-4) pkgconfig(gweather4)
BuildRequires:  pkgconfig(cheese-gtk) >= 3.3.5 pkgconfig(goa-1.0)
BuildRequires:  pkgconfig(geocode-glib-1.0) pkgconfig(goa-backend-1.0)
BuildRequires:  pkgconfig(gtk+-3.0) >= %{gtk_required_version} glib2-devel >= %{glib_required_version}
BuildRequires:  pkgconfig(gdm) pkgconfig(iso-codes)
BuildRequires:  pkgconfig(libgeoclue-2.0) >= %{geoclue_version} pkgconfig(packagekit-glib2)
BuildRequires:  pkgconfig(webkit2gtk-4.0) ibus-devel rest-devel polkit-devel
BuildRequires:  pkgconfig(libhandy-1) >= %{libhandy_version}

Requires: gdm polkit-js-engine libgnomekbd
Requires: geoclue2-libs%{?_isa} >= %{geoclue_version}
Requires: glib2%{?_isa} >= %{glib_required_version}
Requires: libhandy%{?_isa} >= %{libhandy_version}

Requires(pre):  shadow-utils

Provides:       user(%name)

%description
After acquiring or installing a new system there are a few essential things to
set up before use. It would be nice if GNOME had a simple, easy, and safe way to
prepare a new system.

%prep
%autosetup -p1

%build
%meson -Dparental_controls=disabled -Dvendor-conf-file=%{_datadir}/gnome-initial-setup/vendor.conf
%meson_build

%install
%meson_install
%delete_la

install -d %{buildroot}%{_datadir}/gnome-initial-setup
cp %{SOURCE1} %{buildroot}%{_datadir}/gnome-initial-setup/

%check
desktop-file-validate %{buildroot}%{_sysconfdir}/xdg/autostart/gnome-initial-setup-copy-worker.desktop
desktop-file-validate %{buildroot}%{_datadir}/applications/gnome-initial-setup.desktop

%find_lang %{name}

%pre
useradd -rM -d /run/gnome-initial-setup/ -s /sbin/nologin %{name} &>/dev/null || :

%files -f %{name}.lang
%license COPYING
%doc NEWS README.md
%{_libexecdir}/gnome-initial-setup
%{_libexecdir}/gnome-initial-setup-copy-worker
%{_sysconfdir}/xdg/autostart/gnome-initial-setup-copy-worker.desktop
%{_sysconfdir}/xdg/autostart/gnome-initial-setup-first-login.desktop
%{_datadir}/applications/gnome-initial-setup.desktop
%{_datadir}/gnome-session/sessions/gnome-initial-setup.session
%{_datadir}/gnome-shell/modes/initial-setup.json
%{_datadir}/polkit-1/rules.d/20-gnome-initial-setup.rules
%{_userunitdir}/*
%{_datadir}/gnome-initial-setup/vendor.conf

%changelog
* Mon Jun 13 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 42.2-1
- Update to 42.2

* Mon Jun 7 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 3.38.5-1
- Upgrade to 3.38.5
- Update Version, Release, Source0, BuildRequires, Requires, stage 'build', 'install', 'files'
- Use meson rebuild, delete setup-shell.desktop, which doesn't existed in this version
- Delete honor-firstboot-disabled.patch which existed in this version

* Tue Jan 21 2020 openEuler Buildteam <buildteam@openeuler.org> - 3.30.0-3
- Type:bugfix
- ID:NA
- SUG:reboot
- DESC:remove link Macau to Macao

* Wed Dec 11 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.30.0-2
- Package init
