1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +03:00

More cleanups to the documentation part of libxml2

doc/Makefile.am:

* Build what's in doc/ before doc/devhelp/, as the dependency graph flows
   that way

* Add "--path $(srcdir)" so that xsltproc can find DTDs in srcdir

* Replaced $(top_srcdir)/doc with an equivalent $(srcdir)

* Qualified libxml2-api.xml with $(srcdir) as it's always generated there

* Rewrote the dependencies for libxml2-api.xml so that xmlversion.h
   doesn't throw everything off

doc/devhelp/Makefile.am:

* Use Automake constructs to install the HTML files instead of an
   install-data-local rule

* Reorganized the file a bit (hello whitespace!)

* EXTRA_DIST doesn't need to list so many files now that dist_devhelp_DATA
   is being used

* Only print "Rebuilding devhelp files" if rebuilding is actually
   occurring

doc/examples/index.py:

* Make the "this file is auto-generated" banner more prominent

* Autotools updates: Use AM_CPPFLAGS/AM_CFLAGS instead of INCLUDES

* Got rid of DEPS as it's not needed (Automake already sees the dependency
   on libxml2.la by way of LDADD(S))

* Replaced LDADDS with LDADD, which is applied to all programs listed
   in the file. Since all the test programs have the same link
   dependencies, this way is more concise yet equivalent.

* Remove the *.tmp files via "make clean" instead of having the test
   programs do it themselves (more on this later)

* Invoke index.py in srcdir, as it pretty much needs to run there

* Restructured the index.html rule so that only the xmllint invocation is
   allowed to fail

* Use $(MKDIR_P) instead of $(mkinstalldirs), $(VAR) instead of @VAR@

* Remove symlinks for test?.xml in an out-of-source build

* Sort lists for neatness

* Better formatting for EXTRA_DIST and noinst_PROGRAMS variables

* Simplified the Automake bits printed for each program: *_LDFLAGS doesn't
   need to be specified as it's empty anyway, *_DEPENDENCIES is redundant,
   *_LDADD isn't needed due to the global LDADD

* Added a bit that symlinks in test?.xml from srcdir in out-of-source
   builds. This allows the reader4 test to read these files in the current
   directory, which ensures that the output always looks the same (i.e.
   does not contain references to srcdir)

* Don't hide the test program invocation (or else it's hard to tell which
   test failed), and don't use superfluous parentheses

* NOTE: If you check in these changes, be sure to run this script and also
   check in the updated files that it generates!

