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 http://bugs.opensuse.org/
#


Name:           pgadmin3
Version:        1.22.2
Release:        0
Summary:        Management and Administration Tools for the PostgreSQL Database
License:        PostgreSQL
Group:          Productivity/Databases/Tools
Url:            http://www.pgadmin.org/index.php
Source0:        http://ftp.postgresql.org/pub/pgadmin3/release/v%{version}/src/pgadmin3-%{version}.tar.gz
Source1:        %name.desktop
Source2:        %name.png
Source4:        http://ftp.postgresql.org/pub/pgadmin3/release/v%{version}/src/pgadmin3-%{version}.tar.gz.sig
# 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
#%%else
BuildRequires:  wxWidgets
BuildRequires:  wxWidgets-wxcontainer-devel
#%%endif
%define _use_internal_dependency_generator 0
%define __find_requires %wx_requires
%define WX_VER 2.8
%else
# 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
%endif
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
#dummy
%else
BuildRequires:  python-Sphinx
%endif

%description
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.

%lang_package

%prep
%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

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

%install

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/wxstd.mo"

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

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

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

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

%if 0%{?sles_version} != 10 && 0%{?sles_version} != 9
%files
%defattr(-, root, root)
%else
%files -f %{name}.lang
%endif
%defattr(-, root, root)
%doc BUGS CHANGELOG LICENSE README TODO
%{_bindir}/pgadmin3
%dir %{_datadir}/pgadmin3
%doc %dir %{_datadir}/pgadmin3/docs
%dir %{_datadir}/pgadmin3/i18n
%{_datadir}/pgadmin3/i18n/pgadmin3.lng
%{_datadir}/pgadmin3/i18n/pg_settings.csv
%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
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

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

%changelog
openSUSE Build Service is sponsored by