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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244 | $ cat neko-1.8.1.ebuild
# Copyright 2006-2007 Daniel Fischer, Danny Wilson
# Distributed under the terms of the GNU General Public License v2
# $Header: $
# NOTE: neko's install.n checks for availability of optional libraries,
# prompting the user for a path if the library is not found.
# We disable this checking (with patch), and care for availability
# by using dependencies. The .ndlls will be built if the dependency
# is installed, but themselves installed only if the respecive
# USE flag is set.
inherit eutils depend.apache
DESCRIPTION="Intermediate programming language, compiler, and virtual machine."
HOMEPAGE="http://nekovm.org/"
SRC_URI="http://nekovm.org/_media/${P}.tar.gz"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="-sqlite -mysql -apache2 -gtk"
RDEPEND="
>=dev-libs/boehm-gc-6.6
>=dev-libs/libpcre-4.4
>=sys-libs/zlib-1.2.3
sqlite? ( >=dev-db/sqlite-3.2.1-r3 )
mysql? ( >=dev-db/mysql-5.0.44-r1 )
gtk? ( >=x11-libs/gtk+-2.10.9 )
"
DEPEND="${RDEPEND}
>=dev-lang/ocaml-2.08.3
gtk? ( >=dev-util/pkgconfig-0.21-r1 )
"
want_apache2
# FWICT, the neko/nekoc binaries contain the std library,
# so stripping them would deprive them of their runtime environment.
RESTRICT="strip nomirror"
pkg_setup() {
if !(built_with_use dev-libs/boehm-gc threads);
then
eerror "Cannot proceed: dev-libs/boehm-gc needs to be compiled with threads support!"
eerror "Try USE=\"threads\" emerge boehm-gc"
die
fi
if use_apache2 && (built_with_use www-servers/apache threads);
then
eerror "Cannot proceed: www-servers/apache needs to be compiled WITHOUT threads support!"
eerror "Try USE=\"-threads\" emerge apache"
die
fi
}
src_unpack() {
unpack ${A}
cd ${S}
epatch ${FILESDIR}/${P}-gentoo.patch
epatch ${FILESDIR}/${P}-64bit.patch
epatch ${FILESDIR}/${P}-mysql_fpic.patch
}
src_compile() {
sed -i -e "s:-Wall -O3:${CFLAGS}:" Makefile || die "CFLAGS Makefile 'sed' fix failed :'-( ..."
sed -i -e "s:-O3 :${CFLAGS} :" src/tools/install.neko || die "CFLAGS install.neko 'sed' fix failed :'-( ..."
emake -j1 || die "emake failed"
}
src_install() {
exeinto /usr/bin
doexe bin/{neko,nekoc,nekoml,nekotools}
dolib.so bin/libneko.so
insinto /usr/lib/neko
doins bin/{std,regexp,zlib}.ndll
if use sqlite ; then
doins bin/sqlite.ndll
fi
if use mysql ; then
doins bin/mysql.ndll
fi
if use gtk ; then
doins bin/ui.ndll
fi
if use apache2 ; then
insinto ${APACHE_MODULESDIR}
doins bin/mod_neko2.ndll
insinto ${APACHE_MODULES_CONFDIR}
doins ${FILESDIR}/50_mod_neko.conf
fi
insinto /usr/include/neko
doins vm/neko.h
doenvd ${FILESDIR}/50neko
}
$ cat files/neko-1.8.1-64bit.patch
diff -ur neko-1.8.1-orig/Makefile neko-1.8.1/Makefile
--- neko-1.8.1-orig/Makefile 2009-12-13 13:23:11.000000000 -0600
+++ neko-1.8.1/Makefile 2009-12-13 13:45:20.000000000 -0600
@@ -22,10 +22,10 @@
#
# OSX_UNIVERSAL = 1
-
-# For 64 bit
-#
-# CFLAGS += -D_64BITS
+$(info Hmm: $(shell $(CC) -dumpmachine))
+ifeq ($(shell $(CC) -dumpmachine),x86_64-pc-linux-gnu)
+CFLAGS += -D_64BITS
+endif
# For profiling VM
#
$ cat files/neko-1.8.1-gentoo.patch
diff -ur neko-1.8.1-orig/Makefile neko-1.8.1/Makefile
--- neko-1.8.1-orig/Makefile 2009-12-12 21:26:44.000000000 -0600
+++ neko-1.8.1/Makefile 2009-12-12 21:30:07.000000000 -0600
@@ -7,6 +7,7 @@
MAKESO = $(CC) -shared -WBsymbolic
LIBNEKO_NAME = libneko.so
LIBNEKO_LIBS = -ldl -lgc -lm
+LIBNEKO_FLAGS = -Wl,-soname,libneko.so
NEKOVM_FLAGS = -Lbin -lneko
STD_NDLL_FLAGS = ${NEKOVM_FLAGS}
INSTALL_FLAGS =
@@ -117,7 +118,7 @@
(cd src; ${NEKO_EXEC} nekoc -link ../boot/nekoml.n nekoml/Main)
bin/${LIBNEKO_NAME}: ${LIBNEKO_OBJECTS}
- ${MAKESO} ${EXTFLAGS} -o $@ ${LIBNEKO_OBJECTS} ${LIBNEKO_LIBS}
+ ${MAKESO} ${LIBNEKO_FLAGS} ${EXTFLAGS} -o $@ ${LIBNEKO_OBJECTS} ${LIBNEKO_LIBS}
bin/neko: $(VM_OBJECTS)
${CC} ${CFLAGS} ${EXTFLAGS} -o $@ ${VM_OBJECTS} ${NEKOVM_FLAGS}
diff -ur neko-1.8.1-orig/src/tools/install.neko neko-1.8.1/src/tools/install.neko
--- neko-1.8.1-orig/src/tools/install.neko 2009-12-12 21:26:44.000000000 -0600
+++ neko-1.8.1/src/tools/install.neko 2009-12-12 21:30:42.000000000 -0600
@@ -39,11 +39,6 @@
// LIBS DATAS
libs = {
- mod_neko => {
- src => $array("../../vm/stats","mod_neko","cgi"),
- inc => "httpd.h",
- incname => "Apache 1.3.x"
- },
mod_neko2 => {
src => $array("../../vm/stats","mod_neko","cgi"),
inc => $array("httpd.h","apr.h"),
@@ -213,33 +208,6 @@
return arr2;
}
-readline = function() {
- $print("> ");
- var b = buffer_new();
- do {
- var c = read_char(stdin);
- if( c == 10 )
- break;
- buffer_add_char(b,c);
- } while(true);
- return buffer_string(b);
-}
-
-request_include = function(incl) {
- var s = readline();
- if( s == "s" )
- return null;
- return append(incl,s);
-}
-
-request_lib = function() {
- var s = readline();
- if( s == "s" )
- return false;
- libraries = append(libraries,s);
- return true;
-}
-
find_file = function(f,arr) {
var i = 0;
while( i < $asize(arr) ) {
@@ -310,13 +278,9 @@
loop_include = function(data,i,incl) {
var dir;
- while( (dir = find_file(data.inc[i],incl)) == null ) {
- $print("The file "+data.inc[i]+" provided when installing "+data.incname+" was not found\n");
- $print("Please enter a valid include path to look for it\n");
- $print("Or 's' to skip this library\n");
- incl = request_include(incl);
- if( incl == null )
- return null;
+ if( (dir = find_file(data.inc[i],incl)) == null ) {
+ $print("The file "+data.inc[i]+" provided when installing "+data.incname+" was not found (ignored)\n");
+ return null;
}
return dir;
}
@@ -341,12 +305,9 @@
if( linklib == null )
linklib = "";
else {
- while( (dir = find_file(linklib,libraries)) == null ) {
- $print("The file "+linklib+" provided when installing "+data.incname+" was not found\n");
- $print("Please enter a valid include path to look for it\n");
- $print("Or 's' to skip this library\n");
- if( $not(request_lib()) )
- return;
+ if( (dir = find_file(linklib,libraries)) == null ) {
+ $print("The file "+linklib+" provided when installing "+data.incname+" was not found (ignored)\n");
+ return;
}
linklib = dir + "/" + linklib;
}
$ cat files/neko-1.8.1-mysql_fpic.patch
diff -ur neko-1.8.1-orig/src/tools/install.neko neko-1.8.1/src/tools/install.neko
--- neko-1.8.1-orig/src/tools/install.neko 2009-12-13 13:23:11.000000000 -0600
+++ neko-1.8.1/src/tools/install.neko 2009-12-13 15:08:44.000000000 -0600
@@ -51,7 +51,7 @@
src => $array("mysql"),
inc => "mysql.h",
incname => "MySQL 4.+"
- lib => "libmysqlclient_r.a",
+ lib => "libmysqlclient_r.so",
lparams => "-lz -lssl"
},
mysql5 => {
|