You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. <?xml version="1.0"?>
  2. <!-- ===========================================================================
  3. * ================= *
  4. | How to build Fop |
  5. * ================= *
  6. Adaption from the Cocoon build.xml written by Stefano Mazzocchi
  7. by Giacomo Pati with some addition by Fotis Jannidis
  8. Introduction
  9. ============
  10. FOP is the world's first print formatter driven by XSL formatting objects. It
  11. is a Java 1.2 application that reads a formatting object tree and then turns
  12. it into a PDF document. The formatting object tree, can be in the form of an
  13. XML document (output by an XSLT engine like Xalan) or can be passed in
  14. memory as a DOM Document or SAX events.
  15. FOP is part of Apache's XML project. The homepage of FOP is
  16. http:/xml.apache.org/fop
  17. HTML-Documentation can be found in the subdirectory ./docs.
  18. Installing the build tools
  19. ==========================
  20. The Fop build system is based on Jakarta Ant, which is a Java building tool
  21. originally developed for the Jakarta Tomcat project but now used in many other
  22. Apache projects and extended by many developers.
  23. Ant is a little but very handy tool that uses a build file written in XML
  24. (this file) as building instructions. For more information refer to
  25. "http://jakarta.apache.org/ant/".
  26. To make things easier for you, the Fop distribution contains a
  27. precompiled version of Ant and the build scripts take care of all the
  28. classpath issues except the following:
  29. You need to have xerces.jar and xalan.jar in your classpath. You can get
  30. those from http://xml.apache.org/xerces and http://xml.apache.org/xalan
  31. respectively.
  32. Additionaly you have to make sure, that the "JAVA_HOME" environment
  33. property should be set to match the JVM you want to use. That's it.
  34. Building instructions
  35. =====================
  36. First, make sure your current working directory is where this very file is
  37. located. Then type
  38. ./build.sh (unix)
  39. .\build.bat (win32)
  40. if everything is right and all the required packages are visible, this action
  41. will generate a file called "fop.jar" in the "./build" directory. Note, that
  42. if you do further development, compilation time is reduced since Ant is able
  43. to detect which files have changed an to recompile them at need.
  44. If something went wrong, go to the FAQ section below.
  45. Also, you'll note that reusing a single JVM instance for each task, increases
  46. tremendously the performance of the whole build system, compared to other
  47. tools (i.e. make or shell scripts) where a new JVM is started for each task.
  48. Build targets
  49. =============
  50. The build system is not only responsible of compiling Fop into a jar file,
  51. but is also responsible for creating the HTML documentation, javadocs,
  52. distributions and web site. In fact, the file you have here is _exactly_ what
  53. is used by fop maintainers to take care of everything in the Fop
  54. project, no less and no more. (only partially implemented)
  55. These are the meaningful targets for this build file:
  56. - package [default] -> creates ./build/fop.jar
  57. - usage -> shows a help screen
  58. - codegen -> generates needed java sources from xml resources
  59. - htmldoc -> generates the HTML documentation in ./build/docs/html-docs
  60. - javadocs -> generates the API documentation in ./build/javadocs
  61. - pdfdoc -> generates the PDF documentation in ./build/docs/xml-docs
  62. - dist -> generates the Fop distribution
  63. - clean -> restores the distribution to its original and clean state
  64. (excepting dist files)
  65. - distclean -> restores the distribution to its original and clean state
  66. - site -> generates the web site in ../xml-site/targets/fop (not yet impl.)
  67. ====================================== FAQ =====================================
  68. 1) Why some of the classes present in the original jar are not built anymore?
  69. The fop build system is very flexible: if a module requires a package that
  70. is not present in the classpath at build time, the module is skipped but
  71. the built process is not stopped.
  72. 2) I see a lot of warnings starting like this: "Warning: file modified in the future:"
  73. Sometimes ant gives out this warnings, but the build is finished without any problems
  74. ============================================================================ -->
  75. <project default="package" basedir=".">
  76. <fileset dir="${basedir}" id="dist.bin">
  77. <include name="conf/**"/>
  78. <include name="docs/**"/>
  79. <include name="hyph/**"/>
  80. <include name="CHANGES"/>
  81. <include name="LICENSE"/>
  82. <include name="README"/>
  83. <include name="STATUS"/>
  84. <include name="fop.bat"/>
  85. <include name="fop.sh"/>
  86. <exclude name="src/**"/>
  87. <exclude name="dist/**"/>
  88. <exclude name="build/**"/>
  89. <exclude name="lib/**"/>
  90. </fileset>
  91. <fileset dir="${basedir}" id="dist.bin.lib">
  92. <include name="lib/xercesImpl-2.0.1.jar"/>
  93. <include name="lib/xalan-2.3.1.jar"/>
  94. <include name="lib/xml-apis.jar"/>
  95. <include name="lib/batik.jar"/>
  96. <include name="lib/avalon-framework*.jar"/>
  97. <include name="lib/jimi*"/>
  98. </fileset>
  99. <fileset dir="${basedir}" id="dist.src">
  100. <exclude name="lib/classes/**"/>
  101. <exclude name="lib/org/**"/>
  102. <exclude name="lib/src/**"/>
  103. <exclude name="build/**"/>
  104. <include name="src/**"/>
  105. <include name="conf/**"/>
  106. <include name="docs/**"/>
  107. <include name="hyph/**"/>
  108. <include name="lib/**"/>
  109. <include name="CHANGES"/>
  110. <include name="LICENSE"/>
  111. <include name="README"/>
  112. <include name="STATUS"/>
  113. <include name="build*"/>
  114. <include name="fop.bat"/>
  115. <include name="fop.sh"/>
  116. </fileset>
  117. <path id="libs-build-classpath">
  118. <fileset dir="lib">
  119. <include name="*.jar"/>
  120. </fileset>
  121. </path>
  122. <path id="libs-run-classpath">
  123. <fileset dir="lib">
  124. <include name="*.jar"/>
  125. <exclude name="ant.jar"/>
  126. <exclude name="buildtools.jar"/>
  127. <exclude name="stylebook.jar"/>
  128. </fileset>
  129. <fileset dir="build">
  130. <include name="fop.jar"/>
  131. </fileset>
  132. </path>
  133. <!-- =================================================================== -->
  134. <!-- Initialization target -->
  135. <!-- =================================================================== -->
  136. <target name="init" depends="init-avail">
  137. <tstamp/>
  138. <property name="Name" value="Fop"/>
  139. <property name="name" value="fop"/>
  140. <property name="version" value="1.0dev"/>
  141. <filter token="version" value="${version}"/>
  142. <property name="year" value="1999-2002"/>
  143. <echo message="------------------- ${Name} ${version} [${year}] ----------------"/>
  144. <property name="build.compiler" value="classic"/>
  145. <property name="debug" value="on"/>
  146. <property name="optimize" value="off"/>
  147. <property name="deprecation" value="on"/>
  148. <property name="textfontencoding" value="WinAnsiEncoding"/>
  149. <property name="src.dir" value="./src"/>
  150. <property name="src.codegen" value="./src/codegen"/>
  151. <property name="docs.dir" value="./docs"/>
  152. <property name="lib.dir" value="./lib"/>
  153. <property name="hyph.dir" value="./hyph"/>
  154. <property name="conf.dir" value="./conf"/>
  155. <property name="packages" value="org.apache.fop.*"/>
  156. <property name="docs" value="docs/html-docs"/>
  157. <property name="xdocs" value="docs/xml-docs"/>
  158. <property name="skins" value="docs/xml-docs/skins/xml.apache.org/"/>
  159. <property name="doc.generator" value="org.apache.stylebook.StyleBook"/>
  160. <property name="doc.generator.package" value="${lib.dir}/stylebook-1.0-b2.jar"/>
  161. <property name="viewer.resources.src.dir" value="./src/org/apache/fop/viewer/resources"/>
  162. <property name="viewer.images.src.dir" value="./src/org/apache/fop/viewer/Images"/>
  163. <property name="build.dir" value="./build"/>
  164. <property name="build.src" value="./build/src"/>
  165. <property name="build.codegen" value="./build/src/codegen"/>
  166. <property name="build.dest" value="./build/classes"/>
  167. <property name="build.docs" value="./build/docs"/>
  168. <property name="build.javadocs" value="./build/javadocs"/>
  169. <property name="viewer.resources.dest.dir" value="${build.dest}/org/apache/fop/viewer/resources"/>
  170. <property name="viewer.images.dest.dir" value="${build.dest}/org/apache/fop/viewer/Images"/>
  171. <property name="dist.bin.dir" value="./dist-bin"/>
  172. <property name="dist.src.dir" value="./dist-src"/>
  173. <property name="dist.bin.result.dir" value="${dist.bin.dir}/${Name}-${version}"/>
  174. <property name="dist.src.result.dir" value="${dist.src.dir}/${Name}-${version}"/>
  175. <property name="properties.dir" value="org/apache/fop/fo/properties"/>
  176. <property name="fonts.dir" value="org/apache/fop/render/pdf/fonts"/>
  177. <property name="svg.dir" value="org/apache/fop/svg"/>
  178. <property name="replacestring" value="org/apache/fop"/>
  179. <property name="ignore_this" value="ignore_this.java"/>
  180. <property name="jimi" value="JimiImage.java"/>
  181. <property name="jai" value="JAIImage.java"/>
  182. <property name="xslt" value="org.apache.xalan.xslt.Process"/>
  183. <property name="src.properties.xsl" value="${src.codegen}/properties.xsl"/>
  184. <property name="src.propmaker.xsl" value="${src.codegen}/propmaker.xsl"/>
  185. <property name="foproperties.xml" value="${build.codegen}/foproperties.xml"/>
  186. <property name="colorkw.xml" value="${build.codegen}/colorkw.xml"/>
  187. <property name="allprops.xml" value="${build.codegen}/allprops.xml"/>
  188. <property name="properties.xsl" value="${build.codegen}/properties.xsl"/>
  189. <property name="propmap.xsl" value="${build.codegen}/propmap.xsl"/>
  190. <property name="enumgen.xsl" value="${build.codegen}/enumgen.xsl"/>
  191. <property name="propinc.xsl" value="${build.codegen}/propinc.xsl"/>
  192. <property name="genconst.xsl" value="${build.codegen}/genconst.xsl"/>
  193. <property name="src.charlist.xsl" value="${src.codegen}/code-point-mapping.xsl"/>
  194. <property name="encodings.xml" value="${build.codegen}/encodings.xml"/>
  195. <property name="charlist.xsl" value="${build.codegen}/code-point-mapping.xsl"/>
  196. <property name="fontfile.xsl" value="${build.codegen}/font-file.xsl"/>
  197. <property name="t1fontfile.xsl" value="${build.codegen}/t1font-file.xsl"/>
  198. <property name="ttffontfile.xsl" value="${build.codegen}/ttffontfile.xsl"/>
  199. <property name="Courier.xml" value="${build.codegen}/Courier.xml"/>
  200. <property name="Courier-Oblique.xml" value="${build.codegen}/CourierOblique.xml"/>
  201. <property name="Courier-Bold.xml" value="${build.codegen}/CourierBold.xml"/>
  202. <property name="Courier-BoldOblique.xml" value="${build.codegen}/CourierBoldOblique.xml"/>
  203. <property name="Helvetica.xml" value="${build.codegen}/Helvetica.xml"/>
  204. <property name="Helvetica-Oblique.xml" value="${build.codegen}/HelveticaOblique.xml"/>
  205. <property name="Helvetica-Bold.xml" value="${build.codegen}/HelveticaBold.xml"/>
  206. <property name="Helvetica-BoldOblique.xml" value="${build.codegen}/HelveticaBoldOblique.xml"/>
  207. <property name="Times-Roman.xml" value="${build.codegen}/TimesRoman.xml"/>
  208. <property name="Times-Italic.xml" value="${build.codegen}/TimesItalic.xml"/>
  209. <property name="Times-Bold.xml" value="${build.codegen}/TimesBold.xml"/>
  210. <property name="Times-BoldItalic.xml" value="${build.codegen}/TimesBoldItalic.xml"/>
  211. <property name="ZapfDingbats.xml" value="${build.codegen}/ZapfDingbats.xml"/>
  212. <property name="Symbol.xml" value="${build.codegen}/Symbol.xml"/>
  213. <property name="trax" value="TraxTransform.java"/>
  214. <property name="xsltransform" value="XSLTransform.java"/>
  215. <property name="tools.pkg" value="org/apache/fop/tools"/>
  216. <!-- insert custom font information here (step 1 of 2) -->
  217. <!-- use this as a template
  218. <property name="myfont.xml" value="${build.codegen}/myfont.xml"/>
  219. -->
  220. <taskdef name="serHyph" classname="org.apache.fop.tools.anttasks.SerializeHyphPattern"/>
  221. <taskdef name="runTest" classname="org.apache.fop.tools.anttasks.RunTest"/>
  222. <property name="main.class" value="org.apache.fop.apps.Fop"/>
  223. </target>
  224. <target name="init-avail">
  225. <available property="jimi.present" classname="com.sun.jimi.core.Jimi"/>
  226. <available property="jai.present" classname="javax.media.jai.JAI"/>
  227. <available property="trax.present" classname="javax.xml.transform.Transformer"/>
  228. </target>
  229. <!-- =================================================================== -->
  230. <!-- Help on usage -->
  231. <!-- =================================================================== -->
  232. <target name="usage">
  233. <echo message="Use the -projecthelp option instead" />
  234. </target>
  235. <!-- =================================================================== -->
  236. <!-- Prepares the build directory -->
  237. <!-- =================================================================== -->
  238. <target name="prepare" depends="init">
  239. <!-- create directories -->
  240. <echo message="Preparing the build directories"/>
  241. <mkdir dir="${build.dir}"/>
  242. <mkdir dir="${build.src}"/>
  243. <mkdir dir="${build.src}/${properties.dir}"/>
  244. <mkdir dir="${build.src}/${fonts.dir}"/>
  245. <mkdir dir="${build.src}/${svg.dir}"/>
  246. <mkdir dir="${build.dest}/hyph"/>
  247. </target>
  248. <!-- =================================================================== -->
  249. <!-- compiles hyphenation patterns -->
  250. <!-- =================================================================== -->
  251. <target name="hyphenation" depends="prepare">
  252. <serHyph includes="*.xml"
  253. sourceDir="./hyph"
  254. targetDir="${build.dest}/hyph"/>
  255. </target>
  256. <!-- =================================================================== -->
  257. <!-- copies special image class only if Jimi library is present -->
  258. <!-- =================================================================== -->
  259. <target name="prepare-jimi" depends="prepare" if="jimi.present">
  260. <echo message="Jimi library is present. Fop installs jimi support."/>
  261. <copy todir="${build.src}">
  262. <fileset dir="${src.dir}" includes="**/${jimi}"/>
  263. </copy>
  264. </target>
  265. <!-- =================================================================== -->
  266. <!-- copies special image class only if JAI library is present -->
  267. <!-- =================================================================== -->
  268. <target name="prepare-jai" depends="prepare" if="jai.present">
  269. <echo message="JAI library is present. Fop installs JAI support."/>
  270. <copy todir="${build.src}">
  271. <fileset dir="${src.dir}" includes="**/${jai}"/>
  272. </copy>
  273. </target>
  274. <target name="prepare-trax" if="trax.present">
  275. <echo message="JAXP1.1 transforms is present. Installing TRaX support"/>
  276. <copy todir="${build.src}">
  277. <fileset dir="${src.dir}" includes="**/${xsltransform},**/${trax},**/apps/TraxInputHandler.java"/>
  278. </copy>
  279. </target>
  280. <!-- =================================================================== -->
  281. <!-- Prepares the source code -->
  282. <!-- =================================================================== -->
  283. <target name="prepare-src" depends="prepare, prepare-jimi, prepare-jai, prepare-trax">
  284. <!-- copy src files -->
  285. <copy todir="${build.src}">
  286. <fileset dir="${src.dir}"
  287. excludes="**/${jimi},**/${jai},**/${xsltransform},**/${trax},**/apps/TraxInputHandler.java"/>
  288. </copy>
  289. </target>
  290. <!-- =================================================================== -->
  291. <!-- Generate the source code -->
  292. <!-- =================================================================== -->
  293. <target name="codegen" depends="prepare" description="Generates the java files from the xml resources">
  294. <!-- resetting codegen directory -->
  295. <echo message="Resetting codegen directory"/>
  296. <!-- copy codegen directory -->
  297. <copy todir="${build.codegen}" filtering="on">
  298. <fileset dir="${src.codegen}"/>
  299. </copy>
  300. <!-- generate the java files from xml resources -->
  301. <echo message="Generating the java files from xml resources"/>
  302. <dependset>
  303. <srcfilelist dir="./" files="${foproperties.xml},${colorkw.xml}"/>
  304. <targetfilelist dir="./" files="${build.src}/${replacestring}/fo/properties/Constants.java,${build.src}/${replacestring}/fo/properties/fo_${ignore_this}"/>
  305. </dependset>
  306. <dependset>
  307. <srcfilelist dir="./" files="${propinc.xsl}"/>
  308. <targetfilelist dir="./" files="${build.src}/${replacestring}/fo/properties/fo_${ignore_this},${build.src}/${replacestring}/fo/properties/FOPropertyMapping.java,${build.src}/${replacestring}/fo/properties/foenums_${ignore_this}"/>
  309. </dependset>
  310. <style in="${allprops.xml}" style="${genconst.xsl}"
  311. out="${build.src}/${replacestring}/fo/properties/Constants.java"/>
  312. <style in="${foproperties.xml}" style="${properties.xsl}"
  313. out="${build.src}/${replacestring}/fo/properties/fo_${ignore_this}"/>
  314. <style in="${foproperties.xml}" style="${propmap.xsl}"
  315. out="${build.src}/${replacestring}/fo/properties/FOPropertyMapping.java"/>
  316. <style in="${foproperties.xml}" style="${enumgen.xsl}"
  317. out="${build.src}/${replacestring}/fo/properties/foenums_${ignore_this}"/>
  318. <style in="${encodings.xml}" style="${charlist.xsl}"
  319. out="${build.src}/${replacestring}/render/pdf/CodePointMapping.java"/>
  320. <!--
  321. <style basedir="src/codegen" includes="Helvetica*.xml,Times*.xml,Courier*.xml"
  322. style="${fontfile.xsl}"
  323. destdir="${build.src}/${replacestring}/render/pdf/fonts" extension=".java">
  324. <param name="encoding" expression="${textfontencoding}"/>
  325. </style>
  326. -->
  327. <style
  328. in="${Courier.xml}" style="${fontfile.xsl}"
  329. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  330. out="${build.src}/${replacestring}/render/pdf/fonts/Courier.java">
  331. <param name="encoding" expression="${textfontencoding}"/>
  332. </style>
  333. <style
  334. in="${Courier-Oblique.xml}" style="${fontfile.xsl}"
  335. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  336. out="${build.src}/${replacestring}/render/pdf/fonts/CourierOblique.java">
  337. <param name="encoding" expression="${textfontencoding}"/>
  338. </style>
  339. <style
  340. in="${Courier-Bold.xml}" style="${fontfile.xsl}"
  341. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  342. out="${build.src}/${replacestring}/render/pdf/fonts/CourierBold.java">
  343. <param name="encoding" expression="${textfontencoding}"/>
  344. </style>
  345. <style
  346. in="${Courier-BoldOblique.xml}" style="${fontfile.xsl}"
  347. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  348. out="${build.src}/${replacestring}/render/pdf/fonts/CourierBoldOblique.java">
  349. <param name="encoding" expression="${textfontencoding}"/>
  350. </style>
  351. <style
  352. in="${Helvetica.xml}" style="${fontfile.xsl}"
  353. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  354. out="${build.src}/${replacestring}/render/pdf/fonts/Helvetica.java">
  355. <param name="encoding" expression="${textfontencoding}"/>
  356. </style>
  357. <style
  358. in="${Helvetica-Bold.xml}" style="${fontfile.xsl}"
  359. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  360. out="${build.src}/${replacestring}/render/pdf/fonts/HelveticaBold.java">
  361. <param name="encoding" expression="${textfontencoding}"/>
  362. </style>
  363. <style
  364. in="${Helvetica-Oblique.xml}" style="${fontfile.xsl}"
  365. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  366. out="${build.src}/${replacestring}/render/pdf/fonts/HelveticaOblique.java">
  367. <param name="encoding" expression="${textfontencoding}"/>
  368. </style>
  369. <style
  370. in="${Helvetica-BoldOblique.xml}" style="${fontfile.xsl}"
  371. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  372. out="${build.src}/${replacestring}/render/pdf/fonts/HelveticaBoldOblique.java">
  373. <param name="encoding" expression="${textfontencoding}"/>
  374. </style>
  375. <style
  376. in="${Times-Roman.xml}" style="${fontfile.xsl}"
  377. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  378. out="${build.src}/${replacestring}/render/pdf/fonts/TimesRoman.java">
  379. <param name="encoding" expression="${textfontencoding}"/>
  380. </style>
  381. <style
  382. in="${Times-Italic.xml}" style="${fontfile.xsl}"
  383. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  384. out="${build.src}/${replacestring}/render/pdf/fonts/TimesItalic.java">
  385. <param name="encoding" expression="${textfontencoding}"/>
  386. </style>
  387. <style
  388. in="${Times-Bold.xml}" style="${fontfile.xsl}"
  389. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  390. out="${build.src}/${replacestring}/render/pdf/fonts/TimesBold.java">
  391. <param name="encoding" expression="${textfontencoding}"/>
  392. </style>
  393. <style
  394. in="${Times-BoldItalic.xml}" style="${fontfile.xsl}"
  395. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  396. out="${build.src}/${replacestring}/render/pdf/fonts/TimesBoldItalic.java">
  397. <param name="encoding" expression="${textfontencoding}"/>
  398. </style>
  399. <style
  400. in="${Symbol.xml}" style="${fontfile.xsl}"
  401. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  402. out="${build.src}/${replacestring}/render/pdf/fonts/Symbol.java"/>
  403. <style
  404. in="${ZapfDingbats.xml}" style="${fontfile.xsl}"
  405. destdir="${build.src}/${replacestring}/render/pdf/fonts"
  406. out="${build.src}/${replacestring}/render/pdf/fonts/ZapfDingbats.java"/>
  407. <style
  408. in="${Symbol.xml}" style="${fontfile.xsl}"
  409. out="${build.src}/${replacestring}/render/pdf/fonts/Symbol.java"/>
  410. <style
  411. in="${ZapfDingbats.xml}" style="${fontfile.xsl}"
  412. out="${build.src}/${replacestring}/render/pdf/fonts/ZapfDingbats.java"/>
  413. <!-- custom fonts (Use t1fontfile.xsl instead of fontfile.xsl for Type 1 fonts!) step 2/2 -->
  414. <!-- use this as a template for type 1 fonts:
  415. <style in="${myfont.xml}" style="${t1fontfile.xsl}"
  416. out="${build.src}/${replacestring}/render/pdf/fonts/myfont.java"/>
  417. -->
  418. <!-- use this as a template for truetype fonts
  419. <style in="${myfont.xml}" style="${ttffontfile.xsl}"
  420. out="${build.src}/${replacestring}/render/pdf/fonts/myfont.java"/>
  421. -->
  422. </target>
  423. <!-- =================================================================== -->
  424. <!-- Compiles the source directory -->
  425. <!-- =================================================================== -->
  426. <target name="compile" depends="codegen, prepare-src" description="Compiles the source code">
  427. <echo message="Compiling the sources "/>
  428. <!-- create directories -->
  429. <mkdir dir="${build.dest}"/>
  430. <mkdir dir="${viewer.resources.dest.dir}"/>
  431. <copy todir="${viewer.resources.dest.dir}">
  432. <fileset dir="${viewer.resources.src.dir}"/>
  433. </copy>
  434. <mkdir dir="${viewer.images.dest.dir}"/>
  435. <copy todir="${viewer.images.dest.dir}">
  436. <fileset dir="${viewer.images.src.dir}"/>
  437. </copy>
  438. <javac destdir="${build.dest}" debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">
  439. <src path="${build.src}"/>
  440. <classpath refid="libs-build-classpath"/>
  441. <exclude name="**/${ignore_this}"/>
  442. <exclude name="${jimi}"/>
  443. </javac>
  444. </target>
  445. <!-- =================================================================== -->
  446. <!-- Creates the class package -->
  447. <!-- =================================================================== -->
  448. <target name="package" depends="compile,hyphenation" description="Generates the jar files">
  449. <echo message="Creating the jar file ${build.dir}/${name}.jar"/>
  450. <tstamp>
  451. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  452. </tstamp>
  453. <pathconvert property="manifest-classpath" dirsep="/" pathsep=" " refid="libs-run-classpath">
  454. <map from="${basedir}${file.separator}lib${file.separator}" to=""/>
  455. <map from="${basedir}${file.separator}build${file.separator}fop.jar" to=""/>
  456. </pathconvert>
  457. <jar jarfile="${build.dir}/${name}.jar"
  458. basedir="${build.dest}"
  459. includes="org/**,hyph/**">
  460. <manifest>
  461. <attribute name="Main-Class" value="${main.class}"/>
  462. <attribute name="Class-Path" value="${manifest-classpath}"/>
  463. <attribute name="Implementation-Title" value="${Name}"/>
  464. <attribute name="Implementation-Version" value="${version}"/>
  465. <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/fop/)"/>
  466. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}])"/>
  467. </manifest>
  468. </jar>
  469. </target>
  470. <target name="pdf-transcoder" depends="compile" description="Generates the jar for the pdf transcoder for Batik">
  471. <echo message="Creating the jar file ${build.dir}/pdf-transcoder.jar"/>
  472. <property name="pdf-transcoder.name" value="FOP PDF Transcoder"/>
  473. <property name="pdf-transcoder.version" value="1.0beta2"/>
  474. <tstamp>
  475. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  476. </tstamp>
  477. <jar jarfile="${build.dir}/pdf-transcoder.jar">
  478. <fileset dir="${build.dest}" includes="org/apache/fop/pdf/**"/>
  479. <fileset dir="${build.dest}" includes="org/apache/fop/svg/**"/>
  480. <fileset dir="${build.dest}" includes="org/apache/fop/render/pdf/**"
  481. excludes="org/apache/fop/render/pdf/PDFRenderer.class,org/apache/fop/render/pdf/PDFXMLHandler*"/>
  482. <fileset dir="${build.dest}" includes="org/apache/fop/layout/Font*.class,org/apache/fop/image/FopImag*.class,org/apache/fop/image/Jpeg*,org/apache/fop/image/Abstract*,org/apache/fop/util/StreamUtilities.class"/>
  483. <manifest>
  484. <attribute name="Implementation-Title" value="${pdf-transcoder.name}"/>
  485. <attribute name="Implementation-Version" value="${pdf-transcoder.version}"/>
  486. <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/fop/)"/>
  487. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}])"/>
  488. </manifest>
  489. </jar>
  490. </target>
  491. <target name="test" depends="package" description="Runs the test suite">
  492. <echo message="Testing build in jar file ${build.dir}/${name}.jar against reference"/>
  493. <runTest testSuite="basictests.xml" basedir="test/" reference="test/reference/fop.jar"
  494. refVersion="FOP 1.0dev"/>
  495. <runTest testSuite="bugtests.xml" basedir="test/" reference="test/reference/fop.jar"
  496. refVersion="FOP 1.0dev"/>
  497. <!--
  498. <runTest testSuite="testsuite.xml" basedir="TestSuite/NIST/" reference="test/reference/fop.jar"
  499. refVersion="FOP 1.0dev"/>
  500. <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/IBM/" reference="test/reference/fop.jar"
  501. refVersion="FOP 1.0dev"/>
  502. <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/FOP/" reference="test/reference/fop.jar"
  503. refVersion="FOP 1.0dev"/>
  504. <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/XEP/" reference="test/reference/fop.jar"
  505. refVersion="FOP 1.0dev"/>
  506. <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/XSLFormatter/" reference="test/reference/fop.jar"
  507. refVersion="FOP 1.0dev"/>
  508. -->
  509. </target>
  510. <target name="all" depends="package"/> <!-- "all" target for us Makefile converts ;-) -->
  511. <!-- =================================================================== -->
  512. <!-- Prepares the docs -->
  513. <!-- =================================================================== -->
  514. <target name="prepare-docs" depends="init">
  515. <mkdir dir="${build.docs}"/>
  516. </target>
  517. <!-- =================================================================== -->
  518. <!-- Creates the API documentation -->
  519. <!-- =================================================================== -->
  520. <target name="javadocs" depends="prepare-src" description="Generates javadocs">
  521. <echo message="Producing the javadoc files "/>
  522. <mkdir dir="${build.javadocs}"/>
  523. <javadoc packagenames="${packages}"
  524. sourcepath="${build.src}"
  525. destdir="${build.javadocs}"
  526. classpathref="libs-build-classpath"
  527. author="true"
  528. version="true"
  529. windowtitle="${Name} API"
  530. doctitle="${Name}"
  531. bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights Reserved."
  532. overview="${build.src}/overview.html"
  533. failonerror="true"
  534. />
  535. </target>
  536. <target name="html" depends="javadocs, htmldoc" description="Generates javadocs and documentation in html format"/>
  537. <target name="htmldoc" depends= "html-fop, html-design" description="Generates documentation in html format"/>
  538. <target name="html-fop" depends="prepare-src">
  539. <copy file="${xdocs}/fop.xml"
  540. tofile="${xdocs}/book.xml"
  541. filtering="on"/>
  542. <java classname="${doc.generator}" fork="yes">
  543. <classpath refid="libs-build-classpath"/>
  544. <arg line="targetDirectory=${docs} ${xdocs}/book.xml ${skins}"/>
  545. </java>
  546. </target>
  547. <target name="html-design" depends="prepare-src, html-newdesign,
  548. html-altdesign, html-understanding"/>
  549. <target name="html-newdesign" depends="prepare-src">
  550. <java classname="${doc.generator}" fork="yes">
  551. <classpath refid="libs-build-classpath"/>
  552. <arg line="targetDirectory=${docs}/design/ docs/design/book.xml ${skins}"/>
  553. </java>
  554. </target>
  555. <target name="html-altdesign" depends="prepare-src">
  556. <java classname="${doc.generator}" fork="yes">
  557. <classpath refid="libs-build-classpath"/>
  558. <arg line="targetDirectory=${docs}/design/alt.design/ docs/design/alt.design/book.xml ${skins}"/>
  559. </java>
  560. </target>
  561. <target name="html-understanding" depends="prepare-src">
  562. <java classname="${doc.generator}" fork="yes">
  563. <classpath refid="libs-build-classpath"/>
  564. <arg line="targetDirectory=${docs}/design/understanding docs/design/understanding/book.xml ${skins}"/>
  565. </java>
  566. </target>
  567. <target name="pdfdoc" depends="package" description="Generates the documentation in pdf format">
  568. <copy file="${xdocs}/fop.xml"
  569. tofile="${xdocs}/book.xml"
  570. filtering="on"/>
  571. <style in="${xdocs}/fop.xml" style="${xdocs}/xml2xml.xsl" out="${xdocs}/fop-doc.xml"/>
  572. <style in="${xdocs}/fop-doc.xml" style="${xdocs}/xml2pdf.xsl" out="${xdocs}/fop.fo"/>
  573. <java classname="org.apache.fop.apps.Fop" fork="yes">
  574. <classpath refid="libs-run-classpath"/>
  575. <arg line="-fo ${xdocs}/fop.fo -pdf ${xdocs}/fop.pdf"/>
  576. </java>
  577. </target>
  578. <!-- =================================================================== -->
  579. <!-- Creates the distribution -->
  580. <!-- =================================================================== -->
  581. <target name="dist" depends="dist-src,dist-bin" description="Generates the distribution package"/>
  582. <target name="dist-bin" depends="package">
  583. <echo message="Building the binary distribution files (zip,tar)"/>
  584. <mkdir dir="${dist.bin.result.dir}"/>
  585. <copy todir="${dist.bin.result.dir}">
  586. <fileset refid="dist.bin"/>
  587. <fileset refid="dist.bin.lib"/>
  588. </copy>
  589. <mkdir dir="${dist.bin.result.dir}/build"/>
  590. <copy todir="${dist.bin.result.dir}/build" file="build/fop.jar"/>
  591. <chmod file="${dist.bin.result.dir}/fop.sh" perm="ugo+rx" />
  592. <zip zipfile="${Name}-${version}-bin.zip" basedir="${dist.bin.dir}" includes="**"/>
  593. <tar tarfile="${Name}-${version}-bin.tar" basedir="${dist.bin.dir}" includes="**"/>
  594. <gzip zipfile="${Name}-${version}-bin.tar.gz" src="${Name}-${version}-bin.tar" />
  595. <delete file="${Name}-${version}-bin.tar"/>
  596. </target>
  597. <target name="dist-src" depends="package, javadocs">
  598. <echo message="Building the source distribution files (zip,tar)"/>
  599. <mkdir dir="${dist.src.result.dir}"/>
  600. <copy todir="${dist.src.result.dir}">
  601. <fileset refid="dist.src"/>
  602. </copy>
  603. <copy todir="${dist.src.result.dir}/javadocs">
  604. <fileset dir="${build.javadocs}"/>
  605. </copy>
  606. <mkdir dir="${dist.src.result.dir}/build"/>
  607. <copy todir="${dist.src.result.dir}/build" file="build/fop.jar"/>
  608. <chmod file="${dist.src.result.dir}/build.sh" perm="ugo+rx" />
  609. <chmod file="${dist.src.result.dir}/fop.sh" perm="ugo+rx" />
  610. <zip zipfile="${Name}-${version}-src.zip" basedir="${dist.src.dir}" includes="**"/>
  611. <tar tarfile="${Name}-${version}-src.tar" basedir="${dist.src.dir}" includes="**"/>
  612. <gzip zipfile="${Name}-${version}-src.tar.gz" src="${Name}-${version}-src.tar" />
  613. <delete file="${Name}-${version}-src.tar"/>
  614. </target>
  615. <!-- =================================================================== -->
  616. <!-- Clean targets -->
  617. <!-- =================================================================== -->
  618. <target name="clean" depends="init" description="Cleans the build directory">
  619. <delete dir="${build.dir}"/>
  620. </target>
  621. <target name="distclean" depends="clean" description="Cleans the distribution target directories">
  622. <delete dir="${dist.src.dir}"/>
  623. <delete dir="${dist.bin.dir}"/>
  624. <delete>
  625. <fileset dir="${basedir}" includes="${Name}-*.tar.gz"/>
  626. <fileset dir="${basedir}" includes="${Name}-*.zip"/>
  627. </delete>
  628. </target>
  629. </project>