diff options
author | Tommy Reynolds <Tommy.Reynolds@MegaCoder.com> | 2006-01-19 19:49:48 +0000 |
---|---|---|
committer | Tommy Reynolds <Tommy.Reynolds@MegaCoder.com> | 2006-01-19 19:49:48 +0000 |
commit | f41084d4acba94796050d6b4939af4b213e40a11 (patch) | |
tree | 486951067db68346ccedeb1c8e84ac186e09dfa8 /Makefile.common | |
parent | 46b7eac1c5a54b23d50c94ac5094618bf0ad6ecc (diff) | |
download | fedora-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.
Diffstat (limited to 'Makefile.common')
-rw-r--r-- | Makefile.common | 163 |
1 files changed, 149 insertions, 14 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)" |