File scratch.spec of Package scratch
#
# spec file for package scratch
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
%define sover 0
%define _name scratch-text-editor
Name: scratch
Version: 2.4.1
Release: 0
Summary: Extensible Text Editor for Elementary OS
License: GPL-3.0+
Group: Productivity/Text/Editors
Url: https://launchpad.net/scratch
Source: https://launchpad.net/scratch/2.x/%{version}/+download/%{_name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM vala-0.36.patch -- Fix build with vala >= 0.36.
Patch0: scratch-2.4.1-vala-0.36.patch
# PATCH-FIX-UPSTREAM gtk.patch -- Fix build with granite >= 0.5 (#159) (#87)
Patch1: scratch-2.4.1-gtk.patch
BuildRequires: cmake >= 2.8
BuildRequires: ctags
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: intltool
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(gconf-2.0)
BuildRequires: pkgconfig(gee-0.8)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(granite) >= 0.3.0
BuildRequires: pkgconfig(gthread-2.0)
BuildRequires: pkgconfig(gtk+-3.0) >= 3.10
BuildRequires: pkgconfig(gtksourceview-3.0) >= 3.14
BuildRequires: pkgconfig(gtkspell3-3.0)
BuildRequires: pkgconfig(libdevhelp-3.0)
BuildRequires: pkgconfig(libpeas-1.0)
BuildRequires: pkgconfig(libpeas-gtk-1.0)
BuildRequires: pkgconfig(libsoup-2.4)
BuildRequires: pkgconfig(vapigen) >= 0.28.0
BuildRequires: pkgconfig(webkit2gtk-4.0) >= 2.10
BuildRequires: pkgconfig(zeitgeist-2.0)
Recommends: contractor
Recommends: zeitgeist
Recommends: %{name}-lang
%glib2_gsettings_schema_requires
%if 0%{?suse_version} > 1320 || 0%{?sle_version} >= 120000
BuildRequires: pkgconfig(vte-2.91)
%else
BuildRequires: pkgconfig(vte-2.90)
%endif
%description
Scratch is a GTK+-based text editor designed for Elementary OS. It
auto-saves files, and can remembers tabs and cursor positions. You
can install extensions to turn Scratch into a full-blown IDE, as
well as tweak the behaviour and interface to your liking. It has
highlighting for many programming, scripting and markup languages.
%lang_package
%package -n lib%{name}core%{sover}
Summary: Scratch Library
Group: System/Libraries
%description -n lib%{name}core%{sover}
Extensible Text Editor for Elementary OS.
This package contains the shared library.
%package devel
Summary: Development Files for Scratch
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Requires: lib%{name}core%{sover} = %{version}
Recommends: pkgconfig(vapigen)
%description devel
Extensible Text Editor for Elementary OS.
This package contains development files needed to develop plugins for
for Scratch.
%prep
%setup -q -n %{_name}-%{version}
%patch0 -p1
%patch1 -p1
# Fails to compile https://bugs.launchpad.net/scratch/+bug/1456572
sed -e '/add_subdirectory (filemanager)/d;/filemanager/q1' \
-e '/add_subdirectory (folder-manager)/d;/folder-manager/q1' \
-i ./plugins/CMakeLists.txt
# Fails to compile https://bugs.launchpad.net/scratch/+bug/1456580
sed -e '/add_subdirectory (outline)/d;/outline/q1' \
-i ./plugins/CMakeLists.txt
# Fails to compile https://bugs.launchpad.net/scratch/+bug/1456581
sed -e '/add_subdirectory (word-completion)/d;/word-completion/q1' \
-i ./plugins/CMakeLists.txt
%build
%cmake \
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed" \
-DGSETTINGS_COMPILE=OFF
make %{?_smp_mflags} V=1
%install
%cmake_install
%suse_update_desktop_file org.pantheon.scratch
%fdupes %{buildroot}%{_datadir}/
%find_lang scratch-text-editor %{name}.lang
%post
%glib2_gsettings_schema_post
%desktop_database_post
%postun
%glib2_gsettings_schema_postun
%desktop_database_postun
%post -n lib%{name}core%{sover} -p /sbin/ldconfig
%postun -n lib%{name}core%{sover} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc COPYING HACKING
%{_bindir}/%{name}-text-editor
%{_libdir}/%{name}/
%{_datadir}/%{name}/
%{_datadir}/applications/org.pantheon.scratch.desktop
%{_datadir}/glib-2.0/schemas/*.%{name}.*.xml
%dir %{_datadir}/appdata/
%{_datadir}/appdata/org.pantheon.scratch.appdata.xml
%files lang -f %{name}.lang
%defattr(-,root,root)
%files -n lib%{name}core%{sover}
%defattr(-,root,root)
%{_libdir}/lib%{name}core.so.*
%files devel
%defattr(-,root,root)
%{_libdir}/lib%{name}core.so
%{_libdir}/pkgconfig/%{name}core.pc
%{_datadir}/vala/vapi/%{name}core.*
%{_includedir}/%{name}/
%changelog