doc/examples/*.c:

* Updated the test: lines so that

   + "&&" is used to separate commands instead of ";" so that errors are
     not masked

   + reference files are qualified with $(srcdir)/

   + no "rm" takes place -- these are a problem because (1) if a test
     fails, it's useful to have the output file ready for inspection; (2)
     the "rm" invocation masks a potential non-zero exit status from diff

     (This is why I added the CLEANFILES line above)

doc/examples/io1.res:

* Updated this ref file so that the test passes. (This is correct, right?)

doc/examples/reader4.res:

* Changed this back to its original form, as the symlinking of test?.xml
   means this file no longer has to contain path prefixes on the filenames

doc/examples/testWriter.c:

* Changed the output filenames to *.tmp instead of *.res, partly for
   consistency, partly to not have to add special cases to CLEANFILES

doc/examples/xpath1.c:

* Removed the "./" prefix on the test invocation, which is redundant as
   index.py already adds one
This commit is contained in:
Daniel Richard G 2012-08-17 09:58:38 +08:00 committed by Daniel Veillard
parent e02869807e
commit 6842ee810e
16 changed files with 81 additions and 68 deletions

View File

@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
SUBDIRS=devhelp examples
SUBDIRS = . devhelp examples
# The top-level SGML file.
DOC_MAIN_XML_FILE=gnome-xml.xml
@ -256,25 +256,25 @@ web: $(PAGES)
$(PAGES): xml.html $(srcdir)/site.xsl
-@(if [ -x $(XSLTPROC) ] ; then \
echo "Rebuilding the HTML Web pages from xml.html" ; \
$(XSLTPROC) --nonet --html $(top_srcdir)/doc/site.xsl $(top_srcdir)/doc/xml.html > index.html ; fi );
$(XSLTPROC) --nonet --html --path $(srcdir) $(srcdir)/site.xsl $(srcdir)/xml.html > index.html ; fi );
-@(if [ -x $(XMLLINT) ] ; then \
echo "Validating the HTML Web pages" ; \
$(XMLLINT) --nonet --valid --noout $(PAGES) ; fi );
$(top_builddir)/NEWS: $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html
$(top_builddir)/NEWS: $(srcdir)/news.xsl $(srcdir)/news.html
-@(if [ -x $(XSLTPROC) ] ; then \
$(XSLTPROC) --nonet $(top_srcdir)/doc/news.xsl $(top_srcdir)/doc/news.html > $(top_builddir)/NEWS ; fi );
$(XSLTPROC) --nonet $(srcdir)/news.xsl $(srcdir)/news.html > $(top_builddir)/NEWS ; fi );
libxml2.xsa: $(top_srcdir)/doc/xsa.xsl $(top_srcdir)/doc/news.html
libxml2.xsa: $(srcdir)/xsa.xsl $(srcdir)/news.html
-@(if [ -x $(XSLTPROC) ] ; then \
echo "Rebuilding the NEWS file" ; \
$(XSLTPROC) --nonet $(top_srcdir)/doc/xsa.xsl $(top_srcdir)/doc/news.html > libxml2.xsa ; fi );
$(XSLTPROC) --nonet $(srcdir)/xsa.xsl $(srcdir)/news.html > libxml2.xsa ; fi );
$(APIPAGES): libxml2-api.xml libxml2-refs.xml $(top_srcdir)/doc/site.xsl $(top_srcdir)/doc/api.xsl
$(APIPAGES): libxml2-api.xml libxml2-refs.xml $(srcdir)/site.xsl $(srcdir)/api.xsl
-@(if [ -x $(XSLTPROC) ] ; then \
echo "Rebuilding the HTML API pages from libxml2-refs.xml" ; \
$(XSLTPROC) --nonet --html $(top_srcdir)/doc/api.xsl \
$(top_srcdir)/doc/xml.html ; fi );
$(XSLTPROC) --nonet --html $(srcdir)/api.xsl \
$(srcdir)/xml.html ; fi );
-@(if [ -x $(XMLLINT) ] ; then \
echo "Validating the HTML API pages" ; \
$(XMLLINT) --nonet --valid --noout API*.html ; fi );
@ -282,7 +282,7 @@ $(APIPAGES): libxml2-api.xml libxml2-refs.xml $(top_srcdir)/doc/site.xsl $(top_s
$(srcdir)/html/index.html: libxml2-api.xml $(srcdir)/newapi.xsl
-@(if [ -x $(XSLTPROC) ] ; then \
echo "Rebuilding the HTML pages from the XML API" ; \
$(XSLTPROC) --nonet $(srcdir)/newapi.xsl libxml2-api.xml ; fi )
$(XSLTPROC) --nonet $(srcdir)/newapi.xsl $(srcdir)/libxml2-api.xml ; fi )
-@(if [ -x $(XMLLINT) ] ; then \
echo "Validating the resulting XHTML pages" ; \
$(XMLLINT) --nonet --valid --noout html/*.html ; fi );
@ -290,15 +290,20 @@ $(srcdir)/html/index.html: libxml2-api.xml $(srcdir)/newapi.xsl
wiki: libxml2-api.xml $(srcdir)/wiki.xsl
-@(if [ -x $(XSLTPROC) ] ; then \
echo "Rebuilding the wiki HTML pages from the XML API" ; \
$(XSLTPROC) --nonet $(srcdir)/wiki.xsl libxml2-api.xml; fi )
$(XSLTPROC) --nonet $(srcdir)/wiki.xsl $(srcdir)/libxml2-api.xml; fi )
$(WIN32_DIR)/libxml2.def.src: libxml2-api.xml
-@(if [ -x $(XSLTPROC) ] ; then \
$(XSLTPROC) -o $(WIN32_DIR)/libxml2.def.src \
--nonet $(WIN32_DIR)/defgen.xsl libxml2-api.xml ; fi )
libxml2-api.xml libxml2-refs.xml ../libxml2.syms: apibuild.py symbols.xml syms.xsl checkapisym.xsl $(wildcard $(top_srcdir)/include/libxml/*.h) $(wildcard $(top_srcdir)/*.c)
-($(srcdir)/apibuild.py)
source_file_deps = \
$(filter-out %/xmlversion.h, $(wildcard $(top_srcdir)/include/libxml/*.h)) \
$(top_srcdir)/include/libxml/xmlversion.h.in \
$(wildcard $(top_srcdir)/*.c)
libxml2-api.xml libxml2-refs.xml ../libxml2.syms: apibuild.py symbols.xml syms.xsl checkapisym.xsl $(source_file_deps)
(cd $(srcdir) && ./apibuild.py)
($(XSLTPROC) $(srcdir)/checkapisym.xsl $(srcdir)/libxml2-api.xml)
($(XSLTPROC) -o ../libxml2.syms $(srcdir)/syms.xsl $(srcdir)/symbols.xml)
-@(cd .. ; $(MAKE) rebuild_testapi)

View File

@ -1,5 +1,15 @@
DEVHELP_DIR=$(datadir)/gtk-doc/html/libxml2
HTML_FILES=index.html general.html $(HTML_MODULES)
devhelpdir = $(datadir)/gtk-doc/html/libxml2
dist_devhelp_DATA = \
libxml2.devhelp \
$(HTML_FILES) \
$(EXTRA_FORMAT)
HTML_FILES = \
general.html \
index.html \
$(HTML_MODULES)
HTML_MODULES= \
libxml2-c14n.html \
libxml2-catalog.html \
@ -56,24 +66,9 @@ EXTRA_FORMAT= \
up.png \
style.css
EXTRA_DIST=devhelp.xsl html.xsl libxml2.devhelp $(HTML_FILES) $(EXTRA_FORMAT)
all: libxml2.devhelp $(HTML_FILES)
EXTRA_DIST = devhelp.xsl html.xsl
libxml2.devhelp $(HTML_FILES): devhelp.xsl html.xsl $(top_srcdir)/doc/libxml2-api.xml
-@(echo Rebuilding devhelp files)
-@(if [ -x $(XSLTPROC) ] ; then \
echo Rebuilding devhelp files ; \
$(XSLTPROC) --nonet -o $(srcdir)/libxml2.devhelp $(srcdir)/devhelp.xsl $(top_srcdir)/doc/libxml2-api.xml ; fi );
install-data-local:
-$(MKDIR_P) $(DESTDIR)$(DEVHELP_DIR)
-$(INSTALL) -m 0644 $(srcdir)/libxml2.devhelp $(DESTDIR)$(DEVHELP_DIR)
-$(INSTALL) -m 0644 $(EXTRA_FORMAT:%=$(srcdir)/%) $(DESTDIR)$(DEVHELP_DIR)
-$(INSTALL) -m 0644 $(HTML_FILES:%=$(srcdir)/%) $(DESTDIR)$(DEVHELP_DIR)
uninstall-local:
rm -f $(DESTDIR)$(DEVHELP_DIR)/libxml2.devhelp
rm -f $(DESTDIR)$(DEVHELP_DIR)/*.css
rm -f $(DESTDIR)$(DEVHELP_DIR)/*.html
rm -f $(DESTDIR)$(DEVHELP_DIR)/*.png
-rmdir $(DESTDIR)$(DEVHELP_DIR)

View File

@ -220,43 +220,56 @@ def dump_Makefile():
extras.append(file)
for file in glob.glob('*.res'):
extras.append(file)
Makefile="""# Beware this is autogenerated by index.py
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@
DEPS = $(top_builddir)/libxml2.la
LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm @WIN32_EXTRA_LIBADD@
Makefile="""##
## This file is auto-generated by index.py
## DO NOT EDIT !!!
##
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include
AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS)
LDADD = $(RDL_LIBS) $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm $(WIN32_EXTRA_LIBADD)
CLEANFILES = *.tmp
rebuild: examples.xml index.html
examples.xml: index.py $(noinst_PROGRAMS:=.c)
-@($(srcdir)/index.py)
cd $(srcdir) && $(PYTHON) index.py
$(MAKE) Makefile
index.html: examples.xml examples.xsl
-@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html)
cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page"
-cd $(srcdir) && xmllint --valid --noout index.html
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
-@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
$(MKDIR_P) $(DESTDIR)$(HTML_DIR)
-$(INSTALL) -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
clean-local:
test -f Makefile.am || rm -f test?.xml
"""
examples.sort()
extras.sort()
tests.sort()
EXTRA_DIST=""
for extra in extras:
EXTRA_DIST = EXTRA_DIST + extra + " "
Makefile = Makefile + "EXTRA_DIST=%s\n\n" % (EXTRA_DIST)
EXTRA_DIST = EXTRA_DIST + " \\\n\t" + extra
Makefile = Makefile + "EXTRA_DIST =%s\n\n" % (EXTRA_DIST)
noinst_PROGRAMS=""
for example in examples:
noinst_PROGRAMS = noinst_PROGRAMS + example + " "
Makefile = Makefile + "noinst_PROGRAMS=%s\n\n" % (noinst_PROGRAMS)
noinst_PROGRAMS = noinst_PROGRAMS + " \\\n\t" + example
Makefile = Makefile + "noinst_PROGRAMS =%s\n\n" % (noinst_PROGRAMS)
for example in examples:
Makefile = Makefile + "%s_SOURCES=%s.c\n%s_LDFLAGS=\n%s_DEPENDENCIES= $(DEPS)\n%s_LDADD= @RDL_LIBS@ $(LDADDS)\n\n" % (example, example, example,
example, example)
Makefile = Makefile + "%s_SOURCES = %s.c\n\n" % (example, example)
Makefile = Makefile + "valgrind: \n\t$(MAKE) CHECKER='valgrind' tests\n\n"
Makefile = Makefile + "tests: $(noinst_PROGRAMS)\n"
Makefile = Makefile + "\ttest -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .\n"
Makefile = Makefile + "\t@(echo '## examples regression tests')\n"
Makefile = Makefile + "\t@(echo > .memdump)\n"
for test in tests:
Makefile = Makefile + "\t@($(CHECKER) %s)\n" % (test)
Makefile = Makefile + '\t@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)\n'
Makefile = Makefile + "\n\n"
Makefile = Makefile + "\t$(CHECKER) %s\n" % (test)
Makefile = Makefile + '\t@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0\n'
try:
old = open("Makefile.am", "r").read()
if old != Makefile:

View File

@ -6,7 +6,7 @@
* XInclude method context to show how dynamic document can
* be built in a clean way.
* usage: io1
* test: io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp
* test: io1 > io1.tmp && diff io1.tmp $(srcdir)/io1.res
* author: Daniel Veillard
* copy: see Copyright for the status of this software.
*/

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<document xmlns:xi="http://www.w3.org/2003/XInclude">
<p>List of people:</p>
<list><people>a</people><people>b</people></list>
<list xml:base="sql://select_name_from_people"><people>a</people><people>b</people></list>
</document>

