Summary: X.Org X11 xfs font server
Summary(ja): X.Org X11 xfs フォントサーバ
Name: xorg-x11-xfs
Version: 1.1.1
Release: 1%{?_dist_release}
License: MIT/X11
Group: System Environment/Daemons
URL: http://www.x.org
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

Source0: ftp://ftp.x.org/pub/individual/app/xfs-%{version}.tar.bz2
Source1: ftp://ftp.x.org/pub/individual/app/xfsinfo-1.0.3.tar.bz2
Source2: ftp://ftp.x.org/pub/individual/app/fslsfonts-1.0.3.tar.bz2
Source3: ftp://ftp.x.org/pub/individual/app/fstobdf-1.0.4.tar.bz2
Source4: ftp://ftp.x.org/pub/individual/app/showfont-1.0.3.tar.bz2
Source10:  xfs.init
Source11:  xfs.config

BuildRequires: pkgconfig
# xfs needs 'fontsproto' to build, as indicated by ./configure
BuildRequires: xorg-x11-proto-devel
# FIXME: xfs needs xtrans to build, but autotools doesn't detect it missing
BuildRequires: xorg-x11-xtrans-devel
BuildRequires: libFS-devel
BuildRequires: libXfont-devel
BuildRequires: libX11-devel
# FIXME: xfs needs freetype-devel to build, but autotools doesn't detect it missing
BuildRequires: freetype2-devel
BuildRequires: libfontenc-devel

# Make sure libXfont provides the catalogue FPE.
Requires: libXfont

Obsoletes: XFree86-xfs, XOrg-xfs
Provides: xfs
Provides: XOrg-xfs = 7.0

Requires(pre): util-linux, shadow-utils
Requires(post): initscripts, grep, sed, coreutils
Requires(preun): initscripts, chkconfig
Requires(postun): initscripts

# xfs initscript runtime dependencies
Requires: initscripts, fontconfig, sed, findutils
Requires: coreutils
Requires: mkfontdir, mkfontscale, ttmkfdir
# end of xfs initscript runtime dependencies

%description
X.Org X11 xfs font server

%package utils
Summary: X.Org X11 font server utilities
Summary(ja): X.Org X11 フォントサーバユーティリティ
Group: User Interface/X

Conflicts: XOrg-xfs < 7.0

%description utils
X.Org X11 font server utilities

%prep
%setup -q -c %{name}-%{version} -a1 -a2 -a3 -a4

%build

# Build xfs
{
   pushd xfs-*
   %configure --disable-devel-docs
   make configdir=%{_sysconfdir}/X11/fs
   popd
}

for pkg in xfsinfo fslsfonts fstobdf showfont ; do
   pushd ${pkg}-*
   %configure
   make
   popd
done

%install
rm -rf $RPM_BUILD_ROOT
# Install xfs
{
   pushd xfs-*
   %makeinstall configdir=$RPM_BUILD_ROOT%{_sysconfdir}/X11/fs
   popd
}

for pkg in xfsinfo fslsfonts fstobdf showfont ; do
   pushd ${pkg}-*
   make install DESTDIR=$RPM_BUILD_ROOT
   popd
done

# Install the modified xfs config file and initscript
{
   mkdir -p $RPM_BUILD_ROOT/etc/{X11/fs,rc.d/init.d}
   install -c -m 755 %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/xfs
   install -c -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{_sysconfdir}/X11/fs/config
}

%clean
rm -rf $RPM_BUILD_ROOT

%triggerpostun -- XFree86-xfs
{
  /usr/sbin/useradd -c "X Font Server" -r -s /sbin/nologin -u 43 -d /etc/X11/fs xfs || :
  /sbin/chkconfig --add xfs
  /sbin/service xfs condrestart || :
} &> /dev/null || :

%triggerpostun -- XOrg-xfs
{
  /usr/sbin/useradd -c "X Font Server" -r -s /sbin/nologin -u 43 -d /etc/X11/fs xfs || :
  /sbin/chkconfig --add xfs
  /sbin/service xfs condrestart || :
} &> /dev/null || :

%pre
{
  /usr/sbin/useradd -c "X Font Server" -r -s /sbin/nologin -u 43 -d /etc/X11/fs xfs || :
  # Upgrade path:
  if [ "$1" -gt "1" ] ; then
    if [ -e "/usr/X11R6/lib/X11/fs/config" ] ; then
      cat <<-EOF > "/etc/X11/fs/xfs-migrate"
	On upgrades, we now must determine if we are upgrading from monolithic
	xfs or modular xfs by checking for the existance of the old monolithic
	xfs config file.  If found, we know it is a monolith->modular upgrade,
	so we set this flag file in order for xfs.init to perform a "restart"
	instead of a "reload" in the 'condrestart'.  See bug #173271 for
	details.
EOF
    fi
  fi
} &> /dev/null || : # Silence output, and ignore errors (Bug #91822)

