aboutsummaryrefslogtreecommitdiffhomepage
path: root/DOCS/xml/configure
blob: e4c63d49349b50cab5fae5e6211e3372ae4da5fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/sh

# Script to check for catalogs, stylesheets, XSL processors and all
# the other stuff necessary to convert the XML documentation.

echo "Searching for XML catalogs..."
for try_catalog in \
  /etc/sgml/catalog \
  /usr/share/xml/docbook/*/catalog.xml \
  /opt/local/share/xml/docbook-xml/*/catalog.xml \
  /opt/local/share/xml/docbook/*/catalog.xml \
  /usr/share/sgml/docbook/*/*catalog \
  /usr/share/apps/ksgmltools2/customization/en/catalog \
  /usr/share/sgml/catalog \
  /usr/local/share/sgml/catalog \
  /usr/lib/sgml/catalog \
  /usr/local/lib/sgml/catalog \
  /usr/share/docbook-xml42/catalog.xml \
  /usr/share/sgml/docbook/xmlcatalog
do
  if test -f "$try_catalog"; then
    catalog=$try_catalog
    break
  fi
done

if test -n "$catalog"; then
  echo "Found SGML catalog at $catalog"
  catalog_opts=--catalogs
else
  echo "No SGML catalog found."
fi



echo "Searching for stylesheets..."
echo "Searching for html/chunk.xsl..."
for try_chunk_xsl in \
  /usr/share/xml/docbook/*/html/chunk.xsl \
  /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/chunk.xsl \
  /usr/share/sgml/docbook/yelp/docbook/html/chunk.xsl \
  /usr/local/share/sgml/docbook/stylesheet/xsl/nwalsh/html/chunk.xsl \
  /usr/local/share/sgml/docbook/yelp/docbook/html/chunk.xsl \
  /usr/share/docbook-xsl/html/chunk.xsl \
  /usr/share/sgml/docbook/xsl-stylesheets*/html/chunk.xsl \
  /usr/share/xml/docbook/stylesheet/nwalsh/current/html/chunk.xsl \
  /opt/local/share/xsl/docbook-xsl/html/chunk.xsl \

do
  if test -f "$try_chunk_xsl"; then
    chunk_xsl=$try_chunk_xsl
    break
  fi
done

if test -z "$chunk_xsl"; then
  chunk_xsl=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/chunk.xsl
  echo "Not found. Using default ($chunk_xsl)"
  fake_chunk_xsl=yes
else
  echo "Found chunk.xsl at $chunk_xsl"
fi

echo "Searching for html/docbook.xsl..."
for try_docbook_xsl in \
  /usr/share/xml/docbook/*/html/docbook.xsl \
  /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl \
  /usr/share/sgml/docbook/yelp/docbook/html/docbook.xsl \
  /usr/local/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl \
  /usr/local/share/sgml/docbook/yelp/docbook/html/docbook.xsl \
  /usr/share/docbook-xsl/html/docbook.xsl \
  /usr/share/sgml/docbook/xsl-stylesheets*/html/docbook.xsl \
  /usr/share/xml/docbook/stylesheet/nwalsh/current/html/docbook.xsl \
  /opt/local/share/xsl/docbook-xsl/html/docbook.xsl \

do
  if test -f "$try_docbook_xsl"; then
    docbook_xsl=$try_docbook_xsl
    break
  fi
done

if test -z "$docbook_xsl"; then
  docbook_xsl=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl
  echo "Not found. Using default ($docbook_xsl)"
else
  echo "Found docbook.xsl at $docbook_xsl"
fi

cat > html-chunk.xsl << EOF
<?xml version="1.0" encoding="utf-8"?>
<!-- **************************************************
     This file is generated automatically. DO NOT EDIT.
     ************************************************** -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:import href="$chunk_xsl"/>
  <xsl:include href="html-common.xsl"/>

</xsl:stylesheet>
EOF


cat > html-single.xsl << EOF
<?xml version="1.0" encoding="utf-8"?>
<!-- **************************************************
     This file is generated automatically. DO NOT EDIT.
     ************************************************** -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:import href="$docbook_xsl"/>
  <xsl:include href="html-common.xsl"/>

</xsl:stylesheet>
EOF

echo "Searching for DTD..."
#FIXME: This should prefer higher version numbers, not the other way around ..
for try_dtd in \
  /usr/share/xml/docbook/*/dtd/4*/docbookx.dtd \
  /usr/share/xml/docbook/*/docbookx.dtd \
  /usr/share/sgml/docbook/*/docbookx.dtd \
  /usr/share/sgml/docbook/dtd/*/docbookx.dtd \
  /usr/share/sgml/docbook/dtd/xml/*/docbookx.dtd \
  /usr/share/docbook-xml*/docbookx.dtd \
  /opt/local/share/xml/docbook*/*/docbookx.dtd \
  /usr/share/apps/ksgmltools2/docbook/*/docbookx.dtd
do
  if test -f "$try_dtd"; then
    dtd=$try_dtd
    break
  fi
done

if test -z "$dtd"; then
  dtd=/usr/share/sgml/docbook/dtd/xml/4.1.2/docbookx.dtd
  echo "Not found. Using default ($dtd)."
else
  echo "Found docbookx.dtd at $dtd"
fi

for lang in `grep 'DOC_LANGS =' ../../config.mak|cut -d= -f2`; do
  cat > $lang/main.xml << EOF
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!-- **************************************************
     This file is generated automatically. DO NOT EDIT.
     ************************************************** -->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "$dtd"
[
EOF

  for file in $(find en -name \*.xml -exec basename \{\} \;); do
    echo '<!ENTITY '$file' SYSTEM "'$file'">' >> $lang/main.xml
  done

  cat >> $lang/main.xml << EOF
]>
<book id="index" lang="$lang">
&documentation.xml;
</book>
EOF

done

echo "Looking for a valid XSLT processor..."
if xsltproc --version > /dev/null 2>&1; then
  if test -z "$fake_chunk_xsl"; then
    echo "Found xsltproc. If it works, it's probably the best choice."
    xsltcommand="xsltproc $catalog_opts -o \$\$1 \$\$2 \$\$3"
  else
    echo "Found xsltproc but no stylesheets on your system."
    echo "xsltproc is unusable without stylesheets."
  fi
fi


cat > xml.mak << EOF
CATALOG = $catalog
XMLLINT_COMMAND = xmllint --noout --noent --postvalid $catalog_opts \$*
XSLT_COMMAND = $xsltcommand
EOF