View File

@ -4,7 +4,7 @@
* purpose: Demonstrate the use of xmlDocDumpMemory
* to output document to a character buffer
* usage: io2
* test: io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp
* test: io2 > io2.tmp && diff io2.tmp $(srcdir)/io2.res
* author: John Fleck
* copy: see Copyright for the status of this software.
*/

View File

@ -6,7 +6,7 @@
* (Note that the XMLReader functions require libxml2 version later
* than 2.6.)
* usage: reader1 <filename>
* test: reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp
* test: reader1 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
* author: Daniel Veillard
* copy: see Copyright for the status of this software.
*/

View File

@ -7,7 +7,7 @@
* (Note that the XMLReader functions require libxml2 version later
* than 2.6.)
* usage: reader2 <valid_xml_filename>
* test: reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp
* test: reader2 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
* author: Daniel Veillard
* copy: see Copyright for the status of this software.
*/

View File

@ -7,7 +7,7 @@
* (Note that the XMLReader functions require libxml2 version later
* than 2.6.)
* usage: reader3
* test: reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp
* test: reader3 > reader3.tmp && diff reader3.tmp $(srcdir)/reader3.res
* author: Daniel Veillard
* copy: see Copyright for the status of this software.
*/

View File

@ -6,7 +6,7 @@
* and parser context. (Note that the XMLReader functions require
* libxml2 version later than 2.6.)
* usage: reader4 <filename> [ filename ... ]
* test: reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp
* test: reader4 test1.xml test2.xml test3.xml > reader4.tmp && diff reader4.tmp $(srcdir)/reader4.res
* author: Graham Bennett
* copy: see Copyright for the status of this software.
*/

View File

@ -1,3 +1,3 @@
./test1.xml: Processed ok
./test2.xml: Processed ok
./test3.xml: Processed ok
test1.xml: Processed ok
test2.xml: Processed ok
test3.xml: Processed ok

View File

@ -7,7 +7,7 @@
* do encoding string conversions too. The resulting
* documents are then serialized.
* usage: testWriter
* test: testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res
* test: testWriter && for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done
* author: Alfred Mickautsch
* copy: see Copyright for the status of this software.
*/
@ -37,16 +37,16 @@ main(void)
LIBXML_TEST_VERSION
/* first, the file version */
testXmlwriterFilename("writer1.res");
testXmlwriterFilename("writer1.tmp");
/* next, the memory version */
testXmlwriterMemory("writer2.res");
testXmlwriterMemory("writer2.tmp");
/* next, the DOM version */
testXmlwriterDoc("writer3.res");
testXmlwriterDoc("writer3.tmp");
/* next, the tree version */
testXmlwriterTree("writer4.res");
testXmlwriterTree("writer4.tmp");
/*
* Cleanup function for the XML library.

View File

@ -5,7 +5,7 @@
* get the root element, then walk the document and print
* all the element name in document order.
* usage: tree1 filename_or_URL
* test: tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp
* test: tree1 test2.xml > tree1.tmp && diff tree1.tmp $(srcdir)/tree1.res
* author: Dodji Seketeli
* copy: see Copyright for the status of this software.
*/

View File

@ -3,7 +3,7 @@
* synopsis: Creates a tree
* purpose: Shows how to create document, nodes and dump it to stdout or file.
* usage: tree2 <filename> -Default output: stdout
* test: tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp
* test: tree2 > tree2.tmp && diff tree2.tmp $(srcdir)/tree2.res
* author: Lucas Brasilino <brasilino@recife.pe.gov.br>
* copy: see Copyright for the status of this software
*/

View File

@ -4,7 +4,7 @@
* purpose: Shows how to evaluate XPath expression and register
* known namespaces in XPath context.
* usage: xpath1 <xml-file> <xpath-expr> [<known-ns-list>]
* test: ./xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp
* test: xpath1 test3.xml '//child2' > xpath1.tmp && diff xpath1.tmp $(srcdir)/xpath1.res
* author: Aleksey Sanin
* copy: see Copyright for the status of this software.
*/

View File

@ -4,7 +4,7 @@
* said elements and save the resulting document.
* purpose: Shows how to make a full round-trip from a load/edit/save
* usage: xpath2 <xml-file> <xpath-expr> <new-value>
* test: xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp
* test: xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res
* author: Aleksey Sanin and Daniel Veillard
* copy: see Copyright for the status of this software.
*/