%post
{
  # Install section
  /sbin/chkconfig --add xfs
  #------------------------------------------------------------------------
  # Upgrade section
  if [ "$1" -gt "1" ] ; then
    XORG_CONFIG=/etc/X11/xorg.conf
    XFSCONFIG=/etc/X11/fs/config

    # XFS config file upgrade munging
    if [ -f $XFSCONFIG ] ; then
      # Remove Speedo font directories from xfs config if present to avoid
      # bug reports about xfs complaining about empty directories in syslog.
      perl -p -i -e 's#^.*/.*/Speedo.*\n##' $XFSCONFIG

      # On upgrades, remove /usr/X11R6 font path elements from the XFS config file
      if grep -q "/usr/X11R6/lib/X11/fonts" $XFSCONFIG &> /dev/null ; then
        for fpe in misc:unscaled 75dpi:unscaled 100dpi:unscaled Type1 ; do
          perl -p -i -e "s#/usr/X11R6/lib/X11/fonts/${fpe}#%{_x11fontdir}/${fpe}#g" $XFSCONFIG
        done
      fi
    fi
  fi ; # End Upgrade section
}

%preun
{
  if [ "$1" = "0" ]; then
    /sbin/service xfs stop &> /dev/null || :
    /sbin/chkconfig --del xfs || :
  fi
}

%postun
{
  if [ "$1" -gt "1" ]; then
    /sbin/service xfs condrestart &> /dev/null || :
  fi
}

%files
%defattr(-,root,root,-)
%doc xfs-%{version}/AUTHORS xfs-%{version}/COPYING 
%doc xfs-%{version}/NEWS xfs-%{version}/README xfs-%{version}/ChangeLog
%{_bindir}/xfs
%dir %{_sysconfdir}/X11
%dir %{_sysconfdir}/X11/fs
%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/X11/fs/config
%{_mandir}/man1/xfs.1*
%{_sysconfdir}/rc.d/init.d/xfs

%files utils
%{_bindir}/fslsfonts
%{_bindir}/fstobdf
%{_bindir}/showfont
%{_bindir}/xfsinfo
%{_mandir}/man1/fslsfonts.1*
%{_mandir}/man1/fstobdf.1*
%{_mandir}/man1/showfont.1*
%{_mandir}/man1/xfsinfo.1*

%changelog
* Sun Nov 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.1.1-1
- xfs-1.1.1
- xfsinfo-1.0.3
- fslsfonts-1.0.3
- fstobdf-1.0.4
- showfont-1.0.3

* Fri Nov 20 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.1.0-1
- xfs-1.1.0

* Sun May 25 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.8-1
- new upstream release
  - xfs-1.0.8, xfsinfo-1.0.2, fslsfont-1.0.2,
    fstobdf-1.0.3, showfont-1.0.2

* Mon May 19 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.5-4
- add version-release to Obsoletes: XOrg-xfs

* Sun May 18 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.5-3
- add version-release to Provides: XOrg-xfs

* Mon May 12 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.5-2
- add Provides: XOrg-xfs for compatibility

* Wed Mar 26 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.5-1
- initial build for Vine Linux

* Wed Feb 20 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1:1.0.5-2
- Autorebuild for GCC 4.3

* Tue Oct 02 2007 Adam Jackson <ajax@redhat.com> 1:1.0.5-1
- xfs 1.0.5

* Thu Aug 23 2007 Adam Jackson <ajax@redhat.com> - 1:1.0.4-2
- Rebuild for ppc toolchain bug

