-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path3137-Include-cspec-docs-in-build.patch
371 lines (315 loc) · 15.6 KB
/
3137-Include-cspec-docs-in-build.patch
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Bronson <[email protected]>
Date: Wed, 26 May 2021 17:16:37 -0400
Subject: [PATCH] 3137: Include cspec docs in build
Use canonical URL for docbook stylesheets.
Thanks to the magic of XML catalogs, this should not involve
actual network access when the stylesheets are properly
installed.
Squashed:
Ensure that xsltproc doesn't hit the net
The --nonet flag works nicely for this.
Include cspec docs in build
This is a rework of https://github.com/NationalSecurityAgency/ghidra/pull/2108 that does less.
* Mostly copying the layout of the sleigh docs
* We already adjusted the references to the docbook-xsl stylesheets to use the canonical URL,
so it already works fine with Debian's docbook-xsl package
I didn't commit the generated html into GhidraDocs/ directory, as my docbook-xsl is a slightly
different version that generates slightly different output.
Co-Authored-By: R. Elliott Childre <[email protected]>
Signed-off-by: Samuel Bronson <[email protected]>
Tell gradle that help/docs depend on their sources.
Rather than listing the exact sources needed for each one,
which would be laborious and error prone, just mark all of these
as depending on the whole src/main/doc directory.
Signed-off-by: Samuel Bronson <[email protected]>
Add missing '/' to path prefix in decompileplugin_pdf.xsl
Apparently this value just gets prepended as-is,
so a trailing slash is kind of important here.
Signed-off-by: Samuel Bronson <[email protected]>
---
Ghidra/Features/Decompiler/build.gradle | 48 ++++++++++++++-----
.../Decompiler/certification.manifest | 2 +
.../Decompiler/src/main/doc/cspec_common.xsl | 36 ++++++++++++++
.../Decompiler/src/main/doc/cspec_html.xsl | 22 +--------
.../Decompiler/src/main/doc/cspec_pdf.xsl | 14 ++++++
Ghidra/Features/FunctionID/build.gradle | 9 ++--
GhidraDocs/certification.manifest | 6 +++
7 files changed, 102 insertions(+), 35 deletions(-)
create mode 100644 Ghidra/Features/Decompiler/src/main/doc/cspec_common.xsl
create mode 100644 Ghidra/Features/Decompiler/src/main/doc/cspec_pdf.xsl
diff --git a/Ghidra/Features/Decompiler/build.gradle b/Ghidra/Features/Decompiler/build.gradle
index 9c5671fa5b..163125c5a7 100644
--- a/Ghidra/Features/Decompiler/build.gradle
+++ b/Ghidra/Features/Decompiler/build.gradle
@@ -26,6 +26,8 @@ apply plugin: 'eclipse'
eclipse.project.name = 'Features Decompiler'
+ext.xsltproc = "xsltproc --nonet"
+
dependencies {
api project(':Base')
api project(':SoftwareModeling')
@@ -114,6 +116,9 @@ task buildDecompilerHelpHtml(type: Exec) {
workingDir 'src/main/doc'
+ // Rebuild when anything in this directory changes. Crude, but effective.
+ inputs.dir(workingDir)
+
// 'which' returns the number of failed arguments
// Using the 'which' command first will allow the task to fail if the required
// executables are not installed.
@@ -131,8 +136,8 @@ task buildDecompilerHelpHtml(type: Exec) {
rm -f $installHelpPoint/topics/DecompilePlugin/*.html
echo '** Building html files **'
- xsltproc --output $buildDir/decomp_noscaling.xml --stringparam profile.condition "noscaling" commonprofile.xsl decompileplugin.xml 2>&1
- xsltproc --stringparam base.dir ${installHelpPoint}/topics/DecompilePlugin/ --stringparam root.filename Decompiler decompileplugin_html.xsl $buildDir/decomp_noscaling.xml 2>&1
+ $xsltproc --output $buildDir/decomp_noscaling.xml --stringparam profile.condition "noscaling" commonprofile.xsl decompileplugin.xml 2>&1
+ $xsltproc --stringparam base.dir ${installHelpPoint}/topics/DecompilePlugin/ --stringparam root.filename Decompiler decompileplugin_html.xsl $buildDir/decomp_noscaling.xml 2>&1
rm ${installHelpPoint}/topics/DecompilePlugin/Decompiler.html
sed -i -e '/DefaultStyle.css/ { p; sQhref=".*"Qhref="../../shared/languages.css"Q; }' ${installHelpPoint}/topics/DecompilePlugin/*.html 2>&1
@@ -177,6 +182,9 @@ task buildDecompilerHelpPdf(type: Exec) {
outputs.dir "$workingDir/$buildDir/pdf"
outputs.file "$workingDir/$buildDir/pdf/decompileplugin.pdf"
+ // Rebuild when anything in this directory changes. Crude, but effective.
+ inputs.dir(workingDir)
+
// 'which' returns the number of failed arguments
// Using 'which' first will allow the entire command to fail if the required
// executables are not installed.
@@ -203,8 +211,8 @@ task buildDecompilerHelpPdf(type: Exec) {
cp ../../../../../Framework/Project/src/main/resources/images/page_edit.png $buildDir/pdf/images 2>&1
echo '** Building decompileplugin.fo **'
- xsltproc --output $buildDir/pdf/decompileplugin_withscaling.xml --stringparam profile.condition "withscaling" commonprofile.xsl decompileplugin.xml 2>&1
- xsltproc --output $buildDir/pdf/decompileplugin.fo decompileplugin_pdf.xsl $buildDir/pdf/decompileplugin_withscaling.xml 2>&1
+ $xsltproc --output $buildDir/pdf/decompileplugin_withscaling.xml --stringparam profile.condition "withscaling" commonprofile.xsl decompileplugin.xml 2>&1
+ $xsltproc --output $buildDir/pdf/decompileplugin.fo decompileplugin_pdf.xsl $buildDir/pdf/decompileplugin_withscaling.xml 2>&1
echo '** Building decompileplugin.pdf **'
fop $buildDir/pdf/decompileplugin.fo $buildDir/pdf/decompileplugin.pdf 2>&1
@@ -245,10 +253,15 @@ task buildDecompilerDocumentationPdfs(type: Exec) {
workingDir 'src/main/doc'
+ // Rebuild when anything in this directory changes. Crude, but effective.
+ inputs.dir(workingDir)
+
// Gradle will provide a cleanBuildDecompilerDocumentationPdfs task that will remove these
// declared outputs.
outputs.file "$workingDir/$buildDir/pcoderef.fo"
outputs.file "$workingDir/$buildDir/pcoderef.pdf"
+ outputs.file "$workingDir/$buildDir/cspec.fo"
+ outputs.file "$workingDir/$buildDir/cspec.pdf"
outputs.file "$workingDir/$buildDir/sleigh.fo"
outputs.file "$workingDir/$buildDir/sleigh.pdf"
@@ -268,17 +281,23 @@ task buildDecompilerDocumentationPdfs(type: Exec) {
cp $installPoint/Diagram*.png $buildDir 2>&1
echo '** Building sleigh.fo **'
- xsltproc --output $buildDir/sleigh.fo sleigh_pdf.xsl sleigh.xml 2>&1
+ $xsltproc --output $buildDir/sleigh.fo sleigh_pdf.xsl sleigh.xml 2>&1
echo '** Building sleigh.pdf **'
fop $buildDir/sleigh.fo $buildDir/sleigh.pdf 2>&1
echo '** Building pcoderef.fo **'
- xsltproc --output $buildDir/pcoderef.fo pcoderef_pdf.xsl pcoderef.xml 2>&1
+ $xsltproc --output $buildDir/pcoderef.fo pcoderef_pdf.xsl pcoderef.xml 2>&1
echo '** Building pcoderef.pdf **'
fop $buildDir/pcoderef.fo $buildDir/pcoderef.pdf 2>&1
+ echo '** Building cspec.fo **'
+ $xsltproc --output $buildDir/cspec.fo cspec_pdf.xsl cspec.xml 2>&1
+
+ echo '** Building cspec.pdf **'
+ fop $buildDir/cspec.fo $buildDir/cspec.pdf 2>&1
+
echo '** Done. **'
"""
@@ -311,6 +330,9 @@ task buildDecompilerDocumentationHtml(type: Exec) {
workingDir 'src/main/doc'
+ // Rebuild when anything in this directory changes. Crude, but effective.
+ inputs.dir(workingDir)
+
// Gradle will provide a cleanBuildDecompilerDocumentationHtml task that will remove these
// declared outputs.
outputs.file "$workingDir/$buildDir/index.html"
@@ -331,11 +353,11 @@ task buildDecompilerDocumentationHtml(type: Exec) {
which xsltproc 2>&1
echo -e '** Building index.html **'
- xsltproc --output $buildDir/index.html main_html.xsl main.xml 2>&1
+ $xsltproc --output $buildDir/index.html main_html.xsl main.xml 2>&1
sed -i -e '/DefaultStyle.css/ { p; sQhref=".*"Qhref="../../shared/languages.css"Q; }' $buildDir/index.html
echo '** Building html/sleigh.html **'
- xsltproc --stringparam base.dir $buildDir/html/ --stringparam root.filename sleigh sleigh_html.xsl sleigh.xml 2>&1
+ $xsltproc --stringparam base.dir $buildDir/html/ --stringparam root.filename sleigh sleigh_html.xsl sleigh.xml 2>&1
cp $defaultStylePoint $buildDir/html 2>&1
cp $installPoint/languages.css $buildDir/html
cp $installPoint/Diagram1.png $buildDir/html
@@ -343,12 +365,16 @@ task buildDecompilerDocumentationHtml(type: Exec) {
cp $installPoint/Diagram3.png $buildDir/html
echo '** Building html/pcoderef.html **'
- xsltproc --stringparam base.dir $buildDir/html/ --stringparam root.filename pcoderef pcoderef_html.xsl pcoderef.xml 2>&1
+ $xsltproc --stringparam base.dir $buildDir/html/ --stringparam root.filename pcoderef pcoderef_html.xsl pcoderef.xml 2>&1
sed -i -e '/DefaultStyle.css/ { p; sQhref=".*"Qhref="languages.css"Q; }' $buildDir/html/*.html
cp $defaultStylePoint $buildDir/html
cp $installPoint/languages.css $buildDir/html
+ echo '** Building html/cspec.html **'
+ $xsltproc --stringparam base.dir $buildDir/html/ --stringparam root.filename cspec cspec_html.xsl cspec.xml 2>&1
+ sed -i -e '/Frontpage.css/ { p; s/Frontpage.css/languages.css/; }' $buildDir/html/cspec*.html
+
echo '** Installing html documentation. **'
cp $buildDir/index.html $installPoint/index.html
rm $installPoint/*.html $installPoint/*.png
@@ -465,8 +491,8 @@ Task createLexTask(String filename, String binaryName) {
rootProject.createInstallationZip {
dependsOn buildDecompilerDocumentationPdfs
-
-
+
+
def decompilerPdfZipPath = rootProject.ext.ZIP_DIR_PREFIX + "/docs/languages/"
// Add decompiler pdf files to zip. If the pdf files do not exist during execution time
diff --git a/Ghidra/Features/Decompiler/certification.manifest b/Ghidra/Features/Decompiler/certification.manifest
index db9ba7f246..2ef96c6e74 100644
--- a/Ghidra/Features/Decompiler/certification.manifest
+++ b/Ghidra/Features/Decompiler/certification.manifest
@@ -97,7 +97,9 @@ src/decompile/datatests/wayoffarray.xml||GHIDRA||||END|
src/decompile/zlib/README.txt||GHIDRA||||END|
src/main/doc/commonprofile.xsl||GHIDRA||||END|
src/main/doc/cspec.xml||GHIDRA||||END|
+src/main/doc/cspec_common.xsl||GHIDRA||||END|
src/main/doc/cspec_html.xsl||GHIDRA||||END|
+src/main/doc/cspec_pdf.xsl||GHIDRA||||END|
src/main/doc/decompileplugin.xml||GHIDRA||||END|
src/main/doc/decompileplugin_common.xsl||GHIDRA||||END|
src/main/doc/decompileplugin_html.xsl||GHIDRA||||END|
diff --git a/Ghidra/Features/Decompiler/src/main/doc/cspec_common.xsl b/Ghidra/Features/Decompiler/src/main/doc/cspec_common.xsl
new file mode 100644
index 0000000000..550f5b5018
--- /dev/null
+++ b/Ghidra/Features/Decompiler/src/main/doc/cspec_common.xsl
@@ -0,0 +1,36 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:param name="generate.toc">
+ article/appendix nop
+ article title,toc
+ book toc,title,figure,table,example,equation
+ chapter nop
+ part toc,title
+ preface toc,title
+ qandadiv toc
+ qandaset toc
+ reference toc,title
+ sect1 nop
+ sect2 nop
+ sect3 nop
+ sect4 nop
+ sect5 nop
+ section nop
+ set toc,title
+</xsl:param>
+
+<!-- Where does the title go, relative to the object -->
+<xsl:param name="formal.title.placement">
+ figure after
+ example before
+ equation before
+ table before
+ procedure before
+ task before
+</xsl:param>
+
+<!-- Automatically number sections -->
+<xsl:param name="section.autolabel" select="1"/>
+
+</xsl:stylesheet>
diff --git a/Ghidra/Features/Decompiler/src/main/doc/cspec_html.xsl b/Ghidra/Features/Decompiler/src/main/doc/cspec_html.xsl
index 99f301135b..6e623e3aa1 100644
--- a/Ghidra/Features/Decompiler/src/main/doc/cspec_html.xsl
+++ b/Ghidra/Features/Decompiler/src/main/doc/cspec_html.xsl
@@ -1,27 +1,9 @@
<?xml version='1.0'?>
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
-<xsl:param name="generate.toc">
- article/appendix nop
- article toc,title
- book toc,title,figure,table,example,equation
- chapter nop
- part toc,title
- preface toc,title
- qandadiv toc
- qandaset toc
- reference toc,title
- sect1 nop
- sect2 nop
- sect3 nop
- sect4 nop
- sect5 nop
- section nop
- set toc,title
-</xsl:param>
+<xsl:include href="cspec_common.xsl" />
<xsl:param name="use.id.as.filename" select="1"/> <!-- Split up into files based on id attribute -->
diff --git a/Ghidra/Features/Decompiler/src/main/doc/cspec_pdf.xsl b/Ghidra/Features/Decompiler/src/main/doc/cspec_pdf.xsl
new file mode 100644
index 0000000000..40d5541c23
--- /dev/null
+++ b/Ghidra/Features/Decompiler/src/main/doc/cspec_pdf.xsl
@@ -0,0 +1,14 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+
+<xsl:include href="cspec_common.xsl" />
+
+<xsl:param name="fop1.extensions" select="1"/> <!-- Use fop extensions when converting to pdf -->
+
+<xsl:param name="alignment" select="'left'"/> <!-- Justify normal text (only) on the left -->
+
+<xsl:param name="draft.mode" select="'no'"/> <!-- Turn off the draft background watermark -->
+
+</xsl:stylesheet>
diff --git a/Ghidra/Features/FunctionID/build.gradle b/Ghidra/Features/FunctionID/build.gradle
index 51c575ded4..cf40dd0947 100644
--- a/Ghidra/Features/FunctionID/build.gradle
+++ b/Ghidra/Features/FunctionID/build.gradle
@@ -22,6 +22,7 @@ apply plugin: 'eclipse'
eclipse.project.name = 'Features FunctionID'
+ext.xsltproc = "xsltproc --nonet"
dependencies {
api project(":Base")
@@ -90,8 +91,8 @@ task buildFidHelpPdf(type: Exec) {
cp $installPoint/topics/FunctionID/images/*.png $buildDir/images
echo '** Building FunctionID.fo **'
- xsltproc --output $buildDir/fid_withscaling.xml --stringparam profile.condition "withscaling" commonprofile.xsl fid.xml 2>&1
- xsltproc --output $buildDir/FunctionID.fo fid_pdf.xsl $buildDir/fid_withscaling.xml 2>&1
+ $xsltproc --output $buildDir/fid_withscaling.xml --stringparam profile.condition "withscaling" commonprofile.xsl fid.xml 2>&1
+ $xsltproc --output $buildDir/FunctionID.fo fid_pdf.xsl $buildDir/fid_withscaling.xml 2>&1
echo '** Building FunctionID.pdf **'
fop $buildDir/FunctionID.fo $buildDir/FunctionID.pdf 2>&1
@@ -159,8 +160,8 @@ task buildFidHelpHtml(type: Exec) {
rm -f $installPoint/topics/FunctionID/*.html
echo '** Building html files **'
- xsltproc --output $buildDir/fid_noscaling.xml --stringparam profile.condition "noscaling" commonprofile.xsl fid.xml 2>&1
- xsltproc --stringparam base.dir ${installPoint}/topics/FunctionID/ fid_html.xsl $buildDir/fid_noscaling.xml 2>&1
+ $xsltproc --output $buildDir/fid_noscaling.xml --stringparam profile.condition "noscaling" commonprofile.xsl fid.xml 2>&1
+ $xsltproc --stringparam base.dir ${installPoint}/topics/FunctionID/ fid_html.xsl $buildDir/fid_noscaling.xml 2>&1
rm ${installPoint}/topics/FunctionID/index.html
sed -i -e '/DefaultStyle.css/ { p; sQhref=".*"Qhref="../../shared/languages.css"Q; }' ${installPoint}/topics/FunctionID/*.html
diff --git a/GhidraDocs/certification.manifest b/GhidraDocs/certification.manifest
index 12ea58c526..6b176b598f 100644
--- a/GhidraDocs/certification.manifest
+++ b/GhidraDocs/certification.manifest
@@ -227,6 +227,12 @@ languages/html/Diagram1.png||GHIDRA||||END|
languages/html/Diagram2.png||GHIDRA||||END|
languages/html/Diagram3.png||GHIDRA||||END|
languages/html/additionalpcode.html||GHIDRA||||END|
+languages/html/cspec_dataorg.html||GHIDRA||||END|
+languages/html/cspec.html||GHIDRA||||END|
+languages/html/cspec_parampass.html||GHIDRA||||END|
+languages/html/cspec_pcodeinterp.html||GHIDRA||||END|
+languages/html/cspec_scopememory.html||GHIDRA||||END|
+languages/html/cspec_specialreg.html||GHIDRA||||END|
languages/html/pcodedescription.html||GHIDRA||||END|
languages/html/pcoderef.html||GHIDRA||||END|
languages/html/pseudo-ops.html||GHIDRA||||END|
--
2.45.1