From Fedora Project Wiki

Revision as of 17:32, 3 December 2009 by Jjmcd (talk | contribs)

Example spec file for multi-language html

# Documentation Specfile

Name:		fedora-release-notes
Version:	12.0.1
Release:	2%{?dist}
Summary:	Release Notes for Fedora 12
URL:		http://fedoraproject.org/wiki/Documentation_Beats

Group:		System Environment/Base
License:	CC-by-SA
Source0:	Fedora-release-notes-%{version}.tar.gz
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:	noarch
Requires:	htmlview
Provides:	fedora-release-notes = %{version}-%{release}

%description 
This is a test rpm to demonstrate installing a pure
html implementation of fedora release notes.

%prep
%setup -q

%build

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_defaultdocdir}/HTML
mkdir -p $RPM_BUILD_ROOT%{_defaultdocdir}/HTML/%{name}

#
# Loop through the languages
#
for LANGDIR in document/* ; do
  #
  # First, the html in /usr/share/doc/HTML
  #
  LANG=${LANGDIR#%document/}
  # Target for release notes html
  NOTETARG=$RPM_BUILD_ROOT%{_defaultdocdir}/HTML/%{name}/${LANG}
  SRCBASE=${LANGDIR}
  mkdir -p ${NOTETARG}
  install -m 644 ${SRCBASE}/*.html ${NOTETARG}
  # Now the various subdirectories
  mkdir -p ${NOTETARG}/Common_Content
  mkdir -p ${NOTETARG}/Common_Content/css
  mkdir -p ${NOTETARG}/Common_Content/images
  mkdir -p ${NOTETARG}/images
  install -m 644 ${SRCBASE}/Common_Content/css/* ${NOTETARG}/Common_Content/css
  install -m 644 ${SRCBASE}/Common_Content/images/* ${NOTETARG}/Common_Content/images
  install -m 644 ${SRCBASE}/images/* ${NOTETARG}/images
done

#
# index.html that selects languages
#
install -m 644 applications/index.html $RPM_BUILD_ROOT%{_defaultdocdir}/HTML/%{name}
#
# Now the desktop files
#
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications/kde4
SRCBASE=applications
install -m 644 ${SRCBASE}/fedora-release-notes.desktop $RPM_BUILD_ROOT%{_datadir}/applications
install -m 644 ${SRCBASE}/kde4/fedora-release-notes.desktop $RPM_BUILD_ROOT%{_datadir}/applications/kde4

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -x /usr/bin/update-desktop-database ]; then update-desktop-database &> /dev/null; fi

%postun
if [ -x /usr/bin/scrollkeeper-update ]; then scrollkeeper-update -q; fi
if [ -x /usr/bin/update-desktop-database ]; then update-desktop-database &> /dev/null; fi

%files
%defattr(-,root,root,-)
%{_defaultdocdir}/HTML
%{_datadir}/applications/fedora-release-notes.desktop
%{_datadir}/applications/kde4/fedora-release-notes.desktop

%changelog
* Wed Dec 2 2009 John J. McDonough <jjmcd@fedoraproject.org> - 12.0.1-1
- initial

* Thu Dec 3 2009 John J. McDonough <jjmcd@fedoraproject.org> - 12.0.1-1
- some cleanup