|
Lines 9356-9361
Link Here
|
| 9356 |
</sect2> |
9356 |
</sect2> |
| 9357 |
</sect1> |
9357 |
</sect1> |
| 9358 |
|
9358 |
|
|
|
9359 |
<sect1 id="using-iconv"> |
| 9360 |
<title>Using <command>iconv</command></title> |
| 9361 |
|
| 9362 |
<para>After r254273 FreeBSD 10-CURRENT and newer have a native |
| 9363 |
iconv implmentation. On previous versions the <filename |
| 9364 |
role="package">converters/libiconv</filename> port was used |
| 9365 |
as the default implementation.</para> |
| 9366 |
|
| 9367 |
<para>If your software uses the iconv functionality, define |
| 9368 |
<literal>USES=iconv</literal>. On OS versions before |
| 9369 |
r254273, without a native iconv implementation, a dependency |
| 9370 |
on <filename role="package">converters/libiconv</filename> |
| 9371 |
will be added.</para> |
| 9372 |
|
| 9373 |
<para>The <filename>iconv.mk</filename> USES file defines the |
| 9374 |
following variables you can use in your port:</para> |
| 9375 |
|
| 9376 |
<informaltable frame="none" pgwide="0"> |
| 9377 |
<tgroup cols="2"> |
| 9378 |
<thead> |
| 9379 |
<row> |
| 9380 |
<entry>Variable name</entry> |
| 9381 |
<entry>Purpose</entry> |
| 9382 |
<entry>Value with base before r254273</entry> |
| 9383 |
<entry>Value with base after r254273</entry> |
| 9384 |
</row> |
| 9385 |
</thead> |
| 9386 |
|
| 9387 |
<tbody> |
| 9388 |
<row> |
| 9389 |
<entry><makevar>ICONV_CMD</makevar></entry> |
| 9390 |
<entry>Where the <command>iconv</command> binary |
| 9391 |
resides</entry> |
| 9392 |
<entry>${LOCALBASE}/bin/iconv</entry> |
| 9393 |
<entry>/usr/bin/iconv</entry> |
| 9394 |
</row> |
| 9395 |
|
| 9396 |
<row> |
| 9397 |
<entry><makevar>ICONV_LIB</makevar></entry> |
| 9398 |
<entry>ld argument to link to libiconv (if needed)</entry> |
| 9399 |
<entry>-liconv</entry> |
| 9400 |
<entry>(empty)</entry> |
| 9401 |
</row> |
| 9402 |
|
| 9403 |
<row> |
| 9404 |
<entry><makevar>ICONV_PREFIX</makevar></entry> |
| 9405 |
<entry>Where the iconv implementation resides (useful |
| 9406 |
for configure scripts)</entry> |
| 9407 |
<entry>${LOCALBASE}</entry> |
| 9408 |
<entry>/usr</entry> |
| 9409 |
</row> |
| 9410 |
|
| 9411 |
<row> |
| 9412 |
<entry><makevar>ICONV_CONFIGURE_ARG</makevar></entry> |
| 9413 |
<entry>Preconstructed configure argument for |
| 9414 |
configure scripts</entry> |
| 9415 |
<entry>--with-libiconv-prefix=${LOCALBASE}</entry> |
| 9416 |
<entry>(empty)</entry> |
| 9417 |
</row> |
| 9418 |
|
| 9419 |
<row> |
| 9420 |
<entry><makevar>ICONV_CONFIGURE_BASE</makevar></entry> |
| 9421 |
<entry>Preconstructed configure argument for |
| 9422 |
configure scripts</entry> |
| 9423 |
<entry>--with-libiconv=${LOCALBASE}</entry> |
| 9424 |
<entry>(empty)</entry> |
| 9425 |
</row> |
| 9426 |
</tbody> |
| 9427 |
</tgroup> |
| 9428 |
</informaltable> |
| 9429 |
|
| 9430 |
<para>The following two examples will automatically populate |
| 9431 |
the variables with the correct value or empty for systems |
| 9432 |
using iconv or native iconv respectively:</para> |
| 9433 |
|
| 9434 |
<example id="iconv-simple-use"> |
| 9435 |
<title>Simple iconv Usage</title> |
| 9436 |
|
| 9437 |
<programlisting>USES= iconv |
| 9438 |
LDFLAGS+= -L${LOCALBASE}/lib ${ICONV_LIB}</programlisting> |
| 9439 |
</example> |
| 9440 |
|
| 9441 |
<example id="iconv-configure-use"> |
| 9442 |
<title>iconv Usage With configure</title> |
| 9443 |
|
| 9444 |
<programlisting>USES= iconv |
| 9445 |
CONFIGURE_ARGS+=${ICONV_CONFIGURE_ARG}</programlisting> |
| 9446 |
</example> |
| 9447 |
|
| 9448 |
<para>Sometimes a software has some ld argument or search |
| 9449 |
path hardcoded in it's Makefile or configure script, such an |
| 9450 |
approach can be used to fix these:</para> |
| 9451 |
|
| 9452 |
<example id="iconv-reinplace"> |
| 9453 |
<title>Fixing Hardcoded -liconv</title> |
| 9454 |
|
| 9455 |
<programlisting>USES= iconv |
| 9456 |
|
| 9457 |
post-patch: |
| 9458 |
@${REINPLACE_CMD} -e 's/-liconv/${ICONV_LIB}/' ${WRKSRC}/Makefile</programlisting> |
| 9459 |
|
| 9460 |
</example> |
| 9461 |
|
| 9462 |
<para>In some cases it is necessary to conditionally set some |
| 9463 |
other values or performing operations depending on the presence |
| 9464 |
or absence of the native iconv implementations. in such cases |
| 9465 |
you can do this by checking if the ICONV_LIB is empty; doing |
| 9466 |
this requires <filename>bsd.port.pre.mk</filename> to be |
| 9467 |
included:</para> |
| 9468 |
|
| 9469 |
<example id="iconv-conditional"> |
| 9470 |
<title>Setting Port make Variables Depending on Native iconv |
| 9471 |
Availability</title> |
| 9472 |
|
| 9473 |
<programlisting>USES= iconv |
| 9474 |
|
| 9475 |
.include <bsd.port.pre.mk> |
| 9476 |
|
| 9477 |
post-patch: |
| 9478 |
.if empty(ICONV_LIB) |
| 9479 |
@${REINPLACE_CMD} -e 's|iconv||' ${WRKSRC}/Config.sh |
| 9480 |
.endif |
| 9481 |
|
| 9482 |
.include <bsd.port.post.mk></programlisting> |
| 9483 |
</example> |
| 9484 |
|
| 9485 |
</sect1> |
| 9486 |
|
| 9359 |
<sect1 id="using-xfce"> |
9487 |
<sect1 id="using-xfce"> |
| 9360 |
<title>Using Xfce</title> |
9488 |
<title>Using Xfce</title> |
| 9361 |
|
9489 |
|