File valencia.spec of Package valencia

#
# spec file for package valencia
#
# Copyright (c) 2011 SUSE LINUX Products 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/
#


%if 0%{?favor_gtk2}
%define gedit_plugindir %{_libdir}/gedit-2/plugins
%else
%define gedit_plugindir %{_libdir}/gedit/plugins
%endif

Name:           valencia
%if 0%{?favor_gtk2}
Version:        0.3.0
Release:        11
%else
Version:        0.3.0_git20110905
Release:        11
%endif
%define _version 0.3.0
License:        LGPLv2.1+
Summary:        GEdit plugin to use GEdit as a lightweight IDE for Vala
Url:            http://yorba.org/valencia/
Group:          Development/Tools/IDE
Source:         %{name}-%{_version}.tar.bz2
# PATCH-FIX-UPSTREAM valencia-fix-build.patch vuntz@opensuse.org -- Fix build, taken from svn
Patch0:         valencia-fix-build.patch
# PATCH-FIX-UPSTREAM valencia-gedit3.patch vuntz@opensuse.org -- Build against GNOME 3, taken from git (gedit-3 branch, up to 80815271)
Patch1:         valencia-gedit3.patch
BuildRequires:  pkgconfig(gee-1.0)
%if 0%{?favor_gtk2}
BuildRequires:  pkgconfig(gedit-2.20)
BuildRequires:  pkgconfig(gtk+-2.0)
%if 0%{?suse_version} <= 1130
BuildRequires:  pkgconfig(vala-1.0)
%else
BuildRequires:  pkgconfig(vala-0.10)
%endif
BuildRequires:  pkgconfig(vte)
%else
BuildRequires:  pkgconfig(gedit)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(gtksourceview-3.0)
%if 0%{?suse_version} <= 1140
BuildRequires:  pkgconfig(libvala-0.12)
%else
BuildRequires:  pkgconfig(libvala-0.14)
%endif
BuildRequires:  pkgconfig(vte-2.90)
%endif
BuildRequires:  vala
BuildRequires:  update-desktop-files
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Valencia is a gedit plugin that turns gedit into a lightweight IDE for Vala.
Using Valencia, you can easily browse between symbols in a Vala program. You
can build a Vala program inside gedit and can easily jump to lines with
build errors. You can also get tooltips for methods and get autocompletion
suggestions by invoking autocomplete in the appropriate context.

%package -n gedit-plugin-valencia
License:        LGPLv2.1+
Summary:        GEdit plugin to use GEdit as a lightweight IDE for Vala
Group:          Development/Tools/IDE
Provides:       %{name} = %{version}
Requires:       gedit

%description -n gedit-plugin-valencia
Valencia is a gedit plugin that turns gedit into a lightweight IDE for Vala.
Using Valencia, you can easily browse between symbols in a Vala program. You
can build a Vala program inside gedit and can easily jump to lines with
build errors. You can also get tooltips for methods and get autocompletion
suggestions by invoking autocomplete in the appropriate context.

%prep
%setup -q -n %{name}-%{_version}
%if 0%{?favor_gtk2}
%if 0%{?suse_version} > 1130
# vala-1.0 is now vala-0.10 => remove hack when fixed in new upstream version (build will fail)
grep -q vala-1.0 Makefile
sed -i "s/vala-1.0/vala-0.10/g" Makefile
%endif
%patch0 -p3
%else
%patch1 -p1
%if ! 0%{?suse_version} <= 1140
grep -q libvala-0.12 Makefile
sed -i "s/libvala-0.12/libvala-0.14/g" Makefile
%endif
%endif

%build
export CFLAGS="%{optflags}"
%__make %{?jobs:-j%{jobs}}

%install
install -D libvalencia.so %{buildroot}%{gedit_plugindir}/libvalencia.so
install -D valencia.gedit-plugin %{buildroot}%{gedit_plugindir}/valencia.gedit-plugin
install -D valencia.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/valencia.png

%clean
rm -rf %{buildroot}

%if 0%{?suse_version} > 1130

%post -n gedit-plugin-valencia
%icon_theme_cache_post
%endif

%if 0%{?suse_version} > 1130

%postun -n gedit-plugin-valencia
%icon_theme_cache_postun
%endif

%files -n gedit-plugin-valencia
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README THANKS
%{gedit_plugindir}/libvalencia.so
%{gedit_plugindir}/valencia.gedit-plugin
%{_datadir}/icons/hicolor/128x128/apps/valencia.png

%changelog
openSUSE Build Service is sponsored by