Add sgml main to gtk-doc.

pull/218/head
Jussi Pakkanen 9 years ago
parent 83cc5ce4c5
commit cbc329fc32
  1. 30
      gtkdochelper.py
  2. 4
      modules/gnome.py
  3. 39
      test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml
  4. 8
      test cases/frameworks/10 gtk-doc/doc/meson.build
  5. 1
      test cases/frameworks/10 gtk-doc/doc/version.xml.in
  6. 4
      test cases/frameworks/10 gtk-doc/installed_files.txt

@ -17,7 +17,7 @@ import sys, os
import subprocess
import shutil
def build_gtkdoc(source_root, build_root, doc_subdir, src_subdir, module):
def build_gtkdoc(source_root, build_root, doc_subdir, src_subdir, main_sgml, module):
abs_src = os.path.join(source_root, src_subdir)
abs_out = os.path.join(build_root, doc_subdir)
htmldir = os.path.join(abs_out, 'html')
@ -25,18 +25,30 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdir, module):
'--module=' + module,
'--source-dir=' + abs_src,
'--output-dir=.'], cwd=abs_out)
subprocess.check_call(['gtkdoc-mkdb',
mkdb_cmd = ['gtkdoc-mkdb',
'--module=' + module,
'--output-format=xml',
'--source-dir=' + abs_src], cwd=abs_out)
'--sgml-mode',
'--source-dir=' + abs_src]
sgml_abs = os.path.join(source_root, doc_subdir, main_sgml)
if len(main_sgml) > 0:
mkdb_cmd.append('--main-sgml-file=' + sgml_abs)
subprocess.check_call(mkdb_cmd, cwd=abs_out)
shutil.rmtree(htmldir, ignore_errors=True)
try:
os.mkdir(htmldir)
except Exception:
pass
subprocess.check_call(['gtkdoc-mkhtml',
module,
'../%s-docs.xml' % module], cwd=htmldir)
mkhtml_cmd = ['gtkdoc-mkhtml', module]
if len(main_sgml) > 0:
# Workaround for
# https://bugzilla.gnome.org/show_bug.cgi?id=753145
plainfile = os.path.split(sgml_abs)[1]
shutil.copy(sgml_abs, os.path.join(abs_out, plainfile))
mkhtml_cmd.append('../' + plainfile)
else:
mkhtml_cmd.append('../%s-docs.xml' % module)
subprocess.check_call(mkhtml_cmd, cwd=htmldir, shell=False)
subprocess.check_call(['gtkdoc-fixxref',
'--module=' + module,
'--module-dir=html'], cwd=abs_out)
@ -53,12 +65,12 @@ if __name__ == '__main__':
# doc_subdir = 'doc'
# src_subdir = 'include'
# module = 'foobar'
if len(sys.argv) != 6:
if len(sys.argv) != 7:
print(sys.argv)
print("Bad arguments.")
sys.exit(1)
(source_root, build_root, doc_subdir, src_subdir, module) = sys.argv[1:]
build_gtkdoc(source_root, build_root, doc_subdir, src_subdir, module)
(source_root, build_root, doc_subdir, src_subdir, main_sgml, module) = sys.argv[1:]
build_gtkdoc(source_root, build_root, doc_subdir, src_subdir, main_sgml, module)
if 'MESON_INSTALL_PREFIX' in os.environ:
if 'DESTDIR' in os.environ:

@ -184,6 +184,9 @@ class GnomeModule:
raise MesonException('Gtkdoc arg must be string.')
if not 'src_dir' in kwargs:
raise MesonException('Keyword argument src_dir missing.')
main_sgml = kwargs.get('main_sgml', '')
if not isinstance(main_sgml, str):
raise MesonException('Main sgml keyword argument must be a string.')
src_dir = kwargs['src_dir']
targetname = modulename + '-doc'
command = os.path.normpath(os.path.join(os.path.split(__file__)[0], "../gtkdochelper.py"))
@ -191,6 +194,7 @@ class GnomeModule:
state.environment.get_build_dir(),
state.subdir,
os.path.normpath(os.path.join(state.subdir, src_dir)),
main_sgml,
modulename]
res = [build.RunTarget(targetname, command, args, state.subdir)]
if kwargs.get('install', True):

@ -0,0 +1,39 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>Foolib Reference Manual</title>
<releaseinfo>
for Foobar &version;
</releaseinfo>
<authorgroup>
<author>
<firstname>Jonny</firstname>
<surname>Example</surname>
<affiliation>
<address>
<email>unknown@example.com</email>
</address>
</affiliation>
</author>
</authorgroup>
<copyright>
<year>2015</year>
<holder>Foobar corporation holdings ltd</holder>
</copyright>
</bookinfo>
<reference id="foobar">
<title>Foobar library</title>
<partintro>
<para>
This part documents Foobar libs.
</para>
</partintro>
<xi:include href="xml/foo.xml"/>
</reference>
</book>

@ -1,3 +1,9 @@
gnome = import('gnome')
gnome.gtkdoc('foobar', src_dir : '../include', install : true)
cdata = configuration_data()
cdata.set('VERSION', '1.0')
configure_file(input : 'version.xml.in',
output : 'version.xml',
configuration : cdata)
gnome.gtkdoc('foobar', src_dir : '../include', main_sgml : 'foobar-docs.sgml', install : true)

@ -1,8 +1,6 @@
usr/share/gtk-doc/html/foobar/api-index-full.html
usr/share/gtk-doc/html/foobar/ch01.html
usr/share/gtk-doc/html/foobar/deprecated-api-index.html
usr/share/gtk-doc/html/foobar/foobar.devhelp2
usr/share/gtk-doc/html/foobar/foobar-foo.html
usr/share/gtk-doc/html/foobar/foobar.html
usr/share/gtk-doc/html/foobar/home.png
usr/share/gtk-doc/html/foobar/index.html
usr/share/gtk-doc/html/foobar/index.sgml

Loading…
Cancel
Save