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
Summary:        Management and Administration Tools for the PostgreSQL Database
License:        PostgreSQL
Group:          Productivity/Databases/Tools
Version:        1.22.2
Release:        0
Source1:        %name.desktop
Source2:        %name.png
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gcc-c++
BuildRequires:  libopenssl-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  libxslt-devel
BuildRequires:  postgresql-devel
#Documentation build, sles doesn't know python-Sphinx
%if 0%{?suse_version} && 0%{?sles_version}
BuildRequires:  python-Sphinx
BuildRequires:  update-desktop-files
%if 0%{?suse_version} >= 1140
BuildRequires:  wxWidgets
BuildRequires:  wxWidgets-wxcontainer-devel
%define _use_internal_dependency_generator 0
%define __find_requires %wx_requires
BuildRequires:  wxGTK-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1030
BuildRequires:  fdupes
%if 0%{?sles_version} != 10 && 0%{?sles_version} != 9
Suggests:       postgresql-server
Recommends:     %{name}-lang = %{version}
Requires:       libpq5 >= 9.3

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

%__sed -i 's/\r$//' LICENSE TODO CHANGELOG # remove wrong EOL
%__sed -i 's/\r$//' docs/fr_FR/pgadmin3.css # remove wrong EOL
%__sed -i 's/\r$//' docs/zh_CN/pgadmin3.css
%__sed -i 's/\r$//' docs/zh_TW/pgadmin3.css
%__sed -i 's/\r$//' docs/sl_SI/pgadmin3.css

%__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
%__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"
popd #"%{buildroot}%{_datadir}/pgadmin3/i18n"
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"
popd #"%{buildroot}%{_datadir}/pgadmin3/docs"

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

%if 0%{?suse_version} >= 1030
%fdupes -s "%{buildroot}%{_datadir}/pgadmin3"

%{?buildroot:%__rm -rf "%{buildroot}"}

%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