xref: /petsc/systems/Apple/OSX/bin/makedocs (revision bacb95329690568aff0b1ce581edcd45f38ae3de)
1#!/bin/sh
2#
3# This script adds documentation to the Apple Mac OS X framework for PETSc created with makeframework
4#
5#After running makeframework and generating the PETSc documention then just run this script
6#    3) you can also use the framework inside Xcode by simply indicating the targets dependence on the PETSc framework
7#
8#
9cd ${PETSC_DIR}/${PETSC_ARCH}
10rm -rf PETSc.docset
11mkdir PETSc.docset
12mkdir PETSc.docset/Contents
13mkdir PETSc.docset/Contents/Resources
14mkdir PETSc.docset/Contents/Resources/Documents
15cat <<EOF > PETSc.docset/Contents/Info.plist
16<?xml version="1.0" encoding="UTF-8"?>
17<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
18<plist version="1.0">
19<dict>
20        <key>CFBundleName</key>
21        <string>PETSc Documentation</string>
22	<key>CFBundleIdentifier</key>
23	<string>gov.anl.mcs.PETSc.docset</string>
24        <key>DocSetPublisherIdentifier</key>
25        <string>gov.anl.mcs.PETSc.documentation</string>
26        <key>DocSetPublisherName</key>
27        <string>PETSc</string>
28</dict>
29</plist>
30EOF
31
32cat <<EOF > PETSc.docset/Contents/Resources/Nodes.xml
33<?xml version="1.0" encoding="UTF-8"?>
34<DocSetNodes version="1.0">
35    <TOC>
36        <Node type="file">
37            <Name>All PETSc manual pages</Name>
38            <Path>manualpages</Path>
39            <File>singleindex.html</File>
40            <Subnodes>
41                <Node  type="folder">
42                   <Name>ODE Integrators -- TS</Name>
43                   <Path>manualpages/TS</Path>
44                   <File>index.html</File>
45                </Node>
46                <Node  type="folder">
47                   <Name>Nonlinear solvers -- SNES</Name>
48                   <Path>manualpages/SNES</Path>
49                   <File>index.html</File>
50                </Node>
51                <Node  type="folder">
52                   <Name>Krylov solvers -- KSP</Name>
53                   <Path>manualpages/KSP</Path>
54                   <File>index.html</File>
55                </Node>
56                <Node  type="folder">
57                   <Name>Preconditioners -- PC</Name>
58                   <Path>manualpages/PC</Path>
59                   <File>index.html</File>
60                </Node>
61               <Node  type="folder">
62                   <Name>Semi-Lagrange solver</Name>
63                   <Path>manualpages/SemiLagrange</Path>
64                   <File>index.html</File>
65                </Node>
66               <Node  type="folder">
67                   <Name>Mesh management -- DM</Name>
68                   <Path>manualpages/DM</Path>
69                   <File>index.html</File>
70                </Node>
71                <Node  type="folder">
72                   <Name>Matrices -- Mat</Name>
73                   <Path>manualpages/Mat</Path>
74                   <File>index.html</File>
75                </Node>
76                <Node  type="folder">
77                   <Name>Matrix-free operators -- MatFD</Name>
78                   <Path>manualpages/MatFD</Path>
79                   <File>index.html</File>
80                </Node>
81                <Node  type="folder">
82                   <Name>Matrix orderings -- MatOrdering</Name>
83                   <Path>manualpages/MatOrderings</Path>
84                   <File>index.html</File>
85                </Node>
86                <Node  type="folder">
87                   <Name>Vectors -- Vec</Name>
88                   <Path>manualpages/Vec</Path>
89                   <File>index.html</File>
90                </Node>
91                <Node  type="folder">
92                   <Name>Indexing -- IS</Name>
93                   <Path>manualpages/IS</Path>
94                   <File>index.html</File>
95                </Node>
96               <Node  type="folder">
97                   <Name>Numbering/Reordering -- AO</Name>
98                   <Path>manualpages/AO</Path>
99                   <File>index.html</File>
100                </Node>
101                <Node  type="folder">
102                   <Name>Viewers -- PetscViewer</Name>
103                   <Path>manualpages/Viewer</Path>
104                   <File>index.html</File>
105                </Node>
106                <Node  type="folder">
107                   <Name>Profiling -- PetscLog</Name>
108                   <Path>manualpages/Profiling</Path>
109                   <File>index.html</File>
110                </Node>
111                <Node  type="folder">
112                   <Name>Utilities -- Sys</Name>
113                   <Path>manualpages/Sys</Path>
114                   <File>index.html</File>
115                </Node>
116                <Node  type="folder">
117                   <Name>Thread parallelism -- PetscThreadComm</Name>
118                   <Path>manualpages/PetscThreadComm</Path>
119                   <File>index.html</File>
120                </Node>
121                <Node  type="folder">
122                   <Name>Low-level communication -- PetscSF</Name>
123                   <Path>manualpages/PetscSF</Path>
124                   <File>index.html</File>
125                </Node>
126                <Node  type="folder">
127                   <Name>Graphics -- PetscDraw</Name>
128                   <Path>manualpages/Draw</Path>
129                   <File>index.html</File>
130                </Node>
131                <Node  type="folder">
132                   <Name>PF</Name>
133                   <Path>manualpages/PF</Path>
134                   <File>index.html</File>
135                </Node>
136            </Subnodes>
137        </Node>
138    </TOC>
139</DocSetNodes>
140EOF
141
142cat <<EOF > PETSc.docset/Contents/Resources/Tokens.xml
143<?xml version="1.0" encoding="UTF-8"?>
144<Tokens version="1.0">
145EOF
146
147cd ${LOC}/docs
148for i in manualpages/*/*.html; do
149  symbol=`echo $i | sed s?manualpages/[A-Za-z]*/??g | sed s?.html??g`
150  if [ ${symbol} != "index" ]; then
151    echo \<Token\> \<TokenIdentifier\>//apple_ref/c/func/${symbol}\</TokenIdentifier\>\<Path\>${i}\</Path\>\</Token\> >> ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset/Contents/Resources/Tokens.xml
152  fi;
153done
154
155cd ${PETSC_DIR}/${PETSC_ARCH}
156
157cat <<EOF >> PETSc.docset/Contents/Resources/Tokens.xml
158</Tokens>
159EOF
160
161cp -r ${LOC}/docs/manualpages PETSc.docset/Contents/Resources/Documents
162
163/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil index -debug -verbose   PETSc.docset
164
165
166