File pgadmin3.spec of Package pgadmin3

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

Name:           pgadmin3
Summary:        Management and Administration Tools for the PostgreSQL Database
License:        PostgreSQL
Group:          Productivity/Databases/Tools
Version:        1.14.0
Release:        0
Source0:        pgadmin3-%{version}.tar.gz
Source1:        %name.desktop
Source2:        %name.png
BuildRequires:  automake
BuildRequires:  gcc-c++
BuildRequires:  libopenssl-devel
BuildRequires:  libxml2-devel
BuildRequires:  libxslt-devel
BuildRequires:  postgresql-devel
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
Recommends:     postgresql-server
Recommends:     %{name}-lang = %{version}

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,hhc,hhp} # remove wrong EOL


%if 0%{?suse_version} > 1010
  autoreconf -fiv

export CFLAGS="%optflags -fstack-protector"
export CXXFLAGS="%optflags -fstack-protector"

%configure --with-pic --disable-static

%__make %{?_smp_mflags}


%__make DESTDIR="%{buildroot}" install
%__install -D -m0644 "%{SOURCE2}" "%{buildroot}%{_datadir}/pixmaps/%{name}.png"

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

# png2c is an internal helper... why is it installed?
%__rm "%{buildroot}%{_bindir}/png2c"

# 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


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