Prune devel/py-EnthoughtBase
[dports.git] / devel / pcre / Makefile
1 # Created by: dom
2 # $FreeBSD$
3
4 PORTNAME=       pcre
5 PORTVERSION=    8.37
6 PORTREVISION=   4
7 CATEGORIES=     devel
8 MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}/${PORTVERSION} \
9                 ftp://ftp.csx.cam.ac.uk/pub/software/programming/${PORTNAME}/ \
10                 ftp://ftp.fu-berlin.de/unix/misc/${PORTNAME}/ \
11                 ftp://ftp.tin.org/pub/libs/${PORTNAME}/
12
13 MAINTAINER=     bf@FreeBSD.org
14 COMMENT=        Perl Compatible Regular Expressions library
15
16 LICENSE=        BSD3CLAUSE
17 LICENSE_FILE=   ${WRKSRC}/LICENCE
18
19 GNU_CONFIGURE=  yes
20 USES=           libtool pathfix tar:bzip2
21 USE_LDCONFIG=   yes
22 CONFIGURE_ARGS= --enable-utf --enable-unicode-properties \
23                 --enable-pcre8 --enable-pcre16 --enable-pcre32
24 INSTALL_TARGET= install-strip
25
26 OPTIONS_DEFINE=         DOCS STACK_RECURSION
27 OPTIONS_DEFAULT=        STACK_RECURSION
28 OPTIONS_RADIO=  CLI
29 OPTIONS_RADIO_CLI=      LIBEDIT READLINE
30
31 STACK_RECURSION_DESC=   Use the stack for recursion during matching
32
33 LIBEDIT_CONFIGURE_ENABLE=       pcretest-libedit
34 LIBEDIT_USES=                   libedit
35
36 READLINE_USES=                  readline
37 READLINE_CONFIGURE_ENABLE=      pcretest-libreadline
38
39 .include <bsd.port.options.mk>
40
41 .if ${ARCH} != "sparc64" && ${ARCH} != "ia64" && ${ARCH:Mmips64*} == ""
42 CONFIGURE_ARGS+=        --enable-jit
43 .else
44 CONFIGURE_ARGS+=        --disable-jit
45 .endif
46
47 .if ${PORT_OPTIONS:MDOCS}
48 PORTDOCS=       *
49 .endif
50
51 # Using the heap rather than the stack for recursion is slower but less
52 # prone to segfaults from stack exhaustion when matching certain patterns
53 .if !${PORT_OPTIONS:MSTACK_RECURSION}
54 CONFIGURE_ARGS+=        --disable-stack-for-recursion
55 .endif
56
57 # Optional knobs that accept positive integer parameters (see pcrebuild(3)):
58
59 # Allow the use of very large patterns (> 64K) with the 8- and 16-bit
60 # libraries, at the expense of longer load times (possible values:
61 # 2 (default), 3, and 4):
62 .if defined(WITH_LINK_SIZE)
63 CONFIGURE_ARGS+=        --with-link-size=${WITH_LINK_SIZE}
64 .endif
65
66 # Control PCRE resource use by limiting the default number of times pcre_exec()
67 # can call match() during a single operation (default: 10 million):
68 .if defined(WITH_MATCH_LIMIT)
69 CONFIGURE_ARGS+=        --with-match-limit=${WITH_MATCH_LIMIT}
70 .endif
71
72 # Control PCRE resource use by limiting the default number of times pcre_exec()
73 # can call match() recursively during a single operation (default: 10 million):
74 .if defined(WITH_MATCH_LIMIT_RECURSION)
75 CONFIGURE_ARGS+=        --with-match-limit-recursion=${WITH_MATCH_LIMIT_RECURSION}
76 .endif
77
78 # Control PCRE resource use by limiting the nesting depth of parentheses in
79 # patterns compiled with pcre_compile() (default: 250):
80 .if defined(WITH_PARENS_NEST_LIMIT)
81 CONFIGURE_ARGS+=        --with-parens-nest-limit=${WITH_PARENS_NEST_LIMIT}
82 .endif
83
84 # Adjust the default maximum number of substrings that will be stored on the stack
85 # when the 8-bit library is called via the POSIX interface (default: 10):
86 .if defined(WITH_POSIX_MALLOC_THRESHOLD)
87 CONFIGURE_ARGS+=        --with-posix-malloc-threshold=${WITH_POSIX_MALLOC_THRESHOLD}
88 .endif
89
90 post-patch:
91         @${REINPLACE_CMD} -e "/^\.rs/d" ${WRKSRC}/doc/*.3 ${WRKSRC}/doc/*.1
92         @${REINPLACE_CMD} -e "s/£//g" ${WRKSRC}/doc/pcre_compile2.3
93 .if !${PORT_OPTIONS:MDOCS}
94         @${REINPLACE_CMD} -E -e '/^install-data-am/,/^$$/ s,install-(dist_doc|dist_html|html)DATA,,g' \
95                 ${WRKSRC}/Makefile.in
96 .endif
97
98 #prevent regression test coredumps from causing failures on the
99 #package-building cluster:
100 .ifndef(MAINTAINER_MODE)
101 CORELIMIT?=     /usr/bin/limits -Sc 0
102 .endif
103 TESTLOGS?=      RunGrepTest RunTest pcre_jit_test pcre_scanner_unittest \
104                 pcre_stringpiece_unittest pcrecpp_unittest
105
106 post-stage:
107         ${LN} -s libpcre.so.1 ${STAGEDIR}${PREFIX}/lib/libpcre.so.3
108
109 check regression-test test: build
110         @cd ${WRKSRC} ; \
111         ${SETENV} ${MAKE_ENV} ${CORELIMIT} ${MAKE_CMD} ${MAKE_ARGS} check ; \
112         for _l in ${TESTLOGS} ; do if ${TEST} -f $${_l}.log ; then \
113         ${PRINTF} "\n\n$${_l}.log\n\n\n" ; ${CAT} $${_l}.log ; fi ; done
114
115 .include <bsd.port.mk>