2013-04-26 22:44:59 +02:00
|
|
|
# handle dependency on the iconv port
|
|
|
|
#
|
|
|
|
# Feature: iconv
|
2013-09-02 07:41:50 +02:00
|
|
|
# Usage: USES=iconv or USES=iconv:ARGS
|
2014-01-29 21:24:49 +01:00
|
|
|
# Valid ARGS: lib (default, implicit), build, patch,
|
|
|
|
# wchar_t (port uses "WCHAR_T" extension),
|
|
|
|
# translit (port uses "//TRANSLIT" extension)
|
2014-03-15 11:31:54 +01:00
|
|
|
#
|
2022-03-30 16:41:37 +02:00
|
|
|
# MAINTAINER: desktop@FreeBSD.org
|
2014-01-29 21:24:49 +01:00
|
|
|
|
2013-04-26 22:44:59 +02:00
|
|
|
.if !defined(_INCLUDE_USES_ICONV_MK)
|
|
|
|
_INCLUDE_USES_ICONV_MK= yes
|
|
|
|
|
2022-04-24 12:00:20 +02:00
|
|
|
. if !exists(/usr/include/iconv.h) || ${iconv_ARGS:Mwchar_t} || ${iconv_ARGS:Mtranslit}
|
2013-09-04 20:06:07 +02:00
|
|
|
|
|
|
|
ICONV_CMD= ${LOCALBASE}/bin/iconv
|
|
|
|
ICONV_LIB= -liconv
|
2013-09-07 21:49:41 +02:00
|
|
|
ICONV_PREFIX= ${LOCALBASE}
|
2013-09-04 20:06:07 +02:00
|
|
|
ICONV_CONFIGURE_ARG= --with-libiconv-prefix=${LOCALBASE}
|
2013-09-05 22:18:30 +02:00
|
|
|
ICONV_CONFIGURE_BASE= --with-libiconv=${LOCALBASE}
|
2015-09-03 17:44:13 +02:00
|
|
|
ICONV_INCLUDE_PATH= ${LOCALBASE}/include
|
|
|
|
ICONV_LIB_PATH= ${LOCALBASE}/lib/libiconv.so
|
2013-09-04 20:06:07 +02:00
|
|
|
|
2022-04-24 12:00:20 +02:00
|
|
|
. if ${iconv_ARGS:Mbuild}
|
2016-03-27 03:23:25 +02:00
|
|
|
BUILD_DEPENDS+= ${ICONV_CMD}:converters/libiconv
|
2022-04-24 12:00:20 +02:00
|
|
|
. elif ${iconv_ARGS:Mpatch}
|
2016-03-27 03:23:25 +02:00
|
|
|
PATCH_DEPENDS+= ${ICONV_CMD}:converters/libiconv
|
2022-04-24 12:00:20 +02:00
|
|
|
. else
|
2016-03-27 03:23:25 +02:00
|
|
|
LIB_DEPENDS+= libiconv.so:converters/libiconv
|
2022-04-24 12:00:20 +02:00
|
|
|
. endif
|
2013-04-26 22:44:59 +02:00
|
|
|
|
2022-04-24 12:00:20 +02:00
|
|
|
. else
|
2013-09-04 20:06:07 +02:00
|
|
|
|
|
|
|
ICONV_CMD= /usr/bin/iconv
|
|
|
|
ICONV_LIB=
|
2013-09-07 21:49:41 +02:00
|
|
|
ICONV_PREFIX= /usr
|
2013-09-04 20:06:07 +02:00
|
|
|
ICONV_CONFIGURE_ARG=
|
2013-09-05 22:18:30 +02:00
|
|
|
ICONV_CONFIGURE_BASE=
|
2015-09-03 17:44:13 +02:00
|
|
|
ICONV_INCLUDE_PATH= /usr/include
|
|
|
|
ICONV_LIB_PATH= /usr/lib/libc.so
|
2013-09-04 20:06:07 +02:00
|
|
|
|
2022-04-24 12:00:20 +02:00
|
|
|
. if exists(${LOCALBASE}/include/iconv.h)
|
2017-06-13 15:28:49 +02:00
|
|
|
# Check that libiconv iconv.h is recent enough for LIBICONV_PLUG to work.
|
2017-09-25 22:55:27 +02:00
|
|
|
BUILD_DEPENDS+= libiconv>=1.14_11:converters/libiconv
|
2022-04-24 12:00:20 +02:00
|
|
|
. endif
|
2016-05-12 15:36:46 +02:00
|
|
|
|
2017-06-13 15:28:49 +02:00
|
|
|
# LIBICONV_PLUG makes libiconv iconv.h act like libc iconv.h.
|
2014-01-29 21:24:49 +01:00
|
|
|
CPPFLAGS+= -DLIBICONV_PLUG
|
|
|
|
CFLAGS+= -DLIBICONV_PLUG
|
|
|
|
CXXFLAGS+= -DLIBICONV_PLUG
|
2015-07-01 15:50:28 +02:00
|
|
|
OBJCFLAGS+= -DLIBICONV_PLUG
|
2014-01-29 21:24:49 +01:00
|
|
|
|
2022-04-24 12:00:20 +02:00
|
|
|
. endif
|
2013-09-04 20:06:07 +02:00
|
|
|
|
2015-09-03 17:44:13 +02:00
|
|
|
# These are the most common names for the iconv-related variables found in
|
|
|
|
# CMake-based ports. We set them here via CMAKE_ARGS to make sure that the best
|
|
|
|
# combination is always used (ie. we prefer the version in libc whenever it is
|
|
|
|
# available, and sometimes have to fall back to the iconv.h header from ports
|
|
|
|
# while still using the library from base).
|
|
|
|
CMAKE_ARGS+= -DICONV_INCLUDE_DIR=${ICONV_INCLUDE_PATH} \
|
|
|
|
-DICONV_LIBRARIES=${ICONV_LIB_PATH} \
|
|
|
|
-DICONV_LIBRARY=${ICONV_LIB_PATH} \
|
|
|
|
-DLIBICONV_INCLUDE_DIR=${ICONV_INCLUDE_PATH} \
|
|
|
|
-DLIBICONV_LIBRARIES=${ICONV_LIB_PATH} \
|
|
|
|
-DLIBICONV_LIBRARY=${ICONV_LIB_PATH}
|
|
|
|
|
2013-04-26 22:44:59 +02:00
|
|
|
.endif
|