File mysql-workbench.spec of Package mysql-workbench

#
# spec file for package mysql-workbench
#
# 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 edition community

# whether at least Python 2.6 is available
%define have_python26   1
%include %{_rpmconfigdir}/macros.python

Summary:        A MySQL visual database modeling, administration and querying tool
License:        GPL-2.0+
Group:          Productivity/Databases/Clients
Name:           mysql-workbench
Version:        6.3.4
Release:        0
Url:            http://wb.mysql.com
Source:         %{name}-%{edition}-%{version}-src.tar.gz
Source1:        openSUSE_(Vendor_Package).xml
Source99:       %{name}.rpmlintrc

#Patches
# PATCH-FIX-OPENSUSE -- Add categories and generic name to .desktop file
Patch0:         patch-desktop-categories.patch
# PATCH-FIX-OPENSUSE -- Remove "check for update" in help, we use a package manager for that
Patch2:         mysql-workbench-no-check-for-updates.patch
# PATCH-FIX-OPENSUSE -- Fix build error "copytable.cpp:1638: undefined reference to `mysql_options4'"
# This only exist in mysql 5.6.x, but the "if" code didn't work, so disable it
Patch3:         mysql-workbench-community-6.3.3-src-mysql_options4.patch
# PATCH-FIX-UPSTREAM sfalken@opensuse.org
Patch4:         mysql-workbench-cmake-3.2.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# Keep them alphabetic order
BuildRequires:  Mesa
BuildRequires:  Mesa-devel
BuildRequires:  Mesa-libGL-devel
BuildRequires:  ant
#BuildRequires:  ant-antlr
#BuildRequires:  antlr-java >= 3.4
BuildRequires:  boost-devel
BuildRequires:  cairo-devel >= 1.5.12
BuildRequires:  cairomm-devel
BuildRequires:  cmake
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  glib2-devel
BuildRequires:  gnome-keyring-devel
BuildRequires:  gtkmm24-devel
BuildRequires:  libctemplate-devel
BuildRequires:  libgdal-devel
BuildRequires:  libglade2-devel
BuildRequires:  libgnome-devel
BuildRequires:  libmysqlclient-devel
BuildRequires:  libmysqlcppconn-devel
BuildRequires:  libmysqld-devel
BuildRequires:  libsigc++2-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  libzip-devel
BuildRequires:  postgresql-devel
BuildRequires:  unixODBC-devel
BuildRequires:  vsqlite++-devel
%if 0%{?suse_version} > 1210
BuildRequires:  lua51-devel
%else
BuildRequires:  lua-devel
%endif
BuildRequires:  make
BuildRequires:  mysql-devel > 5.1
BuildRequires:  pcre-devel
BuildRequires:  python-devel
BuildRequires:  pkgconfig(xxf86vm)
%if 0%{?suse_version}
BuildRequires:  libuuid-devel
BuildRequires:  sqlite3-devel
BuildRequires:  update-desktop-files
%endif
%if 0%{?fedora}
BuildRequires:  libuuid-devel
BuildRequires:  sqlite-devel
%endif
BuildRequires:  swig
BuildRequires:  tar
BuildRequires:  tinyxml-devel

Requires(post):   shared-mime-info
Requires(postun): shared-mime-info
Requires(post):   desktop-file-utils
Requires(postun): desktop-file-utils

Requires:       libmysqlclient-devel
Requires:       python-paramiko
Requires:       python-pexpect

# WAS in 5x Need for SQL Editor 
#Requires:       libmysqlclient_r18

## requires mysql client pkg (for mysqldump and mysql cmdline client)
Suggests:       gnome-keyring
Suggests:       mysqldump

Provides:       mysql-administrator = %{version}
Provides:       mysql-gui-tools = %{version}
Provides:       mysql-querybrovser = %{version}
Provides:       mysql-workbench-%{edition}
Obsoletes:      mysql-administrator < %{version}
Obsoletes:      mysql-gui-tools < %{version}
Obsoletes:      mysql-querybrovser < %{version}
Conflicts:      mysql-workbench-oss
Conflicts:      mysql-workbench-com-se

%description
MySQL Workbench is a modeling tool that allows you to design
and generate MySQL databases graphically. It also has administration
and query development modules where you can manage MySQL server instances
and execute SQL queries.
This is the %{edition} build.

%prep

# Add the -D flag if you don't want to delete the source root on each build
%setup -q -n %{name}-%{edition}-%{version}-src
%patch0
%patch2 -p1
%patch3 -p1
%patch4 -p1

