File libgnomesu.spec of Package libgnomesu.1421

#
# spec file for package libgnomesu
#
# Copyright (c) 2016 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:           libgnomesu
Version:        1.0.0
Release:        0
Summary:        GNOME su Library
License:        LGPL-2.1+
Group:          System/GUI/GNOME
Url:            http://members.chello.nl/~h.lai/libgnomesu/
Source:         %{name}-%{version}.tar.bz2
Source1:        gnomesu-pam.pamd
# PATCH-FIX-UPSTREAM libgnomesu-libtool.patch -- Simple build fix
Patch0:         libgnomesu-libtool.patch
# PATCH-FIX-UPSTREAM libgnomesu-1.0.0-xauth-nolookup.patch bnc119600 -- Change xauth calls to not cause dns lookups, to avoid hangs
Patch1:         libgnomesu-1.0.0-xauth-nolookup.patch
# PATCH-FIX-UPSTREAM libgnomesu-1.0.0-spin-mainloop.patch bnc156445 -- Use a main loop so we can handle other events while waiting for the child. Like session exiting...
Patch2:         libgnomesu-1.0.0-spin-mainloop.patch
# PATCH-FIX-UPSTREAM libgnomesu-makefile.patch -- Fix some simple Makefile command bugs
Patch4:         libgnomesu-makefile.patch
# PATCH-FIX-UPSTREAM libgnomesu-64bit.patch -- Fix pkg-config file on 64bits machines
Patch5:         libgnomesu-64bit.patch
# PATCH-FIX-OPENSUSE libgnomesu-unsetenv.patch bnc428963 vuntz@novell.com -- Unset DBUS_SESSION_BUS_ADDRESS environment variable.
Patch6:         libgnomesu-unsetenv.patch
# PATCH-FEATURE-UPSTREAM libgnomesu-modernize.patch bnc462073 abockover@novell.com -- Make gnomesu look and act more like PolicyKit-gnome (HIG compliant, use the icon theme, etc.)
Patch7:         libgnomesu-modernize.patch
# PATCH-FIX-UPSTREAM libgnomesu-startup-notification.patch bnc458651 vuntz@novell.com -- Forward startup notification information when there's no authentication dialog
Patch8:         libgnomesu-startup-notification.patch
# PATCH-FIX-UPSTREAM libgnomesu-better-pam-handling.patch bnc430883 vuntz@novell.com -- Handle PAM errors during authentication in a more extensive way, to give better feedback
Patch9:         libgnomesu-better-pam-handling.patch
# PATCH-FIX-UPSTREAM libgnomesu-ia64-crash.patch bnc470618 schwab@suse.de
Patch10:        libgnomesu-ia64-crash.patch
# PATCH-FIX-UPSTREAM libgnomesu-drop-libgnomeui.patch vuntz@novell.com -- Drop libgnomeui dependency
Patch11:        libgnomesu-drop-libgnomeui.patch
# PATCH-FIX-UPSTREAM libgnomesu-bnc440970-safe-path.patch vuntz@novell.com -- When making $PATH safer, try to keep what's relevant from $PATH
Patch12:        libgnomesu-bnc440970-safe-path.patch
# PATCH-FIX-OPENSUSE libgnomesu-remove-prior-cookie.patch bnc477638 hpj@novell.com -- Remove old, potentially broken xauth cookies.
Patch13:        libgnomesu-remove-prior-cookie.patch
# PATCH-FIX-UPSTREAM libgnomesu-i18n.patch bnc582085 sbrabec@suse.cz -- Fix translatability
Patch14:        libgnomesu-i18n.patch
# PATCH-FIX-UPSTREAM libgnomesu-no-manual-memory-cleaning.patch bnc351917 vuntz@opensuse.org -- Let GTK+ remove passwords from memory
Patch15:        libgnomesu-no-manual-memory-cleaning.patch
# PATCH-FIX-UPSTREAM libgnomesu-use-pam_xauth.patch bnc#667577 vuntz@opensuse.org -- Let pam_xauth handle xauth stuff if using pam backend
Patch16:        libgnomesu-use-pam_xauth.patch
# PATCH-FIX-UPSTREAM libgnomesu-reorder-pam-init.patch vuntz@opensuse.org -- Do commands in the same order as in coreutils/su.c in pam backend
Patch17:        libgnomesu-reorder-pam-init.patch
# PATCH-FIX-UPSTREAM libgnomesu-check-setuid-retval.patch bnc#695627 CVE-2011-1946 vuntz@opensuse.org -- Really handle return value of setuid()
Patch18:        libgnomesu-check-setuid-retval.patch
# PATCH-FIX-UPSTREAM libgnomesu-no-gconf.patch vuntz@opensuse.org -- Do not use gconf but gsettings to find preferred terminal (needed for GNOME 3)
Patch19:        libgnomesu-no-gconf.patch
# PATCH-FIX-UPSTREAM libgnomesu-gtk3.patch vuntz@opensuse.org -- Port to GTK+ 3
Patch20:        libgnomesu-gtk3.patch
# PATCH-FIX-UPSTREAM libgnomesu-suid_flags.patch bnc#743139 vuntz@opensuse.org -- Respect SUID_CFLAGS/SUID_LDFLAGS
Patch21:        libgnomesu-suid_flags.patch
# PATCH-FIX-UPSTREAM libgnomesu-exit-with-parent.patch bnc578284 hpj@novell.com -- Make child process exit if parent does.
Patch22:        libgnomesu-exit-with-parent.patch
# PATCH-FIX-UPSTREAM libgnomesu-set-xdg_runtime_dir.patch bnc986236 sreeves@suse.com -- set XDG_RUNTIME_DIR
Patch23:        libgnomesu-set-xdg_runtime_dir.patch
BuildRequires:  fdupes
BuildRequires:  gtk3-devel
BuildRequires:  intltool
BuildRequires:  libtool
BuildRequires:  pam-devel
BuildRequires:  translation-update-upstream
PreReq:         permissions
# Needed for patch19
Requires:       gsettings-desktop-schemas
Requires:       libgnomesu0
Requires:       pam
Recommends:     %{name}-lang = %{version}
# obsolete in >9.3
Provides:       xsu
Obsoletes:      xsu
# Ensure that gnomesu always gets installed
Supplements:    packageand(xdg-utils:gnome-session)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Libgnomesu is a library for providing superuser privileges to GNOME
applications. It supports sudo, consolehelper, PAM, and su.

