File unity-gtk-module.spec of Package unity-gtk-module

#
# spec file for package unity-gtk-module
#
# Copyright (c) 2015 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 _name_gtk2 unity-gtk2-module
%define _name_gtk3 unity-gtk3-module
%define lname_gtk2 libunity-gtk2-parser0
%define lname_gtk3 libunity-gtk3-parser0
%define _version 0.0.0+15.04.20150118
Name:           unity-gtk-module
Version:        0.0.0+bzr20150118
Release:        0
Summary:        GTK+ module for exporting old-style menus as GMenuModels
License:        LGPL-3.0+
Group:          System/GUI/Other
Url:            https://launchpad.net/unity-gtk-module
Source:         http://archive.ubuntu.com/ubuntu/pool/main/u/%{name}/%{name}_%{_version}.orig.tar.gz
Source1:        baselibs.conf
# PATCH-FIX-OPENSUSE unity-gtk-module-gsettings.patch ria.freelander@gmail.com -- Use GSettings key instead of patched Gtk2.
Patch0:         %{name}-gsettings.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gcc-c++
BuildRequires:  gtk-doc
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRequires:  python
BuildRequires:  pkgconfig(gtk+-2.0) >= 2.24.0
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.2.0
BuildRequires:  pkgconfig(x11)

%description
Many applications implement menus as GtkMenuShells and GtkMenuItems
and aren't looking to migrate to the newer GMenuModel API.
This GTK+ module watches for these types of menus and exports the
appropriate GMenuModel implementation.

%package -n %{_name_gtk2}
Summary:        GTK+2 module for exporting old-style menus as GMenuModels
Group:          System/GUI/Other
Requires:       %{lname_gtk2} = %{version}
Requires:       %{name}-common = %{version}

%description -n %{_name_gtk2}
Many applications implement menus as GtkMenuShells and GtkMenuItems
and aren't looking to migrate to the newer GMenuModel API.
This GTK+2 module watches for these types of menus and exports the
appropriate GMenuModel implementation.

%package -n %{_name_gtk3}
Summary:        GTK+3 module for exporting old-style menus as GMenuModels
Group:          System/GUI/Other
Requires:       %{lname_gtk3} = %{version}
Requires:       %{name}-common = %{version}

%description -n %{_name_gtk3}
Many applications implement menus as GtkMenuShells and GtkMenuItems
and aren't looking to migrate to the newer GMenuModel API.
This GTK+3 module watches for these types of menus and exports the
appropriate GMenuModel implementation.

%package common
Summary:        GTK+ module for exporting old-style menus as GMenuModels -- Common Files
Group:          System/GUI/Other
Recommends:     %{_name_gtk2} = %{version}
Recommends:     %{_name_gtk3} = %{version}
Suggests:       appmenu-qt
Suggests:       appmenu-qt5

%description common
Many applications implement menus as GtkMenuShells and GtkMenuItems
and aren't looking to migrate to the newer GMenuModel API.
This GTK+ module watches for these types of menus and exports the
appropriate GMenuModel implementation.

This package contains common data that is used by unity-gtk-module
packages.

%package -n %{lname_gtk2}
Summary:        GtkMenuShell to GMenuModel parser
Group:          System/Libraries

%description -n %{lname_gtk2}
This library converts GtkMenuShells into GMenuModels.

%package -n %{lname_gtk3}
Summary:        GtkMenuShell to GMenuModel parser
Group:          System/Libraries

%description -n %{lname_gtk3}
This library converts GtkMenuShells into GMenuModels.

%package -n libunity-gtk-parser-devel
Summary:        Development files of libunity-gtk-parser
Group:          Development/Libraries/C and C++
Requires:       %{lname_gtk2} = %{version}
Requires:       %{lname_gtk3} = %{version}
Requires:       pkgconfig(gtk+-2.0)
Requires:       pkgconfig(gtk+-3.0)

%description -n libunity-gtk-parser-devel
The libunity-gtk-parser development package includes the header
files, libraries, development tools necessary for compiling and
linking application which will use libunity-gtk-parser.

%prep
%setup -q -n %{name}-%{_version}
%patch0

cat > %{name}.sh << EOF
if [ -z "\$%{nil}GTK_MODULES" ]; then
    export GTK_MODULES="unity-gtk-module"
else
    export GTK_MODULES="\$%{nil}GTK_MODULES:%{name}"
fi
if [ -z "\$%{nil}UBUNTU_MENUPROXY" ]; then
    export UBUNTU_MENUPROXY=1
fi
EOF
cat > %{name}.csh << EOF
if ( -z "\$%{nil}GTK_MODULES" ) then
    setenv GTK_MODULES "unity-gtk-module"
else
    setenv GTK_MODULES "\$%{nil}{GTK_MODULES}:%{name}"
endif
if ( -z "\$%{nil}UBUNTU_MENUPROXY" ) then
    setenv UBUNTU_MENUPROXY 1
fi
EOF

%build
export CFLAGS="%{optflags}"
gtkdocize --copy
autoreconf -fi
%global _configure ../configure
for ver in 2 3; do
    mkdir build-gtk$ver
    pushd build-gtk$ver
    %configure \
      --disable-static \
      --enable-gtk-doc \
      --with-gtk=$ver
    make %{?_smp_mflags}
    popd
done

%install
for ver in 2 3; do
    pushd build-gtk$ver
    %make_install
    popd
done
install -Dm 0644 %{name}.sh %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
install -Dm 0644 %{name}.csh %{buildroot}%{_sysconfdir}/profile.d/%{name}.csh
find %{buildroot} -type f -name "*.la" -delete -print
rm -rf %{buildroot}%{python_sitelib}/unity_gtk_module/ \
  %{buildroot}%{_datadir}/upstart/

%post common
%glib2_gsettings_schema_post

%postun common
%glib2_gsettings_schema_postun

%post -n %{lname_gtk2} -p /sbin/ldconfig

%postun -n %{lname_gtk2} -p /sbin/ldconfig

%post -n %{lname_gtk3} -p /sbin/ldconfig

%postun -n %{lname_gtk3} -p /sbin/ldconfig

%files -n %{_name_gtk2}
%defattr(-,root,root)
%{_libdir}/gtk-2.0/modules/lib%{name}.so

%files -n %{_name_gtk3}
%defattr(-,root,root)
%{_libdir}/gtk-3.0/modules/lib%{name}.so

%files common
%defattr(-,root,root)
%doc AUTHORS COPYING TODO
%config %{_sysconfdir}/profile.d/%{name}.*
%{_datadir}/glib-2.0/schemas/*%{name}.gschema.xml

%files -n %{lname_gtk2}
%defattr(-,root,root)
%doc AUTHORS COPYING TODO
%{_libdir}/libunity-gtk2-parser.so.*

%files -n %{lname_gtk3}
%defattr(-,root,root)
%doc AUTHORS COPYING TODO
%{_libdir}/libunity-gtk3-parser.so.*

%files -n libunity-gtk-parser-devel
%defattr(-,root,root)
%doc %{_datadir}/gtk-doc/html/%{name}/
%{_includedir}/unity-gtk-parser/
%{_libdir}/libunity-gtk?-parser.so
%{_libdir}/pkgconfig/unity-gtk?-parser.pc

%changelog
openSUSE Build Service is sponsored by