* Fri Jul 27 2007 Bill Nottingham <notting@redhat.com> - 1:1.0.4-2
- don't run by default any more, as it's not used by default
- remove explicit restorecon dependency (#215142)

* Fri Jun 22 2007 Kristian H淡gsberg <krh@hinata.boston.redhat.com> - 1:1.0.4-1
- Require catalogue capable libXfont.
- Drop xfs.config.in, just use catalogue font path.
- Stop xorg.conf munging madness.

* Sat Apr 21 2007 Matthias Clasen <mclasen@redhat.com> - 1:1.0.2-4
- Don't install INSTALL

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

* Wed Jun 21 2006 Mike A. Harris <mharris@redhat.com> 1:1.0.2-3
- Added xfs documentation to doc macro.
- Use "make install" instead of makeinstall macro.
- Clean up source file URLs.

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

* Thu Apr 27 2006 Adam Jackson <ajackson@redhat.com> 1:1.0.2-1
- Update xfs and fstobdf

* Wed Mar 01 2006 Mike A. Harris <mharris@redhat.com> 1:1.0.1-4
- Fix all rpm scriptlets "upgrade" tests to only execute on upgrades.

* Sat Feb 25 2006 Mike A. Harris <mharris@redhat.com> 1:1.0.1-3
- Redirect output of "rm -rf fonts.dir" to /dev/null in xfs.init

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

* Thu Feb 09 2006 Mike A. Harris <mharris@redhat.com> 1:1.0.1-2
- Removed invocation of fc-cache from xfs initscript for bug (#179362)
- Redirect stderr to /dev/null to squelch an unwanted error xfs.init (#155349)
- Replace "s#^/.*:[a-z]*$##g" with "s#:unscaled$##g" in xfs.init for (#179491)
- Cosmetic cleanups to spec file to satiate the banshees.

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

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

* Tue Jan 10 2006 Bill Nottingham <notting@redhat.com> 1:1.0.0-2
- fix rpm post script (#176009, <ville.skytta@iki.fi>)

* Fri Dec 16 2005 Mike A. Harris <mharris@redhat.com> 1:1.0.0-1
- Updated all tarballs to version 1.0.0 from X11R7 RC4.
- Get default X font directory with font-utils package 'fontdir' pkgconfig
  variable.
- Change manpage dir from man1x back to man1 to match upstream.

* Tue Nov 15 2005 Jeremy Katz <katzj@redhat.com> 1:0.99.2-4
- require initscripts instead of /etc/init.d/functions

* Tue Nov 15 2005 Mike A. Harris <mharris@redhat.com> 0.99.2-3
- Updated xfs pre script to check for the existance of the old monolithic
  /usr/X11R6/lib/X11/fs/config xfs config file, and set a migration flag
  file.
- Updated xfs.init to check for the existance of the migration flag file,
  and perform an xfs 'restart' instead of a 'reload' if migrating.  Users
  will now have to restart their X server, or reconnect the xfs server to
  the X server after a migration to modular X.
- Changed upgrade comparison typo from 2 to 1 in xfs post script.

* Mon Nov 14 2005 Mike A. Harris <mharris@redhat.com> 0.99.2-2
- Added temporary "BuildRequires: libXfont-devel >= 0.99.2-3" and
  "Requires: libXfont-devel >= 0.99.2-3" to ensure early-testers of
  pre-rawhide modular X have installed the work around for (#172997).

* Fri Nov 11 2005 Mike A. Harris <mharris@redhat.com> 0.99.2-1
- Updated to xfs-0.99.2 and fstobdf-0.99.2 from X11R7 RC2
- Added Epoch 1 to package, and set the version number to the xfs 0.99.2
  version.

* Thu Nov 10 2005 Mike A. Harris <mharris@redhat.com> 6.99.99.901-2
- Added showfont-0.99.1 from X11R7 RC1 release.

* Wed Nov 09 2005 Mike A. Harris <mharris@redhat.com> 6.99.99.901-1
- Updated all packages to version 0.99.1 from X11R7 RC1.
- Bump package version to 6.99.99.901 (the RC1 CVS tag).
- Change manpage location to 'man1x' in file manifest.
- Converted xfs.config to xfs.config.in, and added code to spec file to
  generate xfs.config depending on what the system _x11fontdir is.
- Complete and total rewrite of xfs postinstall script to use "sed -i"
  and complete restructuring, which removed a lot of the super craptasticness
  that had been sitting there for years.

* Wed Oct 03 2005 Mike A. Harris <mharris@redhat.com> 6.99.99.0-4
- Use Fedora-Extras style BuildRoot tag
- Update BuildRequires to use new library package names
- Remove unnecessary BuildRequires on 'install', and fix pkgconfig dep

* Thu Aug 25 2005 Mike A. Harris <mharris@redhat.com> 6.99.99.0-3
- Install the initscript and xfs config file in the correct location as they
  were inadvertently interchanged in previous builds.

* Wed Aug 24 2005 Mike A. Harris <mharris@redhat.com> 6.99.99.0-2
- Ported the xfs related rpm scripts over from monolithic packaging, and
  added up to date Requires(*) dependencies for all of them.
- Flagged xfs config file as config(noreplace)
- Added build and runtime dependencies to xfs subpackage as best as could be
  determined by analyzing ./configure output, and building in minimalized
  build root environment.

* Wed Aug 24 2005 Mike A. Harris <mharris@redhat.com> 6.99.99.0-1
- Initial build.
