File mysql-workbench.spec of Package mysql-workbench

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



Name:           mysql-workbench
Summary:        A MySQL visual modeling tool
License:        GPL-2.0+
Group:          Productivity/Databases/Clients
Version:        5.2.37
Release:        0
Url:            http://dev.mysql.com/downloads/workbench
Source:         %{name}-gpl-%{version}-src.tar.bz2
Source1:        openSUSE_(Vendor_Package).xml
Patch0:         mysql-workbench-gpl-5.2.34-ctemplate-fix.patch
Patch1:         mysql-workbench-gpl-5.2.36-avoid-version.patch
Summary:        A MySQL visual modeling tool
Group:          Productivity/Databases/Clients
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  Mesa
BuildRequires:  Mesa-devel
BuildRequires:  boost-devel
BuildRequires:  cairomm-devel
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  glib2-devel
BuildRequires:  gtkmm24-devel
BuildRequires:  java-devel
BuildRequires:  libglade2-devel
BuildRequires:  libgnome-devel
BuildRequires:  libmysqlcppconn-devel
BuildRequires:  libsigc++2-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  libzip-devel
%if 0%{?suse_version} > 1210
BuildRequires:  lua51-devel
%else
BuildRequires:  lua-devel
%endif
BuildRequires:  mysql-devel
BuildRequires:  pcre-devel
BuildRequires:  php-devel
BuildRequires:  python-devel
BuildRequires:  readline-devel
%if 0%{?suse_version}
BuildRequires:  FastCGI-devel
BuildRequires:  libuuid-devel
BuildRequires:  sqlite3-devel
BuildRequires:  update-desktop-files
%endif
%if 0%{?fedora}
BuildRequires:  fcgi-devel
BuildRequires:  java-1.6.0-openjdk-devel
BuildRequires:  sqlite-devel
%if 0%{?fedora} > 11
BuildRequires:  libuuid-devel
%else
BuildRequires:  PolicyKit-gnome
%endif
%endif
BuildRequires:  cairo-devel >= 1.5.12
BuildRequires:  libctemplate-devel
Requires:       python-paramiko
Requires:       python-pexpect
Provides:       mysql-administrator=%{version}
Provides:       mysql-gui-tools=%{version}
Provides:       mysql-querybrovser=%{version}
Obsoletes:      mysql-administrator<%{version}
Obsoletes:      mysql-gui-tools<%{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
for j in gpattern.h gmessages.h gthread.h gbase64.h gunicode.h gerror.h gquark.h gtypes.h gmacros.h ; do
 for i in `grep -Rl "glib/$j" .`; do
  sed -i "s|glib/$j|glib.h|" $i;
 done
done
rm -rf ext/ctemplate

%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 \
  --enable-i18n \
  --with-gnu-ld \
  --enable-mysql-utilities
# Doesn't exist anymore
#  --enable-readline \

#FIX this is too much on obs Out of Memory make %%{?jobs:-j%%jobs}
make %{?jobs:-j2}

%install
make DESTDIR=%{buildroot} install
cp plugins/README README.plugins
cp modules/README README.modules
rm -f %{buildroot}%{_libdir}/%{name}{,/modules,/plugins}/*.la
rm -f %{buildroot}%{_libdir}/%{name}/lib*.so
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
openSUSE Build Service is sponsored by