]>
Commit | Line | Data |
---|---|---|
e9716b6c JB |
1 | From 2de221ce94b657f9c9a75aa3cc0cb84dbb5da78b Mon Sep 17 00:00:00 2001 |
2 | From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete@collabora.co.uk> | |
3 | Date: Mon, 28 Jan 2013 20:28:09 +0100 | |
4 | Subject: [PATCH] gtk-doc*.mak: Put the API version in the html book name | |
5 | ||
6 | This causes devhelp2 files to get a version. Due to that devhelp can show it | |
7 | along with the 0.10 version. | |
8 | --- | |
9 | gtk-doc-plugins.mak | 11 ++++------- | |
10 | gtk-doc.mak | 11 ++++------- | |
11 | 2 files changed, 8 insertions(+), 14 deletions(-) | |
12 | ||
e1ac5551 JR |
13 | diff -urNp -x '*.orig' gst-plugins-bad-0.10.23.org/common/gtk-doc-plugins.mak gst-plugins-bad-0.10.23/common/gtk-doc-plugins.mak |
14 | --- gst-plugins-bad-0.10.23.org/common/gtk-doc-plugins.mak 2011-12-30 19:32:24.000000000 +0100 | |
15 | +++ gst-plugins-bad-0.10.23/common/gtk-doc-plugins.mak 2021-10-06 23:28:06.340365779 +0200 | |
16 | @@ -162,19 +162,10 @@ scan-build.stamp: $(HFILE_GLOB) $(EXTRA_ | |
17 | --ignore-headers="$(IGNORE_HFILES)"; \ | |
18 | touch scan-build.stamp | |
19 | ||
20 | -#### update templates; done on every build #### | |
21 | +#### generate templates; done on every build #### | |
22 | ||
23 | -# in a non-srcdir build, we need to copy files from the previous step | |
24 | -# and the files from previous runs of this step | |
25 | -tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES) | |
26 | - @echo ' DOC Rebuilding template files' | |
27 | - @if test x"$(srcdir)" != x. ; then \ | |
28 | - for f in $(SCANOBJ_FILES) $(SCAN_FILES); \ | |
29 | - do \ | |
30 | - if test -e $(srcdir)/$$f; then cp -u $(srcdir)/$$f . ; fi; \ | |
31 | - done; \ | |
32 | - fi | |
33 | - @gtkdoc-mktmpl --module=$(DOC_MODULE) | |
34 | +tmpl-build.stamp: | |
35 | + @echo ' DOC Building template files' | |
36 | @$(PYTHON) \ | |
37 | $(top_srcdir)/common/mangle-tmpl.py $(srcdir)/$(INSPECT_DIR) tmpl | |
38 | @touch tmpl-build.stamp | |
39 | @@ -192,9 +183,13 @@ sgml-build.stamp: tmpl.stamp scan-build. | |
40 | $(top_srcdir)/common/plugins.xsl $$a > xml/`basename $$a`; done | |
41 | @for f in $(EXAMPLE_CFILES); do \ | |
42 | $(PYTHON) $(top_srcdir)/common/c-to-xml.py $$f > xml/element-`basename $$f .c`.xml; done | |
43 | - @gtkdoc-mkdb \ | |
44 | + @_source_dir='' ; \ | |
45 | + for i in $(DOC_SOURCE_DIR) ; do \ | |
46 | + _source_dir="$${_source_dir} --source-dir=$$i" ; \ | |
47 | + done ; \ | |
48 | + gtkdoc-mkdb \ | |
49 | --module=$(DOC_MODULE) \ | |
50 | - --source-dir=$(DOC_SOURCE_DIR) \ | |
51 | + $${_source_dir} \ | |
52 | --expand-content-files="$(expand_content_files)" \ | |
53 | --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) \ | |
54 | --output-format=xml \ | |
55 | @@ -223,10 +218,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_ | |
e9716b6c JB |
56 | mkhtml_options="$$mkhtml_options --verbose"; \ |
57 | fi; \ | |
58 | fi; \ | |
59 | - cd html && gtkdoc-mkhtml $$mkhtml_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) | |
60 | - @mv html/index.sgml html/index.sgml.bak | |
61 | - @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml | |
62 | - @rm -f html/index.sgml.bak | |
63 | + cd html && gtkdoc-mkhtml $$mkhtml_options $(DOC_MODULE)-@GST_MAJORMINOR@ $(DOC_MAIN_SGML_FILE) | |
64 | @rm -f html/$(DOC_MAIN_SGML_FILE) | |
65 | @rm -rf html/xml | |
66 | @rm -f html/version.entities | |
e1ac5551 | 67 | @@ -290,9 +282,9 @@ install-data-local: |
e9716b6c JB |
68 | $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \ |
69 | done; \ | |
70 | fi; \ | |
71 | - echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp2' ; \ | |
72 | - if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \ | |
73 | - $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \ | |
74 | + echo '-- Installing $(builddir)/html/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2' ; \ | |
75 | + if test -e $(builddir)/html/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; then \ | |
76 | + $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2 \ | |
77 | $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \ | |
78 | fi; \ | |
e1ac5551 JR |
79 | (which gtkdoc-rebase >/dev/null && \ |
80 | diff -urNp -x '*.orig' gst-plugins-bad-0.10.23.org/common/gtk-doc.mak gst-plugins-bad-0.10.23/common/gtk-doc.mak | |
81 | --- gst-plugins-bad-0.10.23.org/common/gtk-doc.mak 2011-12-30 19:32:24.000000000 +0100 | |
82 | +++ gst-plugins-bad-0.10.23/common/gtk-doc.mak 2021-10-06 23:28:06.340365779 +0200 | |
83 | @@ -104,7 +104,11 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) | |
84 | ||
85 | sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(expand_content_files) | |
86 | @echo ' DOC Building XML' | |
87 | - @gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) --output-format=xml $(MKDB_OPTIONS) | |
88 | + @_source_dir='' ; \ | |
89 | + for i in $(DOC_SOURCE_DIR) ; do \ | |
90 | + _source_dir="$${_source_dir} --source-dir=$$i" ; \ | |
91 | + done ; \ | |
92 | + gtkdoc-mkdb --module=$(DOC_MODULE) $${_source_dir} --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) --output-format=xml $(MKDB_OPTIONS) | |
93 | @cp ../version.entities xml | |
94 | @touch sgml-build.stamp | |
95 | ||
96 | @@ -130,10 +134,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_ | |
e9716b6c JB |
97 | if test "$(?)" = "0"; then \ |
98 | mkhtml_options=--path="$(abs_srcdir)"; \ | |
99 | fi; \ | |
100 | - cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) | |
101 | - @mv html/index.sgml html/index.sgml.bak | |
102 | - @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml | |
103 | - @rm -f html/index.sgml.bak | |
104 | + cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE)-@GST_MAJORMINOR@ ../$(DOC_MAIN_SGML_FILE) | |
105 | @rm -rf html/xml | |
106 | @rm -f version.entities | |
107 | @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) $(abs_builddir)/html ) | |
e1ac5551 | 108 | @@ -189,9 +190,9 @@ install-data-local: |
e9716b6c JB |
109 | echo '-- Installing '$$i ; \ |
110 | $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \ | |
111 | done; \ | |
112 | - echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp2' ; \ | |
113 | - if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \ | |
114 | - $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \ | |
115 | + echo '-- Installing $(builddir)/html/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2' ; \ | |
116 | + if test -e $(builddir)/html/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; then \ | |
117 | + $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2 \ | |
118 | $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \ | |
119 | fi; \ | |
e1ac5551 JR |
120 | (which gtkdoc-rebase >/dev/null && \ |
121 | diff -urNp -x '*.orig' gst-plugins-bad-0.10.23.org/common/mangle-tmpl.py gst-plugins-bad-0.10.23/common/mangle-tmpl.py | |
122 | --- gst-plugins-bad-0.10.23.org/common/mangle-tmpl.py 2011-12-11 20:19:22.000000000 +0100 | |
123 | +++ gst-plugins-bad-0.10.23/common/mangle-tmpl.py 2021-10-06 23:28:06.340365779 +0200 | |
e9716b6c JB |
124 | @@ -2,21 +2,12 @@ |
125 | # vi:si:et:sw=4:sts=4:ts=4 | |
126 | ||
127 | """ | |
128 | -use the output from gst-xmlinspect.py to mangle tmpl/*.sgml and | |
129 | -insert/overwrite Short Description and Long Description | |
130 | +use the files from inspect/*.xml to create mininal tmpl/*.sgml files containing | |
131 | +'Short Description' and 'Long Description' to inject element details into the | |
132 | +docbook files produced by gtkdoc-mkdb | |
133 | """ | |
134 | ||
135 | -# FIXME: right now it uses pygst and scans on its own; | |
136 | -# we really should use inspect/*.xml instead since the result of | |
137 | -# gst-xmlinspect.py is committed by the docs maintainer, who can be | |
138 | -# expected to have pygst, but this step should be done for every docs build, | |
139 | -# so no pygst allowed | |
140 | - | |
141 | -# read in inspect/*.xml | |
142 | -# for every tmpl/element-(name).xml: mangle with details from element | |
143 | - | |
144 | import glob | |
145 | -import re | |
146 | import sys | |
147 | import os | |
148 | ||
e1ac5551 | 149 | @@ -26,37 +17,12 @@ class Tmpl: |
e9716b6c JB |
150 | self._sectionids = [] |
151 | self._sections = {} | |
152 | ||
153 | - def read(self): | |
154 | - """ | |
155 | - Read and parse the sections from the given file. | |
156 | - """ | |
157 | - lines = open(self.filename).readlines() | |
158 | - matcher = re.compile("<!-- ##### SECTION (\S+) ##### -->\n") | |
159 | - id = None | |
160 | - | |
161 | - for line in lines: | |
162 | - match = matcher.search(line) | |
163 | - if match: | |
164 | - id = match.expand("\\1") | |
165 | - self._sectionids.append(id) | |
166 | - self._sections[id] = [] | |
167 | - else: | |
168 | - if not id: | |
169 | - sys.stderr.write( | |
170 | - "WARNING: line before a SECTION header: %s" % line) | |
171 | - else: | |
172 | - self._sections[id].append(line) | |
173 | - | |
174 | - def get_section(self, id): | |
175 | - """ | |
176 | - Get the content from the given section. | |
177 | - """ | |
178 | - return self._sections[id] | |
179 | - | |
180 | def set_section(self, id, content): | |
181 | """ | |
182 | Replace the given section id with the given content. | |
183 | """ | |
184 | + if not id in self._sectionids: | |
185 | + self._sectionids.append(id) | |
186 | self._sections[id] = content | |
187 | ||
188 | def output(self): | |
e1ac5551 | 189 | @@ -71,14 +37,10 @@ class Tmpl: |
e9716b6c JB |
190 | |
191 | return "".join(lines) | |
192 | ||
193 | - def write(self, backup=False): | |
194 | + def write(self): | |
195 | """ | |
196 | Write out the template file again, backing up the previous one. | |
197 | """ | |
198 | - if backup: | |
199 | - target = self.filename + ".mangle.bak" | |
200 | - os.rename(self.filename, target) | |
201 | - | |
202 | handle = open(self.filename, "w") | |
203 | handle.write(self.output()) | |
204 | handle.close() | |
e1ac5551 | 205 | @@ -134,30 +96,28 @@ def main(): |
e9716b6c JB |
206 | inspectdir = sys.argv[1] |
207 | tmpldir = sys.argv[2] | |
208 | ||
209 | + if not os.path.exists (tmpldir): | |
210 | + os.mkdir(tmpldir) | |
211 | + | |
212 | # parse all .xml files; build map of element name -> short desc | |
213 | #for file in glob.glob("inspect/plugin-*.xml"): | |
214 | elements = {} | |
215 | for file in glob.glob("%s/plugin-*.xml" % inspectdir): | |
216 | elements.update(get_elements(file)) | |
217 | ||
218 | - for file in glob.glob("%s/element-*.sgml" % tmpldir): | |
219 | - base = os.path.basename(file) | |
220 | - element = base[len("element-"):-len(".sgml")] | |
221 | + for element in elements.keys(): | |
222 | + file = "%s/element-%s.sgml" % (tmpldir, element) | |
223 | tmpl = Tmpl(file) | |
224 | - tmpl.read() | |
225 | - if element in elements.keys(): | |
226 | - description = elements[element]['description'] | |
227 | - tmpl.set_section("Short_Description", "%s\n\n" % description) | |
228 | ||
229 | - # put in an include if not yet there | |
230 | + description = elements[element]['description'] | |
231 | + tmpl.set_section("Short_Description", "%s\n" % description) | |
232 | + | |
233 | + # add include for details | |
234 | line = '<include xmlns="http://www.w3.org/2003/XInclude" href="' + \ | |
235 | 'element-' + element + '-details.xml">' + \ | |
236 | '<fallback xmlns="http://www.w3.org/2003/XInclude" />' + \ | |
237 | '</include>\n' | |
238 | - section = tmpl.get_section("Long_Description") | |
239 | - if not section[0] == line: | |
240 | - section.insert(0, line) | |
241 | - tmpl.set_section("Long_Description", section) | |
242 | + tmpl.set_section("Long_Description", line) | |
243 | tmpl.write() | |
244 | ||
245 | main() |