%define pkgname xsm

Summary: X.Org X11 X Session Manager
Summary(ja): X.Org X11 X セッションマネージャ
Name: xorg-x11-%{pkgname}
# NOTE: The Version field should be the version of the xsm tarball.
Version: 1.0.2
# Bump the release on rebuilds/bugfixes/etc.
Release: 3%{?_dist_release}
License: MIT
Group: User Interface/X
URL: http://www.x.org
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

Source0: ftp://ftp.x.org/pub/individual/app/xsm-1.0.2.tar.bz2
Source1: ftp://ftp.x.org/pub/individual/app/smproxy-1.0.4.tar.bz2
Source2: ftp://ftp.x.org/pub/individual/app/rstart-1.0.4.tar.bz2

# Patches for xsm (10-19)
Patch10: xsm-1.0.2-xsm-installation-location-fixes.patch

# Patches for smproxy (20-29)


# Patches for rstart (30-39)
Patch30: rstart-1.0.4-rstart-installation-location-fixes.patch

# FIXME: Temporary dependency on automake/autoconf while they're still needed.
BuildRequires: automake autoconf

BuildRequires: pkgconfig
BuildRequires: xorg-x11-util-macros
BuildRequires: xorg-x11-proto-devel
BuildRequires: libXaw-devel libXext-devel libXt-devel libXpm-devel
BuildRequires: rsh

# NOTE: xorg-x11-filesystem >= 0.99.2-3 is required for OS upgrades from
# monolithic X releases to modular X releases to work properly.
Requires(pre): xorg-x11-filesystem
# rstart script invokes xauth, rsh
Requires: xauth, rsh

Provides: xsm, smproxy, rstart, rstartd

# NOTE: xsm, smproxy, rstart used to be part of the XFree86/xorg-x11 package
Obsoletes: XFree86, xorg-x11

%description
X.Org X11 X Session Manager

%prep
%setup -q -c %{name}-%{version} -a1 -a2
%patch10 -p0 -b .xsm-installation-location-fixes
%patch30 -p0 -b .rstart-installation-location-fixes


%build
# Build everything
{
   for pkg in xsm smproxy rstart ; do
      pushd $pkg-*

      sed -i '/XAW_/ s/)/, xaw7)/; /XAW_/ s/XAW_CHECK_XPRINT_SUPPORT/PKG_CHECK_MODULES/' configure.ac
      aclocal ; automake ; autoconf

      %configure --disable-xprint
      make
      popd
   done
}

%install
rm -rf $RPM_BUILD_ROOT

# Install everything
{
   for pkg in xsm smproxy rstart ; do
      pushd $pkg-*
      make install DESTDIR=$RPM_BUILD_ROOT
      popd
   done
}

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
# FIXME: The rpm package version was accidentally bumped to 1.0.2, so we
# can't use the %%version macro here until a upstream xsm is released as
# version 1.0.2 or higher.
#%doc xsm-%{version}/AUTHORS xsm-%{version}/COPYING xsm-%{version}/INSTALL
#%doc xsm-%{version}/NEWS xsm-%{version}/README xsm-%{version}/ChangeLog
%doc xsm-1.0.2/AUTHORS xsm-1.0.2/COPYING xsm-1.0.2/INSTALL
%doc xsm-1.0.2/NEWS xsm-1.0.2/README xsm-1.0.2/ChangeLog

%{_bindir}/rstart
%{_bindir}/rstartd
%{_bindir}/smproxy
%{_bindir}/xsm
%dir %{_datadir}/X11
%dir %{_datadir}/X11/rstart
%dir %{_datadir}/X11/rstart/commands
%{_datadir}/X11/rstart/commands/@List
%{_datadir}/X11/rstart/commands/ListContexts
%{_datadir}/X11/rstart/commands/ListGenericCommands
%dir %{_datadir}/X11/rstart/commands/x11r6
%{_datadir}/X11/rstart/commands/x11r6/@List
%{_datadir}/X11/rstart/commands/x11r6/LoadMonitor
%{_datadir}/X11/rstart/commands/x11r6/Terminal
%dir %{_datadir}/X11/rstart/contexts
%{_datadir}/X11/rstart/contexts/@List
%{_datadir}/X11/rstart/contexts/default
%{_datadir}/X11/rstart/contexts/x
%{_datadir}/X11/rstart/contexts/x11
%{_datadir}/X11/rstart/contexts/x11r6
%{_datadir}/X11/app-defaults/XSm
%dir %{_libdir}/X11
%dir %{_libdir}/X11/rstart
# NOTE: This binary can and probably should sit in /usr/sbin, but oh well.
%{_libdir}/X11/rstart/rstartd.real
#%dir %{_mandir}/man1x
%{_mandir}/man1/rstart.1*
%{_mandir}/man1/rstartd.1*
%{_mandir}/man1/smproxy.1*
%{_mandir}/man1/xsm.1*
%dir %{_sysconfdir}/X11
%dir %{_sysconfdir}/X11/rstart
%config %{_sysconfdir}/X11/rstart/config
%dir %{_sysconfdir}/X11/xsm
%config %{_sysconfdir}/X11/xsm/system.xsm

