Blob Blame History Raw
%global __provides_exclude_from ^%{_libdir}/scratch/.*\\.so$

Name:           scratch-text-editor
Summary:        The text editor that works
Version:        2.4.1
Release:        1%{?dist}
License:        GPLv3
URL:            https://launchpad.net/scratch

Source0:        https://launchpad.net/scratch/2.x/%{version}/+download/%{name}-%{version}.tar.xz

# Include the appropriate icon from elementary-icon-theme so appstream metadata generation works.
# A Bug about the missing icon is reported upstream:
# https://bugs.launchpad.net/scratch/+bug/1658325

Source1:        org.pantheon.scratch.svg

# Patch the .desktop file to not use the generic icon name but the bundled icon
Patch0:         00-rename-icon.patch

BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  gettext
BuildRequires:  intltool
BuildRequires:  libappstream-glib
BuildRequires:  vala

BuildRequires:  pkgconfig(gee-0.8)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(granite) >= 0.3.0
BuildRequires:  pkgconfig(gtksourceview-3.0) >= 3.10
BuildRequires:  pkgconfig(gtkspell3-3.0)
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.10
BuildRequires:  pkgconfig(libpeas-1.0)
BuildRequires:  pkgconfig(libpeas-gtk-1.0)
BuildRequires:  pkgconfig(libvala-0.34)
BuildRequires:  pkgconfig(libsoup-2.4)
BuildRequires:  pkgconfig(vte-2.91)
BuildRequires:  pkgconfig(webkit2gtk-4.0)
BuildRequires:  pkgconfig(zeitgeist-2.0)

Requires:       hicolor-icon-theme


%description
Scratch is the text editor that works for you. It auto-saves your files,
meaning they're always up-to-date. Plus it remembers your tabs so you
never lose your spot, even in between sessions.

Make it yours. Scratch is written from the ground up to be extensible.
Keep things super lightweight and simple, or install extensions to turn
Scratch into a full-blown IDE; it's your choice. And with a handful of
useful preferences, you can tweak the behavior and interface to your
liking.

It's elementary. Scratch is made to be the perfect text editor for
elementary, meaning it closely follows the high standards of design,
speed, and consistency. It's sexy, but not distracting.

Works with your language. Whether you're crafting code in Vala,
scripting with PHP, or marking things up in HTML, Scratch has you
covered. Experience full syntax highlighting with nearly all
programming, scripting, and markup languages.

Other syntax-highlighted languages: Bash, C, C#, C++. Cmake, CSS,
.Desktop, Diff, Fortran, Gettext, ini, Java, JavaScript, LaTex, Lua,
Makefile, Objective C, Pascal, Perl, Python, Ruby, XML.

Additional features include:

 * syntax highlighting with gtksourceview-3
 * a find bar to search the words in the files
 * strong integration with Granite framework by elementary-team
 * tab and split documents system
 * lots of others

Scratch needs to be translated. Go to Translations to help us providing
this software in your language!

Designed for elementary OS. Works and looks great on any GTK+ desktop.


%package        devel
Summary:        The text editor that works
Requires:       %{name}%{?_isa} = %{version}-%{release}
%description    devel
Scratch is the text editor that works for you. It auto-saves your files,
meaning they're always up-to-date. Plus it remembers your tabs so you
never lose your spot, even in between sessions.

This package contains the development headers.


%prep
%autosetup -p1


%build
mkdir build && pushd build
%cmake ..
%make_build
popd


%install
pushd build
%make_install
popd

%find_lang scratch-text-editor

mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/scalable/apps
cp -p %{SOURCE1} %{buildroot}/%{_datadir}/icons/hicolor/scalable/apps/


%check
desktop-file-validate %{buildroot}/%{_datadir}/applications/org.pantheon.scratch.desktop
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/org.pantheon.scratch.appdata.xml


%post
/sbin/ldconfig
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
/sbin/ldconfig

if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files -f scratch-text-editor.lang
%doc HACKING README
%license COPYING

%{_bindir}/scratch-text-editor

%{_libdir}/scratch/
%{_libdir}/libscratchcore.so.0
%{_libdir}/libscratchcore.so.0.0

%{_datadir}/appdata/org.pantheon.scratch.appdata.xml
%{_datadir}/applications/org.pantheon.scratch.desktop
%{_datadir}/glib-2.0/schemas/org.pantheon.scratch*.gschema.xml
%{_datadir}/icons/hicolor/scalable/apps/org.pantheon.scratch.svg
%{_datadir}/scratch/

%files          devel
%{_includedir}/scratch

%{_libdir}/libscratchcore.so
%{_libdir}/pkgconfig/scratchcore.pc

%{_datadir}/vala/vapi/scratchcore.deps
%{_datadir}/vala/vapi/scratchcore.vapi


%changelog
* Mon Feb 20 2017 Fabio Valentini <decathorpe@gmail.com> - 2.4.1-1
- Update to version 2.4.1.

* Fri Feb 10 2017 Fabio Valentini <decathorpe@gmail.com> - 2.4-1
- Update to version 2.4.

* Sun Jan 29 2017 Fabio Valentini <decathorpe@gmail.com> - 2.3-9
- Rename icon to match .desktop file.

* Wed Jan 25 2017 Fabio Valentini <decathorpe@gmail.com> - 2.3-8
- Include icon to fix appstream metadata generation.
- Filter provides to not pick up internal plugins.
- Remove explicit BR: pkgconfig.

* Tue Jan 03 2017 Fabio Valentini <decathorpe@gmail.com> - 2.3-7
- Clean up spec file.

* Thu Oct 06 2016 Fabio Valentini <decathorpe@gmail.com> - 2.3-6
- "Fix" ldconfig path in scriptlets.

* Thu Sep 29 2016 Fabio Valentini <decathorpe@gmail.com> - 2.3-5
- Clean up spec.

* Thu Sep 29 2016 Fabio Valentini <decathorpe@gmail.com> - 2.3-4
- Mass rebuild.

* Wed Sep 28 2016 Fabio Valentini <decathorpe@gmail.com> - 2.3-3
- Spec file cleanups.

* Mon Sep 19 2016 Fabio Valentini <decathorpe@gmail.com> - 2.3-2
- Spec file cosmetics.

* Thu Aug 11 2016 Fabio Valentini <decathorpe@gmail.com> - 2.3-1
- Update to version 2.3.