File pgmodeler.spec of Package pgmodeler

#
# spec file for package pgmodeler
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 Mariusz Fik <fisiu@opensuse.org>.
#
# 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:           pgmodeler
Version:        0.7.0
Release:        0
Summary:        PostgreSQL Database Modeler
License:        GPL-3.0
Group:          Productivity/Databases/Tools
Url:            http://www.pgmodeler.com.br/
Source0:        https://github.com/pgmodeler/pgmodeler/archive/v%{version}.tar.gz
Source1:        %{name}.in
Source2:        %{name}.desktop
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5PrintSupport)
BuildRequires:  pkgconfig(Qt5UiTools)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  postgresql-devel
BuildRequires:  update-desktop-files
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Easily create and edit database models with simple and intuitive interface. The
software forms indicates which fields that must be filled to provide the correct
generation of SQL code.

%prep
%setup -q
### postgresql-devel doesn't provide libpq.pc so don't allow pkconfig to find it and set pg include path
sed -e 's|!macx:PKGCONFIG = libpq libxml-2.0|!macx:PKGCONFIG = libxml-2.0\n !macx:PGSQL_INC = /usr/include/pgsql|' -i pgmodeler.pro

%build
qmake-qt5 \
    BINDIR=%{_libdir}/%{name} \
    LIBDIR=%{_libdir}/%{name} \
    RESDIR=%{_datadir}/%{name} \
    DOCDIR=%{_docdir}/%{name} \
    pgmodeler.pro
make %{?_smp_mflags}

%install
make INSTALL_ROOT=%{buildroot} install %{?_smp_mflags}

### TODO If we need -devel package, put thos libs inside -devel
rm -f %{buildroot}%{_libdir}/%{name}/lib*.so

# we don't need it
rm -vf %{buildroot}%{_datadir}/%{name}/pgmodeler.vars

# icon and application startup script
install -D -m 755 %{SOURCE1} %{buildroot}%{_bindir}/%{name}
sed -i "s|_libdir|%{_libdir}|g" %{buildroot}%{_bindir}/%{name}

mkdir -p %{buildroot}%{_datadir}/pixmaps
ln -s %{_datadir}/%{name}/conf/pgmodeler_logo.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
%suse_update_desktop_file -i %{name}

ln -s %{_libdir}/%{name}/%{name}-ch %{buildroot}%{_bindir}/%{name}-ch
ln -s %{_libdir}/%{name}/%{name}-cli %{buildroot}%{_bindir}/%{name}-cli

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc %{_docdir}/%{name}
%{_bindir}/%{name}
%{_bindir}/%{name}-ch
%{_bindir}/%{name}-cli
%dir %{_datadir}/pixmaps
%{_datadir}/pixmaps/pgmodeler.png
%{_datadir}/applications/pgmodeler.desktop
%{_libdir}/%{name}
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/conf
%{_datadir}/%{name}/lang
%{_datadir}/%{name}/samples
%{_datadir}/%{name}/schemas

%changelog
openSUSE Build Service is sponsored by