File pgadmin3.spec of Package pgadmin3

# spec file for package pgadmin3
# Copyright (c) 2017 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

Name:           pgadmin3
Version:        1.22.2
Release:        0
Summary:        Management and Administration Tools for the PostgreSQL Database
License:        PostgreSQL
Group:          Productivity/Databases/Tools
Source1:        %name.desktop
Source2:        %name.png
# Limit to strict minimum the needed wxWidgets inspired by debian patches
Patch0:         wxWidget-limit-libs-used.patch
Patch1:         0001-Set-row-heights-based-on-pixels-rather-than-points.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libopenssl-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  libxslt-devel
BuildRequires:  postgresql-devel
BuildRequires:  update-desktop-files
%if 0%{?suse_version} <= 1315 || 0%{?sle_version} > 0
# One day a brave soul will find how to build that on SLE
#%%if 0%%{?sle_version} > 0
#BuildRequires:  libwx_baseu-2_8-0-wxcontainer
#BuildRequires:  wxWidgets-devel < 2.9
BuildRequires:  wxWidgets
BuildRequires:  wxWidgets-wxcontainer-devel
%define _use_internal_dependency_generator 0
%define __find_requires %wx_requires
%define WX_VER 2.8
# Tumbleweed
# nostl mandatory otherwise you get errors at compile and runtime
# too much wxChar used
%define WX_VER 3.0
BuildRequires:  wxWidgets-3_0-nostl-devel
Requires:       libpq5 >= 9.3
Recommends:     %{name}-lang = %{version}
Suggests:       postgresql-server
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#Documentation build, sles doesn't know python-Sphinx
%if 0%{?sle_version} > 0
BuildRequires:  python-Sphinx

pgAdmin III is an administration and management tool for the PostgreSQL
database and derivative products such as EnterpriseDB, Mammoth PostgreSQL,
Pervasive Postgres, and SRA PowerGres. It includes a graphical administration
interface, an SQL query tool with graphical EXPLAIN, a procedural code editor,
an SQL/shell/batch scheduling agent, Slony-I management, and much more. It is
designed to answer the needs of most users, from writing simple SQL queries to
developing complex databases. The graphical interface supports all PostgreSQL
features and makes administration easy.


%setup -q
%patch0 -p1
%patch1 -p1
autoreconf -fiv

sed -i 's/\r$//' LICENSE TODO CHANGELOG # remove wrong EOL
sed -i 's/\r$//' docs/*/pgadmin3.css # remove wrong EOL

rm -f docs/en_US/pgadmin3.hhp.cached # zero-length

autoreconf -fiv
export CXXFLAGS="%optflags -fno-delete-null-pointer-checks"
%configure --enable-databasedesigner --disable-static --with-wx-version=%{WX_VER}
make %{?_smp_mflags}


make DESTDIR=%{buildroot} STRIP=/bin/true install
install -D -m0644 "%{SOURCE2}" "%{buildroot}%{_datadir}/pixmaps/%{name}.png"

# whatever that symlink is doing there...
rm "%{buildroot}%{_datadir}/pgadmin3/i18n/"

# fix permissions
find "%{buildroot}%{_datadir}/pgadmin3/docs/" -type f -exec chmod 644 {} \;

# collect and mark localized files
pushd "%{buildroot}%{_datadir}/pgadmin3/i18n"
find . -type d -mindepth 1 -maxdepth 1 -name '*_*' | while read d; do
    echo "%lang(${d}) %{_datadir}/pgadmin3/i18n/${d}" >> "$L"
pushd "%{buildroot}%{_datadir}/pgadmin3/docs"
find . -type d -mindepth 1 -maxdepth 1 -name '*_*' | while read d; do
    echo "%doc %lang(${d}) %{_datadir}/pgadmin3/docs/${d}" >> "$L"

%if 0%{?sles_version} == 10 || 0%{?sles_version} == 9
%suse_update_desktop_file %{name} System Database
%suse_update_desktop_file -i %name System Database

%fdupes -s "%{buildroot}%{_datadir}/pgadmin3"

%if 0%{?sles_version} != 10 && 0%{?sles_version} != 9
%defattr(-, root, root)
%files -f %{name}.lang
%defattr(-, root, root)
%dir %{_datadir}/pgadmin3
%doc %dir %{_datadir}/pgadmin3/docs
%dir %{_datadir}/pgadmin3/i18n
%dir %{_datadir}/pgadmin3/branding
%dir %{_datadir}/pgadmin3/plugins.d
%config(noreplace) %{_datadir}/pgadmin3/branding/branding.ini
%config(noreplace) %{_datadir}/pgadmin3/plugins.d/plugins.ini
%config(noreplace) %{_datadir}/pgadmin3/settings.ini

%if 0%{?sles_version} != 10 && 0%{?sles_version} != 9
%files lang -f %{name}.lang
%defattr(-, root, root)

openSUSE Build Service is sponsored by