From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Aug 26 09:30:12 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A04591065675 for ; Thu, 26 Aug 2010 09:30:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7B7C38FC1C for ; Thu, 26 Aug 2010 09:30:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o7Q9UCFV029674 for ; Thu, 26 Aug 2010 09:30:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o7Q9UC0j029663; Thu, 26 Aug 2010 09:30:12 GMT (envelope-from gnats) Resent-Date: Thu, 26 Aug 2010 09:30:12 GMT Resent-Message-Id: <201008260930.o7Q9UC0j029663@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Anonymous Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0DBC1065675 for ; Thu, 26 Aug 2010 09:24:33 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 720908FC16 for ; Thu, 26 Aug 2010 09:24:33 +0000 (UTC) Received: by bwz20 with SMTP id 20so1122231bwz.13 for ; Thu, 26 Aug 2010 02:24:32 -0700 (PDT) Received: by 10.204.55.195 with SMTP id v3mr6204438bkg.128.1282814672108; Thu, 26 Aug 2010 02:24:32 -0700 (PDT) Received: from localhost (tor-exit-proxy2-readme.formlessnetworking.net [208.53.142.38]) by mx.google.com with ESMTPS id f10sm1480748bkl.17.2010.08.26.02.24.29 (version=SSLv3 cipher=RC4-MD5); Thu, 26 Aug 2010 02:24:31 -0700 (PDT) Message-Id: <86zkw9u3p8.fsf@gmail.com> Date: Thu, 26 Aug 2010 13:24:19 +0400 From: Anonymous To: FreeBSD-gnats-submit@FreeBSD.org Cc: Subject: ports/149983: [new port] devel/lua-alien: Lua -> C FFI X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2010 09:30:12 -0000 >Number: 149983 >Category: ports >Synopsis: [new port] devel/lua-alien: Lua -> C FFI >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Aug 26 09:30:12 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Anonymous >Release: FreeBSD 9.0-CURRENT amd64 >Organization: >Environment: -fno-stack-protector is just a reminder for ports/138228 or anyone who has smth like SSP_CFLAGS from bsd.sys.mk >Description: Unlike alien rock[1] the port uses system libffi. And I've changed install paths a bit to prevent possible filename collisions with games, other FFIs or if someone ports it to a different version of lua. The only rock that depends on alien seems to be fbclient. And I'm not interested in firebird client so the port'll likely remain a leaf. [1] http://luarocks.org/repositories/rocks/alien-0.5.0-1.rockspec --- Alien lets a Lua application call load dynamic libraries and call C functions in a portable way, using libffi. WWW: http://alien.luaforge.net/ >How-To-Repeat: Example of a propeller using nanosleep(2): %% require 'alien' local timespec = alien.defstruct { { 'sec', 'long' }, { 'nsec', 'long' }, } local def = alien.default def.nanosleep:types('int', 'pointer', 'pointer') function nanosleep(seconds, nanoseconds) local t = timespec:new() t.sec, t.nsec = seconds, nanoseconds return def.nanosleep(t(), nil) end function propeller() local prop_sym = { '/', '-', '\\', '|' } local function prop_iter(a, i) i = i < #a and i + 1 or 1 return i, a[i] end return prop_iter, prop_sym, 1 end io.write('waiting...') for i,v in propeller() do io.write(v .. '\b') io.flush() nanosleep(0, 1) end %% There are a few more examples in EXAMPLESDIR and one test in DATADIR/tests. >Fix: --- a.diff begins here --- Index: Mk/bsd.lua.mk =================================================================== RCS file: /a/.cvsup/ports/Mk/bsd.lua.mk,v retrieving revision 1.19 diff -u -p -r1.19 bsd.lua.mk --- Mk/bsd.lua.mk 25 Aug 2008 20:20:50 -0000 1.19 +++ Mk/bsd.lua.mk 26 Aug 2010 06:33:09 -0000 @@ -39,7 +39,7 @@ # Other components (modules): # 5.0 - app, compat51, dfui, filename, gettext, # posix, pty, socket. -# 5.1 - filename, gettext, posix, pty, socket. +# 5.1 - alien, filename, gettext, posix, pty, socket. # The available dependency types are: # build - Requires component for building. # lib - Requires component for building and running. @@ -150,7 +150,8 @@ _LUA_Definitions_Done= yes # _LUA_COMPS_ALL= lua tolua toluaxx ruby \ - app compat51 dfui filename gettext posix pty socket + alien app compat51 dfui filename gettext posix \ + pty socket _LUA_DEP_TYPES_ALL= build lib run _LUA_VERS_ALL= 4.0 5.0 5.1 _LUA_PLIST_ALL= LUA_VER LUA_VER_SH LUA_VER_STR LUA_PREFIX LUA_SUBDIR @@ -191,6 +192,7 @@ _LUA_PORT_socket_5.0= net/lua50-luasocke _LUA_PORT_lua_5.1= lang/lua _LUA_DEPTYPE_lua_5.1= lib +_LUA_PORT_alien_5.1= devel/lua-alien _LUA_PORT_filename_5.1= devel/lua-filename _LUA_PORT_gettext_5.1= devel/lua-gettext _LUA_PORT_posix_5.1= devel/lua-posix Index: devel/Makefile =================================================================== RCS file: /a/.cvsup/ports/devel/Makefile,v retrieving revision 1.4016 diff -u -p -r1.4016 Makefile --- devel/Makefile 19 Aug 2010 14:43:59 -0000 1.4016 +++ devel/Makefile 26 Aug 2010 06:33:48 -0000 @@ -937,6 +937,7 @@ SUBDIR += love SUBDIR += lpc21isp SUBDIR += lrmi + SUBDIR += lua-alien SUBDIR += lua-bitlib SUBDIR += lua-filename SUBDIR += lua-gettext Index: devel/lua-alien/Makefile =================================================================== RCS file: devel/lua-alien/Makefile diff -N devel/lua-alien/Makefile --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ devel/lua-alien/Makefile 26 Aug 2010 08:44:19 -0000 @@ -0,0 +1,65 @@ +# New ports collection makefile for: lua-alien +# Date created: 24 Aug 2010 +# Whom: Anonymous +# +# $FreeBSD$ +# + +PORTNAME= alien +PORTVERSION= 0.5.0 +CATEGORIES= devel +MASTER_SITES= http://alien.luaforge.net/ +PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX} + +MAINTAINER= swell.k@gmail.com +COMMENT= Lua -> C FFI + +LIB_DEPENDS= ffi.5:${PORTSDIR}/devel/libffi + +LICENSE= MIT +USE_LUA= 5.1 + +CFLAGS+= -I${LOCALBASE}/include -I${LUA_INCDIR} \ + -DBSD -fPIC -fno-stack-protector +LDFLAGS+= -L${LOCALBASE}/lib -L${LUA_LIBDIR} -llua -shared +MAKE_ENV+= LIB_OPTION="${LDFLAGS}" LIB_EXT=".so" LUA="${LUA_CMD}" + +# add lua prefix in pkgname +.for p in data: docs:doc/ examples:examples/ +${p:C/:.*//:U}DIR_REL= share/${p:C/.*://}${LUA_PKGNAMEPREFIX}${PORTNAME} +${p:C/:.*//:U}DIR= ${PREFIX}/${${p:C/:.*//:U}DIR_REL} +.endfor + +post-extract: .SILENT + ${RM} -rf ${WRKSRC}/libffi + ${FIND} ${WRKSRC} -type f -name .git-darcs-dir -delete + +post-patch: .SILENT + ${REINPLACE_CMD} '1s|.*|#! ${LUA_CMD}|' ${WRKSRC}/src/constants + ${REINPLACE_CMD} -i '' \ + -e 's|/usr/lib|${PREFIX}/lib|' \ + -e '/luarocks/d' \ + ${WRKSRC}/samples/*.lua ${WRKSRC}/tests/*.lua + +do-install: + ${MKDIR} ${LUA_MODLIBDIR}/${PORTNAME} +.for f in core.so struct.so + ${INSTALL_PROGRAM} ${WRKSRC}/src/alien/${f} \ + ${LUA_MODLIBDIR}/${PORTNAME} +.endfor + ${INSTALL_DATA} ${WRKSRC}/src/alien.lua ${LUA_MODSHAREDIR} +.if !defined(NOPORTDATA) + ${MKDIR} ${DATADIR} + ${INSTALL_PROGRAM} ${WRKSRC}/src/constants ${DATADIR} + ${TAR} cf - -C${WRKSRC} tests | ${TAR} xof - -C${DATADIR} +.endif +.if !defined(NOPORTDOCS) + ${MKDIR} ${DOCSDIR} + ${TAR} cf - -C${WRKSRC}/doc . | ${TAR} xof - -C${DOCSDIR} +.endif +.if !defined(NOPORTEXAMPLES) + ${MKDIR} ${EXAMPLESDIR} + ${TAR} cf - -C${WRKSRC}/samples . | ${TAR} xof - -C${EXAMPLESDIR} +.endif + +.include Index: devel/lua-alien/distinfo =================================================================== RCS file: devel/lua-alien/distinfo diff -N devel/lua-alien/distinfo --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ devel/lua-alien/distinfo 24 Aug 2010 08:34:19 -0000 @@ -0,0 +1,3 @@ +MD5 (alien-0.5.0.tar.gz) = d6b265798f6d610d4651d054f601d468 +SHA256 (alien-0.5.0.tar.gz) = a8ab957f1ced1242f4264a3d8b6ef4617a045900ea60b9e57a6abb0a6bd043c3 +SIZE (alien-0.5.0.tar.gz) = 766042 Index: devel/lua-alien/pkg-descr =================================================================== RCS file: devel/lua-alien/pkg-descr diff -N devel/lua-alien/pkg-descr --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ devel/lua-alien/pkg-descr 25 Aug 2010 08:08:41 -0000 @@ -0,0 +1,4 @@ +Alien lets a Lua application call load dynamic libraries and call C +functions in a portable way, using libffi. + +WWW: http://alien.luaforge.net/ Index: devel/lua-alien/pkg-plist =================================================================== RCS file: devel/lua-alien/pkg-plist diff -N devel/lua-alien/pkg-plist --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ devel/lua-alien/pkg-plist 26 Aug 2010 08:30:57 -0000 @@ -0,0 +1,17 @@ +%%LUA_MODLIBDIR%%/alien/core.so +%%LUA_MODLIBDIR%%/alien/struct.so +%%PORTDATA%%%%DATADIR%%/constants +%%PORTDATA%%%%DATADIR%%/tests/alientest.c +%%PORTDATA%%%%DATADIR%%/tests/libalientest.so +%%PORTDATA%%%%DATADIR%%/tests/test_alien.lua +%%PORTDOCS%%%%DOCSDIR%%/alien.md +%%PORTDOCS%%%%DOCSDIR%%/index.html +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/gtk.lua +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/libc.lua +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/string_array.lua +%%LUA_MODSHAREDIR%%/alien.lua +@dirrm %%LUA_MODLIBDIR%%/alien +%%PORTDATA%%@dirrm %%DATADIR%%/tests +%%PORTDATA%%@dirrm %%DATADIR%% +%%PORTDOCS%%@dirrm %%DOCSDIR%% +%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%% Index: devel/lua-alien/files/patch-Makefile =================================================================== RCS file: devel/lua-alien/files/patch-Makefile diff -N devel/lua-alien/files/patch-Makefile --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ devel/lua-alien/files/patch-Makefile 24 Aug 2010 10:33:44 -0000 @@ -0,0 +1,31 @@ +--- Makefile~ ++++ Makefile +@@ -1,22 +1,14 @@ + + all: src/alien/core.so src/alien/struct.so tests/libalientest$(LIB_EXT) + +-src/alien/core.o: src/alien/core.c libffi/include/ffi.h +- $(CC) -c $(CFLAGS) -Ilibffi/include -o src/alien/core.o src/alien/core.c ++src/alien/core.o: src/alien/core.c ++ $(CC) -c $(CFLAGS) -o src/alien/core.o src/alien/core.c + +-libffi/include/ffi.h: +- cat executables | xargs chmod +x +- cd libffi && ./configure --disable-shared CC=gcc +- +-libffi/Makefile: +- cat executables | xargs chmod +x +- cd libffi && ./configure --disable-shared CC=gcc ++src/alien/struct.o: src/alien/struct.c ++ $(CC) -c $(CFLAGS) -o src/alien/struct.o src/alien/struct.c + +-libffi/.libs/libffi.a: libffi/Makefile +- cd libffi && make CC=gcc +- +-src/alien/core.so: src/alien/core.o libffi/.libs/libffi.a +- export MACOSX_DEPLOYMENT_TARGET=10.3; $(CC) $(LIB_OPTION) -o src/alien/core.so src/alien/core.o -lgcc -Llibffi/.libs -lffi ++src/alien/core.so: src/alien/core.o ++ export MACOSX_DEPLOYMENT_TARGET=10.3; $(CC) $(LIB_OPTION) -o src/alien/core.so src/alien/core.o -lgcc -lffi + + src/alien/struct.so: src/alien/struct.o + export MACOSX_DEPLOYMENT_TARGET=10.3; $(CC) $(LIB_OPTION) -o src/alien/struct.so src/alien/struct.o --- a.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: