summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTommy Reynolds <Tommy.Reynolds@MegaCoder.com>2006-01-19 19:49:48 +0000
committerTommy Reynolds <Tommy.Reynolds@MegaCoder.com>2006-01-19 19:49:48 +0000
commitf41084d4acba94796050d6b4939af4b213e40a11 (patch)
tree486951067db68346ccedeb1c8e84ac186e09dfa8
parent46b7eac1c5a54b23d50c94ac5094618bf0ad6ecc (diff)
downloadfedora-doc-utils-f41084d4acba94796050d6b4939af4b213e40a11.tar.gz
fedora-doc-utils-f41084d4acba94796050d6b4939af4b213e40a11.tar.xz
fedora-doc-utils-f41084d4acba94796050d6b4939af4b213e40a11.zip
First cut a integrating the RPM packaging stuff with the
"docs-common/Makefile.common" infrastructure. While this appears to work *somewhat* with the "example-tutorial", it is certainly not ready for prime time yet. TODO: 1) Verify that all generated RPM's have the necessary files inside. 2) Mangle the "../docs-common" strings in Makefiles, *.xml, to reference the "/usr/share/fedora/doc" ${FDPDIR} so that we don't need to bugger the RPM checksums of the files by altering them at RPM install time. 3) Buy a beer all round.
-rw-r--r--Makefile.common163
-rwxr-xr-xbin/db2rpm-info21
-rw-r--r--common/fedora-entities-en.ent6
-rw-r--r--packaging/fedora-doc-common.spec4
-rw-r--r--packaging/fedora-doc.spec.in.common5
5 files changed, 176 insertions, 23 deletions
diff --git a/Makefile.common b/Makefile.common
index 4ce1664..930a344 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -22,6 +22,8 @@
# providing additional rules, also marked with double-colons, in the
# document Makefile.
#########################################################################
+# N.B.: Don't use "$@" in a template. It doesn't work. I tried ;-(
+#########################################################################
# Allow client document to provide "Make.paths" file to locate our files
# This is a "silent include", so if it's missing there is no problem.
# This file, if present, must be in the DOCUMENT directory, not here in
@@ -49,8 +51,8 @@ endif
ifeq (${HTMLCSS},)
HTMLCSS = ${FDPDIR}/docs-common/css/fedora-draft.css
endif
-ifeq (${HTMLCSSEXTRA},)
-HTMLCSSEXTRA = ${FDPDIR}/docs-common/images/watermark-${LANG}.png
+ifeq (${DRAFT},)
+DRAFT = yes
endif
ifeq (${RPMINFO},)
RPMINFO = ${PWD}/rpm-info.xml
@@ -61,13 +63,34 @@ endif
XMLTO =xmlto
# Let's also do this for xsltproc(1).
XSLTPROC=xsltproc
-XMLFORMAT=$(FDPDIR)/docs-common/bin/xmlformat
+XMLFORMAT=xmlformat
XMLFOPTS=-f $(FDPDIR)/docs-common/bin/xmlformat-fdp.conf
#########################################################################
# Use our very own "docs-common/bin/fdpsh" as the command interpreter
# This automatically has ${FDPBIN} as first in the ${PATH}
SHELL =${FDPBIN}/fdpsh
#########################################################################
+VERSION:=$(shell version doc)
+RELEASE:=$(shell version rpm)
+PWD :=$(shell /bin/pwd)
+#########################################################################
+RPMFLAGS=--define "docbase $(DOCBASE)" \
+ --define "version $(VERSION)" \
+ --define "_topdir $(PWD)/rpm" \
+ --define "fdpdir $(FDPDIR)"
+
+SPECFILE=fedora-doc-$(DOCBASE).spec
+ifeq (${RPMDEBUG},1)
+RPMDFLAG = -vv
+endif
+RPMJUNK = \
+ --define "_sourcedir $(PWD)" \
+ --define "_rpmdir $(PWD)" \
+ --define "_srcrpmdir $(PWD)" \
+ --define "_specdir $(PWD)" \
+ --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
+ FIXME
+#########################################################################
# PUT NO TARGETS BEFORE THIS ONE, not even in your base Makefile
# In a properly-constructed Makefile, this will be the default target
@@ -99,10 +122,11 @@ html-$(1) ${DOCBASE}-$(1)/index.html:: ${DOCBASE}-$(1).xml $$(XMLEXTRAFILES-$(1)
mkdir -p $(DOCBASE)-$(1)/stylesheet-images/
cp ${FDPDIR}/docs-common/stylesheet-images/*.png $(DOCBASE)-$(1)/stylesheet-images
cp ${HTMLCSS} $(DOCBASE)-$(1)/fedora.css
- [ -z "${HTMLCSSEXTRA}" ] || \
- cp ${HTMLCSSEXTRA} $(DOCBASE)-$(1)/watermark.png
+ifeq (${DRAFT},"yes")
+ cp ${FDPDIR}/docs-common/images/watermark-$(1).png
+endif
[ ! -d figs ] || copy-figs -v -f '*.png' \
- -l ${LANG} figs $(DOCBASE)-$(1)
+ -l $(1) figs $(DOCBASE)-$(1)
endef
#
$(foreach LANG,${LANGUAGES},$(eval $(call HTML_template,${LANG})))
@@ -128,16 +152,17 @@ html-nochunks:: $(foreach LANG,${LANGUAGES},$(DOCBASE)-$(LANG).html)
html-nochunks:: $(foreach LANG,${LANGUAGES},html-nochunks-$(LANG))
#
#########################################################################
-# For each language in ${LANGUAGES}, build a tarball of the HTML files.
+# For each language in ${LANGUAGES}, build a tarball of the HTML and
+# image files. Any ".eps" files are ignored.
#
-define TAR_template
+define HTMLTAR_template
${DOCBASE}-$(1).tar.gz:: ${DOCBASE}-$(1)/index.html
tar -zc --exclude '*.eps' -f ${DOCBASE}-$(1).tar.gz ${DOCBASE}-$(1)
endef
#
tarball:: $(foreach LANG,${LANGUAGES},$(DOCBASE)-$(LANG).tar.gz)
-$(foreach LANG,${LANGUAGES},$(eval $(call TAR_template,${LANG})))
+$(foreach LANG,${LANGUAGES},$(eval $(call HTMLTAR_template,${LANG})))
#
#########################################################################
# For each language in ${LANGUAGES}, generate an Adobe Portable Document
@@ -157,7 +182,6 @@ pdf:: $(foreach LANG,${LANGUAGES},pdf-$(LANG).pdf)
define CLEAN_template
${DOCBASE}-$(1)-clean::
${RM} fdp-info-$(1).xml
- ${RM} fedora.css watermark-${LANG}.png watermark.png
endef
#
$(foreach LANG,${LANGUAGES},$(eval $(call CLEAN_template,${LANG})))
@@ -171,6 +195,9 @@ ${DOCBASE}-$(1)-distclean:: ${DOCBASE}-$(1)-clean
${RM} -r ${DOCBASE}-$(1).html stylesheet-images
${RM} -r ${DOCBASE}-$(1).pdf
${RM} -r ${DOCBASE}-$(1).tar.gz
+ ${RM} *-$(1).omf
+ ${RM} *-$(1).desktop
+ ${RM} fedora.css watermark-${LANG}.png watermark.png
endef
#
$(foreach LANG,${LANGUAGES},$(eval $(call DISTCLEAN_template,${LANG})))
@@ -198,17 +225,17 @@ diff::
#########################################################################
# The "fdp-info-${LANG}.xml" file contains the <articleinfo> or
# <bookinfo> stanza. It is automatically generated from data in the
-# "rpm-info.xml" file.
+# "rpm-info.xml" file whenever that file changes.
#
define fdp-info_template
fdp-info-$(1).xml:: $(RPMINFO)
${XSLTPROC} --stringparam lang $(1) \
--stringparam doctype $(shell \
- ${FDPDIR}/docs-common/packaging/doctype \
- $(DOCBASE)-$(1).xml \
+ doctype $(DOCBASE)-$(1).xml \
) ${FDPDIR}/docs-common/packaging/bookinfo.xsl \
$(RPMINFO) | \
- $(XMLFORMAT) $(XMLFOPTS) > fdp-info-$(1).xml
+ $(XMLFORMAT) $(XMLFOPTS) > fdp-info-$(1).xml.tmp && \
+ move-if-change fdp-info-$(1).xml.tmp fdp-info-$(1).xml
endef
#
$(foreach LANG,${LANGUAGES},$(eval $(call fdp-info_template,${LANG})))
@@ -234,3 +261,111 @@ colophon:: $(RPMINFO)
#########################################################################
# End of Makefile.common
#########################################################################
+
+
+clean::
+ ${RM} $(DOCBASE)-$(VERSION)*.src.tar.gz
+ ${RM} -r $(DOCBASE)-$(VERSION)/
+ ${RM} *.omf *.desktop $(SPECFILE)
+ ${RM} *~
+
+distclean::
+ ${RM} -r rpm
+ ${RM} *.rpm
+ ${RM} *.omf
+ ${RM} *.desktop
+ ${RM} *.spec
+ ${RM} *.src.tar.gz
+
+spec:: ${SPECFILE}
+
+${SPECFILE}:: ${RPMINFO}
+ $(XSLTPROC) --stringparam docbase "${DOCBASE}" \
+ ../docs-common/packaging/spec.xsl ${RPMINFO} \
+ >$@.tmp && move-if-change $@.tmp $@
+
+
+gnome.desktop:: fedora-doc-${DOCBASE}-gnome.desktop
+
+fedora-doc-${DOCBASE}-gnome.desktop:: ${RPMINFO}
+ $(XSLTPROC) ../docs-common/packaging/gnome-desktop.xsl \
+ ${RPMINFO} >$@.tmp && move-if-change $@.tmp $@
+
+kde.desktop:: fedora-doc-${DOCBASE}-kde.desktop
+
+fedora-doc-${DOCBASE}-kde.desktop:: ${RPMINFO}
+ $(XSLTPROC) ../docs-common/packaging/kde-desktop.xsl \
+ ${RPMINFO} >$@.tmp && move-if-change $@.tmp $@
+
+khelp.desktop:: fedora-doc-${DOCBASE}-khelp.desktop
+
+fedora-doc-${DOCBASE}-khelp.desktop:: ${RPMINFO}
+ $(XSLTPROC) ../docs-common/packaging/khelpcenter-plugin.xsl \
+ ${RPMINFO} >$@.tmp && move-if-change $@.tmp $@
+
+
+define omf_template
+omf-$(1):: fedora-doc-${DOCBASE}-$(1).omf
+
+fedora-doc-${DOCBASE}-$(1).omf:: ${RPMINFO}
+ ${XSLTPROC} --stringparam docbase "${DOCBASE}" \
+ ../docs-common/packaging/omf.xsl ${RPMINFO} | \
+ $(XMLFORMAT) $(XMLFOPTS) >fedora-doc-${DOCBASE}-$(1).omf.tmp && \
+ move-if-change fedora-doc-${DOCBASE}-$(1).omf.tmp fedora-doc-${DOCBASE}-$(1).omf
+endef
+
+fedora-doc-${DOCBASE}-C.omf:: fedora-doc-${DOCBASE}-en.omf
+ cp fedora-doc-$(DOCBASE)-en.omf $@
+
+$(foreach LANG,${LANGUAGES},$(eval $(call omf_template,${LANG})))
+
+omf:: $(foreach LANG,${LANGUAGES},omf-$(LANG)) fedora-doc-${DOCBASE}-C.omf
+
+
+$(DOCBASE)-$(VERSION).src.tar.gz::
+ ${MAKE} fdp-info
+ ${MAKE} gnome.desktop
+ ${MAKE} kde.desktop
+ ${MAKE} khelp.desktop
+ ${MAKE} omf
+ mkdir $(DOCBASE)-$(VERSION)
+ find * '(' \
+ -name '.*' \
+ -o -name 'CVS' \
+ -o -name 'rpm' \
+ -o -name '*.rpm' \
+ -o -name '#*' \
+ -o -name '*~' \
+ -o -name '*.tar.gz' \
+ -o -name '*.tmp' \
+ -o -name '${DOCBASE}-${VERSION}' \
+ ')' -prune -o -print | cpio -pamdv $(DOCBASE)-$(VERSION)
+ tar -zcvf $@ $(DOCBASE)-$(VERSION)/
+ ${RM} -r $(DOCBASE)-$(VERSION)
+
+package-prep::
+ ${MAKE} distclean
+ ${MAKE} ${DOCBASE}-${VERSION}.src.tar.gz
+ ${MAKE} ${SPECFILE}
+ ${MAKE} omf
+ ${MAKE} kde.desktop
+ ${MAKE} khelp.desktop
+ ${RM} -r rpm
+ mkdir -p rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+ mkdir -p rpm/RPMS/{i386,i486,i586,i686,noarch,ppc,x86_64}
+ cp -f $(DOCBASE)-$(VERSION).src.tar.gz rpm/SOURCES/
+ cp -f ${SPECFILE} rpm/SPECS
+ cp -f *.omf *.desktop rpm/SOURCES
+
+rpm::
+ ${RM} *.rpm
+ ${MAKE} package-prep
+ rpmbuild -ba $(RPMDFLAG) $(RPMFLAGS) rpm/SPECS/$(SPECFILE)
+ ln rpm/SRPMS/*.rpm rpm/RPMS/noarch/*.rpm .
+ ls *.rpm
+
+
+showvars::
+ @echo "VERSION=$(VERSION)"
+ @echo "RELEASE=$(RELEASE)"
+ @echo "PWD=$(PWD)"
diff --git a/bin/db2rpm-info b/bin/db2rpm-info
index db1ed45..162fa26 100755
--- a/bin/db2rpm-info
+++ b/bin/db2rpm-info
@@ -1,8 +1,23 @@
-#!/bin/sh
-BINDIR=`dirname $0`
+#!/bin/zsh
+ME=$(basename $0)
+BINDIR=$(dirname $0)
+USAGE="usage: ${ME} [-o ofile] document.xml"
+ofile=
+while getopts o: c
+do
+ case "${c}" in
+ o) ofile="${OPTARG}";;
+ *) echo "${USAGE}" >&2; exit 1;;
+ esac
+done
+shift $(expr ${OPTIND} - 1)
if [ $# -ne 1 ]; then
- echo "usage: `basename $0` docfile.xml" >&2
+ echo "${USAGE}" >&2
exit 1
fi
+if [ "${ofile}" ]; then
+ rm -f "${ofile}"
+ exec >"${ofile}"
+fi
xsltproc ${BINDIR}/../packaging/info2rpminfo.xsl $1 |
${BINDIR}/xmlformat -f ${BINDIR}/xmlformat-fdp.conf
diff --git a/common/fedora-entities-en.ent b/common/fedora-entities-en.ent
index 972569f..178f674 100644
--- a/common/fedora-entities-en.ent
+++ b/common/fedora-entities-en.ent
@@ -1,8 +1,8 @@
-<!-- $Id: fedora-entities-en.ent,v 1.13 2006/01/17 02:25:49 pfrields Exp $ -->
+<!-- $Id: fedora-entities-en.ent,v 1.14 2006/01/19 19:49:59 jtr Exp $ -->
<!--
- These common entities are useful shorthand
- terms and names, which may be subject to
+ These common entities are useful shorthand
+ terms and names, which may be subject to
change at anytime. This is an important
value the entity provides, a single location
to update terms and common names.
diff --git a/packaging/fedora-doc-common.spec b/packaging/fedora-doc-common.spec
index 48f697b..c031764 100644
--- a/packaging/fedora-doc-common.spec
+++ b/packaging/fedora-doc-common.spec
@@ -32,12 +32,12 @@ This package contains the following official Fedora Documentation components:
%install
rm -rf $RPM_BUILD_ROOT
install -d -m 755 $RPM_BUILD_ROOT/%{_datadir}/fedora/doc/docs-common/bin/
-for i in xmlformat xmldiff copy-figs bulkbuild tidy-bowl
+for i in xmlformat xmldiff copy-figs tidy-bowl fdpsh doctype
do
install -m 755 $RPM_BUILD_DIR/%{name}-%{release}/bin/${i} \
$RPM_BUILD_ROOT/%{_datadir}/fedora/doc/docs-common/bin/
done
-for i in xmlformat-fdp.conf xmldiff.pl active
+for i in xmlformat-fdp.conf xmldiff.pl active fdp-functions
do
install -m 644 $RPM_BUILD_DIR/%{name}-%{release}/bin/${i} \
$RPM_BUILD_ROOT/%{_datadir}/fedora/doc/docs-common/bin/
diff --git a/packaging/fedora-doc.spec.in.common b/packaging/fedora-doc.spec.in.common
index 23bcf88..73667a0 100644
--- a/packaging/fedora-doc.spec.in.common
+++ b/packaging/fedora-doc.spec.in.common
@@ -25,9 +25,12 @@ For more information, refer to the Fedora Documentation Project.
%prep
%setup -q -n %{docbase}-%{version}
+# FIXME: Need to do this remapping in the RPM build section, since it
+# causes "rpm -V foo" to fail, even if it's done immediately after an
+# install...
for i in $RPM_BUILD_DIR/%{docbase}-%{version}/%{docbase}*.xml
do
- %{__sed} -i 's!../docs-common/!../../docs-common/!' "$i"
+ %{__sed} -i 's!../docs-common/!/usr/share/fedora/doc/docs-common/!' "$i"
done