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.

build.xml 35KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  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 XT or Xalan) or can be passed in
  14. memory as a DOM Document or (in the case of XT) 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: "JAVA_HOME" environment
  29. property should be set to match the JVM you want to use. That's it.
  30. Building instructions
  31. =====================
  32. First, make sure your current working directory is where this very file is
  33. located. Then type
  34. ./build.sh (unix)
  35. .\build.bat (win32)
  36. if everything is right and all the required packages are visible, this action
  37. will generate a file called "fop.jar" in the "./build" directory. Note, that
  38. if you do further development, compilation time is reduced since Ant is able
  39. to detect which files have changed an to recompile them at need.
  40. If something went wrong, go to the FAQ section below.
  41. Also, you'll note that reusing a single JVM instance for each task, increases
  42. tremendously the performance of the whole build system, compared to other
  43. tools (i.e. make or shell scripts) where a new JVM is started for each task.
  44. Build targets
  45. =============
  46. The build system is not only responsible of compiling Fop into a jar file,
  47. but is also responsible for creating the HTML documentation, javadocs,
  48. distributions and web site. In fact, the file you have here is _exactly_ what
  49. is used by fop maintainers to take care of everything in the Fop
  50. project, no less and no more. (only partially implemented)
  51. These are the meaningful targets for this build file:
  52. - package [default] -> creates ./build/fop.jar
  53. - usage -> shows a help screen
  54. - codegen -> generates needed java sources from xml resources
  55. - docs -> generates the HTML documentation in ./build/docs
  56. - javadocs -> generates the API documentation in ./build/javadocs
  57. - dist -> generates the Fop distribution
  58. - clean -> restores the distribution to its original and clean state
  59. (excepting dist files)
  60. - distclean -> restores the distribution to its original and clean state
  61. - site -> generates the web site in ../xml-site/targets/fop (not yet impl.)
  62. ====================================== FAQ =====================================
  63. 1) Why some of the classes present in the original jar are not built anymore?
  64. The fop build system is very flexible: if a module requires a package that
  65. is not present in the classpath at build time, the module is skipped but
  66. the built process is not stopped.
  67. Here is a list of such modules and what you have to download to build them:
  68. - Jimi
  69. - JAI
  70. 2) I see a lot of warnings starting like this: "Warning: file modified in the future:"
  71. Sometimes ant gives out this warnings, but the build is finished without any problems
  72. ============================================================================ -->
  73. <project default="package" basedir=".">
  74. <property environment="env"/>
  75. <fileset dir="${basedir}" id="dist.bin">
  76. <include name="build/site/**"/>
  77. <include name="conf/**"/>
  78. <include name="docs/xslfoRef.pdf"/>
  79. <include name="docs/foschema/**"/>
  80. <include name="examples/**"/>
  81. <exclude name="examples/build.xml"/>
  82. <exclude name="examples/fo/runtests.*"/>
  83. <exclude name="examples/fo/results.html"/>
  84. <exclude name="examples/tests/**"/>
  85. <include name="CHANGES"/>
  86. <include name="LICENSE"/>
  87. <include name="KEYS"/>
  88. <include name="README"/>
  89. <include name="STATUS"/>
  90. <include name="ReleaseNotes.html"/>
  91. <include name="fop.bat"/>
  92. <include name="fop.sh"/>
  93. <include name="xalan.bat"/>
  94. <include name="xalan.sh"/>
  95. <exclude name="src/**"/>
  96. <exclude name="dist/**"/>
  97. <exclude name="lib/**"/>
  98. </fileset>
  99. <fileset dir="${basedir}" id="dist.bin.lib">
  100. <include name="lib/xerces*.jar"/>
  101. <include name="lib/xerces.LICENSE.txt"/>
  102. <include name="lib/xml-apis.jar"/>
  103. <include name="lib/xml-apis.README.txt"/>
  104. <include name="lib/xalan*.jar"/>
  105. <include name="lib/xalan.LICENSE.txt"/>
  106. <include name="lib/batik.jar"/>
  107. <include name="lib/batik.LICENSE.txt"/>
  108. <include name="lib/avalon-framework*.jar"/>
  109. <include name="lib/avalon.LICENSE.txt"/>
  110. <include name="lib/readme"/>
  111. </fileset>
  112. <fileset dir="${basedir}" id="dist.src">
  113. <exclude name="lib/jimi*"/>
  114. <exclude name="lib/jai*"/>
  115. <exclude name="lib/jce*"/>
  116. <include name="src/**"/>
  117. <include name="build/site/**"/>
  118. <include name="conf/**"/>
  119. <include name="build/site/**"/>
  120. <include name="docs/**"/>
  121. <include name="examples/**"/>
  122. <include name="hyph/**"/>
  123. <include name="lib/**"/>
  124. <include name="CHANGES"/>
  125. <include name="LICENSE"/>
  126. <include name="README"/>
  127. <include name="STATUS"/>
  128. <include name="ReleaseNotes.html"/>
  129. <include name="build*"/>
  130. <include name="fop.bat"/>
  131. <include name="fop.sh"/>
  132. <include name="xalan.bat"/>
  133. <include name="xalan.sh"/>
  134. </fileset>
  135. <path id="libs-build-classpath">
  136. <fileset dir="lib">
  137. <include name="xalan*.jar"/>
  138. <include name="xerces*.jar"/>
  139. <include name="xml-apis.jar"/>
  140. <include name="avalon-framework*.jar"/>
  141. <include name="batik*.jar"/>
  142. <include name="jimi*.jar"/>
  143. <include name="jai*.jar"/>
  144. <include name="jce*.jar"/>
  145. </fileset>
  146. </path>
  147. <!-- =================================================================== -->
  148. <!-- Initialization target -->
  149. <!-- =================================================================== -->
  150. <target name="init" depends="init-avail, init-filters-jdk14, init-filters-jdk13">
  151. <tstamp/>
  152. <property name="Name" value="Fop"/>
  153. <property name="name" value="fop"/>
  154. <property name="version" value="0.20.5"/>
  155. <filter token="version" value="${version}"/>
  156. <property name="year" value="1999-2003"/>
  157. <echo message="------------------- ${Name} ${version} [${year}] ----------------"/>
  158. <echo message="${ant.version}"/>
  159. <echo message="VM: ${java.vm.version}, ${java.vm.vendor}"/>
  160. <echo message="JAVA_HOME: ${env.JAVA_HOME}"/>
  161. <!--property name="build.compiler" value="classic"/-->
  162. <property name="debug" value="on"/>
  163. <property name="optimize" value="off"/>
  164. <property name="deprecation" value="off"/>
  165. <property name="javac.source" value="1.3"/>
  166. <property name="javac.target" value="1.3"/>
  167. <property name="textfontencoding" value="WinAnsiEncoding"/>
  168. <property name="src.dir" value="./src"/>
  169. <property name="src.codegen" value="./src/codegen"/>
  170. <property name="lib.dir" value="./lib"/>
  171. <property name="hyph.dir" value="./hyph"/>
  172. <property name="conf.dir" value="./conf"/>
  173. <property name="packages" value="org.apache.fop.*"/>
  174. <property name="viewer.resources.src.dir" value="./src/org/apache/fop/viewer/resources"/>
  175. <property name="viewer.images.src.dir" value="./src/org/apache/fop/viewer/Images"/>
  176. <property name="build.dir" value="./build"/>
  177. <property name="build.src" value="./build/src"/>
  178. <property name="build.codegen" value="./build/src/codegen"/>
  179. <property name="build.dest" value="./build/classes"/>
  180. <property name="build.docs" value="./build/docs"/>
  181. <property name="build.javadocs" value="./build/javadocs"/>
  182. <property name="viewer.resources.dest.dir" value="${build.dest}/org/apache/fop/viewer/resources"/>
  183. <property name="viewer.images.dest.dir" value="${build.dest}/org/apache/fop/viewer/Images"/>
  184. <property name="dist.bin.dir" value="./dist-bin"/>
  185. <property name="dist.src.dir" value="./dist-src"/>
  186. <property name="dist.bin.result.dir" value="${dist.bin.dir}/${name}-${version}"/>
  187. <property name="dist.src.result.dir" value="${dist.src.dir}/${name}-${version}"/>
  188. <property name="properties.dir" value="org/apache/fop/fo/properties"/>
  189. <property name="fonts.dir" value="org/apache/fop/render/pdf/fonts"/>
  190. <property name="svg.dir" value="org/apache/fop/svg"/>
  191. <property name="ignore_this" value="ignore_this.java"/>
  192. <property name="jimi" value="JimiImage.java"/>
  193. <property name="jai" value="JAIImage.java"/>
  194. <property name="tiff" value="TiffImage.java"/>
  195. <property name="src.properties.xsl" value="${src.codegen}/properties.xsl"/>
  196. <property name="src.propmaker.xsl" value="${src.codegen}/propmaker.xsl"/>
  197. <property name="foproperties.xml" value="${build.codegen}/foproperties.xml"/>
  198. <property name="colorkw.xml" value="${build.codegen}/colorkw.xml"/>
  199. <property name="extproperties.xml" value="${build.codegen}/extproperties.xml"/>
  200. <property name="allprops.xml" value="${build.codegen}/allprops.xml"/>
  201. <property name="properties.xsl" value="${build.codegen}/properties.xsl"/>
  202. <property name="propmap.xsl" value="${build.codegen}/propmap.xsl"/>
  203. <property name="enumgen.xsl" value="${build.codegen}/enumgen.xsl"/>
  204. <property name="propinc.xsl" value="${build.codegen}/propinc.xsl"/>
  205. <property name="genconst.xsl" value="${build.codegen}/genconst.xsl"/>
  206. <property name="src.charlist.xsl" value="${src.codegen}/code-point-mapping.xsl"/>
  207. <property name="encodings.xml" value="${build.codegen}/encodings.xml"/>
  208. <property name="charlist.xsl" value="${build.codegen}/code-point-mapping.xsl"/>
  209. <property name="fontfile.xsl" value="${build.codegen}/font-file.xsl"/>
  210. <property name="t1fontfile.xsl" value="${build.codegen}/t1font-file.xsl"/>
  211. <property name="ttffontfile.xsl" value="${build.codegen}/ttffontfile.xsl"/>
  212. <property name="Courier.xml" value="${build.codegen}/Courier.xml"/>
  213. <property name="Courier-Oblique.xml" value="${build.codegen}/Courier-Oblique.xml"/>
  214. <property name="Courier-Bold.xml" value="${build.codegen}/Courier-Bold.xml"/>
  215. <property name="Courier-BoldOblique.xml" value="${build.codegen}/Courier-BoldOblique.xml"/>
  216. <property name="Helvetica.xml" value="${build.codegen}/Helvetica.xml"/>
  217. <property name="Helvetica-Oblique.xml" value="${build.codegen}/Helvetica-Oblique.xml"/>
  218. <property name="Helvetica-Bold.xml" value="${build.codegen}/Helvetica-Bold.xml"/>
  219. <property name="Helvetica-BoldOblique.xml" value="${build.codegen}/Helvetica-BoldOblique.xml"/>
  220. <property name="Times-Roman.xml" value="${build.codegen}/Times-Roman.xml"/>
  221. <property name="Times-Italic.xml" value="${build.codegen}/Times-Italic.xml"/>
  222. <property name="Times-Bold.xml" value="${build.codegen}/Times-Bold.xml"/>
  223. <property name="Times-BoldItalic.xml" value="${build.codegen}/Times-BoldItalic.xml"/>
  224. <property name="ZapfDingbats.xml" value="${build.codegen}/ZapfDingbats.xml"/>
  225. <property name="Symbol.xml" value="${build.codegen}/Symbol.xml"/>
  226. <property name="trax" value="TraxTransform.java"/>
  227. <property name="xsltransform" value="XSLTransform.java"/>
  228. <property name="tools.pkg" value="org/apache/fop/tools"/>
  229. <property name="xslfo.std"
  230. value="http://www.w3.org/TR/2001/REC-xsl-20011015/xslspec.html"/>
  231. <property name="xslfo.std.id"
  232. value="XSL-FO 1.0"/>
  233. <!-- insert custom font information here (step 1 of 2) -->
  234. <!-- use this as a template
  235. <property name="myfont.xml" value="${build.codegen}/myfont.xml"/>
  236. -->
  237. <property name="main.class" value="org.apache.fop.apps.Fop"/>
  238. <property name="runtime.classpath" value="xercesImpl-2.2.1.jar xml-apis.jar xalan-2.4.1.jar batik.jar jimi-1.0.jar avalon-framework-cvs-20020806.jar"/>
  239. <filter filtersfile="${build.codegen}/filter"/>
  240. </target>
  241. <target name="init-avail">
  242. <available property="jimi.present" classname="com.sun.jimi.core.Jimi" classpathref="libs-build-classpath"/>
  243. <available property="jai.present" classname="javax.media.jai.JAI" classpathref="libs-build-classpath"/>
  244. <available property="trax.present" classname="javax.xml.transform.Transformer" classpathref="libs-build-classpath"/>
  245. <available property="jdk14.present" classname="java.lang.CharSequence"/>
  246. <available property="jce.present" classname="javax.crypto.Cipher" classpathref="libs-build-classpath"/>
  247. </target>
  248. <target name="init-filters-jdk13" depends="init-avail" unless="jdk14.present">
  249. <echo message="JDK 1.3 or earlier present."/>
  250. <copy file="src/codegen/jdk13.filter" toFile="build/src/codegen/filter"/>
  251. </target>
  252. <target name="init-filters-jdk14" depends="init-avail" if="jdk14.present">
  253. <echo message="JDK 1.4 present."/>
  254. <copy file="src/codegen/jdk14.filter" toFile="build/src/codegen/filter"/>
  255. </target>
  256. <!-- =================================================================== -->
  257. <!-- Help on usage -->
  258. <!-- =================================================================== -->
  259. <target name="usage">
  260. <echo message="Use the -projecthelp option instead"/>
  261. </target>
  262. <!-- =================================================================== -->
  263. <!-- Prepares the build directory -->
  264. <!-- =================================================================== -->
  265. <target name="prepare" depends="init">
  266. <!-- create directories -->
  267. <echo message="Preparing the build directories"/>
  268. <mkdir dir="${build.dir}"/>
  269. <mkdir dir="${build.src}"/>
  270. <mkdir dir="${build.src}/${properties.dir}"/>
  271. <mkdir dir="${build.src}/${fonts.dir}"/>
  272. <mkdir dir="${build.src}/${svg.dir}"/>
  273. <mkdir dir="${build.dest}/conf"/>
  274. <mkdir dir="${build.dest}/hyph"/>
  275. <copy todir="${build.dest}/conf" filtering="yes">
  276. <fileset dir="./conf"/>
  277. </copy>
  278. </target>
  279. <!-- =================================================================== -->
  280. <!-- copies special image class only if Jimi library is present -->
  281. <!-- =================================================================== -->
  282. <target name="prepare-jimi" depends="prepare" if="jimi.present">
  283. <echo message="Jimi library is present. Installing Jimi support."/>
  284. <copy todir="${build.src}">
  285. <fileset dir="${src.dir}" includes="**/${jimi}"/>
  286. </copy>
  287. </target>
  288. <!-- =================================================================== -->
  289. <!-- copies special image class only if JAI library is present -->
  290. <!-- =================================================================== -->
  291. <target name="prepare-jai" depends="prepare" if="jai.present">
  292. <echo message="JAI library is present. Installing JAI support."/>
  293. <copy todir="${build.src}">
  294. <fileset dir="${src.dir}" includes="**/${jai}"/>
  295. <fileset dir="${src.dir}" includes="**/${tiff}"/>
  296. </copy>
  297. </target>
  298. <target name="prepare-trax" if="trax.present">
  299. <echo message="JAXP1.1 transforms is present. Installing TRaX support"/>
  300. <copy todir="${build.src}">
  301. <fileset dir="${src.dir}" includes="**/${xsltransform},**/${trax},**/apps/TraxInputHandler.java"/>
  302. </copy>
  303. </target>
  304. <target name="prepare-jce" depends="prepare" if="jce.present">
  305. <echo message="JCE is present. Installing PDF encryption support."/>
  306. <copy todir="build/src">
  307. <fileset dir="src/java-1.4"/>
  308. </copy>
  309. </target>
  310. <target name="prepare-jce-stub" depends="prepare" unless="jce.present">
  311. <echo message="JCE not present. Installing stub."/>
  312. <copy todir="build/src">
  313. <fileset dir="src/java-1.3"/>
  314. </copy>
  315. </target>
  316. <!-- =================================================================== -->
  317. <!-- Prepares the source code -->
  318. <!-- =================================================================== -->
  319. <target name="prepare-src" depends="prepare, prepare-jimi, prepare-jai, prepare-trax, prepare-jce, prepare-jce-stub">
  320. <!-- copy src files -->
  321. <copy todir="${build.src}" filtering="yes">
  322. <fileset dir="${src.dir}"
  323. includes="**/*.java,*.html"
  324. excludes="java-*/**,**/${jimi},**/${jai},**/${tiff},**/${xsltransform},**/${trax},**/apps/TraxInputHandler.java"/>
  325. <filterset>
  326. <filter token="XSLFO-STD" value="${xslfo.std}"/>
  327. <filter token="XSLFO-STDID" value="${xslfo.std.id}"/>
  328. </filterset>
  329. </copy>
  330. </target>
  331. <!-- =================================================================== -->
  332. <!-- Generate the source code -->
  333. <!-- =================================================================== -->
  334. <target name="codegen" depends="prepare" description="Generates the java files from the xml resources">
  335. <!-- resetting codegen directory -->
  336. <echo message="Resetting codegen directory"/>
  337. <!-- copy codegen directory -->
  338. <copy todir="${build.codegen}" filtering="yes">
  339. <fileset dir="${src.codegen}"/>
  340. </copy>
  341. <!-- generate the java files from xml resources -->
  342. <echo message="Generating the java files from xml resources"/>
  343. <dependset>
  344. <srcfilelist dir="./" files="${foproperties.xml},${colorkw.xml}"/>
  345. <targetfilelist dir="./" files="${build.src}/org/apache/fop/fo/properties/Constants.java,${build.src}/fo_${ignore_this}"/>
  346. </dependset>
  347. <dependset>
  348. <srcfilelist dir="./" files="${propinc.xsl}"/>
  349. <targetfilelist dir="./" files="${build.src}/fo_${ignore_this},${build.src}/org/apache/fop/fo/properties/FOPropertyMapping.java,${build.src}/foenums_${ignore_this}"/>
  350. </dependset>
  351. <dependset>
  352. <srcfilelist dir="./" files="${encodings.xml},${charlist.xsl},${fontfile.xsl},
  353. ${Courier.xml},${Courier-Oblique.xml},${Courier-Bold.xml},
  354. ${Courier-BoldOblique.xml},
  355. ${Helvetica.xml},${Helvetica-Bold.xml},${Helvetica-Oblique.xml},
  356. ${Helvetica-BoldOblique.xml},
  357. ${Times-Roman.xml},${Times-Italic.xml},${Times-Bold.xml},
  358. ${Times-BoldItalic.xml},
  359. ${Symbol.xml},${ZapfDingbats.xml}"/>
  360. <targetfilelist dir="./" files="${build.src}/org/apache/fop/render/pdf/fonts/Courier*,
  361. ${build.src}/org/apache/fop/render/pdf/fonts/Times*,
  362. ${build.src}/org/apache/fop/render/pdf/fonts/Helvetica*,
  363. ${build.src}/org/apache/fop/render/pdf/fonts/Symbol*,
  364. ${build.src}/org/apache/fop/render/pdf/fonts/ZapfDingbats*"/>
  365. </dependset>
  366. <style in="${allprops.xml}" style="${genconst.xsl}"
  367. out="${build.src}/${properties.dir}/Constants.java"/>
  368. <style in="${foproperties.xml}" style="${properties.xsl}"
  369. out="${build.src}/fo_${ignore_this}">
  370. <param name="reldir" expression="${properties.dir}"/>
  371. </style>
  372. <style in="${foproperties.xml}" style="${propmap.xsl}"
  373. out="${build.src}/${properties.dir}/FOPropertyMapping.java"/>
  374. <style in="${foproperties.xml}" style="${enumgen.xsl}"
  375. out="${build.src}/foenums_${ignore_this}">
  376. <param name="reldir" expression="${properties.dir}"/>
  377. </style>
  378. <style in="${extproperties.xml}" style="${propmap.xsl}"
  379. out="${build.src}/${properties.dir}/ExtensionPropertyMapping.java"/>
  380. <style in="${encodings.xml}" style="${charlist.xsl}"
  381. out="${build.src}/org/apache/fop/render/pdf/CodePointMapping.java"/>
  382. <style
  383. in="${Courier.xml}" style="${fontfile.xsl}"
  384. out="${build.src}/${fonts.dir}/Courier.java">
  385. <param name="encoding" expression="${textfontencoding}"/>
  386. </style>
  387. <style
  388. in="${Courier-Oblique.xml}" style="${fontfile.xsl}"
  389. out="${build.src}/${fonts.dir}/CourierOblique.java">
  390. <param name="encoding" expression="${textfontencoding}"/>
  391. </style>
  392. <style
  393. in="${Courier-Bold.xml}" style="${fontfile.xsl}"
  394. out="${build.src}/${fonts.dir}/CourierBold.java">
  395. <param name="encoding" expression="${textfontencoding}"/>
  396. </style>
  397. <style
  398. in="${Courier-BoldOblique.xml}" style="${fontfile.xsl}"
  399. out="${build.src}/${fonts.dir}/CourierBoldOblique.java">
  400. <param name="encoding" expression="${textfontencoding}"/>
  401. </style>
  402. <style
  403. in="${Helvetica.xml}" style="${fontfile.xsl}"
  404. out="${build.src}/${fonts.dir}/Helvetica.java">
  405. <param name="encoding" expression="${textfontencoding}"/>
  406. </style>
  407. <style
  408. in="${Helvetica-Bold.xml}" style="${fontfile.xsl}"
  409. out="${build.src}/${fonts.dir}/HelveticaBold.java">
  410. <param name="encoding" expression="${textfontencoding}"/>
  411. </style>
  412. <style
  413. in="${Helvetica-Oblique.xml}" style="${fontfile.xsl}"
  414. out="${build.src}/${fonts.dir}/HelveticaOblique.java">
  415. <param name="encoding" expression="${textfontencoding}"/>
  416. </style>
  417. <style
  418. in="${Helvetica-BoldOblique.xml}" style="${fontfile.xsl}"
  419. out="${build.src}/${fonts.dir}/HelveticaBoldOblique.java">
  420. <param name="encoding" expression="${textfontencoding}"/>
  421. </style>
  422. <style
  423. in="${Times-Roman.xml}" style="${fontfile.xsl}"
  424. out="${build.src}/${fonts.dir}/TimesRoman.java">
  425. <param name="encoding" expression="${textfontencoding}"/>
  426. </style>
  427. <style
  428. in="${Times-Italic.xml}" style="${fontfile.xsl}"
  429. out="${build.src}/${fonts.dir}/TimesItalic.java">
  430. <param name="encoding" expression="${textfontencoding}"/>
  431. </style>
  432. <style
  433. in="${Times-Bold.xml}" style="${fontfile.xsl}"
  434. out="${build.src}/${fonts.dir}/TimesBold.java">
  435. <param name="encoding" expression="${textfontencoding}"/>
  436. </style>
  437. <style
  438. in="${Times-BoldItalic.xml}" style="${fontfile.xsl}"
  439. out="${build.src}/${fonts.dir}/TimesBoldItalic.java">
  440. <param name="encoding" expression="${textfontencoding}"/>
  441. </style>
  442. <style
  443. in="${Symbol.xml}" style="${fontfile.xsl}"
  444. out="${build.src}/${fonts.dir}/Symbol.java"/>
  445. <style
  446. in="${ZapfDingbats.xml}" style="${fontfile.xsl}"
  447. out="${build.src}/${fonts.dir}/ZapfDingbats.java"/>
  448. <!-- custom fonts (Use t1fontfile.xsl instead of fontfile.xsl for Type 1 fonts!) step 2/2 -->
  449. <!-- use this as a template for type 1 fonts:
  450. <xslt infile="${myfont.xml}" xsltfile="${t1fontfile.xsl}"
  451. outfile="${build.src}/${fonts.dir}/myfont.java" smart="yes"/>
  452. -->
  453. <!-- use this as a template for truetype fonts
  454. <xslt infile="${myfont.xml}" xsltfile="${ttffontfile.xsl}"
  455. outfile="${build.src}/${fonts.dir}/myfont.java" smart="yes"/>
  456. -->
  457. </target>
  458. <!-- =================================================================== -->
  459. <!-- Compiles the source directory -->
  460. <!-- =================================================================== -->
  461. <target name="compile" depends="codegen, prepare-src">
  462. <echo message="Compiling the sources "/>
  463. <!-- create directories -->
  464. <mkdir dir="${build.dest}"/>
  465. <mkdir dir="${viewer.resources.dest.dir}"/>
  466. <copy todir="${viewer.resources.dest.dir}">
  467. <fileset dir="${viewer.resources.src.dir}"/>
  468. </copy>
  469. <mkdir dir="${viewer.images.dest.dir}"/>
  470. <copy todir="${viewer.images.dest.dir}">
  471. <fileset dir="${viewer.images.src.dir}"/>
  472. </copy>
  473. <javac srcdir="${build.src}"
  474. destdir="${build.dest}"
  475. debug="${debug}"
  476. deprecation="${deprecation}"
  477. optimize="${optimize}"
  478. excludes="**/*${ignore_this},${jimi}"
  479. source="${javac.source}" target="${javac.target}">
  480. <classpath refid="libs-build-classpath"/>
  481. </javac>
  482. </target>
  483. <!-- =================================================================== -->
  484. <!-- compiles hyphenation patterns -->
  485. <!-- =================================================================== -->
  486. <target name="hyphenation" depends="compile" >
  487. <path id="hyph-classpath">
  488. <path refid="libs-build-classpath"/>
  489. <pathelement location="${build.dir}/classes"/>
  490. </path>
  491. <taskdef name="serHyph" classname="org.apache.fop.tools.anttasks.SerializeHyphPattern" classpathref="hyph-classpath"/>
  492. <serHyph includes="*.xml"
  493. sourceDir="${hyph.dir}"
  494. targetDir="${build.dest}/hyph" />
  495. </target>
  496. <target name="hyphenation-jar" depends="hyphenation">
  497. <tstamp>
  498. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  499. </tstamp>
  500. <jar jarfile="${build.dir}/fop-hyph.jar"
  501. basedir="${build.dest}"
  502. includes="hyph/**">
  503. <manifest>
  504. <attribute name="Implementation-Title" value="${Name}"/>
  505. <attribute name="Implementation-Version" value="${version}"/>
  506. <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/fop/)"/>
  507. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}])"/>
  508. </manifest>
  509. </jar>
  510. </target>
  511. <!-- =================================================================== -->
  512. <!-- Creates the class package -->
  513. <!-- =================================================================== -->
  514. <target name="package" depends="compile,hyphenation-jar" description="Generates the jar files (default target)">
  515. <echo message="Creating the jar file ${build.dir}/${name}.jar"/>
  516. <tstamp>
  517. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  518. </tstamp>
  519. <jar jarfile="${build.dir}/${name}.jar"
  520. basedir="${build.dest}"
  521. includes="org/**,conf/**">
  522. <manifest>
  523. <attribute name="Main-Class" value="${main.class}"/>
  524. <attribute name="Class-Path" value="${runtime.classpath}"/>
  525. <attribute name="Implementation-Title" value="${Name}"/>
  526. <attribute name="Implementation-Version" value="${version}"/>
  527. <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/fop/)"/>
  528. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}])"/>
  529. </manifest>
  530. </jar>
  531. </target>
  532. <target name="test" depends="package" description="Runs the test suite">
  533. <echo message="Testing build in jar file ${build.dir}/${name}.jar against reference"/>
  534. <path id="testtask-classpath">
  535. <path refid="libs-build-classpath"/>
  536. <pathelement location="${build.dir}/classes"/>
  537. </path>
  538. <taskdef name="runTest" classname="org.apache.fop.tools.anttasks.RunTest" classpathref="testtask-classpath"/>
  539. <runTest testSuite="basictests.xml" basedir="test/" reference="test/reference/fop.jar"
  540. refVersion="FOP 0.20.4"/>
  541. <runTest testSuite="bugtests.xml" basedir="test/" reference="test/reference/fop.jar"
  542. refVersion="FOP 0.20.4"/>
  543. <!--
  544. <runTest testSuite="testsuite.xml" basedir="TestSuite/NIST/" reference="test/reference/fop.jar"
  545. refVersion="FOP 0.19.0-CVS"/>
  546. <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/IBM/" reference="test/reference/fop.jar"
  547. refVersion="FOP 0.19.0-CVS"/>
  548. <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/FOP/" reference="test/reference/fop.jar"
  549. refVersion="FOP 0.19.0-CVS"/>
  550. <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/XEP/" reference="test/reference/fop.jar"
  551. refVersion="FOP 0.19.0-CVS"/>
  552. <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/XSLFormatter/" reference="test/reference/fop.jar"
  553. refVersion="FOP 0.19.0-CVS"/>
  554. -->
  555. </target>
  556. <target name="all" depends="package"/> <!-- "all" target for us Makefile converts ;-) -->
  557. <!-- =================================================================== -->
  558. <!-- Prepares the docs -->
  559. <!-- =================================================================== -->
  560. <target name="prepare-docs" depends="init">
  561. <mkdir dir="${build.docs}"/>
  562. </target>
  563. <!-- =================================================================== -->
  564. <!-- Creates the API documentation -->
  565. <!-- =================================================================== -->
  566. <target name="javadocs" depends="codegen,prepare-src" description="Generates javadocs">
  567. <echo message="Producing the javadoc files "/>
  568. <mkdir dir="${build.javadocs}"/>
  569. <javadoc packagenames="${packages}"
  570. sourcepath="${build.src}"
  571. destdir="${build.javadocs}"
  572. author="true"
  573. version="true"
  574. windowtitle="${Name} API"
  575. doctitle="${Name}"
  576. bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights Reserved."
  577. overview="${build.src}/overview.html"
  578. use="true"
  579. source="${javac.source}"
  580. failonerror="true">
  581. <group title="Control and Startup">
  582. <package name="org.apache.fop.apps"/>
  583. <package name="org.apache.fop.configuration"/>
  584. <package name="org.apache.fop.messaging"/>
  585. </group>
  586. <group title="XSL-FO Document (Input)">
  587. <package name="org.apache.fop.fo"/>
  588. <package name="org.apache.fop.fo.*"/>
  589. <package name="org.apache.fop.datatypes"/>
  590. </group>
  591. <group title="Area Tree Document (Intermediate)">
  592. <package name="org.apache.fop.layout"/>
  593. <package name="org.apache.fop.layout.*"/>
  594. </group>
  595. <group title="Rendered Document (Output)">
  596. <package name="org.apache.fop.render"/>
  597. <package name="org.apache.fop.render.*"/>
  598. <package name="org.apache.fop.viewer"/>
  599. </group>
  600. <group title="Utility">
  601. <package name="org.apache.fop.pdf"/>
  602. <package name="org.apache.fop.mif"/>
  603. <package name="org.apache.fop.tools"/>
  604. <package name="org.apache.fop.tools.*"/>
  605. <package name="org.apache.fop.svg"/>
  606. <package name="org.apache.fop.image"/>
  607. <package name="org.apache.fop.image.*"/>
  608. <package name="org.apache.fop.fonts"/>
  609. <package name="org.apache.fop.fonts.*"/>
  610. </group>
  611. <classpath refid="libs-build-classpath"/>
  612. <classpath>
  613. <fileset dir="${lib.dir}">
  614. <include name="ant*.jar"/>
  615. </fileset>
  616. </classpath>
  617. </javadoc>
  618. </target>
  619. <!-- =================================================================== -->
  620. <!-- Creates the documentation -->
  621. <!-- =================================================================== -->
  622. <target name="docs" depends="prepare" description="Generates documentation">
  623. <echo message="Building documentation with Forrest..."/>
  624. <echo message="Make sure you have a propper Forrest installation (see http://xml.apache.org/forrest)"/>
  625. <exec executable="forrest">
  626. </exec>
  627. </target>
  628. <!-- =================================================================== -->
  629. <!-- Creates the distribution -->
  630. <!-- =================================================================== -->
  631. <target name="dist" depends="dist-src,dist-bin" description="Generates the distribution package"/>
  632. <target name="dist-bin" depends="package, docs">
  633. <echo message="Building the binary distribution files (zip,tar)"/>
  634. <mkdir dir="${dist.bin.result.dir}"/>
  635. <copy todir="${dist.bin.result.dir}">
  636. <fileset refid="dist.bin"/>
  637. <fileset refid="dist.bin.lib"/>
  638. </copy>
  639. <mkdir dir="${dist.bin.result.dir}/build"/>
  640. <copy todir="${dist.bin.result.dir}/build" file="build/fop.jar"/>
  641. <chmod file="${dist.bin.result.dir}/fop.sh" perm="ugo+rx" />
  642. <zip zipfile="${name}-${version}-bin.zip" basedir="${dist.bin.dir}" includes="**"/>
  643. <tar destfile="${name}-${version}-bin.tar.gz" compression="gzip">
  644. <tarfileset dir="${dist.bin.dir}" mode="755">
  645. <include name="**/*.sh"/>
  646. </tarfileset>
  647. <tarfileset dir="${dist.bin.dir}">
  648. <exclude name="**/*.sh"/>
  649. </tarfileset>
  650. </tar>
  651. </target>
  652. <target name="dist-src" depends="package, docs">
  653. <echo message="Building the source distribution files (zip,tar)"/>
  654. <mkdir dir="${dist.src.result.dir}"/>
  655. <copy todir="${dist.src.result.dir}">
  656. <fileset refid="dist.src"/>
  657. </copy>
  658. <mkdir dir="${dist.src.result.dir}/build"/>
  659. <copy todir="${dist.src.result.dir}/build" file="build/fop.jar"/>
  660. <chmod file="${dist.src.result.dir}/build.sh" perm="ugo+rx" />
  661. <chmod file="${dist.src.result.dir}/fop.sh" perm="ugo+rx" />
  662. <chmod file="${dist.src.result.dir}/examples/fo/runtests.sh" perm="ugo+rx" />
  663. <zip zipfile="${name}-${version}-src.zip" basedir="${dist.src.dir}" includes="**"/>
  664. <tar destfile="${name}-${version}-src.tar.gz" compression="gzip">
  665. <tarfileset dir="${dist.src.dir}" mode="755">
  666. <include name="**/*.sh"/>
  667. </tarfileset>
  668. <tarfileset dir="${dist.src.dir}">
  669. <exclude name="**/*.sh"/>
  670. </tarfileset>
  671. </tar>
  672. </target>
  673. <!-- =================================================================== -->
  674. <!-- Optional targets for Eclipse -->
  675. <!-- =================================================================== -->
  676. <target name="src-jar" depends="prepare-src" description="Generates a source zip for Eclipse">
  677. <jar jarfile="${build.dir}/${name}-src.jar">
  678. <fileset dir="${build.src}">
  679. <include name="**/*.java"/>
  680. </fileset>
  681. </jar>
  682. </target>
  683. <!-- =================================================================== -->
  684. <!-- Clean targets -->
  685. <!-- =================================================================== -->
  686. <target name="clean" depends="init" description="Cleans the build directory">
  687. <delete dir="${build.dir}"/>
  688. </target>
  689. <target name="distclean" depends="clean" description="Cleans the distribution target directories">
  690. <delete dir="${dist.src.dir}"/>
  691. <delete dir="${dist.bin.dir}"/>
  692. <delete>
  693. <fileset dir="${basedir}" includes="${name}-*.tar.gz"/>
  694. <fileset dir="${basedir}" includes="${name}-*.zip"/>
  695. </delete>
  696. </target>
  697. <!-- =================================================================== -->
  698. <!-- Special target for Gump -->
  699. <!-- =================================================================== -->
  700. <target name="gump" depends="all, javadocs"/>
  701. </project>