View | Details | Raw Unified | Return to bug 67001
Collapse All | Expand All

(-)book.sgml (+102 lines)
Lines 4151-4156 Link Here
4151
	to get information for debugging your port. It will display the
4151
	to get information for debugging your port. It will display the
4152
	value of many of the forecited variables.</para>
4152
	value of many of the forecited variables.</para>
4153
4153
4154
      <para>Additionally, the following constants are defined so all Java ports
4155
      may be installed in a consistent way:</para>
4156
4157
      <table frame="none">
4158
	<title>Constants defined for ports that use Java</title>
4159
4160
	<tgroup cols="2">
4161
	  <thead>
4162
	    <row>
4163
	      <entry>Constant</entry>
4164
	      <entry>Value</entry>
4165
	    </row>
4166
	  </thead>
4167
	  <tbody>
4168
	    <row>
4169
	      <entry><makevar>JAVASHAREDIR</makevar></entry>
4170
        <entry>The base directory for everything related to Java. Default value
4171
        is <filename>${PREFIX}/share/java</filename>.</entry>
4172
	    </row>
4173
      <row>
4174
        <entry><makevar>JAVAJARDIR</makevar></entry>
4175
        <entry>The directory where JAR files should be installed. Default value
4176
        is <filename>${JAVASHAREDIR}/classes</filename>.</entry>
4177
	  </tbody>
4178
	</tgroup>
4179
      </table>
4180
4181
      <sect2 id="java-best-practices">
4182
        <title>Best practices</title>
4183
4184
        <para>When porting a Java library, your port should install the JAR
4185
        file(s) in <filename>${JAVAJARDIR}</filename>, and everything else
4186
        under <filename>${JAVASHAREDIR}/${PORTNAME}</filename> (except for the
4187
        documentation, see below). In order to reduce the packing file size,
4188
        you may reference the JAR file(s) directly in the
4189
        <filename>Makefile</filename>. Just use the following statement (where
4190
        <filename>myport.jar</filename> is the name of the JAR file installed
4191
        as part of the port):</para>
4192
4193
        <programlisting>PLIST_FILES+= ${JAVAJARDIR:S,^${PREFIX}/,,}/myport.jar</programlisting>
4194
4195
        <para>When porting a Java application, the port usually install
4196
        everything under a single directory (including its JAR dependencies).
4197
        The use of <filename>${JAVASHAREDIR}/${PORTNAME}</filename> is strongly
4198
        encouraged in this extend. It is up the porter to decide whether the
4199
        port should install the additional JAR dependencies under this
4200
        directory or directly use the already installed ones (from
4201
        <filename>${JAVAJARDIR}</filename>).</para>
4202
        
4203
        <para>Regardless of the type of your port (library or application), the
4204
        additional documentation should be installed in the usual location as
4205
        for any port (see <ulink url="#DADS-DOCUMENTATION">this
4206
        section</ulink>). The JavaDoc tool is known to produce a different set
4207
        of files depending on the version of the JDK that is used. For ports
4208
        that do not enforce the use of a particular JDK, it is therefore a
4209
        complex task to specify the packing list
4210
        (<filename>pkg-plist</filename>). This is one reason why porters are
4211
        strongly encouraged to use the <makevar>PORTDOCS</makevar> macro. This
4212
        feature is unfortunately not (yet) documented in this document so you
4213
        should refer to <filename>bsd.port.mk</filename> itself for further
4214
        information.  Moreover, even if you can predict the set of files that
4215
        will be generated by <command>javadoc</command>, the size of the
4216
        resulting <filename>pkg-plist</filename> advocates for the use of the
4217
        forecited <makevar>PORTDOCS</makevar> macro.</para>
4218
4219
        <para>The default value for <makevar>DATADIR</makevar> is
4220
        <filename>${PREFIX}/share/${PORTNAME}</filename>. It is a good idea to
4221
        override <makevar>DATADIR</makevar> to
4222
        <filename>${JAVASHAREDIR}/${PORTNAME}</filename> for Java ports.
4223
        Indeed, <makevar>DATADIR</makevar> is automatically addded to
4224
        <makevar>PLIST_SUB</makevar> (documented <ulink
4225
        url="#PORTING-PLIST">here</ulink>) so you may use
4226
        <literal>%%DATADIR%%</literal> directly in
4227
        <filename>pkg-plist</filename>.</para>
4228
4229
        <para>As for the choice of building Java ports from source or directly
4230
        installing them from a binary distribution, there is no defined policy
4231
        at the time of writing. However, people from the <ulink
4232
        url="http://www.freebsd.org/java/">FreeBSD Java Project</ulink>
4233
        encourage porters to have their ports built from source whenever it is
4234
        a trivial task.</para>
4235
4236
        <para>All the features that have been presented in this section are
4237
        implemented in <filename>bsd.java.mk</filename>. If you ever think that
4238
        your port needs more sophisticated Java support, please first have a
4239
        look at the <ulink
4240
        url="http://www.freebsd.org/cgi/cvsweb.cgi/ports/Mk/bsd.java.mk">bsd.java.mk
4241
        CVS log</ulink> as it usually takes some time to document the latest
4242
        features.  Then, if you think the support you are lacking would be
4243
        beneficial to many other Java ports, feel free to discuss it on the
4244
        FreeBSD Java mailing list.</para>
4245
        
4246
        <para>Although there is a <literal>java</literal> category for PRs, it
4247
        refers to the JDK porting effort from the FreeBSD Java project.
4248
        Therefore, you should submit your Java port in the
4249
        <literal>ports</literal> category as for any other port, unless of
4250
        course it turns out that the issue you are trying to resolve is related
4251
        to either a JDK implementation or
4252
        <filename>bsd.java.mk</filename>.</para>
4253
4254
      </sect2>
4255
      
4154
    </sect1>
4256
    </sect1>
4155
4257
4156
    <sect1 id="using-python">
4258
    <sect1 id="using-python">

Return to bug 67001