aboutsummaryrefslogtreecommitdiffstats
path: root/lang/hiphop-php/Makefile
blob: a819fb65cc933bc99ecea21e167da679d26440c9 (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: Martin Matuska <mm@FreeBSD.org>
# $FreeBSD$

PORTNAME=   hiphop-php
PORTVERSION=    0.0.20120716
PORTREVISION=   5
CATEGORIES= lang devel www
MASTER_SITES=   https://github.com/facebook/hiphop-php/tarball/${GITVERSION}/:main \
        http://unicode.org/Public/UNIDATA/:unidata \
        http://unicode.org/Public/MAPPINGS/ISO8859/:mappings
DIST_SUBDIR=    hiphop-php
EXTRACT_ONLY=   ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}

PATCH_SITES=    http://cpp.in/dev/

MAINTAINER= mm@FreeBSD.org
COMMENT=    Hiphop PHP to C++ code transformer

LICENSE=    PHP301 ZEND200 UNICODE
LICENSE_COMB=   multi
LICENSE_NAME_UNICODE=   Unicode, Inc. License Agreement
LICENSE_NAME_ZEND200=   The Zend Engine License, version 2.00
LICENSE_FILE_PHP301=    ${WRKSRC}/LICENSE.PHP
LICENSE_FILE_UNICODE=   ${FILESDIR}/LICENSE.UNICODE
LICENSE_FILE_ZEND200=   ${WRKSRC}/LICENSE.ZEND
LICENSE_PERMS_UNICODE=  dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
LICENSE_PERMS_ZEND200=  dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
LICENSE_DISTFILES_PHP301=   ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}
LICENSE_DISTFILES_UNICODE= EastAsianWidth.txt \
    8859-1.TXT 8859-2.TXT 8859-3.TXT 8859-4.TXT 8859-5.TXT \
    8859-6.TXT 8859-7.TXT 8859-8.TXT 8859-9.TXT 8859-10.TXT \
    8859-11.TXT 8859-13.TXT 8859-14.TXT 8859-15.TXT 8859-16.TXT
LICENSE_DISTFILES_ZEND200=  ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}

LIB_DEPENDS=    icudata:${PORTSDIR}/devel/icu \
        boost_thread:${PORTSDIR}/devel/boost-libs \
        execinfo:${PORTSDIR}/devel/libexecinfo \
        tbb:${PORTSDIR}/devel/tbb \
        gd:${PORTSDIR}/graphics/gd \
        mcrypt:${PORTSDIR}/security/libmcrypt \
        onig:${PORTSDIR}/devel/oniguruma4 \
        pcre:${PORTSDIR}/devel/pcre \
        expat:${PORTSDIR}/textproc/expat2 \
        memcached:${PORTSDIR}/databases/libmemcached \
        c-client4:${PORTSDIR}/mail/cclient

OPTIONS_DEFINE= NLS
NLS_DESC=   Depend on gettext (required if binutils have NLS)

_EXTDIR=    share/hiphop-php/ext

BUILD_DEPENDS+= bison:${PORTSDIR}/devel/bison \
        flex:${PORTSDIR}/textproc/flex \
        re2c:${PORTSDIR}/devel/re2c \
        ${LOCALBASE}/${_EXTDIR}/lib/libevent.a:${PORTSDIR}/devel/libevent-hiphop \
        ${LOCALBASE}/${_EXTDIR}/lib/libcurl.a:${PORTSDIR}/ftp/curl-hiphop

RUN_DEPENDS+=   ${LOCALBASE}/${_EXTDIR}/lib/libevent.a:${PORTSDIR}/devel/libevent-hiphop \
        ${LOCALBASE}/${_EXTDIR}/lib/libcurl.a:${PORTSDIR}/ftp/curl-hiphop

WRKSRC=     ${WRKDIR}/facebook-hiphop-php-${GITVERSION}
MAKE_JOBS_UNSAFE=   yes

GNU_CONFIGURE=  yes
USE_CMAKE=  yes
USE_MYSQL=  yes
USE_GNOME=  libxml2
USE_OPENSSL=    yes
USE_OPENLDAP=   yes
USE_GETTEXT=    yes
USE_GCC=    4.4+

GITVERSION= 96532ec
FETCH_ARGS= -pRr