%build
# FIX this is too much on obs Out of Memory use
# %%{?_smp_mflags} could it be in _constraint ?
# make %%{?jobs:-j2}

export PATH=$PWD/bin:$PATH

# Find and use antlr >= 3.4 but < 4.x
#export ANTLR_JAR_PATH=`find %%{_javadir} -name antlr-3.*-complete.jar`

# Not using cmake macro as it sets modules LDFLAGS in way that
# workbench doesn't work afterwards - more investigation needed.
%if 0
# Make things more secure, but only on new version
 export LDFLAGS="-Wl,-z,relro,-z,now -pie"
 %cmake -DMYSQL_CONFIG_PATH=%{_bindir}/mysql_config \
   -DCMAKE_BUILD_TYPE=%{edition} \
   -DREAL_EXECUTABLE_DIR=%{_libdir}/%{name} \
   -DUSE_UNIXODBC=TRUE \
   -DCMAKE_SKIP_RPATH=ON \
   -DCMAKE_SKIP_INSTALL_RPATH=ON \
   -DCMAKE_NO_BUILTIN_CHRPATH=ON \
   ..
 make VERBOSE=1 %{?jobs:-j2}
%else
 pushd build
 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
   -DMYSQL_CONFIG_PATH=%{_bindir}/mysql_config \
   -DLIB_INSTALL_DIR=%{_libdir} \
   -DCMAKE_BUILD_TYPE=%{edition} \
   -DREAL_EXECUTABLE_DIR=%{_libdir}/%{name} \
   -DUSE_UNIXODBC=TRUE \
   -DCMAKE_SKIP_RPATH=ON \
   -DCMAKE_SKIP_INSTALL_RPATH=ON \
   -DCMAKE_NO_BUILTIN_CHRPATH=ON \
   ..
 make VERBOSE=1 %{?jobs:-j2}
 popd
%endif

%install
pushd build
make VERBOSE=1 DESTDIR=%{buildroot} %{?jobs:-j2} install 
popd
#Can't we split that in a -doc package ?
#rm -fr %%{buildroot}/usr/share/doc/%%{name}

find %{buildroot}%{_libdir}/%{name} -name \*.a  -exec rm {} \; -print
find %{buildroot}%{_libdir}/%{name} -name \*.la -exec rm {} \; -print

install -m 0644 "%{S:1}" %{buildroot}/usr/share/mysql-workbench/mysql.profiles

mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
echo "%{_libdir}/%{name}" > %{buildroot}/%{_sysconfdir}/ld.so.conf.d/%{name}.conf
chmod 644 %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}.conf

# workaround for prob with libantlr3c not being detected as being provided by pkg in fedora
chmod +x %{buildroot}%{_libdir}/%{name}/*.so
%fdupes -s %{buildroot}%{_datadir}/%{name}

# Check for duplicate files
%fdupes -s %{buildroot}%{_prefix}

%post
%icon_theme_cache_post
%mime_database_post
%desktop_database_post
/sbin/ldconfig

%postun
%icon_theme_cache_postun
%mime_database_postun
%desktop_database_postun
/sbin/ldconfig

%files 
%defattr(0644, root, root, 0755)

%dir %{_datadir}/doc/mysql-workbench
%doc %{_datadir}/doc/mysql-workbench/COPYING
%doc %{_datadir}/doc/mysql-workbench/README

%attr(0755,root,root) %{_bindir}/mysql*
%attr(0755,root,root) %{_bindir}/wbcopytables
%attr(0755,root,root) %{_libdir}/%{name}/%{name}-bin
%attr(0755,root,root) %{_libdir}/%{name}/wbcopytables-bin

%dir %{_libdir}/%{name}
%{_libdir}/%{name}/lib*
%dir %{_libdir}/%{name}/modules
%{_libdir}/%{name}/modules/*
%dir %{_libdir}/%{name}/plugins
%{_libdir}/%{name}/plugins/*

%dir %{_datadir}/%{name}
%{_datadir}/icons/hicolor/*/mimetypes/*
%{_datadir}/icons/hicolor/*/apps/*
%dir %{_datadir}/mime-info
%{_datadir}/mime-info/*
%{_datadir}/mime/packages/*
%{_datadir}/applications/*.desktop
%{_datadir}/%{name}/*
%attr(0755,root,root) %{_datadir}/%{name}/extras/*.sh

%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}.conf

%changelog
openSUSE Build Service is sponsored by