%package -n libgnomesu0
Summary:        GNOME su Library
Group:          System/Libraries
Requires:       %{name} >= %{version}

%description -n libgnomesu0
Libgnomesu is a library for providing superuser privileges to GNOME
applications. It supports sudo, consolehelper, PAM, and su.

%package devel
Summary:        Development files for libgnomesu
Group:          Development/Libraries/GNOME
Requires:       %{name} = %{version}

%description devel
This package contains all files needed to develop with libgnomesu.

%lang_package
%prep
%setup -q
%patch0
%patch1 -p1
%patch2 -p1
%patch4
%patch5
%patch6 -p1
%patch7
%patch8 -p1
%patch9 -p1
%patch10 -p0
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
cp -a %{S:1} pam-backend/gnomesu-pam
# Upstream is dead, libgnomesu.po in LCN includes strings in our patches:
translation-update-upstream

%build
autoreconf -f -i
intltoolize -f
export SUID_CFLAGS="-fPIE"
export SUID_LDFLAGS="-pie"
%configure\
	--libexecdir=%{_libexecdir}/%{name}\
	--disable-schemas-install\
	--disable-setuid-error
make %{?jobs:-j%jobs}

%install
mkdir -p %{buildroot}%{_prefix}/lib/%{name}
%makeinstall
%{__rm} %{buildroot}%{_libdir}/*.la
# Change sr@Latn to sr@latin
mv %{buildroot}%{_datadir}/locale/sr@Latn %{buildroot}%{_datadir}/locale/sr@latin
%find_lang libgnomesu-1.0
mkdir -p %{buildroot}%{_docdir}/%{name}
cp AUTHORS README NEWS ChangeLog doc/api.html doc/libgnomesu.css %{buildroot}%{_docdir}/%{name}
# We want only PAM backend.
rm %{buildroot}%{_prefix}/lib/%{name}/gnomesu-backend
# No support for old GNOME
# FIXME: Transform it to .desktop file
rm %{buildroot}%{_datadir}/application-registry/*.applications %{buildroot}%{_datadir}/mime-info/*.*
%fdupes %{buildroot}

%clean
rm -rf %{buildroot}

%post
%set_permissions %{_libexecdir}/%{name}/gnomesu-pam-backend

%verifyscript
%verify_permissions -e %{_libexecdir}/%{name}/gnomesu-pam-backend

%post -n libgnomesu0 -p /sbin/ldconfig

%postun -n libgnomesu0 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc %dir %{_defaultdocdir}/%{name}
%doc %{_defaultdocdir}/%{name}/AUTHORS
%doc %{_defaultdocdir}/%{name}/README
%doc %{_defaultdocdir}/%{name}/NEWS
%doc %{_defaultdocdir}/%{name}/ChangeLog
%{_bindir}/gnomesu
%dir %{_prefix}/lib/%{name}
#%attr (6755,root,root) %{_prefix}/lib/%{name}/gnomesu-backend
#%attr (6755,root,root) %{_prefix}/lib/%{name}/gnomesu-pam-backend
# NOTE: Original package has 6755.
# We have only 4755 and for easy and secure profile.
%verify (not mode) %attr (4755,root,root) %{_libexecdir}/%{name}/gnomesu-pam-backend
%config %{_sysconfdir}/pam.d/gnomesu-pam

%files -n libgnomesu0
%defattr (-, root, root)
%{_libdir}/libgnomesu.so.*

%files lang -f libgnomesu-1.0.lang

%files devel
%defattr(-,root,root)
%doc %{_docdir}/%{name}/api.html
%doc %{_docdir}/%{name}/libgnomesu.css
%{_includedir}/libgnomesu-1.0
%{_libdir}/libgnomesu.so
%{_libdir}/pkgconfig/libgnomesu-1.0.pc

%changelog
openSUSE Build Service is sponsored by