CUSTOM_ENV= HPHP_HOME=${WRKSRC} \
        HPHP_LIB=${WRKSRC}/bin \
        CMAKE_PREFIX_PATH=${WRKDIR}/libs

DISTFILES+= ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}:main \
        EastAsianWidth.txt:unidata \
        8859-1.TXT:mappings \
        8859-2.TXT:mappings \
        8859-3.TXT:mappings \
        8859-4.TXT:mappings \
        8859-5.TXT:mappings \
        8859-6.TXT:mappings \
        8859-7.TXT:mappings \
        8859-8.TXT:mappings \
        8859-9.TXT:mappings \
        8859-10.TXT:mappings \
        8859-11.TXT:mappings \
        8859-13.TXT:mappings \
        8859-14.TXT:mappings \
        8859-15.TXT:mappings \
        8859-16.TXT:mappings

PATCHFILES+=    hphp-freebsd-20120214.patch \
        hphp-libmemcached-1.0.patch

SUB_LIST+=  CC="${CC}" \
        CPP="${CPP}" \
        CXX="${CXX}" \
        HPHP_HOME="${DATADIR}" \
        HPHP="${DATADIR}/bin/hphp"

SUB_FILES+= hphp

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MNLS}
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-gettext
.endif

.include <bsd.port.pre.mk>

_CFLAGS=    ${CFLAGS}
_CXXFLAGS=  -rpath=${_GCC_RUNTIME} ${CXXFLAGS}
_LDFLAGS=   ${LDFLAGS}

CONFIGURE_ENV+= ${CUSTOM_ENV}
MAKE_ENV+=  ${CUSTOM_ENV}

post-extract:
    @${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/EastAsianWidth.txt \
        ${WRKSRC}/src/third_party/libmbfl/mbfl/
.for i in 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16
    @${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/8859-${i}.TXT \
        ${WRKSRC}/src/third_party/libmbfl/filters/
.endfor

post-patch:
    @${REINPLACE_CMD} -e 's|-levent|${WRKSRC}/libs/lib/libevent.a|g' \
        ${WRKSRC}/src/third_party/libafdt/configure
    @${REINPLACE_CMD} -e 's|-L$$(LIB_DIR)|${_LDFLAGS} -L$$(LIB_DIR)|g' \
        ${WRKSRC}/src/rules.mk
    @${REINPLACE_CMD} \
        -e 's|%%CURL_LIB%%|${LOCALBASE}/${_EXTDIR}/lib/libcurl.a|g' \
        -e 's|%%LIBEVENT_LIB%%|${LOCALBASE}/${_EXTDIR}/lib/libevent.a|g' \
        -e 's|%%CURL_INCLUDE_DIR%%|${LOCALBASE}/${_EXTDIR}/include|g' \
        -e 's|%%LIBEVENT_INCLUDE_DIR%%|${LOCALBASE}/${_EXTDIR}/include|g' \
        ${WRKSRC}/CMake/HPHPFindLibs.cmake
    @${REINPLACE_CMD} -e 's|%%CFLAGS%%|${_CFLAGS}|g' \
        -e 's|%%CXXFLAGS%%|${_CXXFLAGS}|g' \
        ${WRKSRC}/CMake/HPHPSetup.cmake
    @${REINPLACE_CMD} -e 's|LICENSE.PHP|src/version|g' \
        ${WRKSRC}/bin/CMakeLists.base.txt

do-install:
    @${MKDIR} ${DATADIR}/bin ${DATADIR}/src
    @${FIND} ${WRKSRC} -type f -name '*.orig' -exec ${RM} {} \;
    @${FIND} ${WRKSRC} -type f -name '*.bak' -exec ${RM} {} \;
    @${CP} -R ${WRKSRC}/CMake ${WRKSRC}/bin ${DATADIR}
    @${CP} -R ${WRKSRC}/src/runtime ${WRKSRC}/src/system \
        ${WRKSRC}/src/util  ${DATADIR}/src
    @${INSTALL_DATA} ${WRKSRC}/src/version ${DATADIR}/src/version
    @${INSTALL_PROGRAM} ${WRKSRC}/src/hphp/hphp ${DATADIR}/bin
    @${INSTALL_PROGRAM} ${WRKSRC}/src/hphpi/hphpi ${PREFIX}/bin/hphpi
    @${INSTALL_SCRIPT} ${WRKDIR}/hphp ${PREFIX}/bin/hphp

.include <bsd.port.post.mk>