aboutsummaryrefslogtreecommitdiffstats
path: root/lang/neko/Makefile
blob: 4468b99703479f54fd87f5cbd88f3dd99ff3fc75 (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
# Created by: Masanori OZAWA (ozawa@ongs.co.jp)
# $FreeBSD$

PORTNAME=   neko
PORTVERSION=    2.0.0
PORTREVISION=   2
CATEGORIES= lang
MASTER_SITES=   http://nekovm.org/_media/

MAINTAINER= ozawa@ongs.co.jp
COMMENT=    The Neko Programming Language

LIB_DEPENDS=    gc-threaded.1:${PORTSDIR}/devel/boehm-gc-threaded

ONLY_FOR_ARCHS= i386 amd64

USES=       dos2unix gmake pkgconfig
USE_AUTOTOOLS=  libtool:env
MAKE_JOBS_UNSAFE=   yes
DOS2UNIX_REGEX= .*(Makefile|\.(c|h|neko|nml))$$

OPTIONS_DEFINE=     APACHE MYSQL SQLITE PCRE GTK2
OPTIONS_DEFAULT=    PCRE GTK2

OPTIONS_SINGLE=     MYSQL
OPTIONS_SINGLE_MYSQL=   MYSQL4 MYSQL5

MYSQL4_DESC=        Build against MySQL 4.1
MYSQL5_DESC=        Build against MySQL 5.1

NO_STAGE=   yes
.include <bsd.port.options.mk>

CFLAGS+=    -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib
LIBKEYNAME+=    mod_neko mod_tora

.if ${PORT_OPTIONS:MAPACHE}
USE_APACHE= 22
CFLAGS+=    -I${LOCALBASE}/include/apache22
PLIST_SUB+= APACHE22=""
.else
LIBKEYNAME+=    mod_neko2 mod_tora2
PLIST_SUB+= APACHE22="@comment "
.endif

.if ${PORT_OPTIONS:MMYSQL4}
USE_MYSQL=  41
CFLAGS+=    -I${LOCALBASE}/include/mysql
PLIST_SUB+= MYSQL4=""
.else
LIBKEYNAME+=    mysql
PLIST_SUB+= MYSQL4="@comment "
.endif

.if ${PORT_OPTIONS:MMYSQL5}
USE_MYSQL=  51
CFLAGS+=    -I${LOCALBASE}/include/mysql
PLIST_SUB+= MYSQL5=""
.else
LIBKEYNAME+=    mysql5
PLIST_SUB+= MYSQL5="@comment "
.endif

.if ${PORT_OPTIONS:MSQLITE}
USE_SQLITE= yes
PLIST_SUB+= SQLITE3=""
.else
LIBKEYNAME+=    sqlite
PLIST_SUB+= SQLITE3="@comment "
.endif

.if ${PORT_OPTIONS:MPCRE}
LIB_DEPENDS+=   pcre:${PORTSDIR}/devel/pcre
PLIST_SUB+= PCRE=""
.else
LIBKEYNAME+=    regexp
PLIST_SUB+= PCRE="@comment "
.endif

.if ${PORT_OPTIONS:MGTK2}
USE_GNOME=  gtk20
PLIST_SUB+= GTK2=""
.else
LIBKEYNAME+=    ui
PLIST_SUB+= GTK2="@comment "
.endif

.if ${ARCH} == "amd64"
CFLAGS+=    -D_64BITS -fPIC
.endif

post-patch:
    @${REINPLACE_CMD} \
        -e '/INSTALL_PREFIX/s,/usr/local,${PREFIX},' \
        -e '/^CFLAGS =/s,.$$, ${CFLAGS},' \
        -e '/LIBNEKO_LIBS =/s,[-]ldl,${LDFLAGS},' \
        -e '/LIBNEKO_LIBS =/s,[-]lgc,-lgc-threaded,' \
        -e '/NEKOVM_FLAGS =/s,[-]lneko,-L${LOCALBASE}/lib -lneko -lgc-threaded,' \
        -e '/mkdir/s,\(INSTALL_PREFIX[}]/include\),\1/neko,' \
        -e '/cp vm[/]neko[*][.]h/s,\(INSTALL_PREFIX[}]/include\),\1/neko,' \
        ${WRKSRC}/Makefile
    @${REINPLACE_CMD} \
        -e '/^[#]   include/s,wait.h,sys/wait.h,' \
        ${WRKSRC}/libs/std/process.c
    @${REINPLACE_CMD} \
        -e '/^linkcmd =/s,"ld",cc,' \
        -e 's/= readline[(][)];/= "s";/' \
        -e 's,/usr/local/include,${PREFIX}/include,' \
        -e 's,/usr/local/lib,${PREFIX}/lib,' \
        ${WRKSRC}/src/tools/install.neko
.if !empty(LIBKEYNAME)
.for LKN in ${LIBKEYNAME}
    @${REINPLACE_CMD} \
        -e '/^  ${LKN} =[>]/,/^ [}][,]\{0,1\}.$$/d' \
        ${WRKSRC}/src/tools/install.neko
.endfor
.endif
.if ${PORT_OPTIONS:MAPACHE}
    @${REINPLACE_CMD} \
        -e 's,"/usr/include/apache2","${PREFIX}/include/apache22",' \
        ${WRKSRC}/src/tools/install.neko
.endif
.if ${PORT_OPTIONS:MGTK2}
    @${REINPLACE_CMD} \
        -e 's,"/usr/include/gtk-2.0","${PREFIX}/include/gtk-2.0",' \
        ${WRKSRC}/src/tools/install.neko
    @${REINPLACE_CMD} \
        -e 's,NEKO_LINUX,NEKO_BSD,' ${WRKSRC}/libs/ui/ui.c
.endif
.if ${ARCH} == "amd64" && ${PORT_OPTIONS:MMYSQL4}
    @${ECHO_CMD}
    @${ECHO_CMD} "======================================================="
    @${ECHO_CMD}
    @${ECHO_CMD} " Notice: When not building MYSQL with 'CFLAGS+=-fPIC'"
    @${ECHO_CMD} " first, It fails in building of a MYSQL module."
    @${ECHO_CMD}
    @${ECHO_CMD} "======================================================="
    @${ECHO_CMD}
.endif

post-install:
.if ${PORT_OPTIONS:MAPACHE}
    @${ECHO_CMD}
    @${ECHO_CMD} "======================================================="
    @${ECHO_CMD}
    @${ECHO_CMD} " If you want to use Apache with mod_neko, you need "
    @${ECHO_CMD} " edit the Apache configuration files."
    @${ECHO_CMD} " Please see 'http://nekovm.org/doc/mod_neko' for details."
    @${ECHO_CMD}
    @${ECHO_CMD} "======================================================="
    @${ECHO_CMD}
.endif

.include <bsd.port.mk>