File mysql-workbench.spec of Package mysql-workbench

#
# spec file for package mysql-workbench (Version 5.2.31)
#
# Copyright (c) 2010 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/
#

# norootforbuild


Name:           mysql-workbench
Summary:        A MySQL visual modeling tool
Version:        5.2.31
Release:        1
Group:          Productivity/Databases/Clients
License:        GPLv2+
Url:            http://dev.mysql.com/downloads/workbench
# Upstream tarball without ext directory (rm -rf ext)
Source:         %{name}-noext-oss-%{version}.tar.bz2
Source1:        openSUSE_(MySQL_Package).xml
Patch0:         mysql-workbench-gpl-5.2.30-disable-bundled.patch
Patch1:         mysql-workbench-gpl-5.2.31-avoid-version.patch
Summary:        A MySQL visual modeling tool
Group:          Productivity/Databases/Clients
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  boost-devel gcc-c++ lua-devel
BuildRequires:  glib2-devel libsigc++2-devel libxml2-devel
BuildRequires:  java-devel libgnome-devel mysql-devel
BuildRequires:  libzip-devel pcre-devel python-devel readline-devel
BuildRequires:  Mesa Mesa-devel cairomm-devel gtkmm24-devel
BuildRequires:  libglade2-devel libmysqlcppconn-devel php-devel
BuildRequires:  dos2unix fdupes
%if 0%{?suse_version}
BuildRequires:  FastCGI-devel sqlite3-devel update-desktop-files
%endif
%if 0%{?fedora}
BuildRequires:  fcgi-devel java-1.6.0-openjdk-devel sqlite-devel
%if 0%{?fedora} > 11
BuildRequires:  libuuid-devel
%else
BuildRequires:  PolicyKit-gnome
%endif
%endif
BuildRequires:  boost-devel libctemplate-devel
BuildRequires:  cairo-devel >= 1.5.12
Requires:       python-paramiko python-pexpect
Provides:       mysql-gui-tools=%{version}
Provides:       mysql-administrator=%{version}
Provides:       mysql-querybrovser=%{version}
Obsoletes:      mysql-gui-tools<%{version}
Obsoletes:      mysql-administrator<%{version}
Obsoletes:      mysql-querybrovser<%{version}

%description
MySQL Workbench provides DBAs and developers an integrated tools environment
for:
 * Database Design & Modeling
 * SQL Development (replacing MySQL Query Browser)
 * Database Administration (replacing MySQL Administrator)

%prep
%setup -q -n  %{name}-gpl-%{version}-src
%patch0
%patch1

%build
export SUSE_ASNEEDED=0
export INCLUDES="-I/usr/include/SilverCity -I/usr/include"
# dereferencing type-punned pointer will break strict-aliasing rules
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing ${INCLUDES}"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing ${INCLUDES}"
export NOCONFIGURE=y
rm aclocal.m4
sh ./autogen.sh --prefix=%{_prefix} --libdir=%{_libdir}
echo autogen done
%configure \
  --disable-static \
  --with-gnu-ld \
  --enable-grt-generation \
  --with-system-ctemplate
make %{?jobs:-j%jobs}

%install
make DESTDIR=%{buildroot} install
cp plugins/README README.plugins
cp modules/README README.modules
rm -rf %{buildroot}%{_libdir}/%{name}{,/modules,/plugins}/*.la
install -D -m 0644 images/icons/MySQLWorkbench-48.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
install -D -m 0644 "%{S:1}" %{buildroot}%{_datadir}/%{name}/mysql.profiles
rm -f "$RPM_SOURCE_DIR"/*.desktop
sed -i 's/^Icon.*/Icon=%{name}.png/' "%{buildroot}%{_datadir}"/applications/MySQLWorkbench.desktop
sed -i 's/;$//' "%{buildroot}%{_datadir}"/applications/MySQLWorkbench.desktop
%if 0%{?suse_version}
mv "%{buildroot}%{_datadir}"/applications/MySQLWorkbench.desktop "$RPM_SOURCE_DIR"/%{name}.desktop
%suse_update_desktop_file -i -r -G "Database GUI Tool" %{name} "GTK;Development;Database;GUIDesigner;"
%fdupes -s %{_datadir}/%{name}/images
%else
mv "%{buildroot}%{_datadir}"/applications/MySQLWorkbench.desktop "%{buildroot}%{_datadir}"/applications/%{name}.desktop
%endif
for i in ChangeLog README.plugins README README.modules COPYING; do
       dos2unix $i
done
rm -f "%{buildroot}%{_datadir}"/doc/%{name}/{COPYING,README}
rmdir --ignore-fail-on-non-empty "%{buildroot}%{_datadir}"/doc/%{name}
cd "%{buildroot}%{_libdir}/%{name}"
for j in {modules,plugins}; do
cd "$j"
ls -1 *.{wbp,grt}.so | while read i; do
   [ -f "$i" ] && ln -s "$i" "`echo "$i" | sed 's|\.so$||'`"
done
cd ..
done

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING ChangeLog README.plugins README.modules
%{_bindir}/*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

%changelog