From alepulver@FreeBSD.org Sun Oct 29 14:42:23 2006 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6329E16A407 for ; Sun, 29 Oct 2006 14:42:23 +0000 (UTC) (envelope-from alepulver@FreeBSD.org) Received: from relay03.pair.com (relay03.pair.com [209.68.5.17]) by mx1.FreeBSD.org (Postfix) with SMTP id 0B03343D5A for ; Sun, 29 Oct 2006 14:42:22 +0000 (GMT) (envelope-from alepulver@FreeBSD.org) Received: (qmail 61088 invoked from network); 29 Oct 2006 14:42:20 -0000 Received: from unknown (HELO phobos.mars.bsd) (unknown) by unknown with SMTP; 29 Oct 2006 14:42:20 -0000 Message-Id: <1162132944.19094@phobos.mars.bsd> Date: Sun, 29 Oct 2006 11:42:24 -0300 From: "Alejandro Pulver" To: "FreeBSD gnats submit" Subject: [PATCH] Add Lua entry to PH X-Send-Pr-Version: gtk-send-pr 0.4.7 X-GNATS-Notify: >Number: 104909 >Category: docs >Synopsis: [PATCH] Add Lua entry to PH >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: closed >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Oct 29 14:50:13 GMT 2006 >Closed-Date: Sun Oct 29 15:23:55 GMT 2006 >Last-Modified: Sun Oct 29 15:30:21 GMT 2006 >Originator: Alejandro Pulver >Release: FreeBSD 6.1-RELEASE-p1 i386 >Organization: >Environment: System: FreeBSD 6.1-RELEASE-p1 #3: Mon Jun 19 14:49:35 ART 2006 root@phobos.mars.bsd:/usr/obj/usr/src/sys/ATHLON-PHOBOS >Description: - Add Lua entry to PH. - Fix wrong comment in bsd.lua.mk. Please review this patch since it is my first docs PR. >How-To-Repeat: >Fix: --- patch.diff begins here --- Index: doc/en_US.ISO8859-1/books/porters-handbook/book.sgml =================================================================== RCS file: /home/dcvs/doc/en_US.ISO8859-1/books/porters-handbook/book.sgml,v retrieving revision 1.759 diff -u -r1.759 book.sgml --- doc/en_US.ISO8859-1/books/porters-handbook/book.sgml 7 Oct 2006 20:55:22 -0000 1.759 +++ doc/en_US.ISO8859-1/books/porters-handbook/book.sgml 29 Oct 2006 14:36:50 -0000 @@ -6263,6 +6263,550 @@ + + Using <application>Lua</application> + + This section describes the status of the + Lua libraries in the ports tree and its + integration with the ports system. + + + Introduction + + There are many versions of the Lua + libraries and corresponding interpreters, which conflict between + them (install files under the same name). In the ports tree this + problem has been solved by installing each version under a different + name using version number suffixes. + + The obvious disadventage of this is that each application has to + be modified to found the expected version. But it can be solved by + adding some additional flags to the compiler and linker. + + + + Version selection + + To make your port use a specific version of + Lua there are two variables available + for defining (if only one is defined the other will be set to a + default value): + + + Variables to select <application>Lua</application> + versions + + + + + Variable + + Description + + Default value + + + + + + USE_LUA + + List of versions the port can use + + All available versions + + + + USE_LUA_NOT + + List of versions the port can not use + + None + + + +
+ + The following is a list of available + Lua versions and the corresponding port + in the tree: + + + Available <application>Lua</application> versions + + + + + Version + + Port + + + + + + 4.0 + + lang/lua4 + + + + 5.0 + + lang/lua50 + + + + 5.1 + + lang/lua + + + +
+ + The variables in can be set + to one or more of the following combinations separated by + spaces: + + + <application>Lua</application> version specifications + + + + + Description + + Example + + + + + + Single version + + 4.0 + + + + Ascending range + + 5.0+ + + + + Descending range + + 5.0- + + + + Full range (must be ascending) + + 5.0-5.1 + + + +
+ + There are also some variables to select the preferred versions + from the available ones. They can be set to a list of versions, the + first ones will have higher priority. + + + Variables to select preferred <application>Lua</application> + versions + + + + + Name + + Designed for + + + + + + WANT_LUA_VER + + the port + + + + WITH_LUA_VER + + the user + + + +
+ + + Selecting the <application>Lua</application> version + + The following fragment is from a port which can use + Lua version 5.0 or + 5.1, and uses 5.0 by + default. It can be overriden by the user using + WITH_LUA_VER. + + USE_LUA= 5.0-5.1 +WANT_LUA_VER= 5.0 + +
+ + + Component selection + + There are other applications that, while not being + Lua libraries, are related to them. These + applications can be specified in the LUA_COMPS + variable. The following components are available: + + + Available <application>Lua</application> components + + + + + Name + + Description + + Version restriction + + + + + + lua + + main library + + none + + + + tolua + + Library for accesing C/C++ code + + 4.0-5.0 + + + + ruby + + Ruby bindings + + 4.0-5.0 + + + +
+ + + There are more components but they are modules for the + interpreter, not used by applications (only by other + modules). + + + The dependency type added when you select each component can be + manually specified by adding a suffix separated by a + :, or a default value will be used. The available + dependency types are: + + + Available <application>Lua</application> dependency + types + + + + + Name + + Description + + + + + + build + + Component is required for building, equivalent to + BUILD_DEPENDS + + + + run + + Component is required for running, equivalent to + RUN_DEPENDS + + + + lib + + Component is required for building and running, + equivalent to LIB_DEPENDS + + + +
+ + The default values for the components are detailed in the + following table: + + + Default <application>Lua</application> dependency + types + + + + + Name + + Value + + + + + + lua + + lib for 4.0-5.0 + (shared) and build for + 5.1 (static) + + + + tolua + + build (static) + + + + ruby + + lib (shared) + + + +
+ + + Selecting <application>Lua</application> components + + The following fragment corresponds to a port which uses + Lua version 4.0 and + its Ruby bindings. + + USE_LUA= 4.0 +LUA_COMPS= lua ruby + +
+ + + Detecting installed versions + + To detect an installed version you have to define + WANT_LUA. If you do not set it to a specific + version then the components will have a version suffix. The + HAVE_LUA variable will be filled after + detection. + + + Detecting installed <application>Lua</application> versions + and components + + The following fragment can be used in a port that uses + Lua if it is installed, or an option is + selected. + + WANT_LUA= yes + +.include <bsd.port.pre.mk> + +.if defined(WITH_LUA5) || ${HAVE_LUA:Mlua-5.[01]} != "" +USE_LUA= 5.0-5.1 +CONFIGURE_ARGS+=--enable-lua5 +.endif + + The following fragment can be used in a port that enables + tolua support if it is installed or if + an option is selected, in addition to + Lua, both version + 4.0. + + USE_LUA= 4.0 +LUA_COMPS= lua +WANT_LUA= 4.0 + +.include <bsd.port.pre.mk> + +.if defined(WITH_TOLUA) || ${HAVE_LUA:Mtolua} != "" +LUA_COMPS+= tolua +CONFIGURE_ARGS+=--enable-tolua +.endif + + + + + Defined variables + + The following variables are defined after defining one of the + variables from . + + + Variables defined for ports that use + <application>Lua</application> + + + + + Name + + Description + + + + + + LUA_VER + + The Lua version that is + going to be used (e.g., 5.1) + + + + LUA_VER_SH + The Lua shared library major + version (e.g., 1) + + + + LUA_VER_STR + + The Lua version without the + dots (e.g., 51) + + + + LUA_PREFIX + + The prefix where Lua (and + components) is installed + + + + LUA_SUBDIR + + The directory under ${PREFIX}/bin, + ${PREFIX}/share and + ${PREFIX}/lib where + Lua is installed + + + + LUA_INCDIR + + The directory where Lua and + tolua header files are + installed + + + + LUA_LIBDIR + + The directory where Lua and + tolua libraries are + installed + + + + LUA_MODLIBDIR + + The directory where Lua + module libraries (.so) are + installed + + + + LUA_MODSHAREDIR + + The directory where Lua + modules (.lua) are installed + + + + LUA_PKGNAMEPREFIX + + The package name prefix used by + Lua modules + + + +
+ + + Telling the port where to find + <application>Lua</application> + + The following fragment shows how to tell a port that uses a + configure script where the Lua header + files and libraries are. + + +USE_LUA= 4.0 +GNU_CONFIGURE= yes +CONFIGURE_ENV= CPPFLAGS="-I${LUA_INCDIR}" LDFLAGS="-L${LUA_LIBDIR}" + +
+ + + Processing in <filename>bsd.port.pre.mk</filename> + + If you need to use the variables for running commands right + after including bsd.port.pre.mk you need to + define LUA_PREMK. + + + If you define LUA_PREMK, then the version, + dependencies, components and defined variables will not change if + you modify the Lua port variables + after including + bsd.port.pre.mk. + + + + Using <application>Lua</application> variables in + commands + + The following fragment illustrates the use of + LUA_PREMK by running the + Lua interpreter to obtain the full + version string, assign it to a variable and pass it to the + program. + + USE_LUA= 5.0 +LUA_PREMK= yes + +.include <bsd.port.pre.mk> + +VER_STR!= lua${LUA_VER} -v + +CFLAGS+= -DLUA_VERSION_STRING="${VER_STR}" + + + + The Lua variables can be safely + used in commands when they are inside targets without the need of + LUA_PREMK. + + +
+ Starting and stopping services (rc scripts) --- patch.diff ends here --- --- patch2.diff begins here --- Index: ports/Mk/bsd.lua.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.lua.mk,v retrieving revision 1.2 diff -u -r1.2 bsd.lua.mk --- ports/Mk/bsd.lua.mk 5 Oct 2006 18:17:25 -0000 1.2 +++ ports/Mk/bsd.lua.mk 28 Oct 2006 15:41:34 -0000 @@ -75,9 +75,9 @@ # LUA_SUBDIR - The directory under bin/share/lib where Lua is installed. # LUA_INCDIR - The directory where Lua and tolua header files are installed. # LUA_LIBDIR - The directory where Lua and tolua libraries are installed. -# LUA_MODLIBDIR - The directory where Lua modules (.lua) are installed. +# LUA_MODLIBDIR - The directory where Lua module libraries (.so) are installed. # LUA_MODSHAREDIR -# - The directory where Lua module libraries (.so) are installed. +# - The directory where Lua modules (.lua) are installed. # LUA_PKGNAMEPREFIX # - The package name prefix used by Lua modules. # --- patch2.diff ends here --- >Release-Note: >Audit-Trail: State-Changed-From-To: open->closed State-Changed-By: pav State-Changed-When: Sun Oct 29 15:23:16 UTC 2006 State-Changed-Why: Committed to PH. The bsd.lua.mk patch can be applied directly by you - you are the maintainer of that file, after all. http://www.freebsd.org/cgi/query-pr.cgi?pr=104909 From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: docs/104909: commit references a PR Date: Sun, 29 Oct 2006 15:22:40 +0000 (UTC) pav 2006-10-29 15:22:35 UTC FreeBSD doc repository Modified files: en_US.ISO8859-1/books/porters-handbook book.sgml Log: A new section on using Lua PR: docs/104909 Submitted by: alepulver Revision Changes Path 1.763 +544 -0 doc/en_US.ISO8859-1/books/porters-handbook/book.sgml _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org" >Unformatted: