-%define ver 1.0.0
-%define rel 2
-%define prefix /usr
-
-Summary: GNOME Display Manager
-Name: gdm
-Version: %ver
-Release: %rel
-Source: ftp://ftp.socsci.auc.dk/pub/empl/mkp/gdm-%{PACKAGE_VERSION}.tar.gz
-Group: X11/Utilities
-Copyright: LGPL/GPL
-BuildRoot: /tmp/%{name}-%{version}-root
-Prefix: %{prefix}
-Docdir: %{prefix}/doc
-Requires: gnome-libs >= 1.0.0
-
-%description
-gdm manages local and remote displays and provides the user with a
-graphical login window.
+# TODO:
+# s=/dev/null=/home/services/xdm= in %%trigger for gracefull upgrade from xdm/kdm/gdm 2.2
+# check /etc/pam.d/gdm-autologin
+#
+
+Summary: GNOME Display Manager
+Summary(es): Administrador de Entrada del GNOME
+Summary(ja): GNOME ¥Ç¥£¥¹¥×¥ì¥¤¥Þ¥Í¡¼¥¸¥ã
+Summary(pl): gdm - zarz±dca ekranów GNOME
+Summary(pt_BR): Gerenciador de Entrada do GNOME
+Summary(ru): äÉÓÐÌÅÊÎÙÊ ÍÅÎÅÄÖÅÒ GNOME
+Summary(uk): äÉÓÐÌÅÊÎÉÊ ÍÅÎÅÄÖÅÒ GNOME
+Name: gdm
+Version: 2.4.1.4
+Release: 1
+Epoch: 1
+License: GPL/LGPL
+Group: X11/Applications
+Source0: http://ftp.gnome.org/pub/GNOME/sources/%{name}/2.4/%{name}-%{version}.tar.bz2
+Source1: %{name}.pamd
+Source2: %{name}.init
+Source3: %{name}-pld-logo.png
+Patch0: %{name}-xdmcp.patch
+Patch1: %{name}-conf.patch
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: gettext-devel
+BuildRequires: gtk+2-devel >= 2.0.6
+BuildRequires: intltool >= 0.22
+BuildRequires: libglade2-devel >= 2.0.1
+BuildRequires: libgnomecanvas-devel >= 2.0.3
+BuildRequires: libgnome-devel >= 2.0.6
+BuildRequires: libgnomeui-devel >= 2.0.4
+BuildRequires: librsvg-devel >= 2.0.1
+BuildRequires: libtool
+BuildRequires: libxml2-devel >= 2.4.24
+BuildRequires: pam-devel
+BuildRequires: perl-modules
+BuildRequires: scrollkeeper >= 0.3.11
+Requires: libgnome >= 2.1.0-3
+Requires: which
+Requires: sessreg
+Requires(pre): /bin/id
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires(postun): /usr/sbin/userdel
+Requires(postun): /usr/sbin/groupdel
+Requires(post,postun):scrollkeeper
+Requires(post,preun):/sbin/chkconfig
+Conflicts: gdkxft
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+Obsoletes: xdm kdm wdm
+
+%define _localstatedir /var/lib
+
+%description
+Gdm (the GNOME Display Manager) is a highly configurable
+reimplementation of xdm, the X Display Manager. Gdm allows you to log
+into your system with the X Window System running and supports running
+several different X sessions on your local machine at the same time.
+
+%description -l es
+Administrador de Entrada del GNOME.
+
+%description -l ja
+Gdm (the GNOME Display Manager) ¤Ï¡¢¹âÅÙ¤ËÀßÄê²Äǽ¤Ê xdm X Display
+Manager ¤ÎºÆ¼ÂÁõÈǤǤ¹¡£ Gdm ¤ò»È¤¦¤È¡¢ X Window System
+¤¬Æ°¤¤¤Æ¤¤¤ë¤¢¤Ê¤¿¤Î
+¥·¥¹¥Æ¥à¤Ë¤¤¤í¤¤¤í¤Ê¥»¥Ã¥·¥ç¥ó¤òÁªÂò¤·¤Æ¥í¥°¥¤¥ó¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
+
+¤³¤Î¥Ð¡¼¥¸¥ç¥ó¤Î Gdm ¤Ç¤Ï¡¢³Æ¼ï¸À¸ì¤ä¡¢XIM ¤òÁªÂò¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£
+
+%description -l pl
+Gdm jest wysokokonfigurowaln± reimplementacj± xdma. Gdm pozwala
+logowaæ siê do systemu z poziomu X11 i wspiera jednoczesn± pracê kilku
+ró¿nych sesji X na lokalnej maszynie.
+
+%description -l pt_BR
+Gerenciador de Entrada do GNOME.
+
+%description -l ru
+GDM (GNOME Display Manager) - ÜÔÏ ÒÅÉÍÐÌÅÍÅÎÔÁÃÉÑ xdm (X Display
+Manager). GDM ÐÏÚ×ÏÌÑÅÔ ×ÁÍ ×ÈÏÄÉÔØ × ÓÉÓÔÅÍÕ, ÎÁ ËÏÔÏÒÏÊ ÚÁÐÕÝÅÎÏ X
+Window É ÐÏÄÄÅÒÖÉ×ÁÅÔ ÒÁÂÏÔÕ ÎÅÓËÏÌØÕÉÈ ÒÁÚÎÙÈ X ÓÅÁÎÓÏ× ÏÄÎÏ×ÒÅÍÅÎÎÏ.
+
+%description -l uk
+GDM (GNOME Display Manager) - ÃÅ ÒŦÍÐÌÅÍÅÎÔÁÃ¦Ñ xdm (X Display
+Manager). GDM ÄÏÚ×ÏÌѤ ×ÁÍ ×ÈÏÄÉÔÉ × ÓÉÓÔÅÍÕ, ÎÁ ÑË¦Ê ÚÁÐÕÝÅÎÏ X
+Window ÔÁ ЦÄÔÒÉÍÕ¤ ÒÏÂÏÔÕ Ë¦ÌØËÏÈ Ò¦ÚÎÉÈ X ÓÅÁÎÓ¦× ÏÄÎÏÞÁÓÎÏ.
+
+%package Xnest
+Summary: Xnest (ie embedded X) server for GDM
+Summary(pl): Serwer Xnest dla GDM
+Group: X11/Applications
+Requires: %{name} = %{version}
+Requires: XFree86-Xnest
+
+%description Xnest
+This package add support for Xnest server in gdm.
+
+%description Xnest -l pl
+Ten pakiet dodaje do gdm wsparcie dla Xnest.
+
+%package init
+Summary: Init script for GDM
+Summary(pl): Skrypt init dla GDM-a
+Group: X11/Applications
+Requires: %{name} = %{version}
+Requires: open
+
+%description init
+Init script for GDM.
+
+%description init -l pl
+Skrypt init dla GDM-a.
%prep
-%setup
+%setup -q
+%patch0 -p1
+%patch1 -p1
%build
-# Needed for snapshot releases.
-if [ ! -f configure ]; then
- CFLAGS="$RPM_OPT_FLAGS" \
- ./autogen.sh %{_target_platform} \
- --prefix=%prefix
-else
- CFLAGS="$RPM_OPT_FLAGS" \
- ./configure %{_target_platform} \
- --prefix=%prefix
-fi
-make
+rm -f missing
+%{__libtoolize}
+glib-gettextize --copy --force
+%{__aclocal}
+%{__autoconf}
+%{__automake}
+%configure \
+ --with-xinerama=yes \
+ --with-xdmcp=yes \
+ --with-pam-prefix=/etc \
+ --with-tcp-wrappers=yes \
+ --enable-authentication-scheme=pam \
+ --disable-console-helper
+
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT%{prefix}
-make prefix=$RPM_BUILD_ROOT%{prefix} install
+install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,pam.d,security} \
+ $RPM_BUILD_ROOT/home/services/xdm
+
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT \
+ PAM_PREFIX=/etc
+
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/pam.d/gdm
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/gdm
+
+install %{SOURCE3} $RPM_BUILD_ROOT%{_pixmapsdir}
+
+touch $RPM_BUILD_ROOT/etc/security/blacklist.gdm
-strip $RPM_BUILD_ROOT%{prefix}/bin/* || :
+%find_lang %{name} --all-name --with-gnome
%clean
rm -rf $RPM_BUILD_ROOT
-%files
-%doc AUTHORS COPYING ChangeLog NEWS README TODO docs/gdm-manual.txt
-%defattr(-, gdm, gdm)
-%{prefix}/bin/gdm
-%{prefix}/bin/gdmgreeter
-%{prefix}/bin/gdmchooser
-%attr (750, gdm, gdm) %{prefix}/var/gdm
-%attr (-,root,root) %{prefix}/share/locale/*/*
-%config %{prefix}/etc/gdm
-%config %{prefix}/etc/gnomerc
+%pre
+/usr/sbin/groupadd -g 55 -r -f xdm
+
+if [ -z "`id -u xdm 2>/dev/null`" ]; then
+ /usr/sbin/useradd -u 55 -r -d /home/services/xdm -s /bin/false -c 'X Display Manager' -g xdm xdm 1>&2
+fi
+
+%post
+/usr/bin/scrollkeeper-update
+
+%postun
+/usr/bin/scrollkeeper-update
+if [ "$1" = "0" ]; then
+ if [ -n "`id -u xdm 2>/dev/null`" ]; then
+ /usr/sbin/userdel xdm
+ fi
+ /usr/sbin/groupdel xdm
+fi
+
+%post init
+/sbin/chkconfig --add gdm
+if [ -f /var/lock/subsys/gdm ]; then
+ echo "Run \"/etc/rc.d/init.d/gdm restart\" to restart gdm." >&2
+else
+ echo "Run \"/etc/rc.d/init.d/gdm start\" to start gdm." >&2
+fi
+
+%preun init
+if [ "$1" = "0" ]; then
+ if [ -f /var/lock/subsys/gdm ]; then
+ /etc/rc.d/init.d/gdm stop >&2
+ fi
+ /sbin/chkconfig --del gdm
+fi
+
+%files -f %{name}.lang
+%defattr(644,root,root,755)
+%doc AUTHORS ChangeLog NEWS README TODO
+%attr(755,root,root) %{_bindir}/gdm
+%attr(755,root,root) %{_bindir}/gdm-binary
+%attr(755,root,root) %{_bindir}/gdmchooser
+%attr(755,root,root) %{_bindir}/gdmflexiserver
+%attr(755,root,root) %{_bindir}/gdmgreeter
+%attr(755,root,root) %{_bindir}/gdmlogin
+%attr(755,root,root) %{_bindir}/gdmmktemp
+%attr(755,root,root) %{_bindir}/gdmphotosetup
+%attr(755,root,root) %{_bindir}/gdmsetup
+%attr(755,root,root) %{_bindir}/gdmthemetester
+%attr(755,root,root) %{_sbindir}/*
+%dir %{_sysconfdir}/gdm
+%attr(755,root,root) %config %{_sysconfdir}/gdm/Init
+%attr(755,root,root) %config %{_sysconfdir}/gdm/PreSession
+%attr(755,root,root) %config %{_sysconfdir}/gdm/Sessions
+%attr(755,root,root) %config %{_sysconfdir}/gdm/PostSession
+%attr(755,root,root) %config %{_sysconfdir}/gdm/gnomerc
+%attr(755,root,root) %config %{_sysconfdir}/gdm/XKeepsCrashing
+%config %{_sysconfdir}/gdm/factory-gdm.conf
+%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/gdm/gdm.conf
+%config %{_sysconfdir}/gdm/locale.alias
+%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/pam.d/gdm*
+%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/security/blacklist.gdm
+%attr(750,xdm,xdm) /var/lib/gdm
+%attr(750,xdm,xdm) /home/services/xdm
+%{_pixmapsdir}/*
+%{_datadir}/applications/gdmsetup.desktop
+%{_datadir}/applications/gdmflexiserver.desktop
+%{_datadir}/gnome/capplets/*
+%{_datadir}/gdm
+
+%files Xnest
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/gdmXnestchooser
+%{_datadir}/applications/gdmflexiserver-xnest.desktop
+
+%files init
+%defattr(644,root,root,755)
+%attr(754,root,root) /etc/rc.d/init.d/gdm