aboutsummaryrefslogtreecommitdiffstats
path: root/textproc/xerces-c2/Makefile
blob: d309d233b1b85337a1ddfa766b240a98892d9736 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Created by: Bjoern A. Zeeb <bz@FreeBSD.org>
# $FreeBSD$

PORTNAME=   xerces-c2
PORTVERSION=    2.7.0
PORTREVISION=   1
CATEGORIES= textproc
MASTER_SITES=   ${MASTER_SITE_APACHE_XML}
MASTER_SITE_SUBDIR= xerces-c/source
DISTNAME=   xerces-c-src_${PORTVERSION:S/./_/g}

MAINTAINER= ports@FreeBSD.org
COMMENT=    Validating XML parser from the Apache XML Project

OPTIONS_DEFINE=     DOCS DEBUG EXAMPLES THREADS
OPTIONS_SINGLE=     TCODER
OPTIONS_SINGLE_TCODER=  ICONVFBSD ICU NATIVE
OPTIONS_DEFAULT=    ICONVFBSD THREADS
ICONVFBSD_DESC=     Use IconvFBSD transcoder
ICU_DESC=       Use ICU transcoder
NATIVE_DESC=        Use native transcoder

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MICU}
LIB_DEPENDS+=       icuuc:${PORTSDIR}/devel/icu
ICUROOT?=       ${LOCALBASE}
CONFIGURE_ENV+=     ICUROOT=${ICUROOT}
MAKE_ENV+=      ICUROOT=${ICUROOT}
TRANSCODER=     icu
PLIST_SUB+=     TRANSICONV="@comment "
PLIST_SUB+=     TRANSICU=""
.endif

.if ${PORT_OPTIONS:MNATIVE}
TRANSCODER=     native
PLIST_SUB+=     TRANSICONV=""
PLIST_SUB+=     TRANSICU="@comment "
.endif

.if ${PORT_OPTIONS:MICONVFBSD}
USE_ICONV=      yes
TRANSCODER=     IconvFBSD
ICONVROOT?=     ${LOCALBASE}
CONFIGURE_ENV+=     ICONVROOT=${ICONVROOT}
MAKE_ENV+=      ICONVROOT=${ICONVROOT}
PLIST_SUB+=     TRANSICONV=""
PLIST_SUB+=     TRANSICU="@comment "
.endif

USE_LDCONFIG=   yes

XERCESWRKSRC=       ${WRKSRC}/src/xercesc
CONFIGURE_WRKSRC=   ${XERCESWRKSRC}
BUILD_WRKSRC=       ${XERCESWRKSRC}
INSTALL_WRKSRC=     ${XERCESWRKSRC}

USE_GMAKE=      yes
MAKE_ENV+=      XERCESCROOT=${WRKSRC}
MAKE_JOBS_UNSAFE=   yes

HAS_CONFIGURE=      yes
CONFIGURE_ENV+=     XERCESCROOT=${WRKSRC} TRANSCODER=${TRANSCODER}
CONFIGURE_SCRIPT=   runConfigure
CONFIGURE_ARGS+=    -p freebsd -c ${CC} -x ${CXX} -n socket -P ${PREFIX}

CONFIGURE_ARGS+=    -t ${TRANSCODER}

.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+=    -d
.endif

.if defined(ARCH) && \
    (${ARCH} == "alpha" || ${ARCH} == "sparc64" || \
    ${ARCH} == "amd64" || ${ARCH} == "ia64")
# set bitsToBuild to 64
CONFIGURE_ARGS+=    -b 64
SAMPLES_CONFIG_ARGS+=   -b 64
.endif

.if ! ${PORT_OPTIONS:MTHREADS}
CONFIGURE_ARGS+=    -r none
.else
CONFIGURE_ENV+=     PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
            PTHREAD_LIBS="${PTHREAD_LIBS}"
.endif

XERCESC_LIB_VERSION=    ${PORTVERSION:S/.//:R}
XERCESC_LIB=        libxerces-c.so.${PORTVERSION:S/.//}
XERCESC_DEPDOM_LIB= libxerces-depdom.so.${PORTVERSION:S/.//}
PLIST_SUB+=     XERCESC_LIB=${XERCESC_LIB} \
            XERCESC_DEPDOM_LIB=${XERCESC_DEPDOM_LIB} \
            XERCESC_LIB_VERSION=${XERCESC_LIB_VERSION}

.if ${PORT_OPTIONS:MEXAMPLES}
ALL_TARGET?=    all samples
XERCES_BINS?=   CreateDOMDocument DOMCount DOMPrint EnumVal MemParse PParse \
        PSVIWriter Redirect SAX2Count SAX2Print SAXCount SAXPrint \
        SCMPrint SEnumVal StdInParse
SAMPLES_CONFIG_ARGS+=   -p freebsd -c ${CC} -x ${CXX}
.if ! ${PORT_OPTIONS:MTHREADS}
SAMPLES_CONFIG_ARGS+=   -r none
.else
SAMPLES_CONFIG_ARGS+=   -r pthread
SAMPLES_CONFIG_ENV+=    PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
            PTHREAD_LIBS="${PTHREAD_LIBS}"
.endif
.endif

.if ${PORT_OPTIONS:MDOCS}
PORTDOCS=   *
.endif

post-patch:
    @${REINPLACE_CMD} -e 's#CP = -cp -p#CP = -cp#'  \
        ${WRKSRC}/src/xercesc/Makefile.incl
    @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' \
        ${WRKSRC}/src/xercesc/Makefile.incl \
        ${WRKSRC}/src/xercesc/runConfigure
    @${SED} -i '' 's| /\* argV\[\] \*/|* argV|' \
        ${WRKSRC}/samples/CreateDOMDocument/CreateDOMDocument.cpp

pre-configure:
    @${CHMOD} 700 ${CONFIGURE_WRKSRC}/runConfigure
    @${CHMOD} 700 ${CONFIGURE_WRKSRC}/configure

post-configure:
.if ${PORT_OPTIONS:MEXAMPLES}
.if defined(TRANSCODER) && (${TRANSCODER} == "icu")
    @(cd ${WRKSRC}/samples && \
        ${SETENV} \
        XERCESCROOT=${WRKSRC} \
        ICUROOT=${ICUROOT} \
        LDFLAGS="-L${LOCALBASE}/lib" \
        ${SAMPLES_CONFIG_ENV} \
        ${SH} runConfigure ${SAMPLES_CONFIG_ARGS})
.else
    @(cd ${WRKSRC}/samples && \
        ${SETENV} \
        XERCESCROOT=${WRKSRC} \
        ${SAMPLES_CONFIG_ENV} \
        ${SH} runConfigure ${SAMPLES_CONFIG_ARGS})
.endif
.endif

post-install:
.if ${PORT_OPTIONS:MDOCS}
    @${MKDIR} ${DOCSDIR}
    @${CP} -r ${WRKSRC}/doc/ ${DOCSDIR}
.endif
.if ${PORT_OPTIONS:MEXAMPLES}
    @${MKDIR} ${EXAMPLESDIR}
.for i in ${XERCES_BINS} data
    @${CP} -r ${WRKSRC}/samples/$i ${EXAMPLESDIR}
.endfor
.for i in ${XERCES_BINS}
    @${INSTALL_PROGRAM} ${WRKSRC}/bin/$i ${PREFIX}/bin
.endfor
.endif

.include <bsd.port.mk>