%changelog
* Sun Nov 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.2-3
- xsm-1.0.2
- smproxy-1.0.4
- rstart-1.0.4
- update Patch10, Patch30
- fix %%files

* Fri Nov 20 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.2-2
- smproxy-1.0.3
- rstart-1.0.3

* Sun Sep 07 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.2-1
- initial build for Vine Linux

* Tue Jul 15 2008 Adam Jackson <ajax@redhat.com> 1.0.2-8
- Fix license tag.

* Wed Feb 20 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.0.2-7
- Autorebuild for GCC 4.3

* Tue Aug 21 2007 Adam Jackson <ajax@redhat.com> - 1.0.2-6
- Rebuild for build id

* Tue Jan 30 2007 Adam Jackson <ajax@redhat.com> 1.0.2-5
- Fix man page globs and rebuild for FC7.

* Wed Jul 19 2006 Mike A. Harris <mharris@redhat.com> 1.0.2-4.fc6
- Remove app-defaults dir from file manifest, as it is owned by libXt (#174021)
- Add 'dist' tag to package release string.

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> 1.0.2-3.1
- rebuild

* Wed Jun 21 2006 Mike A. Harris <mharris@redhat.com> 1.0.2-3
- Added xsm documentation to doc macro.
- The 1.0.2-1 build had the version accidentally bumped to 1.0.2 before
  an xsm-1.0.2 was available, so I had to hard code the actual 1.0.1 version
  in a few places temporarily until xsm-1.0.2 is available.

* Tue May 30 2006 Adam Jackson <ajackson@redhat.com> 1.0.2-2
- Fix BuildRequires (#191802)

* Thu Apr 27 2006 Adam Jackson <ajackson@redhat.com> 1.0.2-1
- Update smproxy and rstart

* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> 1.0.1-1.2
- bump again for double-long bug on ppc(64)

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> 1.0.1-1.1
- rebuilt for new gcc4.1 snapshot and glibc changes

* Wed Jan 18 2006 Mike A. Harris <mharris@redhat.com> 1.0.1-1
- Updated all apps to version 1.0.1 from X11R7.0

* Tue Nov 22 2005 Mike A. Harris <mharris@redhat.com> 1.0.0-1
- Updated all apps to version 1.0.0 from X11R7 RC4.
- Changed manpage dir from man1x to man1 to match upstream default.

* Tue Nov 22 2005 Mike A. Harris <mharris@redhat.com> 0.99.2-4
- Add "Requires(pre): xorg-x11-filesystem >= 0.99.2-3" to avoid bug (#173384).
- Added rstart-0.99.1-rstart-installation-location-fixes.patch and
  xsm-0.99.2-xsm-installation-location-fixes.patch to put config files in
 /etc and data files in /usr/share where they belong.
- Added "Requires: xauth, rsh" as rstart invokes xauth, rsh.

* Mon Nov 14 2005 Jeremy Katz <katzj@redhat.com> 0.99.2-3
- require newer filesystem package (#172610)

* Sun Nov 13 2005 Mike A. Harris <mharris@redhat.com> 0.99.1-2
- Added "Obsoletes: XFree86, xorg-x11", as all of these used to be in there.
- Rebuild against new libXaw 0.99.2-2, which has fixed DT_SONAME. (#173027)

* Fri Nov 11 2005 Mike A. Harris <mharris@redhat.com> 0.99.2-1
- Initial build of xsm, smproxy, and rstart from X11R7 RC1
