commit
849786da14
13 changed files with 221 additions and 24 deletions
@ -0,0 +1,80 @@ |
||||
#!/usr/bin/env python3 |
||||
# Copyright 2015 The Meson development team |
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
import sys, os |
||||
import subprocess |
||||
import shutil |
||||
|
||||
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') |
||||
subprocess.check_call(['gtkdoc-scan', |
||||
'--module=' + module, |
||||
'--source-dir=' + abs_src, |
||||
'--output-dir=.'], cwd=abs_out) |
||||
mkdb_cmd = ['gtkdoc-mkdb', |
||||
'--module=' + module, |
||||
'--output-format=xml', |
||||
'--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 |
||||
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) |
||||
|
||||
def install_gtkdoc(build_root, doc_subdir, install_prefix, datadir, module): |
||||
source = os.path.join(build_root, doc_subdir, 'html') |
||||
final_destination = os.path.join(install_prefix, datadir, module) |
||||
shutil.rmtree(final_destination, ignore_errors=True) |
||||
shutil.copytree(source, final_destination) |
||||
|
||||
if __name__ == '__main__': |
||||
# source_root = '/home/jpakkane/workspace/meson/test cases/frameworks/10 gtk-doc' |
||||
# build_root = '/home/jpakkane/workspace/meson/work area' |
||||
# doc_subdir = 'doc' |
||||
# src_subdir = 'include' |
||||
# module = 'foobar' |
||||
if len(sys.argv) != 7: |
||||
print(sys.argv) |
||||
print("Bad arguments.") |
||||
sys.exit(1) |
||||
(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: |
||||
installdir = os.environ['DESTDIR'] + os.environ['MESON_INSTALL_PREFIX'] |
||||
else: |
||||
installdir = os.environ['MESON_INSTALL_PREFIX'] |
||||
install_gtkdoc(build_root, doc_subdir, installdir, 'share/gtk-doc/html', module) |
@ -1,8 +1,8 @@ |
||||
project('custom install script', 'c') |
||||
|
||||
if meson.get_compiler('c').get_id() == 'msvc' |
||||
meson.set_install_script('myinstall.bat') |
||||
meson.add_install_script('myinstall.bat') |
||||
else |
||||
meson.set_install_script('myinstall.sh') |
||||
meson.add_install_script('myinstall.sh') |
||||
endif |
||||
executable('prog', 'prog.c', 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> |
@ -0,0 +1,9 @@ |
||||
gnome = import('gnome') |
||||
|
||||
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) |
@ -0,0 +1 @@ |
||||
@VERSION@ |
@ -0,0 +1,15 @@ |
||||
#pragma once |
||||
|
||||
/**
|
||||
* FooIndecision: |
||||
* @FOO_MAYBE: Something maybe |
||||
* @FOO_POSSIBLY: Something possible |
||||
* |
||||
* The indecision type. |
||||
**/ |
||||
|
||||
typedef enum { |
||||
FOO_MAYBE, |
||||
FOO_POSSIBLY, |
||||
} FooIndecision; |
||||
|
@ -0,0 +1,13 @@ |
||||
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 |
||||
usr/share/gtk-doc/html/foobar/left-insensitive.png |
||||
usr/share/gtk-doc/html/foobar/left.png |
||||
usr/share/gtk-doc/html/foobar/right-insensitive.png |
||||
usr/share/gtk-doc/html/foobar/right.png |
||||
usr/share/gtk-doc/html/foobar/style.css |
||||
usr/share/gtk-doc/html/foobar/up-insensitive.png |
||||
usr/share/gtk-doc/html/foobar/up.png |
@ -0,0 +1,3 @@ |
||||
project('gtkdoctest', 'c') |
||||
|
||||
subdir('doc') |
Loading…
Reference in new issue