This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
kepler-install-1.1.1-1
544 lines (457 loc) · 13.5 KB
/
kepler-install-1.1.1-1
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
#!/bin/bash
# Kepler installation script.
# Platform
WGET="wget -c -t0"
if [ "`echo ${OSTYPE%%[0-9]*}`" = "darwin" ]
then
WGET="curl -O --retry 10"
fi
# Defaults
PREFIX="/usr/local"
TMP="/tmp"
LUA_SUFFIX=""
BUILD_LUA="yes"
INSTALL_LUA="yes"
USE_READLINE="yes"
NCURSES_DIR="/usr"
READLINE_DIR="/usr"
LUA_DIR="/usr"
LUA_INCDIR="/usr/include"
LUA_LIBDIR="/usr/lib"
LUA_BINDIR="/usr/bin"
UNAME="`uname`"
if ! [ "$UNAME" = "Linux" -o "$UNAME" = "Darwin" -o "$UNAME" = "FreeBSD" ]
then
USE_READLINE=no
fi
LUA_VERSION=5.1.4
KEPLER_VERSION=0.4
LUAROCKS_URL=http://luaforge.net/frs/download.php/3981/luarocks-1.0.1.tar.gz
LUAROCKS_VERSION=1.0.1
KEPLER_ROCK_VERSION=1.1.1
SKIP_KEPLER=no
# Help
show_help() {
cat <<EOF
Kepler Installer version $KEPLER_VERSION.
Installs Lua $LUA_VERSION, LuaRocks $LUAROCKS_VERSION and Kepler $KEPLER_ROCK_VERSION.
--help This help.
--prefix=DIR Prefix where Lua should be installed.
Default is $PREFIX. Creates \$PREFIX/bin,
\$PREFIX/include, \$PREFIX/lib, \$PREFIX/share,
\$PREFIX/man, and \$PREFIX/kepler.
--include-dir=DIR Prefix where C header files should be installed.
Default is \$(PREFIX)/include
--tmp-dir=DIR Path for temporary files.
Default is $TMP.
--web-dir=DIR Document root for web server.
Default is \$PREFIX/kepler/htdocs.
--lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
(lua vs. lua5.1, liblua.a vs. liblua5.1.a...)
--with-readline=DIR Prefix where Readline is installed.
Used by Lua.
Default is $READLINE_DIR
--with-ncurses=DIR Prefix where NCurses is installed.
Used by Lua when Readline is enabled.
Default is $NCURSES_DIR
--without-readline Disable Readline support when building Lua.
--with-kepler=VERSION Installs the provided Kepler version instead
of Kepler $KEPLER_ROCK_VERSION
--without-kepler Does not install Kepler, just Lua and LuaRocks
EOF
}
# Parse options
while [ "$1" ]
do
value="`echo $1 | sed 's/.*=\(.*\)/\1/'`"
if echo "$value" | grep -q "~"
then
echo
echo '*WARNING*: the "~" sign is not expanded in flags.'
echo 'If you mean the home directory, use $HOME instead.'
echo
exit 1
fi
case "$1" in
--help)
show_help
exit 0
;;
--prefix=*)
PREFIX="$value"
PREFIX_SET=yes
;;
--tmp-dir=*)
TMP="$value"
TMP_SET=yes
;;
--web-dir=*)
WEB="$value"
WEB_SET=yes
;;
--include-dir=*)
INCLUDEDIR="$value"
INCLUDEDIR_SET=yes
;;
--lua-suffix=*)
LUA_SUFFIX="$value"
LUA_SUFFIX_SET=yes
;;
--with-readline=*)
READLINE_DIR="$value"
USE_READLINE=yes
;;
--with-ncurses=*)
NCURSES_DIR="$value"
;;
--with-kepler=*)
KEPLER_ROCK_VERSION="$value"
;;
--without-kepler*)
SKIP_KEPLER=yes
;;
--without-readline)
USE_READLINE=no
;;
*)
echo "Error: Unknown flag: $1"
exit 1
;;
esac
shift
done
echo "Kepler Installer version $KEPLER_VERSION."
if ! [ "$WEB_SET" = "yes" ]
then
WEB="$PREFIX/kepler/htdocs"
fi
if ! [ "$INCLUDEDIR_SET" = "yes" ]
then
INCLUDEDIR="$PREFIX/include"
fi
LUA_DIR="$PREFIX"
LUA_INCDIR="$INCLUDEDIR"
LUA_LIBDIR="$LUA_DIR/lib"
LUA_BINDIR="$LUA_DIR/bin"
echo
echo "The name of the Lua executable is lua$LUA_SUFFIX"
echo "Lua installation prefix: $PREFIX"
echo "Include files: $PREFIX/include"
if ! [ $SKIP_KEPLER = "yes" ]
then
echo "Document root: $WEB"
echo "Temporary files: $TMP"
echo
echo "Will create bin, etc, lib, share, man, kepler,"
echo "and rocks directories in $PREFIX"
fi
echo
echo "Proceed with setup? [Y/n] "
read YESNO
if [ "$YESNO" = "n" ]
then
echo "Setup aborted"
exit 1
fi
if [ "$YESNO" = "N" ]
then
echo "Setup aborted"
exit 1
fi
# External dependencies
test_package() {
package_keyword="$1"
package_name="$2"
with_flag="$3"
shift 3
if echo "$OPTIONAL_PACKAGES" | grep -q "$package_keyword"
then
echo -n "Checking $package_name... "
tried=""
while [ "$1" ]
do
test_file="$1"
if [ -e "$test_file" ]
then
echo "found: $test_file"
return 0
fi
tried="$tried $1"
shift
done
echo "not found:$tried"
echo
echo "Error: Could not verify the presence of $package_name."
echo "You may need to install development packages for $package_name."
if [ "$with_flag" ]
then
echo "If you are sure they are installed,"
echo "you can supply their location with $with_flag."
fi
echo "See --help for details."
exit 1
fi
}
if [ "$USE_READLINE" = "yes" ]
then
test_package "" "Readline" --with-readline $READLINE_DIR/include/readline/readline.h
if [ "$UNAME" = "Linux" ]
then
test_package "" "NCurses" --with-ncurses $NCURSES_DIR/include/ncurses.h
fi
fi
if [[ -f lua-$LUA_VERSION.tar.gz && -f luarocks-$LUAROCKS_VERSION.tar.gz && -d rocks ]]; then
echo "Installing Kepler from current directory..."
else
echo "Installing Kepler from the Net..."
mkdir -p $TMP/kepler-$KEPLER_VERSION && pushd $TMP/kepler-$KEPLER_VERSION
fi
cat <<EOF > Makefile
# This file was automatically generated by the configure script.
# Run "./configure --help" for details.
BUILD_LUA=$BUILD_LUA
INSTALL_LUA=$INSTALL_LUA
USE_READLINE=$USE_READLINE
PREFIX=$PREFIX
INCLUDEDIR=$INCLUDEDIR
LUA_SUFFIX=$LUA_SUFFIX
READLINE_DIR=$READLINE_DIR
NCURSES_DIR=$NCURSES_DIR
LUA_DIR=$LUA_DIR
LUA_INCDIR=$LUA_INCDIR
LUA_LIBDIR=$LUA_LIBDIR
LUA_BINDIR=$LUA_BINDIR
LUA_URL=http://www.lua.org/ftp
READLINE_LIBDIR=\$(READLINE_DIR)/lib
READLINE_INCLUDEDIR=\$(READLINE_DIR)/include
NCURSES_LIBDIR=\$(NCURSES_DIR)/lib
NCURSES_INCLUDEDIR=\$(NCURSES_DIR)/include
LUA_VERSION=$LUA_VERSION
PLATFORM_CFLAGS=-Wl,-E
PLATFORM_LDFLAGS=-lm -ldl
LIB_FLAG=-shared
ifeq (\$(shell uname -m | sed 's/i.86/i386/'),i386)
FPIC=
else
FPIC=-fpic
endif
LUA_LIB=\$(LUA_LIBDIR)/liblua\$(LUA_SUFFIX).a
LUA_DEFPATH=-DLUA_ROOT=\\\\\\"\$(LUA_DIR)\\\\\\"
ifeq (\$(USE_READLINE), yes)
LUA_READLINE_CFLAGS=-DLUA_USE_READLINE -I\$(READLINE_INCLUDEDIR)
LUA_READLINE_LIBS=-lreadline -lhistory -lncurses -L\$(READLINE_LIBDIR) -L\$(NCURSES_LIBDIR)
else
LUA_READLINE_CFLAGS=
LUA_READLINE_LIBS=
endif
LUA_MYCFLAGS=-DLUA_USE_POSIX -DLUA_USE_DLOPEN \$(LUA_READLINE_CFLAGS)
LUA_MYLIBS=\$(PLATFORM_CFLAGS) -ldl \$(LUA_READLINE_LIBS)
WGET=wget -c -t0
PLATFORM_BUILD=build
ifeq (\$(shell bash -c 'echo ${OSTYPE%%[0-9]*}'),darwin)
WGET=curl -O --retry 10
PLATFORM_BUILD=OSX-build
ifneq (\$(LUA_READLINE_LIBS),)
LUA_READLINE_LIBS=-lreadline -L\$(READLINE_LIBDIR)
endif
endif
ifeq (\$(shell uname -s),FreeBSD)
PLATFORM_BUILD=FreeBSD-build
endif
platform: \$(PLATFORM_BUILD)
OSX-build:
MACOSX_DEPLOYMENT_TARGET=10.3 \$(MAKE) \\
LUA_MYCFLAGS="-DLUA_USE_MACOSX \$(LUA_READLINE_CFLAGS)" \\
LUA_MYLIBS="\$(LUA_READLINE_LIBS)" \\
PLATFORM_CFLAGS="-dynamic" \\
PLATFORM_LDFLAGS="-lm -ldl" \\
LIB_FLAG="-bundle -undefined dynamic_lookup -all_load" \\
build
FreeBSD-build:
\$(MAKE) \\
LUA_MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" \\
LUA_MYLIBS="-Wl,-E" \\
PLATFORM_LDFLAGS="-lm" \\
build
LUA_TESTFILE=lua-\$(LUA_VERSION)/src/lua\$(LUA_SUFFIX)
fetch: lua-\$(LUA_VERSION)
lua-\$(LUA_VERSION).tar.gz:
\$(WGET) \$(LUA_URL)/\$@
lua-\$(LUA_VERSION):
\$(MAKE) lua-\$(LUA_VERSION).tar.gz
test -d \$@ || tar zxvpf lua-\$(LUA_VERSION).tar.gz
cd lua-\$(LUA_VERSION) && patch -p1 < ../lua-\$(LUA_VERSION)-easylua.diff
build: \$(LUA_TESTFILE)
\$(LUA_TESTFILE): lua-\$(LUA_VERSION)
cd lua-\$(LUA_VERSION) && \$(MAKE) \\
LUA_SUFFIX="\$(LUA_SUFFIX)" \\
INSTALL_INC="\$(LUA_INCDIR)" \\
MYCFLAGS="\$(LUA_DEFPATH) \$(LUA_MYCFLAGS)" \\
MYLIBS="\$(LUA_MYLIBS)" \\
CC="\$(CC)" \\
generic
install: build
cd lua-\$(LUA_VERSION) && \$(MAKE) \\
LUA_SUFFIX="\$(LUA_SUFFIX)" \\
INSTALL_INC="\$(LUA_INCDIR)" \\
INSTALL_TOP="\$(LUA_DIR)" \\
MYCFLAGS="\$(LUA_MYCFLAGS)" \\
MYLIBS="\$(LUA_MYLIBS)" \\
INSTALL_EXEC="install -p -m 0755" \\
INSTALL_DATA="install -p -m 0644" \\
STRIP="true" \\
install
clean:
if [ -d lua-\$(LUA_VERSION) ]; then \\
cd lua-\$(LUA_VERSION) && \$(MAKE) \\
LUA_SUFFIX="\$(LUA_SUFFIX)" \\
clean; \\
fi
klean:
rm -f lua-\$(LUA_VERSION).tar.gz
rm -rf lua-\$(LUA_VERSION)
rm -f Makefile
rm -f lua-\$(LUA_VERSION)-easylua.diff
EOF
cat <<EOF > lua-5.1.4-easylua.diff
diff -Naur lua-5.1.4-orig/Makefile lua-5.1.4/Makefile
--- lua-5.1.4-orig/Makefile 2007-03-25 11:44:39.000000000 -0300
+++ lua-5.1.4/Makefile 2007-05-11 16:08:02.000000000 -0300
@@ -41,10 +41,10 @@
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
# What to install.
-TO_BIN= lua luac
+TO_BIN= lua\$(LUA_SUFFIX) luac\$(LUA_SUFFIX)
TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-TO_LIB= liblua.a
-TO_MAN= lua.1 luac.1
+TO_LIB= liblua\$(LUA_SUFFIX).a
+TO_MAN= lua\$(LUA_SUFFIX).1 luac\$(LUA_SUFFIX).1
# Lua version and release.
V= 5.1
@@ -56,11 +56,15 @@
cd src && \$(MAKE) \$@
test: dummy
- src/lua test/hello.lua
+ src/lua\$(LUA_SUFFIX) test/hello.lua
install: dummy
- cd src && \$(MKDIR) \$(INSTALL_BIN) \$(INSTALL_INC) \$(INSTALL_LIB) \$(INSTALL_MAN) \$(INSTALL_LMOD) \$(INSTALL_CMOD)
+ cd src && \$(MKDIR) -p \$(INSTALL_BIN) \$(INSTALL_INC) \$(INSTALL_LIB) \$(INSTALL_MAN) \$(INSTALL_LMOD) \$(INSTALL_CMOD)
cd src && \$(INSTALL_EXEC) \$(TO_BIN) \$(INSTALL_BIN)
cd src && \$(INSTALL_DATA) \$(TO_INC) \$(INSTALL_INC)
cd src && \$(INSTALL_DATA) \$(TO_LIB) \$(INSTALL_LIB)
+ cp doc/lua.1 doc/t_lua.1
+ cp doc/luac.1 doc/t_luac.1
+ mv doc/t_lua.1 doc/lua\$(LUA_SUFFIX).1
+ mv doc/t_luac.1 doc/luac\$(LUA_SUFFIX).1
cd doc && \$(INSTALL_DATA) \$(TO_MAN) \$(INSTALL_MAN)
diff -Naur lua-5.1.4-orig/src/luaconf.h lua-5.1.4/src/luaconf.h
--- lua-5.1.4-orig/src/luaconf.h 2007-03-24 00:01:55.000000000 -0300
+++ lua-5.1.4/src/luaconf.h 2007-05-11 16:12:55.000000000 -0300
@@ -94,9 +94,11 @@
".\\\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
-#define LUA_ROOT "/usr/local/"
-#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
-#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
+#ifndef LUA_ROOT
+#define LUA_ROOT "/usr/local"
+#endif
+#define LUA_LDIR LUA_ROOT "/share/lua/5.1/"
+#define LUA_CDIR LUA_ROOT "/lib/lua/5.1/"
#define LUA_PATH_DEFAULT \\
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \\
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
diff -Naur lua-5.1.4-orig/src/Makefile lua-5.1.4/src/Makefile
--- lua-5.1.4-orig/src/Makefile 2007-03-25 11:49:23.000000000 -0300
+++ lua-5.1.4/src/Makefile 2007-05-11 16:08:02.000000000 -0300
@@ -22,17 +22,17 @@
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
-LUA_A= liblua.a
+LUA_A= liblua\$(LUA_SUFFIX).a
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \\
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \\
lundump.o lvm.o lzio.o
LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \\
lstrlib.o loadlib.o linit.o
-LUA_T= lua
+LUA_T= lua\$(LUA_SUFFIX)
LUA_O= lua.o
-LUAC_T= luac
+LUAC_T= luac\$(LUA_SUFFIX)
LUAC_O= luac.o print.o
ALL_O= \$(CORE_O) \$(LIB_O) \$(LUA_O) \$(LUAC_O)
@@ -93,7 +93,7 @@
\$(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline"
generic:
- \$(MAKE) all MYCFLAGS=
+ \$(MAKE) all
linux:
\$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
EOF
echo
echo
echo "========================================================="
echo "Installing Lua $LUA_VERSION on $PREFIX"
echo "========================================================="
echo
echo
if [ "`uname -s`" = "FreeBSD" ]
then
MAKE=gmake
else
MAKE=make
fi
$MAKE clean > /dev/null 2> /dev/null
$MAKE
$MAKE install
echo
echo "Done. Lua is installed on $PREFIX."
echo
echo
echo
echo "========================================================="
echo "Now installing LuaRocks $LUAROCKS_VERSION in $PREFIX."
echo "========================================================="
echo
echo
if [ $LUAROCKS_URL != "" ]
then
if [ ! -f luarocks-$LUAROCKS_VERSION.tar.gz ]; then
$WGET $LUAROCKS_URL
fi
tar zxvf luarocks-$LUAROCKS_VERSION.tar.gz
cd luarocks-$LUAROCKS_VERSION
else
cvs -d:pserver:[email protected]:/cvsroot/luarocks export -r HEAD luarocks
cd luarocks
fi
sh configure --prefix=$PREFIX --with-lua=$PREFIX \
--with-lua-include=$LUA_INCDIR \
--rocks-tree=$PREFIX && make && make install
cd ..
if ! [ $SKIP_KEPLER = "yes" ]
then
echo
echo
echo "========================================================="
echo "Now installing Kepler in $PREFIX."
echo "========================================================="
echo
if [ -d rocks ]; then
$PREFIX/bin/luarocks install kepler-xavante --only-from=./rocks $KEPLER_ROCK_VERSION KEPLER_WEB=$WEB
else
if [ "$KEPLER_ROCK_VERSION" = "cvs" ]
then
$PREFIX/bin/luarocks install --from=http://luarocks.luaforge.net/rocks-cvs kepler-xavante $KEPLER_ROCK_VERSION KEPLER_WEB=$WEB
else
$PREFIX/bin/luarocks install kepler-xavante $KEPLER_ROCK_VERSION KEPLER_WEB=$WEB
fi
fi
fi
echo
echo "Cleaning up..."
echo
if [ -d $TMP/kepler-$KEPLER_VERSION ]; then
popd && rm -rf $TMP/kepler-$KEPLER_VERSION
fi