summaryrefslogtreecommitdiff
path: root/lang/lua52
diff options
context:
space:
mode:
authorMatthias Andree <mandree@FreeBSD.org>2013-01-05 23:24:51 +0000
committerMatthias Andree <mandree@FreeBSD.org>2013-01-05 23:24:51 +0000
commitfdc96c8fdd81323a61cf294ebb9dbe8bd7152e52 (patch)
tree78fcc49a5557b6ba8ccbbee6d859de94c3368f8c /lang/lua52
parentConvert x11@ owned ports to OptionsNG. Thanks go to bapt@ for review and help (diff)
Add new port lang/lua52.
Lua is a programming language originally designed for extending applications, but also frequently used as a general-purpose, stand-alone language. Lua combines simple procedural syntax (similar to Pascal) with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, interpreted from bytecodes, and has automatic memory management with garbage collection, making it ideal for configuration, scripting, and rapid prototyping. A fundamental concept in the design of Lua is to provide meta-mechanisms for implementing features, instead of providing a host of features directly in the language. For example, although Lua is not a pure object-oriented language, it does provide meta-mechanisms for implementing classes and inheritance. Lua's meta-mechanisms bring an economy of concepts and keep the language small, while allowing the semantics to be extended in unconventional ways. Extensible semantics is a distinguishing feature of Lua. Lua is implemented as a small library of C functions, written in ANSI C, and compiles unmodified in all known platforms. The implementation goals are simplicity, efficiency, portability, and low embedding cost. WWW: http://www.lua.org/ PR: ports/174437 Submitted by: Green Dog <fiziologus@gmail.com>
Notes
Notes: svn path=/head/; revision=309973
Diffstat (limited to 'lang/lua52')
-rw-r--r--lang/lua52/Makefile74
-rw-r--r--lang/lua52/distinfo2
-rw-r--r--lang/lua52/files/patch-Makefile44
-rw-r--r--lang/lua52/files/patch-src__Makefile58
-rw-r--r--lang/lua52/files/patch-src__liolib.c10
-rw-r--r--lang/lua52/pkg-descr21
-rw-r--r--lang/lua52/pkg-plist29
7 files changed, 238 insertions, 0 deletions
diff --git a/lang/lua52/Makefile b/lang/lua52/Makefile
new file mode 100644
index 000000000000..03099690eb1e
--- /dev/null
+++ b/lang/lua52/Makefile
@@ -0,0 +1,74 @@
+# Created by: GreenDog <fiziologus@gmail.com>
+# $FreeBSD$
+
+PORTNAME= lua
+PORTVERSION= 5.2.1
+CATEGORIES= lang
+MASTER_SITES= http://www.lua.org/ftp/
+
+MAINTAINER= fisiologus@gmail.com
+COMMENT= Small, compilable scripting language providing easy access to C code
+
+LICENSE= MIT
+
+#USE_LUA= 5.2
+LUA_VER= 5.2
+LUA_VER_SH= 1
+LUA_VER_STR= 52
+LUA_SUBDIR= lua${LUA_VER_STR}
+LUA_PREFIX= ${PREFIX}
+LUA_BINDIR= ${LUA_PREFIX}/bin/${LUA_SUBDIR}
+LUA_INCDIR= ${LUA_PREFIX}/include/${LUA_SUBDIR}
+LUA_LIBDIR= ${LUA_PREFIX}/lib/${LUA_SUBDIR}
+LUA_MODLIBDIR= ${LUA_PREFIX}/lib/lua/${LUA_VER}
+LUA_MODSHAREDIR= ${LUA_PREFIX}/share/lua/${LUA_VER}
+
+ALL_TARGET= freebsd
+USE_LDCONFIG= yes
+MAKE_JOBS_SAFE= yes
+MAKE_ENV= LUA_SONAME="liblua-${LUA_VER}.so.${LUA_VER_SH}" \
+ MYCFLAGS="${CFLAGS}" MYLDFLAGS="${LDFLAGS}"
+# liblua.so requires libm, so make sure it has an explicit dependency
+# so that applications need not second-guess lua's dependencies.
+LDFLAGS+= -lm
+
+MAN1= lua-${LUA_VER}.1 luac-${LUA_VER}.1
+DOCSDIR= ${PREFIX}/share/doc/${LUA_SUBDIR}
+LATEST_LINK= ${LUA_SUBDIR}
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "amd64" || ${ARCH} == "powerpc"
+CFLAGS+= -fPIC
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -Ee \
+ "s|%%LUA_PREFIX%%|${LUA_PREFIX}| ; \
+ s|%%LUA_BINDIR%%|${LUA_BINDIR}| ; \
+ s|%%LUA_INCDIR%%|${LUA_INCDIR}| ; \
+ s|%%LUA_LIBDIR%%|${LUA_LIBDIR}| ; \
+ s|%%LUA_MODSHAREDIR%%|${LUA_MODSHAREDIR}| ; \
+ s|%%LUA_MODLIBDIR%%|${LUA_MODLIBDIR}| ; \
+ s|%%LUA_VER_SH%%|${LUA_VER_SH}|" \
+ ${WRKSRC}/Makefile
+ @${REINPLACE_CMD} -e 's,rand *(,random(,g' \
+ ${WRKSRC}/src/lmathlib.c
+ @${REINPLACE_CMD} -e "/LUA_ROOT/s|/usr/local|${LUA_PREFIX}|" \
+ ${WRKSRC}/src/luaconf.h
+
+post-install:
+.for f in lua luac
+ ${LN} -sf ${LUA_BINDIR}/${f} ${PREFIX}/bin/${f}-${LUA_VER}
+.endfor
+ ${LN} -sf ${LUA_LIBDIR}/liblua-${LUA_VER}.so.${LUA_VER_SH} ${LUA_LIBDIR}/liblua.so
+ ${LN} -sf ${LUA_SUBDIR}/liblua-${LUA_VER}.so.${LUA_VER_SH} ${PREFIX}/lib
+ ${LN} -sf liblua-${LUA_VER}.so.${LUA_VER_SH} ${PREFIX}/lib/liblua-${LUA_VER}.so
+
+# Documentation.
+.if ${PORT_OPTIONS:MDOCS}
+ ${MKDIR} ${DOCSDIR}
+ cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif *.css *.png ${DOCSDIR}
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/lang/lua52/distinfo b/lang/lua52/distinfo
new file mode 100644
index 000000000000..061fcbe7f1b0
--- /dev/null
+++ b/lang/lua52/distinfo
@@ -0,0 +1,2 @@
+SHA256 (lua-5.2.1.tar.gz) = 64304da87976133196f9e4c15250b70f444467b6ed80d7cfd7b3b982b5177be5
+SIZE (lua-5.2.1.tar.gz) = 249882
diff --git a/lang/lua52/files/patch-Makefile b/lang/lua52/files/patch-Makefile
new file mode 100644
index 000000000000..abed9c763112
--- /dev/null
+++ b/lang/lua52/files/patch-Makefile
@@ -0,0 +1,44 @@
+--- Makefile.orig 2012-12-14 18:29:11.000000000 +0400
++++ Makefile 2012-12-14 18:45:06.000000000 +0400
+@@ -10,13 +10,13 @@
+ # so take care if INSTALL_TOP is not an absolute path. See the local target.
+ # You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
+ # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
+-INSTALL_TOP= /usr/local
+-INSTALL_BIN= $(INSTALL_TOP)/bin
+-INSTALL_INC= $(INSTALL_TOP)/include
+-INSTALL_LIB= $(INSTALL_TOP)/lib
++INSTALL_TOP= %%LUA_PREFIX%%
++INSTALL_BIN= %%LUA_BINDIR%%
++INSTALL_INC= %%LUA_INCDIR%%
++INSTALL_LIB= %%LUA_LIBDIR%%
+ INSTALL_MAN= $(INSTALL_TOP)/man/man1
+-INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
+-INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
++INSTALL_LMOD= %%LUA_MODSHAREDIR%%
++INSTALL_CMOD= %%LUA_MODLIBDIR%%
+
+ # How to install. If your install program does not support "-p", then
+ # you may have to run ranlib on the installed liblua.a.
+@@ -41,8 +41,8 @@
+ # What to install.
+ TO_BIN= lua luac
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua.a
+-TO_MAN= lua.1 luac.1
++TO_LIB= liblua.a liblua-5.2.so.1
++TO_MAN= lua-5.2.1 luac-5.2.1
+
+ # Lua version and release.
+ V= 5.2
+@@ -61,8 +61,8 @@
+ cd src && $(MKDIR) $(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)
+- cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
++ cd src && mv liblua.so liblua-$V.so.%%LUA_VER_SH%% && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
++ cd doc && mv lua.1 lua-$V.1 && mv luac.1 luac-$V.1 && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+
+ uninstall:
+ cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
diff --git a/lang/lua52/files/patch-src__Makefile b/lang/lua52/files/patch-src__Makefile
new file mode 100644
index 000000000000..4e010bacf44c
--- /dev/null
+++ b/lang/lua52/files/patch-src__Makefile
@@ -0,0 +1,58 @@
+--- src/Makefile.orig 2012-03-09 20:32:16.000000000 +0400
++++ src/Makefile 2012-12-14 16:39:47.000000000 +0400
+@@ -6,12 +6,13 @@
+ # Your platform. See PLATS for possible values.
+ PLAT= none
+
+-CC= gcc
+-CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)
++CC?= gcc
++CFLAGS= -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)
+ LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
+ LIBS= -lm $(SYSLIBS) $(MYLIBS)
+
+-AR= ar rcu
++AR= ar
++ARFLAGS= rcu
+ RANLIB= ranlib
+ RM= rm -f
+
+@@ -19,8 +20,8 @@
+ SYSLDFLAGS=
+ SYSLIBS=
+
+-MYCFLAGS=
+-MYLDFLAGS=
++MYCFLAGS?=
++MYLDFLAGS?=
+ MYLIBS=
+ MYOBJS=
+
+@@ -38,12 +39,13 @@
+
+ LUA_T= lua
+ LUA_O= lua.o
++LUA_SO= liblua.so
+
+ LUAC_T= luac
+ LUAC_O= luac.o
+
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
+ ALL_A= $(LUA_A)
+
+ # Targets start here.
+@@ -55,8 +57,11 @@
+
+ a: $(ALL_A)
+
++$(LUA_SO): $(CORE_O) $(LIB_O)
++ $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(MYLDFLAGS) -shared -Wl,-soname=$(LUA_SONAME) $?
++
+ $(LUA_A): $(BASE_O)
+- $(AR) $@ $(BASE_O)
++ $(AR) $(ARFLAGS) $@ $(BASE_O)
+ $(RANLIB) $@
+
+ $(LUA_T): $(LUA_O) $(LUA_A)
diff --git a/lang/lua52/files/patch-src__liolib.c b/lang/lua52/files/patch-src__liolib.c
new file mode 100644
index 000000000000..35a3db195d14
--- /dev/null
+++ b/lang/lua52/files/patch-src__liolib.c
@@ -0,0 +1,10 @@
+--- ./src/liolib.c.orig 2013-01-05 22:46:54.000000000 +0100
++++ ./src/liolib.c 2013-01-05 22:47:32.000000000 +0100
+@@ -19,6 +19,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <unistd.h>
+
+ #define liolib_c
+ #define LUA_LIB
diff --git a/lang/lua52/pkg-descr b/lang/lua52/pkg-descr
new file mode 100644
index 000000000000..d0ed8afbd09c
--- /dev/null
+++ b/lang/lua52/pkg-descr
@@ -0,0 +1,21 @@
+Lua is a programming language originally designed for extending applications,
+but also frequently used as a general-purpose, stand-alone language. Lua
+combines simple procedural syntax (similar to Pascal) with powerful data
+description constructs based on associative arrays and extensible semantics.
+Lua is dynamically typed, interpreted from bytecodes, and has automatic memory
+management with garbage collection, making it ideal for configuration,
+scripting, and rapid prototyping.
+
+A fundamental concept in the design of Lua is to provide meta-mechanisms for
+implementing features, instead of providing a host of features directly in
+the language. For example, although Lua is not a pure object-oriented
+language, it does provide meta-mechanisms for implementing classes and
+inheritance. Lua's meta-mechanisms bring an economy of concepts and keep the
+language small, while allowing the semantics to be extended in unconventional
+ways. Extensible semantics is a distinguishing feature of Lua.
+
+Lua is implemented as a small library of C functions, written in ANSI C, and
+compiles unmodified in all known platforms. The implementation goals are
+simplicity, efficiency, portability, and low embedding cost.
+
+WWW: http://www.lua.org/
diff --git a/lang/lua52/pkg-plist b/lang/lua52/pkg-plist
new file mode 100644
index 000000000000..da41dddbc692
--- /dev/null
+++ b/lang/lua52/pkg-plist
@@ -0,0 +1,29 @@
+bin/lua-5.2
+bin/lua52/lua
+bin/lua52/luac
+bin/luac-5.2
+include/lua52/lauxlib.h
+include/lua52/lua.h
+include/lua52/lua.hpp
+include/lua52/luaconf.h
+include/lua52/lualib.h
+lib/liblua-5.2.so
+lib/liblua-5.2.so.1
+lib/lua52/liblua-5.2.so.1
+lib/lua52/liblua.a
+lib/lua52/liblua.so
+%%PORTDOCS%%%%DOCSDIR%%/contents.html
+%%PORTDOCS%%%%DOCSDIR%%/logo.gif
+%%PORTDOCS%%%%DOCSDIR%%/lua.css
+%%PORTDOCS%%%%DOCSDIR%%/manual.css
+%%PORTDOCS%%%%DOCSDIR%%/manual.html
+%%PORTDOCS%%%%DOCSDIR%%/osi-certified-72x60.png
+%%PORTDOCS%%%%DOCSDIR%%/readme.html
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrm bin/lua52
+@dirrm include/lua52
+@dirrm lib/lua52
+@dirrmtry lib/lua/5.2
+@dirrmtry lib/lua
+@dirrmtry share/lua/5.2
+@dirrmtry share/lua