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

Name:           pgadmin3
Summary:        Management and Administration Tools for the PostgreSQL Database
License:        PostgreSQL
Group:          Productivity/Databases/Tools
Version:        1.14.0
Release:        0
Url:            http://www.pgadmin.org/index.php
# http://wwwmaster.postgresql.org/download/mirrors-ftp/pgadmin3/release/v{version}/src/pgadmin3-%{version}.tar.gz
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
%else
BuildRequires:  wxGTK-devel
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1030
BuildRequires:  fdupes
%endif
%if 0%{?sles_version} != 10 && 0%{?sles_version} != 9
Recommends:     postgresql-server
Recommends:     %{name}-lang = %{version}
%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

%__sed -i 's/\r$//' LICENSE TODO CHANGELOG # remove wrong EOL
%__sed -i 's/\r$//' docs/fr_FR/pgadmin3.{css,hhc,hhp} # remove wrong EOL

%build

%if 0%{?suse_version} > 1010
  autoreconf -fiv
%else
  autoheader
  autoconf
%endif

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

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

%__make %{?_smp_mflags}

%install

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

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

# 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
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

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

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

%if 0%{?sles_version} != 10 && 0%{?sles_version} != 9

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