After 2013-10-08 (254273),
FreeBSD 10-CURRENT and newer versions have a native
iconv
in the operating system. On earlier
versions, converters/libiconv
was used as a dependency.
For software that needs iconv
, define
USES=iconv
. FreeBSD versions before
10-CURRENT on 2013-08-13 (254273) do
not have a native iconv
. On these earlier
versions, a dependency on
converters/libiconv will be
added automatically.
When a port defines USES=iconv
, these
variables will be available:
Variable name | Purpose | Value before FreeBSD 10-CURRENT 254273 (2013-08-13) | Value after FreeBSD 10-CURRENT 254273 (2013-08-13) |
---|---|---|---|
ICONV_CMD | Directory where the iconv
binary resides | ${LOCALBASE}/bin/iconv | /usr/bin/iconv |
ICONV_LIB | ld argument to link to
libiconv (if needed) | -liconv | (empty) |
ICONV_PREFIX | Directory where the iconv
implementation resides (useful for configure
scripts) | ${LOCALBASE} | /usr |
ICONV_CONFIGURE_ARG | Preconstructed configure argument for configure scripts | --with-libiconv-prefix=${LOCALBASE} | (empty) |
ICONV_CONFIGURE_BASE | Preconstructed configure argument for configure scripts | --with-libiconv=${LOCALBASE} | (empty) |
These two examples automatically populate the variables
with the correct value for systems using
converters/libiconv or the
native iconv
respectively:
As shown above, ICONV_LIB
is empty when
a native iconv
is present. This can be
used to detect the native iconv
and respond
appropriately.
Sometimes a program has an ld
argument
or search path hardcoded in a Makefile
or
configure script. This approach can be used to solve that
problem:
-liconv
USES= iconv post-patch: @${REINPLACE_CMD} -e 's/-liconv/${ICONV_LIB}/' ${WRKSRC}/Makefile
In some cases it is necessary to set alternate values or
perform operations depending on whether there is a native
iconv
.
bsd.port.pre.mk
must be included before
testing the value of ICONV_LIB
:
iconv
AvailabilityUSES= iconv .include <bsd.port.pre.mk> post-patch: .if empty(ICONV_LIB) # native iconv detected @${REINPLACE_CMD} -e 's|iconv||' ${WRKSRC}/Config.sh .endif .include <bsd.port.post.mk>
All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/
Questions that are not answered by the
documentation may be
sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.