summaryrefslogtreecommitdiff
path: root/development/luajit
diff options
context:
space:
mode:
authorAndrew Tkalia <anddt@yandex.ru>2013-06-30 00:05:59 -0500
committerErik Hanson <erik@slackbuilds.org>2013-06-30 00:17:07 -0500
commit4bbe59cb3e2695c3d4526cdb2797fb5bb289bb65 (patch)
treea17b46acbcb348f15a127dde6728d1e4c318150e /development/luajit
parent69646a8cc504ff506d5be8d7a150d5163fd53d08 (diff)
downloadslackbuilds-4bbe59cb3e2695c3d4526cdb2797fb5bb289bb65.tar.gz
development/luajit: Added (just-in-time compiler for Lua)
Signed-off-by: Erik Hanson <erik@slackbuilds.org>
Diffstat (limited to 'development/luajit')
-rw-r--r--development/luajit/README1
-rw-r--r--development/luajit/luajit.SlackBuild100
-rw-r--r--development/luajit/luajit.info10
-rw-r--r--development/luajit/slack-desc19
-rw-r--r--development/luajit/v2.0.1_hotfix1.patch103
5 files changed, 233 insertions, 0 deletions
diff --git a/development/luajit/README b/development/luajit/README
new file mode 100644
index 0000000000..dff3753145
--- /dev/null
+++ b/development/luajit/README
@@ -0,0 +1 @@
+LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
diff --git a/development/luajit/luajit.SlackBuild b/development/luajit/luajit.SlackBuild
new file mode 100644
index 0000000000..ca833231c1
--- /dev/null
+++ b/development/luajit/luajit.SlackBuild
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+# Slackware build script for luajit
+
+# Copyright 2013, Andrew Tkalia <anddt@yandex.ru>, Ukraine, Kyiv
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=luajit
+VERSION=2.0.1
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf LuaJIT-$VERSION
+tar zxvf $CWD/LuaJIT-$VERSION.tar.gz
+cd LuaJIT-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+patch -p1 < $CWD/v2.0.1_hotfix1.patch
+
+make \
+ PREFIX=/usr \
+ INSTALL_LIB=/usr/lib${LIBDIRSUFFIX} \
+ INSTALL_MAN=/usr/man/man1
+
+make install \
+ DESTDIR=$PKG \
+ PREFIX=/usr \
+ INSTALL_LIB=$PKG/usr/lib${LIBDIRSUFFIX} \
+ INSTALL_MAN=$PKG/usr/man/man1
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ doc/* COPYRIGHT README \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/development/luajit/luajit.info b/development/luajit/luajit.info
new file mode 100644
index 0000000000..bedba91fd3
--- /dev/null
+++ b/development/luajit/luajit.info
@@ -0,0 +1,10 @@
+PRGNAM="luajit"
+VERSION="2.0.1"
+HOMEPAGE="http://luajit.org/"
+DOWNLOAD="http://luajit.org/download/LuaJIT-2.0.1.tar.gz http://luajit.org/download/v2.0.1_hotfix1.patch"
+MD5SUM="85e406e8829602988eb1233a82e29f1f 5186c5901e37679a3c835d7b7cdac88e"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="lua"
+MAINTAINER="Andrew Tkalia"
+EMAIL="anddt@yandex.ru"
diff --git a/development/luajit/slack-desc b/development/luajit/slack-desc
new file mode 100644
index 0000000000..e5b855ef18
--- /dev/null
+++ b/development/luajit/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+luajit: luajit (just-in-time compiler for Lua)
+luajit:
+luajit: LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming
+luajit: language.
+luajit:
+luajit:
+luajit:
+luajit:
+luajit:
+luajit: Project Homepage: http://luajit.org/
+luajit:
diff --git a/development/luajit/v2.0.1_hotfix1.patch b/development/luajit/v2.0.1_hotfix1.patch
new file mode 100644
index 0000000000..0601cd9845
--- /dev/null
+++ b/development/luajit/v2.0.1_hotfix1.patch
@@ -0,0 +1,103 @@
+Add missing GC steps for io.* functions.
+MIPS: Fix cache flush/sync for JIT-compiled code jump area.
+ARM: Fix cache flush/sync for exit stubs of JIT-compiled code.
+Fix MSVC intrinsics for older versions.
+Fix memory access check for fast string interning.
+
+--- a/src/lib_io.c
++++ b/src/lib_io.c
+@@ -17,6 +17,7 @@
+ #include "lualib.h"
+
+ #include "lj_obj.h"
++#include "lj_gc.h"
+ #include "lj_err.h"
+ #include "lj_str.h"
+ #include "lj_state.h"
+@@ -152,6 +153,7 @@ static int io_file_readline(lua_State *L, FILE *fp, MSize chop)
+ if (n >= m - 64) m += m;
+ }
+ setstrV(L, L->top++, lj_str_new(L, buf, (size_t)n));
++ lj_gc_check(L);
+ return (int)ok;
+ }
+
+@@ -163,6 +165,7 @@ static void io_file_readall(lua_State *L, FILE *fp)
+ n += (MSize)fread(buf+n, 1, m-n, fp);
+ if (n != m) {
+ setstrV(L, L->top++, lj_str_new(L, buf, (size_t)n));
++ lj_gc_check(L);
+ return;
+ }
+ }
+@@ -174,6 +177,7 @@ static int io_file_readlen(lua_State *L, FILE *fp, MSize m)
+ char *buf = lj_str_needbuf(L, &G(L)->tmpbuf, m);
+ MSize n = (MSize)fread(buf, 1, m, fp);
+ setstrV(L, L->top++, lj_str_new(L, buf, (size_t)n));
++ lj_gc_check(L);
+ return (n > 0 || m == 0);
+ } else {
+ int c = getc(fp);
+--- a/src/lj_asm_arm.h
++++ b/src/lj_asm_arm.h
+@@ -91,6 +91,7 @@ static MCode *asm_exitstub_gen(ASMState *as, ExitNo group)
+ *mxp++ = group*EXITSTUBS_PER_GROUP;
+ for (i = 0; i < EXITSTUBS_PER_GROUP; i++)
+ *mxp++ = ARMI_B|((-6-i)&0x00ffffffu);
++ lj_mcode_sync(as->mcbot, mxp);
+ lj_mcode_commitbot(as->J, mxp);
+ as->mcbot = mxp;
+ as->mclim = as->mcbot + MCLIM_REDZONE;
+--- a/src/lj_asm_mips.h
++++ b/src/lj_asm_mips.h
+@@ -71,6 +71,7 @@ static void asm_sparejump_setup(ASMState *as)
+ memset(mxp+2, 0, MIPS_SPAREJUMP*8);
+ mxp += MIPS_SPAREJUMP*2;
+ lua_assert(mxp < as->mctop);
++ lj_mcode_sync(as->mcbot, mxp);
+ lj_mcode_commitbot(as->J, mxp);
+ as->mcbot = mxp;
+ as->mclim = as->mcbot + MCLIM_REDZONE;
+--- a/src/lj_def.h
++++ b/src/lj_def.h
+@@ -243,17 +243,17 @@ static LJ_AINLINE uint32_t lj_getu32(const void *p)
+ #endif
+
+ #ifdef _M_PPC
+-#pragma intrinsic(_CountLeadingZeros)
+ unsigned int _CountLeadingZeros(long);
++#pragma intrinsic(_CountLeadingZeros)
+ static LJ_AINLINE uint32_t lj_fls(uint32_t x)
+ {
+ return _CountLeadingZeros(x) ^ 31;
+ }
+ #else
+-#pragma intrinsic(_BitScanForward)
+-#pragma intrinsic(_BitScanReverse)
+ unsigned char _BitScanForward(uint32_t *, unsigned long);
+ unsigned char _BitScanReverse(uint32_t *, unsigned long);
++#pragma intrinsic(_BitScanForward)
++#pragma intrinsic(_BitScanReverse)
+
+ static LJ_AINLINE uint32_t lj_ffs(uint32_t x)
+ {
+--- a/src/lj_str.c
++++ b/src/lj_str.c
+@@ -48,7 +48,7 @@ static LJ_AINLINE int str_fastcmp(const char *a, const char *b, MSize len)
+ {
+ MSize i = 0;
+ lua_assert(len > 0);
+- lua_assert((((uintptr_t)a + len) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4);
++ lua_assert((((uintptr_t)a+len-1) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4);
+ do { /* Note: innocuous access up to end of string + 3. */
+ uint32_t v = lj_getu32(a+i) ^ *(const uint32_t *)(b+i);
+ if (v) {
+@@ -121,7 +121,7 @@ GCstr *lj_str_new(lua_State *L, const char *str, size_t lenx)
+ h ^= b; h -= lj_rol(b, 16);
+ /* Check if the string has already been interned. */
+ o = gcref(g->strhash[h & g->strmask]);
+- if (LJ_LIKELY((((uintptr_t)str + len) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4)) {
++ if (LJ_LIKELY((((uintptr_t)str+len-1) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4)) {
+ while (o != NULL) {
+ GCstr *sx = gco2str(o);
+ if (sx->len == len && str_fastcmp(str, strdata(sx), len) == 0) {