Bug 101612 - bsd.lua.mk - Support for Lua based ports and remove conflicts
Summary: bsd.lua.mk - Support for Lua based ports and remove conflicts
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-07 22:20 UTC by Alejandro Pulver
Modified: 2006-09-16 23:10 UTC (History)
0 users

See Also:


Attachments
patch.diff (89.42 KB, patch)
2006-08-07 22:20 UTC, Alejandro Pulver
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alejandro Pulver freebsd_committer 2006-08-07 22:20:15 UTC

This new bsd.lua.mk file adds support for Lua based ports, also fixing the CONFLICTS between 4.0/5.1/5.2 versions by using the same approach as the databases/dbXX ports (SONAME header in library).

A patch to integrate this into bsd.wx.mk and all ports that currently use Lua is included.
Comment 1 Edwin Groothuis freebsd_committer 2006-08-07 23:48:50 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Let's start with portmgr approval
Comment 2 Alejandro Pulver freebsd_committer 2006-08-15 22:19:41 UTC
This new bsd.lua.mk avoids processing the component list and adding
dependencies twice (adds a _LUA_Include_Post check and definition).

#-*- mode: makefile; tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
# bsd.lua.mk - Support for Lua based ports.
#
# Created by: Alejandro Pulver <alepulver@FreeBSD.org>
#
# Please view me with 4 column tabs!
#
# The following variables can be defined in a port that uses the Lua library,
# tolua, Ruby bindings or related components like .lua modules (with run
# and/or build dependencies). It can be used after and/or before
# bsd.port.pre.mk, but Ruby components will only work if Ruby variables (e.g.
# USE_RUBY) are defined before it (this is a bsd.ruby.mk limitation), at least
# it is manually included.
# USE_LUA		- Set to the list of Lua versions that can be used by the
#				  port. The syntax allows the following elements:
#				  - Single version (e.g. "4.0").
#				  - Range of versions (e.g. "5.0-5.1"). Must be ascending.
#				  - Partial range: single version and upper (e.g. "5.0+").
#				  - Partial range: single version and lower (e.g. "5.1-").
#				  Multiple elements can be specified separated by spaces.
# USE_LUA_NOT	- Set to the list of Lua versions that can't be used by the
#				  port. In other words, it removes some versions from USE_LUA.
#				  If the latter is not defined, it will have the value of all
#				  the possible versions. The syntax is like USE_LUA.
# LUA_COMPS		- Set to the list of Lua components the port uses. Several
#				  components can be specified separated by spaces. By default
#				  it will have the value of "lua". Suffixes in the form ":xxx"
#				  may be added to the components to determine the dependency
#				  type.
#				  The available components are:
#				  lua			- The Lua library.
#				  tolua			- The tolua library (vers 4.0-5.0).
#				  ruby			- The Ruby bindings for Lua (vers 4.0-5.0).
#				  app, compat51, dfui, filename, gettext, posix, pty and
#				  socket		- Modules for Lua 5.0.
#				  The available dependency types are:
#				  build			- Requires component for building.
#				  lib			- Requires component for building and running.
#				  run			- Requires component for running.
#				  If no suffix is present then "lib" will be used for "lua"
#				  4.0-5.0 and "ruby", "build" for lua 5.1 and "tolua" (they
#				  are static), all others default to "run".
# LUA_PREMK		- Define to determine version and define variables after
#				  <bsd.port.pre.mk> (in case the port needs to manually run
#				  the Lua program or the like).
# WANT_LUA		- Set to "yes" or a valid single version (no ranges, etc).
#				  In both cases it will detect the installed Lua components
#				  and add them to the variable HAVE_LUA. If a version is
#				  selected, HAVE_LUA will contain a list of components in the
#				  other case it will contain a list of "component-version"
#				  pairs (e.g. lua-4.0, tolua-5.1, etc).
#				  It has to be used before bsd.port.pre.mk.
# WANT_LUA_VER	- Set to the prefered Lua version for the port. It must be
#				  present in USE_LUA or missing in USE_LUA_NOT. This is
#				  overriden by the user variable WITH_LUA_VER if set. It can
#				  contain multiple versions in order of preference (last ones
#				  are tried first).
#
# The following variables are intended for the user and can be defined in
# make.conf.
# WITH_LUA_VER	- Define to the list of prefered versions in reverse order.
#
# The following variables are defined by this file, to be read from the port.
# HAVE_LUA		- The list of Lua components installed, if WANT_LUA was
#				  defined. The components will have version suffix if it was
#				  set to "yes".
# 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 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_MODSHAREDIR	- The directory where Lua module libraries (.so) are
#					  installed.
# LUA_PKGNAMEPREFIX	- The package name prefix used by Lua modules.
#
# Examples:
# - A port that needs Lua 4.0 and tolua (also 4.0) libraries (lua for building
#   and running and tolua for building).
#	USE_LUA=	4.0
#	LUA_COMPS=	lua tolua
# - A port that needs Ruby bindings for Lua 5.0 for building and running.
#	USE_LUA=	5.0
#	LUA_COMPS=	ruby
# - A port that needs tolua 5.0 or 5.1 for building.
#	USE_LUA=	5.0 5.1
#	LUA_COMPS=	tolua
# - A port that needs Lua version 5.0 or higher for building and running.
#	USE_LUA=	5.0+
# - A port that needs Lua of any version other than 5.1 for building and
#   running.
#	USE_LUA_NOT=5.1
#

LUA_Include_MAINTAINER=	alepulver@FreeBSD.org

#
# Global definitions.
#

.if !defined(_LUA_Definitions_Done)
_LUA_Definitions_Done=	yes

# Common variables:
# _LUA_COMPS_ALL		- List of valid components.
# _LUA_DEP_TYPES_ALL	- List of valid dependency types.
# _LUA_VERS_ALL			- List of available Lua versions.
# _LUA_VERS_LISTS=		- Reverse lists preference order.
# _LUA_PLIST_ALL		- List of variables to be added to PLIST_SUB.
# _LUA_PLIST_DIR_ALL	- List of path variables (relative to ${LUA_PREFIX})
#						  to be added to PLIST_SUB.
#

_LUA_COMPS_ALL=			lua tolua ruby \
						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
_LUA_PLIST_DIR_ALL=		LUA_BINDIR LUA_INCDIR LUA_LIBDIR \
						LUA_MODLIBDIR LUA_MODSHAREDIR
_LUA_VERS_LISTS=		WANT_LUA_VER WITH_LUA_VER

#
# Variables used to determine what is needed.
# _LUA_PORT_comp_ver	- Port directory.
# _LUA_LIB_comp_ver		- Name of the shared library (optional).
# _LUA_SHVER_comp_ver	- Shared library version (optional).
# _LUA_FILE_comp_ver	- File installed by that component.
# _LUA_DEPTYPE_comp_ver	- Default dependency type.
#

_LUA_PORT_lua_4.0=		lang/lua4
_LUA_DEPTYPE_lua_4.0=	lib
_LUA_PORT_tolua_4.0=	lang/tolua4
_LUA_PORT_ruby_4.0=		lang/ruby-lua4

_LUA_PORT_lua_5.0=		lang/lua50
_LUA_DEPTYPE_lua_5.0=	lib
_LUA_PORT_tolua_5.0=	lang/tolua
_LUA_PORT_ruby_5.0=		lang/ruby-lua

_LUA_PORT_app_5.0=		devel/lua50-app
_LUA_PORT_compat51_5.0=	devel/lua50-compat51
_LUA_FILE_compat51_5.0=	${LUA_MODSHAREDIR}/compat-5.1.lua
_LUA_PORT_dfui_5.0=		devel/lua50-dfui
_LUA_PORT_filename_5.0=	devel/lua50-filename
_LUA_PORT_gettext_5.0=	devel/lua50-gettext
_LUA_PORT_posix_5.0=	devel/lua50-posix
_LUA_PORT_pty_5.0=		devel/lua50-pty
_LUA_PORT_socket_5.0=	net/luasocket

_LUA_PORT_lua_5.1=		lang/lua
_LUA_DEPTYPE_lua_5.1=	build

.for comp in ${_LUA_COMPS_ALL}
_LUA_COMP=				${comp}
.	for ver in ${_LUA_VERS_ALL}
.		if ${_LUA_COMP} == "lua"
_LUA_LIB_${comp}_${ver}=	lua-${LUA_VER}.${LUA_VER_SH}
_LUA_SHVER_${comp}_${ver}=	${LUA_VER_SH}
_LUA_FILE_${comp}_${ver}=	${LUA_LIBDIR}/liblua.a
.		elif ${_LUA_COMP} == "tolua"
_LUA_FILE_${comp}_${ver}=	${LUA_LIBDIR}/libtolua.a
_LUA_DEPTYPE_${comp}_${ver}=build
.		elif ${_LUA_COMP} == "ruby"
_LUA_FILE_${comp}_${ver}=	${RUBY_SITEARCHLIBDIR}/lua-${LUA_VER}.so
_LUA_DEPTYPE_${comp}_${ver}=lib
.		else
.			if !defined(_LUA_FILE_${comp}_${ver})
_LUA_FILE_${comp}_${ver}=	${LUA_MODSHAREDIR}/${comp}.lua
.			endif
_LUA_DEPTYPE_${comp}_${ver}=run
.		endif
.	endfor
.endfor

.endif

#
# Check for present components.
#

.if defined(WANT_LUA) && !defined(AFTERPORTMK)
.	for __WANT_LUA in ${WANT_LUA}
# Check if WANT_LUA contains more than one word.
.		if defined(HAVE_LUA)
IGNORE?=				selected multiple values for WANT_LUA: ${WANT_LUA}
.		endif
HAVE_LUA=				#
# Check for all versions.
.		if ${WANT_LUA:L} == "yes"
.			for comp in ${_LUA_COMPS_ALL}
.				for ver in ${_LUA_VERS_ALL}
_LUA_COMP=				_LUA_FILE_${comp}_${ver}
.					if defined(${_LUA_COMP}) && exists(${${_LUA_COMP}})
HAVE_LUA+=				${comp}-${ver}
.					endif
.				endfor
.			endfor
# Check for a specific version.
.		elif ${_LUA_VERS_ALL:M${__WANT_LUA}} != ""
.			for comp in ${_LUA_COMPS_ALL}
.				if exists(${_LUA_FILE_${comp}_${__WANT_LUA}})
HAVE_LUA+=				${comp}
.				endif
.			endfor
.		else
IGNORE?=				selected an invalid value for WANT_LUA: ${__WANT_LUA}
.		endif
.	endfor
.endif		# WANT_LUA && !AFTERPORTMK

#
# Select Lua version.
#

.if !defined(_LUA_Version_Done) && (!defined(BEFOREPORTMK) || \
    (defined(LUA_PREMK) && !defined(AFTERPORTMK) && \
    (defined(USE_LUA) || defined(USE_LUA_NOT))))
_LUA_Version_Done=		yes

# Set defaults (if one isn't present).

USE_LUA?=				${_LUA_VERS_ALL}
USE_LUA_NOT?=			#

#
# Make lists of valid and invalid versions.
#
# The following variables are used:
# _LUA_VER_CHECK		- If the version is a single one, express in a range.
# _LUA_VER_MIN			- Lower version of the range.
# _LUA_VER_MAX			- Higher version of the range.
# _LUA_VER_LIST			- List of requested versions.
# _LUA_VER_NOT_LIST		- List of disallowed versions.
# _LUA_VER_FINAL		- List of requested version without disallowed ones.
#

.for list in VER VER_NOT
_LUA_${list}_LIST=		#
.	for ver in ${USE_LUA${list:C/VER//}}
_LUA_VER_CHECK:=		${ver:C/^([[:digit:]]+(\.[[:digit:]]+)*)$/\1-\1/}
_LUA_VER_MIN:=			${_LUA_VER_CHECK:C/([[:digit:]]+(\.[[:digit:]]+)*)[-+].*/\1/}
_LUA_VER_MAX:=			${_LUA_VER_CHECK:C/.*-([[:digit:]]+(\.[[:digit:]]+)*)/\1/}
# Minimum version not specified.
.		if ${_LUA_VER_MIN} == ${_LUA_VER_CHECK}
.			undef _LUA_VER_MIN
.			for v in ${_LUA_VERS_ALL}
_LUA_VER_MIN?=			${v}
.			endfor
.		endif
# Maximum version not specified.
.		if ${_LUA_VER_MAX} == ${_LUA_VER_CHECK}
.			for v in ${_LUA_VERS_ALL}
_LUA_VER_MAX=			${v}
.			endfor
.		endif
# Expand versions and add valid ones to each list.
.		for v in ${_LUA_VERS_ALL}
.			if ${_LUA_VER_MIN} <= ${v} && ${_LUA_VER_MAX} >= ${v} && \
			   ${_LUA_${list}_LIST:M${v}} == ""
_LUA_${list}_LIST+=		${v}
.			endif
.		endfor
.	endfor
.endfor

# Merge the lists into a single list of valid versions.

_LUA_VER_FINAL=			#
.for ver in ${_LUA_VER_LIST}
.	if ${_LUA_VER_NOT_LIST:M${ver}} == ""
_LUA_VER_FINAL+=		${ver}
.	endif
.endfor

# Check for a null version.

.if empty(_LUA_VER_FINAL)
IGNORE?=				selected a null or invalid Lua version
.endif

#
# Choose final version.
#

#
# Check for the following (in order):
# 1) WITH_LUA_VER		- User preference.
# 2) WANT_LUA_VER		- Port preference.
# 3) _LUA_VER_FINAL		- Available versions.
#

.for list in _LUA_VER_FINAL ${_LUA_LISTS_ORDER}
.	if defined(${list})
.		for ver in ${${list}}
.			if ${_LUA_VER_FINAL:M${ver}} != ""
_LUA_VER=				${ver}
.			endif
.		endfor
.	endif
.endfor

#
# Set variables.
#

# Version.
LUA_VER=				${_LUA_VER}
LUA_VER_SH?=			${LUA_VER:C/[[:digit:]]\.([[:digit:]])/\1/}
LUA_VER_STR?=			${LUA_VER:S/.//g}

# Paths.
LUA_PREFIX?=			${LOCALBASE}
LUA_SUBDIR?=			lua${LUA_VER_STR}
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}

# Package name.
LUA_PKGNAMEPREFIX?=		lua${LUA_VER_STR}-

.endif		# !_LUA_Version_Done && (!BEFOREPORTMK || \
#			(LUA_PREMK && !AFTERPORTMK && (USE_LUA || USE_LUA_NOT)))

#
# Process components list and add dependencies, variables, etc.
#

.if !defined(BEFOREPORTMK) && !defined(_LUA_Include_Post)
_LUA_Include_Post=		yes

#
# Component parsing.
#
# The variables used are:
# _LUA_COMP				- Component part.
# _LUA_DEP_TYPE			- Dependency type part.
# _LUA_COMP_NEW			- Component + dependency type.
# _LUA_COMPS_FINAL		- Final list of components with dependency types.
#

# Default components.

LUA_COMPS?=				lua

# Detect invalid and duplicated components.

_LUA_COMPS_FINAL=		#
.for comp in ${LUA_COMPS}
_LUA_COMP=				${comp:C/:([[:alpha:]]+)$//}
.	if ${_LUA_COMP} == ${comp}
_LUA_DEP_TYPE=			${_LUA_DEPTYPE_${comp}_${_LUA_VER}}
.	else
_LUA_DEP_TYPE=			${comp:C/.+:([[:alpha:]]+)$/\1/}
.	endif
_LUA_COMP_NEW=			${_LUA_COMP}_${_LUA_DEP_TYPE}
.	for __LUA_COMP in ${_LUA_COMP}
.		if ${_LUA_COMPS_ALL:M${__LUA_COMP}} == ""
IGNORE?=				selected an invalid Lua component: ${__LUA_COMP}
.		endif
.	endfor
.	for __LUA_DEP_TYPE in ${_LUA_DEP_TYPE}
.		if ${_LUA_DEP_TYPES_ALL:M${__LUA_DEP_TYPE}} == ""
IGNORE?=				selected an invalid Lua dependency type: ${__LUA_DEP_TYPE}
.		endif
.	endfor
.	if !defined(_LUA_PORT_${_LUA_COMP}_${_LUA_VER})
IGNORE?=				selected a Lua component (${_LUA_COMP}) which is not available for the selected version (${_LUA_VER})
.	endif
.	for newcomp in ${_LUA_COMP_NEW}
.		if ${_LUA_COMPS_FINAL:M${newcomp}} == ""
_LUA_COMPS_FINAL+=		${newcomp}
.		endif
.	endfor
.endfor

# Add dependencies.
#
# The variable used are:
# _LUA_COMP		-		- Component part.
# _LUA_DEP_TYPE			- Dependency type part.

.for comp in ${_LUA_COMPS_FINAL}
_LUA_DEP_TYPE=			${comp:C/.+_([[:alpha:]]+)$/\1/}
_LUA_COMP=				${comp:C/_([[:alpha:]]+)$//}
# XXX Need a .for loop here so the variable is expanded before the assignment.
.	for comp_part in ${_LUA_COMP}
.		if ${_LUA_DEP_TYPE} == "lib"
.			if defined(_LUA_LIB_${comp_part}_${_LUA_VER})
LIB_DEPENDS+=			${_LUA_LIB_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
.			else
BUILD_DEPENDS+=			${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
RUN_DEPENDS+=			${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
.			endif
.		else
${_LUA_DEP_TYPE:U}_DEPENDS+=	${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
.		endif
.	endfor
.endfor

# Packaging list variables.
.for var in ${_LUA_PLIST_ALL}
PLIST_SUB+=				${var}="${${var}}"
.endfor
.for var in ${_LUA_PLIST_DIR_ALL}
PLIST_SUB+=				${var}="${${var}:S/${LUA_PREFIX}\///}"
.endfor
.for var in ${_LUA_PLIST_ALL} ${_LUA_PLIST_DIR_ALL}
MAKE_ENV+=				${var}="${${var}}"
.endfor

.endif	# ! BEFOREPORTMK
Comment 3 Alejandro Pulver freebsd_committer 2006-08-15 22:19:41 UTC
This new bsd.lua.mk avoids processing the component list and adding
dependencies twice (adds a _LUA_Include_Post check and definition).

#-*- mode: makefile; tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
# bsd.lua.mk - Support for Lua based ports.
#
# Created by: Alejandro Pulver <alepulver@FreeBSD.org>
#
# Please view me with 4 column tabs!
#
# The following variables can be defined in a port that uses the Lua library,
# tolua, Ruby bindings or related components like .lua modules (with run
# and/or build dependencies). It can be used after and/or before
# bsd.port.pre.mk, but Ruby components will only work if Ruby variables (e.g.
# USE_RUBY) are defined before it (this is a bsd.ruby.mk limitation), at least
# it is manually included.
# USE_LUA		- Set to the list of Lua versions that can be used by the
#				  port. The syntax allows the following elements:
#				  - Single version (e.g. "4.0").
#				  - Range of versions (e.g. "5.0-5.1"). Must be ascending.
#				  - Partial range: single version and upper (e.g. "5.0+").
#				  - Partial range: single version and lower (e.g. "5.1-").
#				  Multiple elements can be specified separated by spaces.
# USE_LUA_NOT	- Set to the list of Lua versions that can't be used by the
#				  port. In other words, it removes some versions from USE_LUA.
#				  If the latter is not defined, it will have the value of all
#				  the possible versions. The syntax is like USE_LUA.
# LUA_COMPS		- Set to the list of Lua components the port uses. Several
#				  components can be specified separated by spaces. By default
#				  it will have the value of "lua". Suffixes in the form ":xxx"
#				  may be added to the components to determine the dependency
#				  type.
#				  The available components are:
#				  lua			- The Lua library.
#				  tolua			- The tolua library (vers 4.0-5.0).
#				  ruby			- The Ruby bindings for Lua (vers 4.0-5.0).
#				  app, compat51, dfui, filename, gettext, posix, pty and
#				  socket		- Modules for Lua 5.0.
#				  The available dependency types are:
#				  build			- Requires component for building.
#				  lib			- Requires component for building and running.
#				  run			- Requires component for running.
#				  If no suffix is present then "lib" will be used for "lua"
#				  4.0-5.0 and "ruby", "build" for lua 5.1 and "tolua" (they
#				  are static), all others default to "run".
# LUA_PREMK		- Define to determine version and define variables after
#				  <bsd.port.pre.mk> (in case the port needs to manually run
#				  the Lua program or the like).
# WANT_LUA		- Set to "yes" or a valid single version (no ranges, etc).
#				  In both cases it will detect the installed Lua components
#				  and add them to the variable HAVE_LUA. If a version is
#				  selected, HAVE_LUA will contain a list of components in the
#				  other case it will contain a list of "component-version"
#				  pairs (e.g. lua-4.0, tolua-5.1, etc).
#				  It has to be used before bsd.port.pre.mk.
# WANT_LUA_VER	- Set to the prefered Lua version for the port. It must be
#				  present in USE_LUA or missing in USE_LUA_NOT. This is
#				  overriden by the user variable WITH_LUA_VER if set. It can
#				  contain multiple versions in order of preference (last ones
#				  are tried first).
#
# The following variables are intended for the user and can be defined in
# make.conf.
# WITH_LUA_VER	- Define to the list of prefered versions in reverse order.
#
# The following variables are defined by this file, to be read from the port.
# HAVE_LUA		- The list of Lua components installed, if WANT_LUA was
#				  defined. The components will have version suffix if it was
#				  set to "yes".
# 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 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_MODSHAREDIR	- The directory where Lua module libraries (.so) are
#					  installed.
# LUA_PKGNAMEPREFIX	- The package name prefix used by Lua modules.
#
# Examples:
# - A port that needs Lua 4.0 and tolua (also 4.0) libraries (lua for building
#   and running and tolua for building).
#	USE_LUA=	4.0
#	LUA_COMPS=	lua tolua
# - A port that needs Ruby bindings for Lua 5.0 for building and running.
#	USE_LUA=	5.0
#	LUA_COMPS=	ruby
# - A port that needs tolua 5.0 or 5.1 for building.
#	USE_LUA=	5.0 5.1
#	LUA_COMPS=	tolua
# - A port that needs Lua version 5.0 or higher for building and running.
#	USE_LUA=	5.0+
# - A port that needs Lua of any version other than 5.1 for building and
#   running.
#	USE_LUA_NOT=5.1
#

LUA_Include_MAINTAINER=	alepulver@FreeBSD.org

#
# Global definitions.
#

.if !defined(_LUA_Definitions_Done)
_LUA_Definitions_Done=	yes

# Common variables:
# _LUA_COMPS_ALL		- List of valid components.
# _LUA_DEP_TYPES_ALL	- List of valid dependency types.
# _LUA_VERS_ALL			- List of available Lua versions.
# _LUA_VERS_LISTS=		- Reverse lists preference order.
# _LUA_PLIST_ALL		- List of variables to be added to PLIST_SUB.
# _LUA_PLIST_DIR_ALL	- List of path variables (relative to ${LUA_PREFIX})
#						  to be added to PLIST_SUB.
#

_LUA_COMPS_ALL=			lua tolua ruby \
						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
_LUA_PLIST_DIR_ALL=		LUA_BINDIR LUA_INCDIR LUA_LIBDIR \
						LUA_MODLIBDIR LUA_MODSHAREDIR
_LUA_VERS_LISTS=		WANT_LUA_VER WITH_LUA_VER

#
# Variables used to determine what is needed.
# _LUA_PORT_comp_ver	- Port directory.
# _LUA_LIB_comp_ver		- Name of the shared library (optional).
# _LUA_SHVER_comp_ver	- Shared library version (optional).
# _LUA_FILE_comp_ver	- File installed by that component.
# _LUA_DEPTYPE_comp_ver	- Default dependency type.
#

_LUA_PORT_lua_4.0=		lang/lua4
_LUA_DEPTYPE_lua_4.0=	lib
_LUA_PORT_tolua_4.0=	lang/tolua4
_LUA_PORT_ruby_4.0=		lang/ruby-lua4

_LUA_PORT_lua_5.0=		lang/lua50
_LUA_DEPTYPE_lua_5.0=	lib
_LUA_PORT_tolua_5.0=	lang/tolua
_LUA_PORT_ruby_5.0=		lang/ruby-lua

_LUA_PORT_app_5.0=		devel/lua50-app
_LUA_PORT_compat51_5.0=	devel/lua50-compat51
_LUA_FILE_compat51_5.0=	${LUA_MODSHAREDIR}/compat-5.1.lua
_LUA_PORT_dfui_5.0=		devel/lua50-dfui
_LUA_PORT_filename_5.0=	devel/lua50-filename
_LUA_PORT_gettext_5.0=	devel/lua50-gettext
_LUA_PORT_posix_5.0=	devel/lua50-posix
_LUA_PORT_pty_5.0=		devel/lua50-pty
_LUA_PORT_socket_5.0=	net/luasocket

_LUA_PORT_lua_5.1=		lang/lua
_LUA_DEPTYPE_lua_5.1=	build

.for comp in ${_LUA_COMPS_ALL}
_LUA_COMP=				${comp}
.	for ver in ${_LUA_VERS_ALL}
.		if ${_LUA_COMP} == "lua"
_LUA_LIB_${comp}_${ver}=	lua-${LUA_VER}.${LUA_VER_SH}
_LUA_SHVER_${comp}_${ver}=	${LUA_VER_SH}
_LUA_FILE_${comp}_${ver}=	${LUA_LIBDIR}/liblua.a
.		elif ${_LUA_COMP} == "tolua"
_LUA_FILE_${comp}_${ver}=	${LUA_LIBDIR}/libtolua.a
_LUA_DEPTYPE_${comp}_${ver}=build
.		elif ${_LUA_COMP} == "ruby"
_LUA_FILE_${comp}_${ver}=	${RUBY_SITEARCHLIBDIR}/lua-${LUA_VER}.so
_LUA_DEPTYPE_${comp}_${ver}=lib
.		else
.			if !defined(_LUA_FILE_${comp}_${ver})
_LUA_FILE_${comp}_${ver}=	${LUA_MODSHAREDIR}/${comp}.lua
.			endif
_LUA_DEPTYPE_${comp}_${ver}=run
.		endif
.	endfor
.endfor

.endif

#
# Check for present components.
#

.if defined(WANT_LUA) && !defined(AFTERPORTMK)
.	for __WANT_LUA in ${WANT_LUA}
# Check if WANT_LUA contains more than one word.
.		if defined(HAVE_LUA)
IGNORE?=				selected multiple values for WANT_LUA: ${WANT_LUA}
.		endif
HAVE_LUA=				#
# Check for all versions.
.		if ${WANT_LUA:L} == "yes"
.			for comp in ${_LUA_COMPS_ALL}
.				for ver in ${_LUA_VERS_ALL}
_LUA_COMP=				_LUA_FILE_${comp}_${ver}
.					if defined(${_LUA_COMP}) && exists(${${_LUA_COMP}})
HAVE_LUA+=				${comp}-${ver}
.					endif
.				endfor
.			endfor
# Check for a specific version.
.		elif ${_LUA_VERS_ALL:M${__WANT_LUA}} != ""
.			for comp in ${_LUA_COMPS_ALL}
.				if exists(${_LUA_FILE_${comp}_${__WANT_LUA}})
HAVE_LUA+=				${comp}
.				endif
.			endfor
.		else
IGNORE?=				selected an invalid value for WANT_LUA: ${__WANT_LUA}
.		endif
.	endfor
.endif		# WANT_LUA && !AFTERPORTMK

#
# Select Lua version.
#

.if !defined(_LUA_Version_Done) && (!defined(BEFOREPORTMK) || \
    (defined(LUA_PREMK) && !defined(AFTERPORTMK) && \
    (defined(USE_LUA) || defined(USE_LUA_NOT))))
_LUA_Version_Done=		yes

# Set defaults (if one isn't present).

USE_LUA?=				${_LUA_VERS_ALL}
USE_LUA_NOT?=			#

#
# Make lists of valid and invalid versions.
#
# The following variables are used:
# _LUA_VER_CHECK		- If the version is a single one, express in a range.
# _LUA_VER_MIN			- Lower version of the range.
# _LUA_VER_MAX			- Higher version of the range.
# _LUA_VER_LIST			- List of requested versions.
# _LUA_VER_NOT_LIST		- List of disallowed versions.
# _LUA_VER_FINAL		- List of requested version without disallowed ones.
#

.for list in VER VER_NOT
_LUA_${list}_LIST=		#
.	for ver in ${USE_LUA${list:C/VER//}}
_LUA_VER_CHECK:=		${ver:C/^([[:digit:]]+(\.[[:digit:]]+)*)$/\1-\1/}
_LUA_VER_MIN:=			${_LUA_VER_CHECK:C/([[:digit:]]+(\.[[:digit:]]+)*)[-+].*/\1/}
_LUA_VER_MAX:=			${_LUA_VER_CHECK:C/.*-([[:digit:]]+(\.[[:digit:]]+)*)/\1/}
# Minimum version not specified.
.		if ${_LUA_VER_MIN} == ${_LUA_VER_CHECK}
.			undef _LUA_VER_MIN
.			for v in ${_LUA_VERS_ALL}
_LUA_VER_MIN?=			${v}
.			endfor
.		endif
# Maximum version not specified.
.		if ${_LUA_VER_MAX} == ${_LUA_VER_CHECK}
.			for v in ${_LUA_VERS_ALL}
_LUA_VER_MAX=			${v}
.			endfor
.		endif
# Expand versions and add valid ones to each list.
.		for v in ${_LUA_VERS_ALL}
.			if ${_LUA_VER_MIN} <= ${v} && ${_LUA_VER_MAX} >= ${v} && \
			   ${_LUA_${list}_LIST:M${v}} == ""
_LUA_${list}_LIST+=		${v}
.			endif
.		endfor
.	endfor
.endfor

# Merge the lists into a single list of valid versions.

_LUA_VER_FINAL=			#
.for ver in ${_LUA_VER_LIST}
.	if ${_LUA_VER_NOT_LIST:M${ver}} == ""
_LUA_VER_FINAL+=		${ver}
.	endif
.endfor

# Check for a null version.

.if empty(_LUA_VER_FINAL)
IGNORE?=				selected a null or invalid Lua version
.endif

#
# Choose final version.
#

#
# Check for the following (in order):
# 1) WITH_LUA_VER		- User preference.
# 2) WANT_LUA_VER		- Port preference.
# 3) _LUA_VER_FINAL		- Available versions.
#

.for list in _LUA_VER_FINAL ${_LUA_LISTS_ORDER}
.	if defined(${list})
.		for ver in ${${list}}
.			if ${_LUA_VER_FINAL:M${ver}} != ""
_LUA_VER=				${ver}
.			endif
.		endfor
.	endif
.endfor

#
# Set variables.
#

# Version.
LUA_VER=				${_LUA_VER}
LUA_VER_SH?=			${LUA_VER:C/[[:digit:]]\.([[:digit:]])/\1/}
LUA_VER_STR?=			${LUA_VER:S/.//g}

# Paths.
LUA_PREFIX?=			${LOCALBASE}
LUA_SUBDIR?=			lua${LUA_VER_STR}
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}

# Package name.
LUA_PKGNAMEPREFIX?=		lua${LUA_VER_STR}-

.endif		# !_LUA_Version_Done && (!BEFOREPORTMK || \
#			(LUA_PREMK && !AFTERPORTMK && (USE_LUA || USE_LUA_NOT)))

#
# Process components list and add dependencies, variables, etc.
#

.if !defined(BEFOREPORTMK) && !defined(_LUA_Include_Post)
_LUA_Include_Post=		yes

#
# Component parsing.
#
# The variables used are:
# _LUA_COMP				- Component part.
# _LUA_DEP_TYPE			- Dependency type part.
# _LUA_COMP_NEW			- Component + dependency type.
# _LUA_COMPS_FINAL		- Final list of components with dependency types.
#

# Default components.

LUA_COMPS?=				lua

# Detect invalid and duplicated components.

_LUA_COMPS_FINAL=		#
.for comp in ${LUA_COMPS}
_LUA_COMP=				${comp:C/:([[:alpha:]]+)$//}
.	if ${_LUA_COMP} == ${comp}
_LUA_DEP_TYPE=			${_LUA_DEPTYPE_${comp}_${_LUA_VER}}
.	else
_LUA_DEP_TYPE=			${comp:C/.+:([[:alpha:]]+)$/\1/}
.	endif
_LUA_COMP_NEW=			${_LUA_COMP}_${_LUA_DEP_TYPE}
.	for __LUA_COMP in ${_LUA_COMP}
.		if ${_LUA_COMPS_ALL:M${__LUA_COMP}} == ""
IGNORE?=				selected an invalid Lua component: ${__LUA_COMP}
.		endif
.	endfor
.	for __LUA_DEP_TYPE in ${_LUA_DEP_TYPE}
.		if ${_LUA_DEP_TYPES_ALL:M${__LUA_DEP_TYPE}} == ""
IGNORE?=				selected an invalid Lua dependency type: ${__LUA_DEP_TYPE}
.		endif
.	endfor
.	if !defined(_LUA_PORT_${_LUA_COMP}_${_LUA_VER})
IGNORE?=				selected a Lua component (${_LUA_COMP}) which is not available for the selected version (${_LUA_VER})
.	endif
.	for newcomp in ${_LUA_COMP_NEW}
.		if ${_LUA_COMPS_FINAL:M${newcomp}} == ""
_LUA_COMPS_FINAL+=		${newcomp}
.		endif
.	endfor
.endfor

# Add dependencies.
#
# The variable used are:
# _LUA_COMP		-		- Component part.
# _LUA_DEP_TYPE			- Dependency type part.

.for comp in ${_LUA_COMPS_FINAL}
_LUA_DEP_TYPE=			${comp:C/.+_([[:alpha:]]+)$/\1/}
_LUA_COMP=				${comp:C/_([[:alpha:]]+)$//}
# XXX Need a .for loop here so the variable is expanded before the assignment.
.	for comp_part in ${_LUA_COMP}
.		if ${_LUA_DEP_TYPE} == "lib"
.			if defined(_LUA_LIB_${comp_part}_${_LUA_VER})
LIB_DEPENDS+=			${_LUA_LIB_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
.			else
BUILD_DEPENDS+=			${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
RUN_DEPENDS+=			${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
.			endif
.		else
${_LUA_DEP_TYPE:U}_DEPENDS+=	${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
.		endif
.	endfor
.endfor

# Packaging list variables.
.for var in ${_LUA_PLIST_ALL}
PLIST_SUB+=				${var}="${${var}}"
.endfor
.for var in ${_LUA_PLIST_DIR_ALL}
PLIST_SUB+=				${var}="${${var}:S/${LUA_PREFIX}\///}"
.endfor
.for var in ${_LUA_PLIST_ALL} ${_LUA_PLIST_DIR_ALL}
MAKE_ENV+=				${var}="${${var}}"
.endfor

.endif	# ! BEFOREPORTMK
Comment 4 Alejandro Pulver freebsd_committer 2006-08-17 21:04:20 UTC
This new diff is relative to the ports directory. Also applies to the
latest "games/alephone".

Index: ./mail/imapfilter/Makefile
===================================================================
RCS file: /home/pcvs/ports/mail/imapfilter/Makefile,v
retrieving revision 1.18
diff -u -r1.18 Makefile
--- ./mail/imapfilter/Makefile	28 May 2006 15:43:33 -0000	1.18
+++ ./mail/imapfilter/Makefile	17 Aug 2006 19:52:36 -0000
@@ -13,35 +13,39 @@
 MAINTAINER=	stefan@FreeBSD.org
 COMMENT=	IMAP mail filtering utility
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.hpp:${PORTSDIR}/lang/lua
-
 USE_BZIP2=	yes
+USE_LUA=	5.1
 USE_OPENSSL=	yes
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS=	-d ${PREFIX} -s ${DATADIR}
+CPPFLAGS=	-I${LOCALBASE}/include -I${LUA_INCDIR}
+LDFLAGS=	-L${LOCALBASE}/lib -L${LUA_LIBDIR}
 
 MAN1=		imapfilter.1
 MAN5=		imapfilter_config.5
 PORTDOCS=	LICENSE NEWS README
 PLIST_FILES=	bin/imapfilter \
-		${DATADIR:S%${PREFIX}/%%}/interface.lua \
-		${DATADIR:S%${PREFIX}/%%}/auxiliary.lua \
-		${EXAMPLESDIR:S%${PREFIX}/%%}/sample.config.lua \
-		${EXAMPLESDIR:S%${PREFIX}/%%}/sample.extend.lua
-PLIST_DIRS=	${DATADIR:S%${PREFIX}/%%} ${EXAMPLESDIR:S%${PREFIX}/%%}
+		%%DATADIR%%/interface.lua \
+		%%DATADIR%%/auxiliary.lua \
+		%%EXAMPLESDIR%%/sample.config.lua \
+		%%EXAMPLESDIR%%/sample.extend.lua
+PLIST_DIRS=	%%DATADIR%% %%EXAMPLESDIR%%
 
 post-patch:
-	${REINPLACE_CMD} -e "s,%%PREFIX%%,${PREFIX},g" ${WRKSRC}/configure
-	${REINPLACE_CMD} -e "s,%%LOCALBASE%%,${LOCALBASE},g" ${WRKSRC}/configure
+	@${REINPLACE_CMD} -Ee \
+		's|^(incdirs=).*|\1"${CPPFLAGS}"| ; \
+		 s|^(libdirs=).*|\1"${LDFLAGS}"| ; \
+		 s|^(mycflags=).*|\1"${CFLAGS}"| ; \
+		 s|-llualib||' \
+		${WRKSRC}/configure
 
 post-install:
 	${STRIP_CMD} ${PREFIX}/bin/imapfilter
-	@${MKDIR} ${DATADIR}
-	cd ${WRKSRC} && ${INSTALL_DATA} interface.lua \
-		auxiliary.lua ${DATADIR}
-	@${MKDIR} ${EXAMPLESDIR}
-	cd ${WRKSRC} && ${INSTALL_DATA} sample.config.lua \
-		sample.extend.lua ${EXAMPLESDIR}
+	@${MKDIR} ${DATADIR} ${EXAMPLESDIR}
+	cd ${WRKSRC} && \
+		${INSTALL_DATA} interface.lua auxiliary.lua ${DATADIR} && \
+		${INSTALL_DATA} sample.config.lua sample.extend.lua \
+			${EXAMPLESDIR}
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 	cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
Index: ./mail/imapfilter/files/patch-configure
===================================================================
RCS file: ./mail/imapfilter/files/patch-configure
diff -N ./mail/imapfilter/files/patch-configure
--- ./mail/imapfilter/files/patch-configure	28 May 2006 15:43:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,73 +0,0 @@
---- configure.orig	Thu Mar  9 23:58:22 2006
-+++ configure	Fri May 26 21:52:12 2006
-@@ -2,7 +2,7 @@
- 
- # Default values
- 
--destdir="/usr/local"
-+destdir="%%PREFIX%%"
- bindir="$destdir/bin"
- sharedir="$destdir/share/imapfilter"
- mandir="$destdir/man"
-@@ -10,13 +10,13 @@
- ssltls="yes"
- crammd5="yes"
- 
--incdirs="-I/usr/local/include"
--libdirs="-L/usr/local/lib"
-+incdirs="-I%%LOCALBASE%%/include"
-+libdirs="-L%%LOCALBASE%%/lib"
- 
- mycflags="-Wall -O"
- myldflags=""
- 
--libs="-lm -llua -llualib"
-+libs="-lm -llua"
- libssl="-lssl"
- libcrypto="-lcrypto"
- 
-@@ -145,16 +145,16 @@
- SHAREDIR = $sharedir
- MANDIR = $mandir
- 
-+INST_BIN = \$(BSD_INSTALL_PROGRAM)
-+INST_DOC = \$(BSD_INSTALL_MAN)
-+
- INCDIRS = $incdirs
- LIBDIRS = $libdirs
- 
--MYCFLAGS = $mycflags
--MYLDFLAGS = $myldflags
--
- DEFS = $defs
- 
--CFLAGS = \$(MYCFLAGS) \$(DEFS) \$(INCDIRS)
--LDFLAGS = \$(MYLDFLAGS) \$(LIBDIRS)
-+CFLAGS += \$(DEFS) \$(INCDIRS)
-+LDFLAGS += \$(LIBDIRS)
- 
- LIBS = $libs
- 
-@@ -184,19 +184,9 @@
- imapfilter.o: version.h
- 
- install: \$(BIN)
--	if test ! -d \$(BINDIR); then mkdir -p \$(BINDIR); fi
--	cp -f \$(BIN) \$(BINDIR) && chmod 0755 \$(BINDIR)/\$(BIN)
--	if test ! -d \$(SHAREDIR); then mkdir -p \$(SHAREDIR); fi
--	cp -f \$(INTERFACE_LUA) \$(SHAREDIR) && \\
--		chmod 0644 \$(SHAREDIR)/\$(INTERFACE_LUA)
--	cp -f \$(AUXILIARY_LUA) \$(SHAREDIR) && \\
--		chmod 0644 \$(SHAREDIR)/\$(AUXILIARY_LUA)
--	if test ! -d \$(MANDIR)/man1; then mkdir -p \$(MANDIR)/man1; fi
--	cp -f \$(MAN_BIN) \$(MANDIR)/man1 && \\
--		chmod 0644 \$(MANDIR)/man1/\$(MAN_BIN)
--	if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi
--	cp -f \$(MAN_CONFIG) \$(MANDIR)/man5 && \\
--		chmod 0644 \$(MANDIR)/man5/\$(MAN_CONFIG)
-+	\$(INST_BIN) \$(BIN) \$(BINDIR)
-+	\$(INST_DOC) \$(MAN_BIN) \$(MANDIR)/man1
-+	\$(INST_DOC) \$(MAN_CONFIG) \$(MANDIR)/man5
- 
- deinstall:
- 	rm -f \$(BINDIR)/\$(BIN) \$(SHAREDIR)/\$(INTERFACE_LUA) \\
Index: ./textproc/ruby-xml-script/Makefile
===================================================================
RCS file: /home/pcvs/ports/textproc/ruby-xml-script/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./textproc/ruby-xml-script/Makefile	11 Nov 2005 01:17:55 -0000	1.2
+++ ./textproc/ruby-xml-script/Makefile	17 Aug 2006 19:52:36 -0000
@@ -16,9 +16,10 @@
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A Ruby module for scripting an XML stream using an ASP-like notation
 
-RUN_DEPENDS=	${RUBY_SITEARCHLIBDIR}/js.so:${PORTSDIR}/lang/ruby-js \
-		${RUBY_SITEARCHLIBDIR}/lua.so:${PORTSDIR}/lang/ruby-lua4
+RUN_DEPENDS=	${RUBY_SITEARCHLIBDIR}/js.so:${PORTSDIR}/lang/ruby-js
 
+USE_LUA=	4.0
+LUA_COMPS=	ruby
 USE_RUBY=	yes
 USE_RUBY_SETUP=	yes
 
@@ -28,6 +29,10 @@
 		README
 EXAMPLES=	tests/*
 
+post-patch:
+	@${REINPLACE_CMD} -Ee 's|(language/lua)|\1-${LUA_VER}|' \
+		${WRKSRC}/lib/xml/script/lua/compiler.rb
+
 post-install:
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${RUBY_MODEXAMPLESDIR}
Index: ./x11-wm/ion-2/Makefile
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-2/Makefile,v
retrieving revision 1.20
diff -u -r1.20 Makefile
--- ./x11-wm/ion-2/Makefile	3 May 2006 13:25:07 -0000	1.20
+++ ./x11-wm/ion-2/Makefile	17 Aug 2006 19:52:36 -0000
@@ -15,15 +15,14 @@
 MAINTAINER=	anthony.ginepro@laposte.net
 COMMENT=	Ion is a tiling tabbed window manager
 
-LIB_DEPENDS=	lua.5:${PORTSDIR}/lang/lua50
-
 CONFLICTS=	ion-2002* ion-devel-* pwm-*
 
-GNU_CONFIGURE=	yes
-USE_AUTOTOOLS=	libtool:15 libltdl:15
 USE_X_PREFIX=	yes
+USE_AUTOTOOLS=	libtool:15 libltdl:15
+USE_LUA=	5.0
 USE_GMAKE=	yes
 MAKE_ENV=	DEFINES="${IONDEFINES}"
+GNU_CONFIGURE=	yes
 
 .if !defined(WITH_MULTIBYTE)
 IONDEFINES+=	-DCF_NO_MB_SUPPORT
Index: ./x11-wm/ion-2/files/patch-rules.mk
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-2/files/patch-rules.mk,v
retrieving revision 1.1
diff -u -r1.1 patch-rules.mk
--- ./x11-wm/ion-2/files/patch-rules.mk	30 May 2004 07:06:29 -0000	1.1
+++ ./x11-wm/ion-2/files/patch-rules.mk	17 Aug 2006 19:52:36 -0000
@@ -1,5 +1,5 @@
---- rules.mk	Wed Apr  7 09:15:54 2004
-+++ rules.mk.bsd	Sun Apr 11 12:55:10 2004
+--- ./rules.mk.orig	Thu Jul 29 00:10:32 2004
++++ ./rules.mk	Mon Jul 17 21:50:19 2006
 @@ -91,6 +91,7 @@
  module_install:
  	$(INSTALLDIR) $(MODULEDIR)
Index: ./x11-wm/ion-2/files/patch-system.mk
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-2/files/patch-system.mk,v
retrieving revision 1.9
diff -u -r1.9 patch-system.mk
--- ./x11-wm/ion-2/files/patch-system.mk	23 Feb 2006 10:40:40 -0000	1.9
+++ ./x11-wm/ion-2/files/patch-system.mk	17 Aug 2006 19:52:36 -0000
@@ -1,5 +1,5 @@
---- system.mk.orig	Tue Jun  1 16:35:23 2004
-+++ system.mk	Sat Jun  5 13:27:08 2004
+--- ./system.mk.orig	Thu Jul 29 00:10:32 2004
++++ ./system.mk	Mon Jul 17 21:53:01 2006
 @@ -7,7 +7,7 @@
  ## Installation paths
  ##
@@ -33,15 +33,23 @@
  
  # The following should do it if you have manually installed libtool 1.5 in
  # $(LIBTOOLDIR).
-@@ -72,7 +72,7 @@
+@@ -72,11 +72,11 @@
  
  # If you have installed Lua 5.0 from the official tarball without changing
  # paths, this should do it.
 -LUA_DIR=/usr/local
+-LUA_LIBS = -L$(LUA_DIR)/lib -R$(LUA_DIR)/lib -llua -llualib
+-LUA_INCLUDES = -I$(LUA_DIR)/include
+-LUA=$(LUA_DIR)/bin/lua
+-LUAC=$(LUA_DIR)/bin/luac
 +LUA_DIR=$(LOCALBASE)
- LUA_LIBS = -L$(LUA_DIR)/lib -R$(LUA_DIR)/lib -llua -llualib
- LUA_INCLUDES = -I$(LUA_DIR)/include
- LUA=$(LUA_DIR)/bin/lua
++LUA_LIBS = -L$(LUA_LIBDIR) -R$(LUA_LIBDIR) -llua -llualib
++LUA_INCLUDES = -I$(LUA_INCDIR)
++LUA=$(LUA_BINDIR)/lua
++LUAC=$(LUA_BINDIR)/luac
+ 
+ # If you are using the Debian packages, the following settings should be
+ # what you want.
 @@ -90,7 +90,7 @@
  ## X libraries, includes and options
  ##
Index: ./x11-wm/ion-3ds/Makefile
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-3ds/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- ./x11-wm/ion-3ds/Makefile	14 Jul 2006 23:51:10 -0000	1.14
+++ ./x11-wm/ion-3ds/Makefile	17 Aug 2006 19:52:36 -0000
@@ -13,12 +13,12 @@
 MAINTAINER=	ed@fxq.nl
 COMMENT=	The development version of the Ion window manager
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.hpp:${PORTSDIR}/lang/lua
 RUN_DEPENDS=	run-mailcap:${PORTSDIR}/misc/mime-support
 
 USE_X_PREFIX=	yes
 USE_GETTEXT=	yes
 USE_GMAKE=	yes
+USE_LUA=	5.1
 MAKE_ENV=	DEFINES="${IONDEFINES}"
 
 .if !defined(WITH_XINERAMA)
Index: ./x11-wm/ion-3ds/files/patch-system.mk
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-3ds/files/patch-system.mk,v
retrieving revision 1.3
diff -u -r1.3 patch-system.mk
--- ./x11-wm/ion-3ds/files/patch-system.mk	28 May 2006 15:55:13 -0000	1.3
+++ ./x11-wm/ion-3ds/files/patch-system.mk	17 Aug 2006 19:52:36 -0000
@@ -1,5 +1,5 @@
---- system.mk.orig	Thu May 18 16:06:53 2006
-+++ system.mk	Fri May 19 13:19:25 2006
+--- ./system.mk.orig	Wed May 24 13:23:51 2006
++++ ./system.mk	Mon Jul 17 18:15:24 2006
 @@ -7,7 +7,7 @@
  ## Installation paths
  ##
@@ -27,15 +27,23 @@
  
  
  ##
-@@ -56,7 +56,7 @@
+@@ -56,11 +56,11 @@
  
  # If you have installed Lua 5.1 from the official tarball without changing
  # paths, this should do it.
 -LUA_DIR=/usr/local
+-LUA_LIBS = -L$(LUA_DIR)/lib -llua
+-LUA_INCLUDES = -I$(LUA_DIR)/include
+-LUA=$(LUA_DIR)/bin/lua
+-LUAC=$(LUA_DIR)/bin/luac
 +LUA_DIR=$(LOCALBASE)
- LUA_LIBS = -L$(LUA_DIR)/lib -llua
- LUA_INCLUDES = -I$(LUA_DIR)/include
- LUA=$(LUA_DIR)/bin/lua
++LUA_LIBS = -L$(LUA_LIBDIR) -llua
++LUA_INCLUDES = -I$(LUA_INCDIR)
++LUA=$(LUA_BINDIR)/lua
++LUAC=$(LUA_BINDIR)/luac
+ 
+ # If you are using the Debian packages, the following settings should be
+ # what you want.
 @@ -74,7 +74,7 @@
  ## X libraries, includes and options
  ##
Index: ./games/alephone/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/alephone/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- ./games/alephone/Makefile	12 Aug 2006 21:03:35 -0000	1.24
+++ ./games/alephone/Makefile	17 Aug 2006 19:52:36 -0000
@@ -16,19 +16,18 @@
 COMMENT=	The open source version of Bungie's Marathon game
 
 BUILD_DEPENDS=	${LOCALBASE}/include/boost/function.hpp:${PORTSDIR}/devel/boost
-LIB_DEPENDS=	speex.3:${PORTSDIR}/audio/speex \
-		lua.5:${PORTSDIR}/lang/lua50
+LIB_DEPENDS=	speex.3:${PORTSDIR}/audio/speex
 
 USE_BZIP2=	yes
 USE_X_PREFIX=	yes
+USE_GL=		yes
 USE_GNOME=	gnometarget
+USE_LUA=	5.0
 USE_SDL=	image net sdl sound
-USE_GL=		yes
 GNU_CONFIGURE=	yes
 CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
-
-CPPFLAGS=	-I${LOCALBASE}/include -I${X11BASE}/include
-LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib
+CPPFLAGS=	-I${LOCALBASE}/include -I${X11BASE}/include -I${LUA_INCDIR}
+LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib -L${LUA_LIBDIR}
 
 .include <bsd.port.pre.mk>
 
Index: ./games/enigma/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/enigma/Makefile,v
retrieving revision 1.32
diff -u -r1.32 Makefile
--- ./games/enigma/Makefile	6 Jul 2006 17:54:46 -0000	1.32
+++ ./games/enigma/Makefile	17 Aug 2006 19:52:36 -0000
@@ -15,21 +15,23 @@
 MAINTAINER=	anholt@FreeBSD.org
 COMMENT=	Enigma is a reimplementation of Oxyd, a puzzle game
 
-BUILD_DEPENDS=	${LOCALBASE}/bin/tolua:${PORTSDIR}/lang/tolua4
-LIB_DEPENDS=	zipios.0:${PORTSDIR}/archivers/zipios++ \
-		lua.4:${PORTSDIR}/lang/lua4
+LIB_DEPENDS=	zipios.0:${PORTSDIR}/archivers/zipios++
 
 USE_GCC=	3.4
-
-GNU_CONFIGURE=	yes
-USE_XLIB=	yes
 USE_GMAKE=	yes
 USE_GETTEXT=	yes
+USE_LUA=	4.0
+LUA_COMPS=	lua tolua
 USE_SDL=	gfx image mixer sdl ttf
+USE_XLIB=	yes
+GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--target="" \
 		--with-libintl-prefix="${LOCALBASE}"
-CONFIGURE_ENV=	LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}" \
-		CXXFLAGS="${PTHREAD_CFLAGS} -I${X11BASE}/include"
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" CXXFLAGS="${CXXFLAGS}" \
+		LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${LOCALBASE}/include -I${LUA_INCDIR}
+CXXFLAGS=	-I${X11BASE}/include ${PTHREAD_CFLAGS}
+LDFLAGS=	-L${LOCALBASE}/lib -L${LUA_LIBDIR} ${PTHREAD_LIBS}
 
 MAN6=		enigma.6
 
Index: ./games/fillets-ng/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/fillets-ng/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- ./games/fillets-ng/Makefile	7 May 2006 23:45:15 -0000	1.5
+++ ./games/fillets-ng/Makefile	17 Aug 2006 19:52:36 -0000
@@ -19,15 +19,16 @@
 MAINTAINER=	amdmi3@mail.ru
 COMMENT=	A wonderful puzzle game
 
-LIB_DEPENDS=	lua.5:${PORTSDIR}/lang/lua50
-
 USE_SDL=	sdl mixer image ttf
+USE_LUA=	5.0
 USE_GMAKE=	yes
 GNU_CONFIGURE=	yes
 
-CONFIGURE_ENV=		SDL_CONFIG="${SDL_CONFIG}"
+CONFIGURE_ENV=		CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
 CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
 CONFIGURE_ARGS=		--datadir="${DATADIR}" --with-lua="${LOCALBASE}"
+CPPFLAGS=	-I${LUA_INCDIR}
+LDFLAGS=	-L${LUA_LIBDIR}
 
 OPTIONS=	FRIBIDI		"Enable fribidi support"	off
 
Index: ./games/xmoto/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/xmoto/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- ./games/xmoto/Makefile	28 Jul 2006 15:10:38 -0000	1.8
+++ ./games/xmoto/Makefile	17 Aug 2006 19:52:37 -0000
@@ -18,19 +18,19 @@
 LIB_DEPENDS=	vorbis.3:${PORTSDIR}/audio/libvorbis \
 		png.5:${PORTSDIR}/graphics/png \
 		jpeg.9:${PORTSDIR}/graphics/jpeg
-BUILD_DEPENDS=	${X11BASE}/lib/libode.a:${PORTSDIR}/devel/ode \
-		${LOCALBASE}/include/lua.hpp:${PORTSDIR}/lang/lua
+BUILD_DEPENDS=	${X11BASE}/lib/libode.a:${PORTSDIR}/devel/ode
 
 GNU_CONFIGURE=	yes
 USE_GMAKE=	yes
 USE_GL=		yes
+USE_LUA=	5.1
 USE_SDL=	sdl mixer
 USE_DOS2UNIX=	src/*.cpp src/*.h
 
 CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
-CONFIGURE_ENV=	LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib" \
-		CPPFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include" \
-		SDL_CONFIG="${SDL_CONFIG}"
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${LOCALBASE}/include -I${X11BASE}/include -I${LUA_INCDIR}
+LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib -L${LUA_LIBDIR}
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 
@@ -45,13 +45,14 @@
 .endif
 
 post-patch:
-	@${REINPLACE_CMD} -e 's|SDL/|SDL11/|' ${WRKSRC}/src/VCommon.h
-	@${REINPLACE_CMD} -e 's|malloc.h|stdlib.h|' ${WRKSRC}/src/image/tim_memory_crt.cpp
-	@${REINPLACE_CMD} -e 's|endian.h|sys/endian.h|' ${WRKSRC}/src/VCommon.h
-	@${REINPLACE_CMD} -e '/LIBS/ s|\(-lSDL_mixer\)|\1 `${SDL_CONFIG} --libs`|' ${WRKSRC}/configure
-.if !defined(WITH_CURL)
-	@${REINPLACE_CMD} -e 's|test $$ac_cv_lib_curl_curl_easy_init = yes|false|' ${WRKSRC}/configure
-.endif
+	@${REINPLACE_CMD} -e 's|SDL/||; s|endian.h|sys/endian.h|' \
+		${WRKSRC}/src/VCommon.h
+	@${REINPLACE_CMD} -e 's|malloc.h|stdlib.h|' \
+		${WRKSRC}/src/image/tim_memory_crt.cpp
+	@${REINPLACE_CMD} -e \
+		'/LIBS/ s|\(-lSDL_mixer\)|`${SDL_CONFIG} --libs` \1| ; \
+		 s|test $$ac_cv_lib_curl_curl_easy_init = yes|false|' \
+		${WRKSRC}/configure
 
 .if !defined(NOPORTDOCS)
 post-install:
Index: ./games/stratagus/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/stratagus/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- ./games/stratagus/Makefile	7 May 2006 23:45:35 -0000	1.6
+++ ./games/stratagus/Makefile	17 Aug 2006 19:52:37 -0000
@@ -16,32 +16,21 @@
 MAINTAINER=	tlp@liquidx.org
 COMMENT=	Free cross-platform real-time strategy gaming engine
 
-LIB_DEPENDS=	png.5:${PORTSDIR}/graphics/png \
-		lua.5:${PORTSDIR}/lang/lua50
+LIB_DEPENDS=	png.5:${PORTSDIR}/graphics/png
 
+USE_GMAKE=	yes
+USE_LUA=	5.0
 USE_SDL=	yes
 USE_XLIB=	yes
-USE_GMAKE=	yes
-
-WRKSRC=		${WRKDIR}/stratagus-040702
-
 GNU_CONFIGURE=	yes
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${LOCALBASE}/include -I${X11BASE}/include -I${LUA_INCDIR}
+LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib -L${LUA_LIBDIR}
+WRKSRC=		${WRKDIR}/stratagus-040702
 
-.if defined(WITH_OPENGL)
-CONFIGURE_ARGS+=	--with-opengl
-.endif
-
-.if defined(WITHOUT_VORBIS)
-CONFIGURE_ARGS+=	--without-ogg
-.else
-LIB_DEPENDS+=	vorbisfile.4:${PORTSDIR}/audio/libvorbis
-.endif
-
-.if defined(WITHOUT_MIKMOD)
-CONFIGURE_ARGS+=	--without-mikmod
-.else
-LIB_DEPENDS+=	mikmod.2:${PORTSDIR}/audio/libmikmod
-.endif
+OPTIONS=	OPENGL "Enable OpenGL support" on \
+		MIKMOD "Enable Mikmod support" off \
+		VORBIS "Enable Ogg Vorbis support" off
 
 PLIST_FILES=	bin/stratagus
 
@@ -51,20 +40,21 @@
 IGNORE=		does not run properly on FreeBSD 4.x
 .endif
 
-pre-everything::
-	@${ECHO_MSG} ""
-	@${ECHO_MSG} "Stratagus has the following tunable option(s):"
-	@${ECHO_MSG} ""
-	@${ECHO_MSG} "	WITH_OPENGL=yes		Builds Stratagus with OpenGL"
-	@${ECHO_MSG} ""
-	@${ECHO_MSG} "	WITHOUT_VORBIS=yes	Turns off Ogg Vorbis support"
-	@${ECHO_MSG} "	WITHOUT_MIKMOD=yes	Turns off Mikmod support"
-	@${ECHO_MSG} ""
-
-post-configure:
-	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/Makefile
-	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/Rules.make
-	@${REINPLACE_CMD} -e 's|/usr/X11R6|${X11BASE}|' ${WRKSRC}/Rules.make
+.if defined(WITH_OPENGL)
+CONFIGURE_ARGS+=--with-opengl
+.endif
+
+.if defined(WITH_MIKMOD)
+LIB_DEPENDS+=	mikmod.2:${PORTSDIR}/audio/libmikmod
+.else
+CONFIGURE_ARGS+=--without-mikmod
+.endif
+
+.if defined(WITH_VORBIS)
+LIB_DEPENDS+=	vorbisfile.4:${PORTSDIR}/audio/libvorbis
+.else
+CONFIGURE_ARGS+=--without-ogg
+.endif
 
 post-install:
 	@${CAT} ${PKGMESSAGE}
Index: ./games/stratagus/pkg-message
===================================================================
RCS file: /home/pcvs/ports/games/stratagus/pkg-message,v
retrieving revision 1.1
diff -u -r1.1 pkg-message
--- ./games/stratagus/pkg-message	4 Jul 2004 05:27:40 -0000	1.1
+++ ./games/stratagus/pkg-message	17 Aug 2006 19:52:37 -0000
@@ -1,9 +1,9 @@
--------------------------------------------------------------------------------
-NOTE: This is only the engine. If you wish to play a game that uses the 
-Stratagus engine, you must manually download the Stratagus game data. 
+------------------------------------------------------------------------------
+NOTE: This is only the engine. If you wish to play a game that uses the
+Stratagus engine, you must manually download the Stratagus game data.
 
-You can use the 'games/wargus' port to extract data from a legal copy of 
-Warcraft 2 (original DOS version required, won't work with the battle.net 
+You can use the 'games/wargus' port to extract data from a legal copy of
+Warcraft 2 (original DOS version required, won't work with the battle.net
 edition).
 
 For more information, please take a look at the following URL:
@@ -11,4 +11,4 @@
 http://stratagus.sourceforge.net/games.shtml
 
 Enjoy!
--------------------------------------------------------------------------------
+------------------------------------------------------------------------------
Index: ./games/stratagus/files/patch-Rules.make.in
===================================================================
RCS file: ./games/stratagus/files/patch-Rules.make.in
diff -N ./games/stratagus/files/patch-Rules.make.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ./games/stratagus/files/patch-Rules.make.in	17 Aug 2006 19:52:37 -0000
@@ -0,0 +1,38 @@
+--- ./Rules.make.in.orig	Thu Jul  1 22:38:08 2004
++++ ./Rules.make.in	Mon Jul 17 19:23:39 2006
+@@ -10,17 +10,15 @@
+ ##
+ 
+ # Compile commands
+-CC=gcc
+ CCLD=$(CC)
+ RM=rm -f
+-MAKE=make
+ 
+ # Prefix for 'make install'
+ PREFIX=@PREFIX@
+ 
+ # Use LUA support
+-CCL		= -DUSE_LUA
+-CCLLIB		= -lm
++CCL		= -DUSE_LUA -I$(LUA_INCDIR)
++CCLLIB		= -L$(LUA_LIBDIR) -lm
+ 
+ # Video support
+ VIDEO_CFLAGS = @VIDEO_CFLAGS@
+@@ -49,13 +47,12 @@
+ 
+ IFLAGS=	-I$(TOPDIR)/src/include $(XIFLAGS) -I$(TOPDIR)/src/movie/vp31/include
+ 
+-CFLAGS=@EXTRA_CFLAGS@ @PROFILE_CFLAGS@ @DEBUG_CFLAGS@ $(IFLAGS) \
++CFLAGS=@CFLAGS@ @CPPFLAGS@ @EXTRA_CFLAGS@ @PROFILE_CFLAGS@ @DEBUG_CFLAGS@ $(IFLAGS) \
+     -DUSE_HP_FOR_XP -DMAP_REGIONS \
+     @PROFILE_CFLAGS@ @DEBUG_CFLAGS@ @VIDEO_CFLAGS@ @BZ2_CFLAGS@ \
+     @OGG_CFLAGS@ @MAD_CFLAGS@ @FLAC_CFLAGS@ @CDAUDIO_CFLAGS@ \
+     @MIKMOD_CFLAGS@ @LUA_CFLAGS@ $(CCL) \
+-    $(COMP_CFLAGS) @PLATFORM@ \
+-    -I/usr/local/include
++    $(COMP_CFLAGS) @PLATFORM@
+ 
+ CTAGSFLAGS=-i defptvS -a -f 
+ 
Index: ./games/stratagus/files/patch-aa
===================================================================
RCS file: ./games/stratagus/files/patch-aa
diff -N ./games/stratagus/files/patch-aa
--- ./games/stratagus/files/patch-aa	4 Jul 2004 05:27:40 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- Rules.make.in.orig	Thu Jul  1 00:03:00 2004
-+++ Rules.make.in	Thu Jul  1 00:04:55 2004
-@@ -55,7 +55,8 @@
-     @OGG_CFLAGS@ @MAD_CFLAGS@ @FLAC_CFLAGS@ @CDAUDIO_CFLAGS@ \
-     @MIKMOD_CFLAGS@ @LUA_CFLAGS@ $(CCL) \
-     $(COMP_CFLAGS) @PLATFORM@ \
--    -I/usr/local/include
-+    -I/usr/local/include \
-+    -I/usr/X11R6/include
- 
- CTAGSFLAGS=-i defptvS -a -f 
Index: ./games/stratagus/files/patch-configure
===================================================================
RCS file: /home/pcvs/ports/games/stratagus/files/patch-configure,v
retrieving revision 1.1
diff -u -r1.1 patch-configure
--- ./games/stratagus/files/patch-configure	2 Nov 2004 20:43:22 -0000	1.1
+++ ./games/stratagus/files/patch-configure	17 Aug 2006 19:52:37 -0000
@@ -1,5 +1,5 @@
---- configure.orig	Fri Jul  2 03:46:35 2004
-+++ configure	Tue Nov  2 21:31:50 2004
+--- ./configure.orig	Thu Jul  1 22:46:35 2004
++++ ./configure	Mon Jul 17 19:23:06 2006
 @@ -3229,9 +3229,6 @@
  	VIDEO_LIBS="$VIDEO_LIBS -lwsock32 -lws2_32 -lmingwex -lgmon"
      fi
Index: ./lang/lua4/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/lua4/Makefile,v
retrieving revision 1.22
diff -u -r1.22 Makefile
--- ./lang/lua4/Makefile	4 Jun 2006 12:12:33 -0000	1.22
+++ ./lang/lua4/Makefile	17 Aug 2006 19:52:37 -0000
@@ -17,40 +17,74 @@
 MAINTAINER=	him@richardkiss.com
 COMMENT=	Small, compilable scripting language providing easy access to C code
 
-LATEST_LINK=	lua4
-MAN1=		luac.1
-WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
+USE_LDCONFIG=	yes
+USE_LUA=	4.0
+LUA_COMPS=	# only define variables
 ALL_TARGET=	all so
-INSTALLS_SHLIB=	YES
 
-CONFLICTS=	lua-5*
+MAN1=		lua-${LUA_VER}.1 luac-${LUA_VER}.1
+DOCSDIR=	${PREFIX}/share/doc/${LUA_SUBDIR}
+LATEST_LINK=	${LUA_SUBDIR}
 
-do-install:
-	@ ${MKDIR} ${PREFIX}/share/doc/lua
-	@ ${INSTALL_PROGRAM} ${WRKSRC}/bin/lua ${PREFIX}/bin
-	@ ${INSTALL_PROGRAM} ${WRKSRC}/bin/luac ${PREFIX}/bin
-	@ ${INSTALL_MAN} ${WRKSRC}/doc/luac.1 ${PREFIX}/man/man1/luac.1
-	@ ${INSTALL_DATA} ${WRKSRC}/doc/idx.html ${PREFIX}/share/doc/lua
-	@ ${INSTALL_DATA} ${WRKSRC}/doc/index.html ${PREFIX}/share/doc/lua
-	@ ${INSTALL_DATA} ${WRKSRC}/doc/luac.html ${PREFIX}/share/doc/lua
-	@ ${INSTALL_DATA} ${WRKSRC}/doc/manual.html ${PREFIX}/share/doc/lua
-	@ ${INSTALL_DATA} ${WRKSRC}/include/lua.h ${PREFIX}/include
-	@ ${INSTALL_DATA} ${WRKSRC}/include/luadebug.h ${PREFIX}/include
-	@ ${INSTALL_DATA} ${WRKSRC}/include/lualib.h ${PREFIX}/include
-	@ ${INSTALL_DATA} ${WRKSRC}/include/lauxlib.h ${PREFIX}/include
-	@ ${INSTALL_DATA} ${WRKSRC}/lib/liblua.a ${PREFIX}/lib
-	@ ${INSTALL_DATA} ${WRKSRC}/lib/liblua.so.4.0 ${PREFIX}/lib/liblua.so.4
-	@ ${LN} -s ${PREFIX}/lib/liblua.so.4 ${PREFIX}/lib/liblua.so
-	@ ${INSTALL_DATA} ${WRKSRC}/lib/liblualib.a ${PREFIX}/lib
-	@ ${INSTALL_DATA} ${WRKSRC}/lib/liblualib.so.4.0 ${PREFIX}/lib/liblualib.so.4
-	@ ${LN} -s ${PREFIX}/lib/liblualib.so.4 ${PREFIX}/lib/liblualib.so
-
-post-install:
-	@${STRIP_CMD} ${PREFIX}/bin/lua
-	@${STRIP_CMD} ${PREFIX}/bin/luac
+LUA_BIN=	lua luac
+LUA_LIB=	lua lualib
+LUA_MAN=	${LUA_BIN:S/$/.1/}
+
+.include <bsd.port.pre.mk>
 
-.if ${MACHINE_ARCH:L} == "amd64"
+.if ${ARCH} == "amd64"
 CFLAGS+=	-fPIC
 .endif
 
-.include <bsd.port.mk>
+post-patch:
+	@${REINPLACE_CMD} -Ee \
+		's|^#(POPEN=.*)|\1|; \
+		 s|^(CC=).*|\1 ${CC}|; \
+		 s|^(CFLAGS=) -O2 (.*)|\1 ${CFLAGS} \2|; \
+		 s|^(V=)[[:digit:]]\.0|\1 ${LUA_VER}|' \
+		${WRKSRC}/config
+	@${REINPLACE_CMD} -Ee 's|(ld -o lib/(liblua(lib)?)\.so\.\$$V)|\1 -soname=\2-${LUA_VER}.so.${LUA_VER_SH}|' \
+		${WRKSRC}/${MAKEFILE}
+
+post-build:
+	@${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac
+
+do-install:
+# Programs.
+	${MKDIR} ${LUA_BINDIR}
+.for f in ${LUA_BIN}
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/${f} ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/${f} ${PREFIX}/bin/${f}-${LUA_VER}
+.endfor
+# Include files.
+	${MKDIR} ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/include/*.h ${LUA_INCDIR}
+# Libraries.
+	${MKDIR} ${LUA_LIBDIR}
+.for f in ${LUA_LIB}
+	${INSTALL_PROGRAM} ${WRKSRC}/lib/lib${f}.a ${LUA_LIBDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/lib/lib${f}.so \
+		${LUA_LIBDIR}/lib${f}-${LUA_VER}.so.${LUA_VER_SH}
+	@${LN} -sf lib${f}-${LUA_VER}.so.${LUA_VER_SH} ${LUA_LIBDIR}/lib${f}.so
+	@${LN} -sf ${LUA_SUBDIR}/lib${f}-${LUA_VER}.so.${LUA_VER_SH} \
+		${PREFIX}/lib
+	@${LN} -sf lib${f}-${LUA_VER}.so.${LUA_VER_SH} \
+		${PREFIX}/lib/lib${f}-${LUA_VER}.so
+.endfor
+# Manual pages.
+.for f in ${LUA_MAN}
+	${INSTALL_MAN} ${WRKSRC}/doc/${f} \
+		${PREFIX}/man/man1/${f:C/.1$//}-${LUA_VER}.1
+.endfor
+# Documentation.
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+	cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
+	${CP} -r ${WRKSRC}/etc ${WRKSRC}/test ${DOCSDIR}
+.endif
+# Module directories.
+	${MKDIR} ${LUA_MODSHAREDIR}
+	${MKDIR} ${LUA_MODLIBDIR}
+
+.include <bsd.port.post.mk>
Index: ./lang/lua4/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/lua4/pkg-plist,v
retrieving revision 1.4
diff -u -r1.4 pkg-plist
--- ./lang/lua4/pkg-plist	4 Jun 2006 12:12:33 -0000	1.4
+++ ./lang/lua4/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,17 +1,77 @@
-bin/lua
-bin/luac
-include/lauxlib.h
-include/lua.h
-include/luadebug.h
-include/lualib.h
-lib/liblua.a
-lib/liblua.so
-lib/liblua.so.4
-lib/liblualib.a
-lib/liblualib.so
-lib/liblualib.so.4
+@exec mkdir -p %D/share/lua/%%LUA_VER%%
+@exec mkdir -p %D/lib/lua/%%LUA_VER%%
+bin/lua-%%LUA_VER%%
+%%LUA_BINDIR%%/lua
+%%LUA_BINDIR%%/luac
+bin/luac-%%LUA_VER%%
+%%LUA_INCDIR%%/lauxlib.h
+%%LUA_INCDIR%%/lua.h
+%%LUA_INCDIR%%/luadebug.h
+%%LUA_INCDIR%%/lualib.h
+lib/liblua-%%LUA_VER%%.so
+lib/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+lib/liblualib-%%LUA_VER%%.so
+lib/liblualib-%%LUA_VER%%.so.0
+%%LUA_LIBDIR%%/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblua.a
+%%LUA_LIBDIR%%/liblua.so
+%%LUA_LIBDIR%%/liblualib-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblualib.a
+%%LUA_LIBDIR%%/liblualib.so
+%%PORTDOCS%%%%DOCSDIR%%/etc/Makefile
+%%PORTDOCS%%%%DOCSDIR%%/etc/README
+%%PORTDOCS%%%%DOCSDIR%%/etc/bin2c.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/def.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.ico
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.magic
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.xpm
+%%PORTDOCS%%%%DOCSDIR%%/etc/min.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/setfallback.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/stdcall.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/trace.c
+%%PORTDOCS%%%%DOCSDIR%%/README
 %%PORTDOCS%%%%DOCSDIR%%/idx.html
 %%PORTDOCS%%%%DOCSDIR%%/index.html
+%%PORTDOCS%%%%DOCSDIR%%/logo.gif
+%%PORTDOCS%%%%DOCSDIR%%/lua.html
 %%PORTDOCS%%%%DOCSDIR%%/luac.html
 %%PORTDOCS%%%%DOCSDIR%%/manual.html
+%%PORTDOCS%%%%DOCSDIR%%/readme.html
+%%PORTDOCS%%%%DOCSDIR%%/test/README
+%%PORTDOCS%%%%DOCSDIR%%/test/bisect.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/cf-for.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/cf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/ps/hilbert.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/ps/ps.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/www/README
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/www/db.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/www/staff.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/www/template.html
+%%PORTDOCS%%%%DOCSDIR%%/test/factorial.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fib.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/hello.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/life.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/lisp.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/old.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/qp.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/save.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sort.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/table.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-calls.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/undefined.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/webform.lua
+@dirrm share/lua/%%LUA_VER%%
+@dirrmtry share/lua
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test/examples/www
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test/examples/ps
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test/examples
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/etc
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrm %%LUA_LIBDIR%%
+@dirrm lib/lua/%%LUA_VER%%
+@dirrmtry lib/lua
+@dirrm %%LUA_INCDIR%%
+@dirrm %%LUA_BINDIR%%
Index: ./lang/lua4/files/patch-aa
===================================================================
RCS file: ./lang/lua4/files/patch-aa
diff -N ./lang/lua4/files/patch-aa
--- ./lang/lua4/files/patch-aa	30 Apr 2001 00:05:28 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
---- config	Mon Nov  6 12:28:20 2000
-+++ config.new	Tue Jan  2 15:51:57 2001
-@@ -28,7 +28,6 @@
- # ------------------------------------------------------------------ C compiler
- 
- # You need an ANSI C compiler. gcc is a popular one.
--CC= gcc
- WARN= -ansi -pedantic -Wall
- 
- # On IRIX, cc is a good ANSI compiler.
-@@ -93,7 +93,7 @@
- INCS= -I$(INC) $(EXTRA_INCS)
- DEFS= $(COMPAT) $(NUMBER) $(OLD_ANSI) $(EXTRA_DEFS)
- 
--CFLAGS= -O2 $(WARN) $(INCS) $(DEFS)
-+CFLAGS+= $(WARN) $(INCS) $(DEFS)
- 
- V=4.0
- 
Index: ./lang/lua50/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/lua50/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- ./lang/lua50/Makefile	3 May 2006 13:30:06 -0000	1.24
+++ ./lang/lua50/Makefile	17 Aug 2006 19:52:37 -0000
@@ -19,36 +19,76 @@
 MAINTAINER=	him@richardkiss.com
 COMMENT=	Small, compilable scripting language providing easy access to C code
 
-LATEST_LINK=	lua50
-MAN1=		lua.1 luac.1
+USE_LDCONFIG=	yes
+USE_LUA=	5.0
+LUA_COMPS=	# only define variables
 ALL_TARGET=	all so
-INSTALL_TARGET=	install soinstall
-INSTALLS_SHLIB=	YES
 
-CONFLICTS=	lua-4* lua-5.1*
+MAN1=		lua-${LUA_VER}.1 luac-${LUA_VER}.1
+DOCSDIR=	${PREFIX}/share/doc/${LUA_SUBDIR}
+LATEST_LINK=	${LUA_SUBDIR}
 
-do-configure:
-	${REINPLACE_CMD} \
-		-e 's|^\(MYCFLAGS=\).*$$|\1 ${CFLAGS}|' \
-		-e 's|^\(LOADLIB=\).*$$|\1 -DUSE_DLOPEN=1|' \
-		-e 's|^\(CC=\).*$$|\1 ${CC}|' \
-		-e 's|^\(STRIP=\).*$$|\1 ${STRIP_CMD}|' \
-		-e 's|^\(INSTALL_ROOT=\).*$$|\1 ${PREFIX}|' \
-		-e 's|^\(INSTALL_EXEC=\).*$$|\1 ${INSTALL_PROGRAM}|' \
-		-e 's|^\(INSTALL_DATA=\).*$$|\1 ${INSTALL_DATA}|' \
-		-e 's|^#\(USERCONF.*READLINE.*\)$$|\1|' \
-		-e 's|^\(EXTRA_LIBS=\).*$$|\1 -lm -lreadline -lhistory -lncurses|' \
-		-e 's|V=5.0|V=5|' \
-		${WRKSRC}/config
+LUA_BIN=	lua luac
+LUA_LIB=	lua lualib
+LUA_MAN=	${LUA_BIN:S/$/.1/}
 
-post-install:
-.if !defined(NOPORTDOCS)
-	@${MKDIR} ${DOCSDIR}
-	@cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
-.endif
+.include <bsd.port.pre.mk>
 
-.if ${MACHINE_ARCH:L} == "amd64"
+.if ${ARCH} == "amd64"
 CFLAGS+=	-fPIC
 .endif
 
-.include <bsd.port.mk>
+post-patch:
+	@${REINPLACE_CMD} -Ee \
+		's|^(MYCFLAGS=).*|\1 ${CFLAGS}|; \
+		 s|^(LOADLIB=).*|\1 -DUSE_DLOPEN=1|; \
+		 s|^(CC=).*|\1 ${CC}|; \
+		 s|^#(USERCONF.*READLINE.*)|\1|; \
+		 s|^(EXTRA_LIBS=).*|\1 -lm -lreadline -lhistory -lncurses|; \
+		 s|^(V=[[:digit:]])\.0|\1|' \
+		${WRKSRC}/config
+	@${REINPLACE_CMD} -Ee 's|(ld -o lib/(liblua(lib)?)\.so\.\$$V)|\1 -soname=\2-${LUA_VER}.so.${LUA_VER_SH}|' \
+		${WRKSRC}/${MAKEFILE}
+
+post-build:
+	@${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac
+
+do-install:
+# Programs.
+	${MKDIR} ${LUA_BINDIR}
+.for f in ${LUA_BIN}
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/${f} ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/${f} ${PREFIX}/bin/${f}-${LUA_VER}
+.endfor
+# Include files.
+	${MKDIR} ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/include/*.h ${LUA_INCDIR}
+# Libraries.
+	${MKDIR} ${LUA_LIBDIR}
+.for f in ${LUA_LIB}
+	${INSTALL_PROGRAM} ${WRKSRC}/lib/lib${f}.a ${LUA_LIBDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/lib/lib${f}.so \
+		${LUA_LIBDIR}/lib${f}-${LUA_VER}.so.${LUA_VER_SH}
+	@${LN} -sf lib${f}-${LUA_VER}.so.${LUA_VER_SH} ${LUA_LIBDIR}/lib${f}.so
+	@${LN} -sf ${LUA_SUBDIR}/lib${f}-${LUA_VER}.so.${LUA_VER_SH} \
+		${PREFIX}/lib
+	@${LN} -sf lib${f}-${LUA_VER}.so.${LUA_VER_SH} \
+		${PREFIX}/lib/lib${f}-${LUA_VER}.so
+.endfor
+# Manual pages.
+.for f in ${LUA_MAN}
+	${INSTALL_MAN} ${WRKSRC}/doc/${f} \
+		${PREFIX}/man/man1/${f:C/.1$//}-${LUA_VER}.1
+.endfor
+# Documentation.
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+	cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
+	${CP} -r ${WRKSRC}/etc ${WRKSRC}/test ${DOCSDIR}
+.endif
+# Module directories.
+	${MKDIR} ${LUA_MODLIBDIR}
+	${MKDIR} ${LUA_MODSHAREDIR}
+
+.include <bsd.port.post.mk>
Index: ./lang/lua50/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/lua50/pkg-plist,v
retrieving revision 1.5
diff -u -r1.5 pkg-plist
--- ./lang/lua50/pkg-plist	1 Apr 2004 21:49:20 -0000	1.5
+++ ./lang/lua50/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,18 +1,71 @@
-bin/lua
-bin/luac
-include/lauxlib.h
-include/lua.h
-include/lualib.h
-lib/liblua.a
-lib/liblua.so
-lib/liblua.so.5
-lib/liblualib.a
-lib/liblualib.so
-lib/liblualib.so.5
-%%DOCSDIR%%/contents.html
-%%DOCSDIR%%/logo.gif
-%%DOCSDIR%%/lua.html
-%%DOCSDIR%%/luac.html
-%%DOCSDIR%%/manual.html
-%%DOCSDIR%%/readme.html
-@dirrm %%DOCSDIR%%
+@exec mkdir -p %D/share/lua/%%LUA_VER%%
+@exec mkdir -p %D/lib/lua/%%LUA_VER%%
+bin/lua-%%LUA_VER%%
+%%LUA_BINDIR%%/lua
+%%LUA_BINDIR%%/luac
+bin/luac-%%LUA_VER%%
+%%LUA_INCDIR%%/lauxlib.h
+%%LUA_INCDIR%%/lua.h
+%%LUA_INCDIR%%/lualib.h
+lib/liblua-%%LUA_VER%%.so
+lib/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+lib/liblualib-%%LUA_VER%%.so
+lib/liblualib-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblua.a
+%%LUA_LIBDIR%%/liblua.so
+%%LUA_LIBDIR%%/liblualib-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblualib.a
+%%LUA_LIBDIR%%/liblualib.so
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/contents.html
+%%PORTDOCS%%%%DOCSDIR%%/etc/Makefile
+%%PORTDOCS%%%%DOCSDIR%%/etc/README
+%%PORTDOCS%%%%DOCSDIR%%/etc/bin2c.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/compat.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/doall.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.ico
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.magic
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.xpm
+%%PORTDOCS%%%%DOCSDIR%%/etc/luser_number.h
+%%PORTDOCS%%%%DOCSDIR%%/etc/luser_tests.h
+%%PORTDOCS%%%%DOCSDIR%%/etc/min.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/noparser.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/saconfig.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/trace.c
+%%PORTDOCS%%%%DOCSDIR%%/logo.gif
+%%PORTDOCS%%%%DOCSDIR%%/lua.html
+%%PORTDOCS%%%%DOCSDIR%%/luac.html
+%%PORTDOCS%%%%DOCSDIR%%/manual.html
+%%PORTDOCS%%%%DOCSDIR%%/readme.html
+%%PORTDOCS%%%%DOCSDIR%%/test/README
+%%PORTDOCS%%%%DOCSDIR%%/test/bisect.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/cf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/echo.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/env.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/factorial.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fib.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fibfor.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/hello.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/life.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/luac.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/printf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/readonly.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sieve.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sort.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/table.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-calls.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/undefined.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/xd.lua
+@dirrm share/lua/%%LUA_VER%%
+@dirrmtry share/lua
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/etc
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrm %%LUA_LIBDIR%%
+@dirrm lib/lua/%%LUA_VER%%
+@dirrmtry lib/lua
+@dirrm %%LUA_INCDIR%%
+@dirrm %%LUA_BINDIR%%
Index: ./lang/lua/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/lua/Makefile,v
retrieving revision 1.25
diff -u -r1.25 Makefile
--- ./lang/lua/Makefile	18 Jun 2006 12:41:44 -0000	1.25
+++ ./lang/lua/Makefile	17 Aug 2006 19:52:37 -0000
@@ -19,20 +19,58 @@
 MAINTAINER=	him@richardkiss.com
 COMMENT=	Small, compilable scripting language providing easy access to C code
 
-MAN1=		lua.1 luac.1
-
-MAKE_ARGS=	bsd
-
-CONFLICTS=	lua-4* lua-5.0*
+USE_LUA=	5.1
+LUA_COMPS=	# only define variables
+ALL_TARGET=	bsd
+
+MAN1=		lua-${LUA_VER}.1 luac-${LUA_VER}.1
+DOCSDIR=	${PREFIX}/share/doc/${LUA_SUBDIR}
+LATEST_LINK=	${LUA_SUBDIR}
+
+LUA_BIN=	lua luac
+LUA_INC=	lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
+LUA_MAN=	${LUA_BIN:S/$/.1/}
 
 post-patch:
-	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/Makefile
-
-post-install:
+	@${REINPLACE_CMD} -Ee \
+		 's|^(CC=).*|\1 ${CC}| ; \
+		 s|^(CFLAGS=)|\1 ${CFLAGS}| ; \
+		 s|/usr/local|${PREFIX}|' \
+		 ${WRKSRC}/Makefile ${WRKSRC}/src/Makefile
+
+post-build:
+	@${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac
+
+do-install:
+# Programs.
+	${MKDIR} ${LUA_BINDIR}
+.for f in ${LUA_BIN}
+	${INSTALL_PROGRAM} ${WRKSRC}/src/${f} ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/${f} ${PREFIX}/bin/${f}-${LUA_VER}
+.endfor
+# Include files.
+	${MKDIR} ${LUA_INCDIR}
+.for f in ${LUA_INC}
+	${INSTALL_DATA} ${WRKSRC}/src/${f} ${LUA_INCDIR}
+.endfor
+# Libraries.
+	${MKDIR} ${LUA_LIBDIR}
+	${INSTALL_DATA} ${WRKSRC}/src/liblua.a ${LUA_LIBDIR}
+# Manual pages.
+.for f in ${LUA_MAN}
+	${INSTALL_MAN} ${WRKSRC}/doc/${f} \
+		${PREFIX}/man/man1/${f:C/.1$//}-${LUA_VER}.1
+.endfor
+# Documentation.
 .if !defined(NOPORTDOCS)
-	@${MKDIR} ${DOCSDIR}
-	@cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.css *.gif ${DOCSDIR}
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+	cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
+	${CP} -r ${WRKSRC}/etc ${WRKSRC}/test ${DOCSDIR}
 .endif
+# Module directories.
+	${MKDIR} ${LUA_MODLIBDIR}
+	${MKDIR} ${LUA_MODSHAREDIR}
 
 .if ${MACHINE_ARCH:L} == "amd64"
 CFLAGS+=	-fPIC
Index: ./lang/lua/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/lua/pkg-plist,v
retrieving revision 1.6
diff -u -r1.6 pkg-plist
--- ./lang/lua/pkg-plist	3 May 2006 13:25:42 -0000	1.6
+++ ./lang/lua/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,22 +1,59 @@
-@exec mkdir -p %D/lib/lua/5.1
-@exec mkdir -p %D/share/lua/5.1
-%%DOCSDIR%%/contents.html
-%%DOCSDIR%%/logo.gif
-%%DOCSDIR%%/lua.css
-%%DOCSDIR%%/lua.html
-%%DOCSDIR%%/luac.html
-%%DOCSDIR%%/manual.html
-%%DOCSDIR%%/readme.html
-bin/lua
-bin/luac
-include/lauxlib.h
-include/lua.h
-include/lua.hpp
-include/luaconf.h
-include/lualib.h
-lib/liblua.a
-@dirrm %%DOCSDIR%%
-@dirrm share/lua/5.1
-@dirrm share/lua
-@dirrm lib/lua/5.1
-@dirrm lib/lua
+@exec mkdir -p %D/share/lua/%%LUA_VER%%
+@exec mkdir -p %D/lib/lua/%%LUA_VER%%
+bin/lua-%%LUA_VER%%
+%%LUA_BINDIR%%/lua
+%%LUA_BINDIR%%/luac
+bin/luac-%%LUA_VER%%
+%%LUA_INCDIR%%/lauxlib.h
+%%LUA_INCDIR%%/lua.h
+%%LUA_INCDIR%%/lua.hpp
+%%LUA_INCDIR%%/luaconf.h
+%%LUA_INCDIR%%/lualib.h
+%%LUA_LIBDIR%%/liblua.a
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/contents.html
+%%PORTDOCS%%%%DOCSDIR%%/etc/Makefile
+%%PORTDOCS%%%%DOCSDIR%%/etc/README
+%%PORTDOCS%%%%DOCSDIR%%/etc/all.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.hpp
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.ico
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.pc
+%%PORTDOCS%%%%DOCSDIR%%/etc/luavs.bat
+%%PORTDOCS%%%%DOCSDIR%%/etc/min.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/noparser.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/strict.lua
+%%PORTDOCS%%%%DOCSDIR%%/logo.gif
+%%PORTDOCS%%%%DOCSDIR%%/lua.html
+%%PORTDOCS%%%%DOCSDIR%%/luac.html
+%%PORTDOCS%%%%DOCSDIR%%/manual.html
+%%PORTDOCS%%%%DOCSDIR%%/readme.html
+%%PORTDOCS%%%%DOCSDIR%%/test/README
+%%PORTDOCS%%%%DOCSDIR%%/test/bisect.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/cf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/echo.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/env.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/factorial.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fib.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fibfor.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/hello.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/life.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/luac.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/printf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/readonly.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sieve.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sort.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/table.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-calls.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/xd.lua
+@dirrm share/lua/%%LUA_VER%%
+@dirrmtry share/lua
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/etc
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrm %%LUA_LIBDIR%%
+@dirrm lib/lua/%%LUA_VER%%
+@dirrmtry lib/lua
+@dirrm %%LUA_INCDIR%%
+@dirrm %%LUA_BINDIR%%
Index: ./lang/tolua/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/tolua/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- ./lang/tolua/Makefile	3 May 2006 13:25:06 -0000	1.3
+++ ./lang/tolua/Makefile	17 Aug 2006 19:52:37 -0000
@@ -15,15 +15,14 @@
 MAINTAINER=	edwin@mavetju.org
 COMMENT=	toLua: accessing C/C++ code from Lua
 
-LIB_DEPENDS=	lua:${PORTSDIR}/lang/lua50
-
-WRKSRC=		${WRKDIR}/${PORTNAME}-5.0
 USE_GMAKE=	yes
-CONFLICTS=	tolua4-.*
+USE_LUA=	5.0
+WRKSRC=		${WRKDIR}/${PORTNAME}-5.0
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${PREFIX}/include
-	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${PREFIX}/lib
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/tolua ${PREFIX}/bin/tolua-${LUA_VER}
+	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${LUA_LIBDIR}
 
 .include <bsd.port.mk>
Index: ./lang/tolua/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/tolua/pkg-plist,v
retrieving revision 1.1
diff -u -r1.1 pkg-plist
--- ./lang/tolua/pkg-plist	21 Nov 2004 08:32:23 -0000	1.1
+++ ./lang/tolua/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,3 +1,4 @@
-bin/tolua
-lib/libtolua.a
-include/tolua.h
+%%LUA_BINDIR%%/tolua
+bin/tolua-%%LUA_VER%%
+%%LUA_LIBDIR%%/libtolua.a
+%%LUA_INCDIR%%/tolua.h
Index: ./lang/tolua++/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/tolua++/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./lang/tolua++/Makefile	3 May 2006 13:25:06 -0000	1.2
+++ ./lang/tolua++/Makefile	17 Aug 2006 19:52:37 -0000
@@ -15,11 +15,10 @@
 COMMENT=	An extended version of tolua, a tool to integrate C/C++ code with Lua
 
 BUILD_DEPENDS=	${LOCALBASE}/bin/scons:${PORTSDIR}/devel/scons
-LIB_DEPENDS=	lua:${PORTSDIR}/lang/lua50
 
-WRKSRC=		${WRKDIR}/tolua++-${PORTVERSION}
 USE_BZIP2=	yes
-INSTALLS_SHLIB=	yes
+USE_LDCONFIG=	yes
+USE_LUA=	5.0
 NO_BUILD=	yes
 
 do-build:
Index: ./lang/tolua4/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/tolua4/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- ./lang/tolua4/Makefile	21 Nov 2004 09:32:06 -0000	1.1
+++ ./lang/tolua4/Makefile	17 Aug 2006 19:52:37 -0000
@@ -6,7 +6,7 @@
 # $FreeBSD: ports/lang/tolua4/Makefile,v 1.1 2004/11/21 09:32:06 edwin Exp $
 #
 
-PORTNAME=	tolua4
+PORTNAME=	tolua
 PORTVERSION=	4.0a
 CATEGORIES=	lang
 MASTER_SITES=	ftp://ftp.tecgraf.puc-rio.br/pub/users/celes/tolua/ \
@@ -16,15 +16,24 @@
 MAINTAINER=	edwin@mavetju.org
 COMMENT=	toLua: accessing C/C++ code from Lua
 
-LIB_DEPENDS=	lua.4:${PORTSDIR}/lang/lua4
-
-WRKSRC=		${WRKDIR}/tolua
 USE_GMAKE=	yes
-CONFLICTS=	tolua-5.*
+USE_LUA=	4.0
+WRKSRC=		${WRKDIR}/tolua
+
+LATEST_LINK=	${PORTNAME}${LUA_VER_STR}
+
+post-patch:
+	@${REINPLACE_CMD} -Ee \
+		's|^(CC=).*|\1 ${CC}|; \
+		 s|^(LUA=).*|\1 ${LOCALBASE}|; \
+		 s|^(LUA(INC\|LIB)=.*)|\1/lua${LUA_VER_STR}|; \
+		 s|^(CFLAGS)(=.*)|\1+\2|;' \
+		${WRKSRC}/config
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${PREFIX}/include
-	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${PREFIX}/lib
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/tolua ${PREFIX}/bin/tolua-${LUA_VER}
+	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${LUA_LIBDIR}
 
 .include <bsd.port.mk>
Index: ./lang/tolua4/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/tolua4/pkg-plist,v
retrieving revision 1.1
diff -u -r1.1 pkg-plist
--- ./lang/tolua4/pkg-plist	21 Nov 2004 09:32:06 -0000	1.1
+++ ./lang/tolua4/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,3 +1,4 @@
-bin/tolua
-lib/libtolua.a
-include/tolua.h
+%%LUA_BINDIR%%/tolua
+bin/tolua-%%LUA_VER%%
+%%LUA_INCDIR%%/tolua.h
+%%LUA_LIBDIR%%/libtolua.a
Index: ./lang/tolua4/files/patch-config
===================================================================
RCS file: ./lang/tolua4/files/patch-config
diff -N ./lang/tolua4/files/patch-config
--- ./lang/tolua4/files/patch-config	21 Nov 2004 09:32:07 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
---- config.orig	Sun Nov 21 20:12:01 2004
-+++ config	Sun Nov 21 20:12:39 2004
-@@ -3,7 +3,7 @@
- # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================
- 
- # you need an ANSI C compiler. gcc is a popular one.
--CC= gcc
-+#CC= gcc
- WARN= -ansi -Wall
- 
- # on SGI's, cc is ANSI.
-@@ -20,7 +20,7 @@
- AR= ar rcu
- 
- # set lua path
--LUA=/usr/local/lua
-+LUA=${LOCALBASE}
- LUAINC=$(LUA)/include
- LUALIB=$(LUA)/lib
- 
-@@ -29,4 +29,4 @@
- INC= -I$(LUAINC) -I$(TOLUA)/include
- LIB= -L$(LUALIB)
- 
--CFLAGS= -O2 $(WARN) $(INC)
-+CFLAGS+= -O2 $(WARN) $(INC)
Index: ./lang/ruby-lua4/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/ruby-lua4/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./lang/ruby-lua4/Makefile	11 Nov 2005 01:17:41 -0000	1.2
+++ ./lang/ruby-lua4/Makefile	17 Aug 2006 19:52:37 -0000
@@ -11,28 +11,33 @@
 MASTER_SITES=	${MASTER_SITE_LOCAL}
 MASTER_SITE_SUBDIR=	knu
 PKGNAMEPREFIX=	${RUBY_PKGNAMEPREFIX}
-PKGNAMESUFFIX=	4
 DISTNAME=	ruby${PORTNAME}-${PORTVERSION}
 DIST_SUBDIR=	ruby
 
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A Ruby extension to make Lua script language as a class
 
-LIB_DEPENDS=	lua.4:${PORTSDIR}/lang/lua4
-
-CONFLICTS=	${RUBY_PKGNAMEPREFIX}lua5-[0-9]*
-
+USE_LUA=	4.0
 USE_ZIP=	yes
 
 USE_RUBY=	yes
 USE_RUBY_EXTCONF=	yes
 RUBY_EXTCONF=	luaconf.rb
+RUBY_MODNAME=	${PORTNAME}-${LUA_VER}
 
 NO_WRKSUBDIR=	yes
 INSTALL_TARGET=	site-install
 
 EXAMPLES=	html_ssi_lua.rb test_*
 
+post-patch:
+	@${REINPLACE_CMD} -Ee 's/[[:<:]](lua(lib)?)[[:>:]]/\1-${LUA_VER}/' \
+		${WRKSRC}/${RUBY_EXTCONF}
+
+post-configure:
+	@${REINPLACE_CMD} -Ee 's|^(CPPFLAGS =.*)|\1 -I${LUA_INCDIR}|' \
+		${WRKSRC}/${MAKEFILE}
+
 post-install:
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${RUBY_MODEXAMPLESDIR}
Index: ./lang/ruby-lua4/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/ruby-lua4/pkg-plist,v
retrieving revision 1.1
diff -u -r1.1 pkg-plist
--- ./lang/ruby-lua4/pkg-plist	25 Dec 2004 19:08:59 -0000	1.1
+++ ./lang/ruby-lua4/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,4 +1,4 @@
-%%RUBY_SITEARCHLIBDIR%%/lua.so
+%%RUBY_SITEARCHLIBDIR%%/lua-%%LUA_VER%%.so
 %%PORTDOCS%%%%RUBY_MODDOCDIR%%/rubylua.txt
 %%PORTDOCS%%@dirrm %%RUBY_MODDOCDIR%%
 %%PORTDOCS%%%%RUBY_MODEXAMPLESDIR%%/html_ssi_lua.rb
Index: ./devel/lua50-app/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-app/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./devel/lua50-app/Makefile	3 May 2006 13:25:03 -0000	1.2
+++ ./devel/lua50-app/Makefile	17 Aug 2006 19:52:37 -0000
@@ -9,24 +9,22 @@
 PORTVERSION=	1.70
 CATEGORIES=	devel
 MASTER_SITES=	http://cvs.bsdinstaller.org/cgi-bin/cvsweb.cgi/installer/src/lib/lua/app/
-PKGNAMEPREFIX=	lua50-
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	app.lua?rev=${PORTVERSION}
-EXTRACT_ONLY=
+EXTRACT_ONLY=	#
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	App framework for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${LOCALBASE}/share/lua/5.0/posix.lua:${PORTSDIR}/devel/lua50-posix \
-		${LOCALBASE}/share/lua/5.0/filename.lua:${PORTSDIR}/devel/lua50-filename \
-		${LOCALBASE}/share/lua/5.0/pty.lua:${PORTSDIR}/devel/lua50-pty
-
-NO_WRKSUBDIR=	yes
+USE_LUA=	5.0
+LUA_COMPS=	filename posix pty
 NO_BUILD=	yes
+NO_WRKSUBDIR=	yes
+
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/app.lua
 
 do-install:
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${DISTDIR}/${DISTFILES} ${PREFIX}/share/lua/5.0/${DISTFILES:C/\?.*$//}
+	${INSTALL_DATA} ${DISTDIR}/${DISTFILES} \
+		${LUA_MODSHAREDIR}/${DISTFILES:C/\?.*$//}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-app/pkg-plist
===================================================================
RCS file: ./devel/lua50-app/pkg-plist
diff -N ./devel/lua50-app/pkg-plist
--- ./devel/lua50-app/pkg-plist	17 Apr 2006 22:15:27 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-share/lua/5.0/app.lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-compat51/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-compat51/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- ./devel/lua50-compat51/Makefile	3 May 2006 13:25:04 -0000	1.3
+++ ./devel/lua50-compat51/Makefile	17 Aug 2006 19:52:37 -0000
@@ -5,31 +5,31 @@
 # $FreeBSD: ports/devel/lua50-compat51/Makefile,v 1.3 2006/05/03 13:25:04 pav Exp $
 #
 
-PORTNAME=	lua50-compat51
+PORTNAME=	compat
 PORTVERSION=	${CVER}.${CREV}
 CATEGORIES=	devel
 MASTER_SITES=	http://luaforge.net/frs/download.php/1410/
-DISTNAME=	compat-${CVER}${CREV}.tar.gz
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	Lua 5.1 package compatibility layer for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
+USE_LUA=	5.0
+WRKSRC=		${WRKDIR}/compat-${CVER}${CREV}
 
-CONFLICTS=	luasocket-2.0
+MAKE_ENV=	CVER="${CVER}"
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/compat-${CVER}.lua \
+		%%LUA_MODLIBDIR%%/lcompat-${CVER}.so
 
-# Update these values when there is a new release
+# Update these values when there is a new release.
 CVER=		5.1
 CREV=		r5
 
-WRKSRC=		${WRKDIR}/compat-${CVER}${CREV}
-LIBDIR=		${PREFIX}/lib
-
 post-extract:
 	@${CP} ${FILESDIR}/Makefile ${WRKSRC}
 
 do-install:
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${WRKSRC}/compat-5.1.lua ${PREFIX}/share/lua/5.0
+	${INSTALL_DATA} ${WRKSRC}/compat-${CVER}.lua ${LUA_MODSHAREDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/lcompat-${CVER}.so ${LUA_MODLIBDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-compat51/distinfo
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-compat51/distinfo,v
retrieving revision 1.1
diff -u -r1.1 distinfo
--- ./devel/lua50-compat51/distinfo	15 Apr 2006 16:54:48 -0000	1.1
+++ ./devel/lua50-compat51/distinfo	17 Aug 2006 19:52:37 -0000
@@ -1,3 +1,3 @@
-MD5 (compat-5.1r5.tar.gz.tar.gz) = 30d50d173ab236e96c4b969347163eb7
-SHA256 (compat-5.1r5.tar.gz.tar.gz) = 93262ad793552c338b825e6b67c903063aa07625952ef643d126ae60949c8ab6
-SIZE (compat-5.1r5.tar.gz.tar.gz) = 2977
+MD5 (compat-5.1.r5.tar.gz) = 30d50d173ab236e96c4b969347163eb7
+SHA256 (compat-5.1.r5.tar.gz) = 93262ad793552c338b825e6b67c903063aa07625952ef643d126ae60949c8ab6
+SIZE (compat-5.1.r5.tar.gz) = 2977
Index: ./devel/lua50-compat51/pkg-plist
===================================================================
RCS file: ./devel/lua50-compat51/pkg-plist
diff -N ./devel/lua50-compat51/pkg-plist
--- ./devel/lua50-compat51/pkg-plist	20 Apr 2006 08:45:35 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-share/lua/5.0/compat-5.1.lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-compat51/files/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-compat51/files/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- ./devel/lua50-compat51/files/Makefile	15 Apr 2006 16:54:49 -0000	1.1
+++ ./devel/lua50-compat51/files/Makefile	17 Aug 2006 19:52:37 -0000
@@ -1,9 +1,10 @@
 # $FreeBSD: ports/devel/lua50-compat51/files/Makefile,v 1.1 2006/04/15 16:54:49 pav Exp $
 
-LIB=		lua-compat-5.1
+SHLIB=		compat-${CVER}
+SHLIB_NAME=	lcompat-${CVER}.so
 
-SRCS=		compat-5.1.c
+SRCS=		compat-${CVER}.c
 
-CFLAGS+=	-I${PREFIX}/include
+CFLAGS+=	-I${LUA_INCDIR}
 
 .include <bsd.lib.mk>
Index: ./devel/lua50-dfui/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-dfui/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./devel/lua50-dfui/Makefile	3 May 2006 13:25:04 -0000	1.2
+++ ./devel/lua50-dfui/Makefile	17 Aug 2006 19:52:37 -0000
@@ -10,29 +10,28 @@
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_LOCAL}
 MASTER_SITE_SUBDIR=	philip
-PKGNAMEPREFIX=	lua50-
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTNAME=	lua-dfui-0.1.20050901
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	DFUI binding for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${NONEXISTENT}:${PORTSDIR}/devel/lua50-compat51:extract
+BUILD_DEPENDS=	${NONEXISTENT}:${PORTSDIR}/devel/lua50-compat51:extract
 LIB_DEPENDS=	dfui4.4:${PORTSDIR}/devel/libdfui
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${LOCALBASE}/share/lua/5.0/compat-5.1.lua:${PORTSDIR}/devel/lua50-compat51 \
-		${LOCALBASE}/share/lua/5.0/posix.lua:${PORTSDIR}/devel/lua50-posix
 
 USE_BZIP2=	yes
+USE_LUA=	5.0
+LUA_COMPS=	compat51 posix
 WRKSRC=		${WRKDIR}/lua-dfui-${PORTVERSION}
 
-COMPAT_SRC=	`(cd ${PORTSDIR}/devel/lua50-compat51 && make -V WRKSRC)`
-MAKE_ENV=	COMPAT=${COMPAT_SRC}
+COMPAT_SRC=	`(cd ${PORTSDIR}/devel/lua50-compat51 && ${MAKE} -V WRKSRC)`
+MAKE_ENV=	COMPAT="${COMPAT_SRC}"
+
+PLIST_FILES=	%%LUA_MODLIBDIR%%/ldfui.so \
+		%%LUA_MODSHAREDIR%%/dfui.lua
 
 do-install:
-	${MKDIR} ${PREFIX}/lib/lua/5.0
-	${INSTALL_PROGRAM} ${WRKSRC}/ldfui.so ${PREFIX}/lib/lua/5.0
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${WRKSRC}/dfui.lua ${PREFIX}/share/lua/5.0
+	${INSTALL_PROGRAM} ${WRKSRC}/ldfui.so ${LUA_MODLIBDIR}
+	${INSTALL_DATA} ${WRKSRC}/dfui.lua ${LUA_MODSHAREDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-dfui/pkg-plist
===================================================================
RCS file: ./devel/lua50-dfui/pkg-plist
diff -N ./devel/lua50-dfui/pkg-plist
--- ./devel/lua50-dfui/pkg-plist	23 Apr 2006 09:31:12 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-lib/lua/5.0/ldfui.so
-share/lua/5.0/dfui.lua
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-dfui/files/patch-Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-dfui/files/patch-Makefile,v
retrieving revision 1.1
diff -u -r1.1 patch-Makefile
--- ./devel/lua50-dfui/files/patch-Makefile	23 Apr 2006 09:31:12 -0000	1.1
+++ ./devel/lua50-dfui/files/patch-Makefile	17 Aug 2006 19:52:37 -0000
@@ -1,5 +1,5 @@
---- Makefile.orig	Tue Apr 18 13:49:53 2006
-+++ Makefile	Tue Apr 18 13:54:23 2006
+--- Makefile.orig	Mon Apr 17 21:40:11 2006
++++ Makefile	Mon Aug  7 13:22:22 2006
 @@ -1,11 +1,6 @@
  # Makefile for luadfui.
  # $Id: Makefile,v 1.13 2005/08/26 22:44:37 cpressey Exp $
@@ -18,13 +18,13 @@
  CFLAGS+=	${WARNS} -fPIC
 -CFLAGS+=	-I${LUA}/include -I${COMPAT} -I../../libdfui
 -CFLAGS+=	-I/usr/local/include -I/usr/pkg/include
-+CFLAGS+=	-I${COMPAT} -I${PREFIX}/include/dfui4
-+CFLAGS+=	-I${PREFIX}/include
++CFLAGS+=	-I${COMPAT} -I${LOCALBASE}/include/dfui4
++CFLAGS+=	-I${LUA_INCDIR}
  CFLAGS+=	${EXTRA_CFLAGS}
 -LDFLAGS+=	-L../../libdfui -L../../libaura -L${LUA}/lib/
 -LDFLAGS+=	-L/usr/local/lib -L/usr/pkg/lib
 -LDFLAGS+=	-ldfui -laura -lm -llua50 -llualib50
-+LDFLAGS+=	-L${PREFIX}/lib
++LDFLAGS+=	-L${LOCALBASE}/lib -L${LUA_LIBDIR}
 +LDFLAGS+=	-ldfui4 -laura3 -lm -llua -llualib
  
  all: ${LIB}
Index: ./devel/lua50-filename/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-filename/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./devel/lua50-filename/Makefile	3 May 2006 13:25:04 -0000	1.2
+++ ./devel/lua50-filename/Makefile	17 Aug 2006 19:52:37 -0000
@@ -5,23 +5,25 @@
 # $FreeBSD: ports/devel/lua50-filename/Makefile,v 1.2 2006/05/03 13:25:04 pav Exp $
 #
 
-PORTNAME=	lua50-filename
+PORTNAME=	filename
 PORTVERSION=	1.2
 CATEGORIES=	devel
 MASTER_SITES=	http://cvs.bsdinstaller.org/cgi-bin/cvsweb.cgi/installer/src/lib/lua/filename/
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	filename.lua?rev=${PORTVERSION}
-EXTRACT_ONLY=
+EXTRACT_ONLY=	#
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	Filename-manipulating functions for Lua 5.0.x
 
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-
-NO_WRKSUBDIR=	yes
+USE_LUA=	5.0
 NO_BUILD=	yes
+NO_WRKSUBDIR=	yes
+
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/filename.lua
 
 do-install:
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${DISTDIR}/${DISTFILES} ${PREFIX}/share/lua/5.0/${DISTFILES:C/\?.*$//}
+	${INSTALL_DATA} ${DISTDIR}/${DISTFILES} \
+		${LUA_MODSHAREDIR}/${DISTFILES:C/\?.*$//}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-filename/pkg-descr
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-filename/pkg-descr,v
retrieving revision 1.1
diff -u -r1.1 pkg-descr
--- ./devel/lua50-filename/pkg-descr	17 Apr 2006 17:09:17 -0000	1.1
+++ ./devel/lua50-filename/pkg-descr	17 Aug 2006 19:52:37 -0000
@@ -1,3 +1,3 @@
-Package of routines for manipulating filenames.
-Also contains convenience functions for querying the
-status of files in the filesystem named by those filenames.
+Package of routines for manipulating filenames. Also contains convenience
+functions for querying the status of files in the filesystem named by those
+filenames.
Index: ./devel/lua50-filename/pkg-plist
===================================================================
RCS file: ./devel/lua50-filename/pkg-plist
diff -N ./devel/lua50-filename/pkg-plist
--- ./devel/lua50-filename/pkg-plist	17 Apr 2006 17:09:17 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-share/lua/5.0/filename.lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-gettext/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-gettext/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- ./devel/lua50-gettext/Makefile	31 May 2006 19:37:41 -0000	1.1
+++ ./devel/lua50-gettext/Makefile	17 Aug 2006 19:52:37 -0000
@@ -9,22 +9,21 @@
 PORTVERSION=	1.5
 CATEGORIES=	devel
 MASTER_SITES=	http://cvs.bsdinstaller.org/cgi-bin/cvsweb.cgi/installer/src/lib/lua/gettext/
-PKGNAMEPREFIX=	lua50-
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	lua_gettext.c?rev=${CVER} gettext.lua?rev=${LVER}
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	Gettext ibinding for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-
+USE_LUA=	5.0
 USE_GETTEXT=	yes
 
-LIBDIR=		${PREFIX}/lib/lua/5.0
-
 CVER=		1.15
 LVER=		${PORTVERSION}
 
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/gettext.lua \
+		%%LUA_MODLIBDIR%%/lgettext.so
+
 do-extract:
 	${MKDIR} ${WRKSRC}
 .for file in ${DISTFILES}
@@ -33,10 +32,7 @@
 	${CP} ${FILESDIR}/Makefile ${WRKSRC}
 
 do-install:
-	${MKDIR} ${PREFIX}/lib/lua/5.0
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${WRKSRC}/gettext.lua ${PREFIX}/share/lua/5.0/
-	${MKDIR} ${PREFIX}/lib/lua/5.0
-	${INSTALL_PROGRAM} ${WRKSRC}/lgettext.so ${PREFIX}/lib/lua/5.0/
+	${INSTALL_DATA} ${WRKSRC}/gettext.lua ${LUA_MODSHAREDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/lgettext.so ${LUA_MODLIBDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-gettext/pkg-plist
===================================================================
RCS file: ./devel/lua50-gettext/pkg-plist
diff -N ./devel/lua50-gettext/pkg-plist
--- ./devel/lua50-gettext/pkg-plist	31 May 2006 19:37:41 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-lib/lua/5.0/lgettext.so
-share/lua/5.0/gettext.lua
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-gettext/files/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-gettext/files/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- ./devel/lua50-gettext/files/Makefile	31 May 2006 19:37:41 -0000	1.1
+++ ./devel/lua50-gettext/files/Makefile	17 Aug 2006 19:52:37 -0000
@@ -5,7 +5,7 @@
 
 SRCS=		lua_gettext.c
 
-CFLAGS+=	-I${PREFIX}/include
-LDFLAGS+=	-L${PREFIX}/lib -lintl
+CFLAGS+=	-I${LOCALBASE}/include -I${LUA_INCDIR}
+LDFLAGS+=	-L${LOCALBASE}/lib -lintl
 
 .include <bsd.lib.mk>
Index: ./devel/lua50-posix/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-posix/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- ./devel/lua50-posix/Makefile	14 May 2006 12:36:19 -0000	1.3
+++ ./devel/lua50-posix/Makefile	17 Aug 2006 19:52:37 -0000
@@ -5,23 +5,24 @@
 # $FreeBSD: ports/devel/lua50-posix/Makefile,v 1.3 2006/05/14 12:36:19 pav Exp $
 #
 
-PORTNAME=	lua50-posix
+PORTNAME=	posix
 PORTVERSION=	5.0
 CATEGORIES=	devel
 MASTER_SITES=	http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.0/
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	lposix.tar.gz
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	A POSIX layer for Lua
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-
+USE_LUA=	5.0
 WRKSRC=		${WRKDIR}/posix
 
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/posix.lua \
+		%%LUA_MODLIBDIR%%/lposix.so
+
 do-install:
-	@ ${MKDIR} ${PREFIX}/share/lua/5.0
-	@ ${INSTALL_DATA} ${WRKSRC}/posix.lua ${PREFIX}/share/lua/5.0
-	@ ${MKDIR} ${PREFIX}/lib/lua/5.0
-	@ ${INSTALL_PROGRAM} ${WRKSRC}/lposix.so ${PREFIX}/lib/lua/5.0
+	@${INSTALL_DATA} ${WRKSRC}/posix.lua ${LUA_MODSHAREDIR}
+	@${INSTALL_PROGRAM} ${WRKSRC}/lposix.so ${LUA_MODLIBDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-posix/pkg-plist
===================================================================
RCS file: ./devel/lua50-posix/pkg-plist
diff -N ./devel/lua50-posix/pkg-plist
--- ./devel/lua50-posix/pkg-plist	15 Apr 2006 16:59:09 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-share/lua/5.0/posix.lua
-lib/lua/5.0/lposix.so
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
Index: ./devel/lua50-posix/files/patch-Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-posix/files/patch-Makefile,v
retrieving revision 1.1
diff -u -r1.1 patch-Makefile
--- ./devel/lua50-posix/files/patch-Makefile	15 Apr 2006 16:59:09 -0000	1.1
+++ ./devel/lua50-posix/files/patch-Makefile	17 Aug 2006 19:52:37 -0000
@@ -1,20 +1,30 @@
---- Makefile.orig	Mon Mar 27 12:25:04 2006
-+++ Makefile	Mon Mar 27 12:43:24 2006
-@@ -1,7 +1,7 @@
+--- Makefile.orig	Wed Nov  5 21:26:49 2003
++++ Makefile	Mon Aug  7 00:38:38 2006
+@@ -1,13 +1,13 @@
  # makefile for POSIX library for Lua
  
  # change these to reflect your Lua installation
 -LUA= /tmp/lhf/lua-5.0
+-LUAINC= $(LUA)/include
+-LUALIB= $(LUA)/lib
+-LUABIN= $(LUA)/bin
 +LUA= ${PREFIX}
- LUAINC= $(LUA)/include
- LUALIB= $(LUA)/lib
- LUABIN= $(LUA)/bin
++LUAINC= $(LUA_INCDIR)
++LUALIB= $(LUA_LIBDIR)
++LUABIN= $(LUA_BINDIR)
+ 
+ # no need to change anything below here
+-CFLAGS= -fPIC $(INCS) $(WARN) -O2 $G
++CFLAGS+= -fPIC $(INCS) $(WARN) -O2 $G
+ WARN= -pedantic -Wall
+ INCS= -I$(LUAINC)
+ 
 @@ -21,7 +21,7 @@
  all:	test
  
  test:	$T
 -	$(LUABIN)/lua -l$(MYNAME) test.lua
-+	LD_PRELOAD=${PREFIX}/lib/liblua.so:${PREFIX}/lib/liblualib.so $(LUABIN)/lua -l$(MYNAME) test.lua
++	LD_PRELOAD=${LUA_LIBDIR}/liblua.so:${LUA_LIBDIR}/liblualib.so $(LUABIN)/lua -l$(MYNAME) test.lua
  
  $T:	$(OBJS)
  	$(CC) -o $@ -shared $(OBJS)
Index: ./devel/lua50-pty/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-pty/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- ./devel/lua50-pty/Makefile	23 Jun 2006 16:05:24 -0000	1.3
+++ ./devel/lua50-pty/Makefile	17 Aug 2006 19:52:37 -0000
@@ -10,18 +10,20 @@
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_LOCAL}
 MASTER_SITE_SUBDIR= philip
-PKGNAMEPREFIX=	lua50-
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	pty.lua?rev=1.2 pty.c?rev=1.25
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	Pty (pseudo-terminal) bindings for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${NONEXISTENT}:${PORTSDIR}/devel/lua50-compat51:extract
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${LOCALBASE}/share/lua/5.0/compat-5.1.lua:${PORTSDIR}/devel/lua50-compat51
+USE_LUA=	5.0
+LUA_COMPS=	lua compat51
 
-COMPAT_SRC=	`(cd ${PORTSDIR}/devel/lua50-compat51 && make -V WRKSRC)`
+COMPAT_SRC!=	`(cd ${PORTSDIR}/devel/lua50-compat51 && ${MAKE} -V WRKSRC)`
+MAKE_ENV=	COMPATDIR="${COMPAT_SRC}"
+
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/pty.lua \
+		%%LUA_MODLIBDIR%%/lpty.so
 
 do-extract:
 	@${MKDIR} ${WRKSRC}
@@ -30,13 +32,8 @@
 .endfor
 	@${CP} ${FILESDIR}/Makefile ${WRKSRC}
 
-post-patch:
-	@${REINPLACE_CMD} -e "s|%%COMPATDIR%%|${COMPAT_SRC}|" ${WRKSRC}/Makefile
-
 do-install:
-	${MKDIR} ${PREFIX}/lib/lua/5.0
-	${INSTALL_PROGRAM} ${WRKSRC}/lpty.so ${PREFIX}/lib/lua/5.0
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${WRKSRC}/pty.lua ${PREFIX}/share/lua/5.0
+	${INSTALL_PROGRAM} ${WRKSRC}/lpty.so ${LUA_MODLIBDIR}
+	${INSTALL_DATA} ${WRKSRC}/pty.lua ${LUA_MODSHAREDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-pty/pkg-plist
===================================================================
RCS file: ./devel/lua50-pty/pkg-plist
diff -N ./devel/lua50-pty/pkg-plist
--- ./devel/lua50-pty/pkg-plist	17 Apr 2006 16:21:40 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-lib/lua/5.0/lpty.so
-share/lua/5.0/pty.lua
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-pty/files/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-pty/files/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./devel/lua50-pty/files/Makefile	27 Apr 2006 12:48:48 -0000	1.2
+++ ./devel/lua50-pty/files/Makefile	17 Aug 2006 19:52:37 -0000
@@ -3,9 +3,9 @@
 SHLIB=		pty
 SHLIB_NAME=	lpty.so
 
-SRCS=		pty.c %%COMPATDIR%%/compat-5.1.c
+SRCS=		pty.c ${COMPATDIR}/compat-5.1.c
 
-CFLAGS+=	-I${PREFIX}/include
+CFLAGS+=	-I${LUA_INCDIR}
 LDFLAGS+=	-L/usr/lib -lutil
 
 .include <bsd.lib.mk>
Index: ./www/elinks/Makefile
===================================================================
RCS file: /home/pcvs/ports/www/elinks/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- ./www/elinks/Makefile	3 May 2006 13:25:07 -0000	1.39
+++ ./www/elinks/Makefile	17 Aug 2006 19:52:37 -0000
@@ -74,8 +74,10 @@
 .endif
 
 .if defined(WITH_LUASCRIPT)
-LIB_DEPENDS+=	lua:${PORTSDIR}/lang/lua50
+USE_LUA=	5.0
 CONFIGURE_ARGS+=	--with-lua
+CPPFLAGS+=	-I${LUA_INCDIR}
+LDFLAGS+=	-L${LUA_LIBDIR}
 .else
 CONFIGURE_ARGS+=	--without-lua
 .endif
Index: ./www/lighttpd/Makefile
===================================================================
RCS file: /home/pcvs/ports/www/lighttpd/Makefile,v
retrieving revision 1.40
diff -u -r1.40 Makefile
--- ./www/lighttpd/Makefile	9 Jun 2006 15:35:49 -0000	1.40
+++ ./www/lighttpd/Makefile	17 Aug 2006 19:52:37 -0000
@@ -64,9 +64,9 @@
 .endif
 
 .if defined(WITH_CML)
-LIB_DEPENDS+=		lua.5:${PORTSDIR}/lang/lua50
+USE_LUA=	5.0
 CONFIGURE_ARGS+=	--with-lua
-CONFIGURE_ENV+=		CFLAGS=-I${LOCALBASE}/include LDFLAGS=-L/${LOCALBASE}/lib
+CONFIGURE_ENV+=		CPPFLAGS="-I${LUA_INCDIR}" LDFLAGS="-L${LUA_LIBDIR}"
 .endif
 
 SUB_LIST+=		REQUIRE="${_REQUIRE}"
Index: ./astro/celestia/Makefile
===================================================================
RCS file: /home/pcvs/ports/astro/celestia/Makefile,v
retrieving revision 1.31
diff -u -r1.31 Makefile
--- ./astro/celestia/Makefile	5 May 2006 11:20:51 -0000	1.31
+++ ./astro/celestia/Makefile	17 Aug 2006 19:52:37 -0000
@@ -26,9 +26,9 @@
 USE_X_PREFIX=	yes
 
 CONFIGURE_ARGS=	--program-prefix=""
-CONFIGURE_ENV=	\
-	LDFLAGS="-L${X11BASE}/lib -L${LOCALBASE}/lib -lm ${PTHREAD_LIBS}" \
-	CPPFLAGS="-I${X11BASE}/include -I${LOCALBASE}/include ${PTHREAD_CFLAGS}"
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${X11BASE}/include -I${LOCALBASE}/include ${PTHREAD_CFLAGS}
+LDFLAGS=	-L${X11BASE}/lib -L${LOCALBASE}/lib -lm ${PTHREAD_LIBS}
 
 UI_LIST=	glut gtk gnome
 CELESTIA_UI?=	glut
@@ -77,8 +77,10 @@
 .endif
 
 .if defined(WITH_LUA)
-LIB_DEPENDS+=	lua.5:${PORTSDIR}/lang/lua50
+USE_LUA=	5.0
 CONFIGURE_ARGS+=	--with-lua
+CPPFLAGS+=	-I${LUA_INCDIR}
+LDFLAGS+=	-L${LUA_LIBDIR}
 .endif
 
 pre-patch:
Index: ./net-p2p/verlihub-plugins/Makefile
===================================================================
RCS file: /home/pcvs/ports/net-p2p/verlihub-plugins/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- ./net-p2p/verlihub-plugins/Makefile	3 May 2006 13:25:06 -0000	1.6
+++ ./net-p2p/verlihub-plugins/Makefile	17 Aug 2006 19:52:37 -0000
@@ -16,17 +16,18 @@
 COMMENT=        Plugins for the Verlihub Linux/Unix Direct Connect Hub Software
 
 BUILD_DEPENDS=	${LOCALBASE}/bin/verlihub:${PORTSDIR}/net-p2p/verlihub
-LIB_DEPENDS=	lua.5:${PORTSDIR}/lang/lua50
 
 WRKSRC=         ${WRKDIR}/vh_plugins-0.1
 
 USE_GMAKE=	yes
+USE_LUA=	5.0
+USE_GCC=	3.3
 GNU_CONFIGURE=	yes
 INSTALLS_SHLIB=	yes
 LDCONFIG_DIRS=	%%PREFIX%%/include/verlihub
-CONFIGURE_ENV+=	CPPFLAGS="-I${LOCALBASE}/include -I${LOCALBASE}/include/verlihub -I${LOCALBASE}/include/mysql"
-
-DATADIR=	${PREFIX}/share/${PORTNAME}
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${LOCALBASE}/include -I${LOCALBASE}/include/verlihub -I${LOCALBASE}/include/mysql -I${LUA_INCDIR}
+LDFLAGS=	-L${LUA_LIBDIR}
 
 post-install:
 	@${MKDIR} ${DATADIR}
@@ -45,14 +46,6 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} < 502010
-USE_GCC=	3.3
-.endif
-
-.if ${OSVERSION} > 502126
-BROKEN=		Does not compile with gcc 3.4
-.endif
-
 .if ${PERL_LEVEL} < 500800
 IGNORE=		requires perl 5.8 or later. Install lang/perl5.8 and try again
 .endif
Index: ./net-p2p/luasocket/Makefile
===================================================================
RCS file: /home/pcvs/ports/net/luasocket/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- ./net-p2p/luasocket/Makefile	3 May 2006 13:25:06 -0000	1.7
+++ ./net-p2p/luasocket/Makefile	17 Aug 2006 19:52:37 -0000
@@ -14,35 +14,22 @@
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	IPv4 Sockets support for the Lua language
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${LOCALBASE}/share/lua/5.0/compat-5.1.lua:${PORTSDIR}/devel/lua50-compat51
+BUILD_DEPENDS=	${NONEXISTENT}:${PORTSDIR}/devel/lua50-compat51:extract
 
 USE_GMAKE=	yes
+USE_LUA=	5.0
+LUA_COMPS=	lua compat51
+
+COMPAT_SRC=	`(cd ${PORTSDIR}/devel/lua50-compat51 && ${MAKE} -V WRKSRC)`
+MAKE_ENV=	COMPATDIR="${COMPAT_SRC}"
 
 post-extract:
-	@ ${MV} ${WRKSRC}/makefile ${WRKSRC}/Makefile
-	@ ${RM} ${WRKSRC}/src/compat-5.1r4/compat-5.1.o
+	@${MV} ${WRKSRC}/makefile ${WRKSRC}/Makefile
 
 post-install:
 .if !defined(NOPORTDOCS)
-	@${MKDIR} ${PREFIX}/share/doc/luasocket
-	@${INSTALL_DATA} ${WRKSRC}/doc/dns.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/ftp.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/home.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/http.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/installation.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/introduction.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/ltn12.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/luasocket.png ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/mime.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/reference.css ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/reference.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/smtp.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/socket.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/tcp.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/udp.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/url.html ${DOCSDIR}
+	@${MKDIR} ${DOCSDIR}
+	@${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR}
 .endif
 
 .include <bsd.port.mk>
Index: ./net-p2p/luasocket/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/net/luasocket/pkg-plist,v
retrieving revision 1.3
diff -u -r1.3 pkg-plist
--- ./net-p2p/luasocket/pkg-plist	20 Apr 2006 08:58:20 -0000	1.3
+++ ./net-p2p/luasocket/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,13 +1,13 @@
-share/lua/5.0/mime.lua
-share/lua/5.0/socket.lua
-share/lua/5.0/ltn12.lua
-share/lua/5.0/socket/smtp.lua
-share/lua/5.0/socket/ftp.lua
-share/lua/5.0/socket/tp.lua
-share/lua/5.0/socket/url.lua
-share/lua/5.0/socket/http.lua
-lib/lua/5.0/socket/core.so
-lib/lua/5.0/mime/core.so
+%%LUA_MODSHAREDIR%%/mime.lua
+%%LUA_MODSHAREDIR%%/socket.lua
+%%LUA_MODSHAREDIR%%/ltn12.lua
+%%LUA_MODSHAREDIR%%/socket/smtp.lua
+%%LUA_MODSHAREDIR%%/socket/ftp.lua
+%%LUA_MODSHAREDIR%%/socket/tp.lua
+%%LUA_MODSHAREDIR%%/socket/url.lua
+%%LUA_MODSHAREDIR%%/socket/http.lua
+%%LUA_MODLIBDIR%%/socket/core.so
+%%LUA_MODLIBDIR%%/mime/core.so
 %%PORTDOCS%%%%DOCSDIR%%/dns.html
 %%PORTDOCS%%%%DOCSDIR%%/ftp.html
 %%PORTDOCS%%%%DOCSDIR%%/home.html
@@ -25,10 +25,6 @@
 %%PORTDOCS%%%%DOCSDIR%%/udp.html
 %%PORTDOCS%%%%DOCSDIR%%/url.html
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
-@dirrm share/lua/5.0/socket
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
-@dirrm lib/lua/5.0/socket
-@dirrm lib/lua/5.0/mime
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
+@dirrm %%LUA_MODSHAREDIR%%/socket
+@dirrm %%LUA_MODLIBDIR%%/socket
+@dirrm %%LUA_MODLIBDIR%%/mime
Index: ./net-p2p/luasocket/files/patch-config
===================================================================
RCS file: /home/pcvs/ports/net/luasocket/files/patch-config,v
retrieving revision 1.1
diff -u -r1.1 patch-config
--- ./net-p2p/luasocket/files/patch-config	26 Mar 2006 13:43:34 -0000	1.1
+++ ./net-p2p/luasocket/files/patch-config	17 Aug 2006 19:52:37 -0000
@@ -1,28 +1,35 @@
---- config.orig	Fri Nov 25 09:29:38 2005
-+++ config	Mon Mar  6 19:46:29 2006
-@@ -15,8 +15,8 @@
+--- config.orig	Thu Nov 24 17:29:38 2005
++++ config	Mon Aug  7 13:36:23 2006
+@@ -15,42 +15,42 @@
  #------
  # Lua includes and libraries
  #
 -LUAINC=-Ilua-5.0.2/include
 -LUALIB=-Llua-5.0.2/lib
-+LUAINC=-I$(PREFIX)/include
-+LUALIB=-L$(PREFIX)/lib
++LUAINC=-I$(LUA_INCDIR)
++LUALIB=-L$(LUA_LIBDIR)
  
  #------
  # Compat-5.1 directory
-@@ -27,8 +27,8 @@
+ #
+-COMPAT=compat-5.1r4
++COMPAT=${COMPATDIR}
+ 
+ #------
  # Top of your Lua installation
  # Relative paths will be inside the src tree
  #
 -INSTALL_TOP_SHARE=share
 -INSTALL_TOP_LIB=lib
-+INSTALL_TOP_SHARE=${PREFIX}/share/lua/5.0
-+INSTALL_TOP_LIB=${PREFIX}/lib/lua/5.0
++INSTALL_TOP_SHARE=${LUA_MODSHAREDIR}
++INSTALL_TOP_LIB=${LUA_MODLIBDIR}
  
- INSTALL_DATA=cp
- INSTALL_EXEC=cp
-@@ -37,20 +37,20 @@
+-INSTALL_DATA=cp
+-INSTALL_EXEC=cp
++INSTALL_DATA=${BSD_INSTALL_DATA}
++INSTALL_EXEC=${BSD_INSTALL_PROGRAM}
+ 
+ #------
  # Compiler and linker settings
  # for Mac OS X
  #
@@ -48,7 +55,7 @@
 -#LD=gcc 
 +CFLAGS+= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -fpic
 +LDFLAGS=-O -shared
-+LD=gcc 
++LD=${CC}
  
  #------
  # End of makefile configuration
Comment 5 Alejandro Pulver freebsd_committer 2006-08-17 21:04:20 UTC
This new diff is relative to the ports directory. Also applies to the
latest "games/alephone".

Index: ./mail/imapfilter/Makefile
===================================================================
RCS file: /home/pcvs/ports/mail/imapfilter/Makefile,v
retrieving revision 1.18
diff -u -r1.18 Makefile
--- ./mail/imapfilter/Makefile	28 May 2006 15:43:33 -0000	1.18
+++ ./mail/imapfilter/Makefile	17 Aug 2006 19:52:36 -0000
@@ -13,35 +13,39 @@
 MAINTAINER=	stefan@FreeBSD.org
 COMMENT=	IMAP mail filtering utility
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.hpp:${PORTSDIR}/lang/lua
-
 USE_BZIP2=	yes
+USE_LUA=	5.1
 USE_OPENSSL=	yes
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS=	-d ${PREFIX} -s ${DATADIR}
+CPPFLAGS=	-I${LOCALBASE}/include -I${LUA_INCDIR}
+LDFLAGS=	-L${LOCALBASE}/lib -L${LUA_LIBDIR}
 
 MAN1=		imapfilter.1
 MAN5=		imapfilter_config.5
 PORTDOCS=	LICENSE NEWS README
 PLIST_FILES=	bin/imapfilter \
-		${DATADIR:S%${PREFIX}/%%}/interface.lua \
-		${DATADIR:S%${PREFIX}/%%}/auxiliary.lua \
-		${EXAMPLESDIR:S%${PREFIX}/%%}/sample.config.lua \
-		${EXAMPLESDIR:S%${PREFIX}/%%}/sample.extend.lua
-PLIST_DIRS=	${DATADIR:S%${PREFIX}/%%} ${EXAMPLESDIR:S%${PREFIX}/%%}
+		%%DATADIR%%/interface.lua \
+		%%DATADIR%%/auxiliary.lua \
+		%%EXAMPLESDIR%%/sample.config.lua \
+		%%EXAMPLESDIR%%/sample.extend.lua
+PLIST_DIRS=	%%DATADIR%% %%EXAMPLESDIR%%
 
 post-patch:
-	${REINPLACE_CMD} -e "s,%%PREFIX%%,${PREFIX},g" ${WRKSRC}/configure
-	${REINPLACE_CMD} -e "s,%%LOCALBASE%%,${LOCALBASE},g" ${WRKSRC}/configure
+	@${REINPLACE_CMD} -Ee \
+		's|^(incdirs=).*|\1"${CPPFLAGS}"| ; \
+		 s|^(libdirs=).*|\1"${LDFLAGS}"| ; \
+		 s|^(mycflags=).*|\1"${CFLAGS}"| ; \
+		 s|-llualib||' \
+		${WRKSRC}/configure
 
 post-install:
 	${STRIP_CMD} ${PREFIX}/bin/imapfilter
-	@${MKDIR} ${DATADIR}
-	cd ${WRKSRC} && ${INSTALL_DATA} interface.lua \
-		auxiliary.lua ${DATADIR}
-	@${MKDIR} ${EXAMPLESDIR}
-	cd ${WRKSRC} && ${INSTALL_DATA} sample.config.lua \
-		sample.extend.lua ${EXAMPLESDIR}
+	@${MKDIR} ${DATADIR} ${EXAMPLESDIR}
+	cd ${WRKSRC} && \
+		${INSTALL_DATA} interface.lua auxiliary.lua ${DATADIR} && \
+		${INSTALL_DATA} sample.config.lua sample.extend.lua \
+			${EXAMPLESDIR}
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 	cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
Index: ./mail/imapfilter/files/patch-configure
===================================================================
RCS file: ./mail/imapfilter/files/patch-configure
diff -N ./mail/imapfilter/files/patch-configure
--- ./mail/imapfilter/files/patch-configure	28 May 2006 15:43:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,73 +0,0 @@
---- configure.orig	Thu Mar  9 23:58:22 2006
-+++ configure	Fri May 26 21:52:12 2006
-@@ -2,7 +2,7 @@
- 
- # Default values
- 
--destdir="/usr/local"
-+destdir="%%PREFIX%%"
- bindir="$destdir/bin"
- sharedir="$destdir/share/imapfilter"
- mandir="$destdir/man"
-@@ -10,13 +10,13 @@
- ssltls="yes"
- crammd5="yes"
- 
--incdirs="-I/usr/local/include"
--libdirs="-L/usr/local/lib"
-+incdirs="-I%%LOCALBASE%%/include"
-+libdirs="-L%%LOCALBASE%%/lib"
- 
- mycflags="-Wall -O"
- myldflags=""
- 
--libs="-lm -llua -llualib"
-+libs="-lm -llua"
- libssl="-lssl"
- libcrypto="-lcrypto"
- 
-@@ -145,16 +145,16 @@
- SHAREDIR = $sharedir
- MANDIR = $mandir
- 
-+INST_BIN = \$(BSD_INSTALL_PROGRAM)
-+INST_DOC = \$(BSD_INSTALL_MAN)
-+
- INCDIRS = $incdirs
- LIBDIRS = $libdirs
- 
--MYCFLAGS = $mycflags
--MYLDFLAGS = $myldflags
--
- DEFS = $defs
- 
--CFLAGS = \$(MYCFLAGS) \$(DEFS) \$(INCDIRS)
--LDFLAGS = \$(MYLDFLAGS) \$(LIBDIRS)
-+CFLAGS += \$(DEFS) \$(INCDIRS)
-+LDFLAGS += \$(LIBDIRS)
- 
- LIBS = $libs
- 
-@@ -184,19 +184,9 @@
- imapfilter.o: version.h
- 
- install: \$(BIN)
--	if test ! -d \$(BINDIR); then mkdir -p \$(BINDIR); fi
--	cp -f \$(BIN) \$(BINDIR) && chmod 0755 \$(BINDIR)/\$(BIN)
--	if test ! -d \$(SHAREDIR); then mkdir -p \$(SHAREDIR); fi
--	cp -f \$(INTERFACE_LUA) \$(SHAREDIR) && \\
--		chmod 0644 \$(SHAREDIR)/\$(INTERFACE_LUA)
--	cp -f \$(AUXILIARY_LUA) \$(SHAREDIR) && \\
--		chmod 0644 \$(SHAREDIR)/\$(AUXILIARY_LUA)
--	if test ! -d \$(MANDIR)/man1; then mkdir -p \$(MANDIR)/man1; fi
--	cp -f \$(MAN_BIN) \$(MANDIR)/man1 && \\
--		chmod 0644 \$(MANDIR)/man1/\$(MAN_BIN)
--	if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi
--	cp -f \$(MAN_CONFIG) \$(MANDIR)/man5 && \\
--		chmod 0644 \$(MANDIR)/man5/\$(MAN_CONFIG)
-+	\$(INST_BIN) \$(BIN) \$(BINDIR)
-+	\$(INST_DOC) \$(MAN_BIN) \$(MANDIR)/man1
-+	\$(INST_DOC) \$(MAN_CONFIG) \$(MANDIR)/man5
- 
- deinstall:
- 	rm -f \$(BINDIR)/\$(BIN) \$(SHAREDIR)/\$(INTERFACE_LUA) \\
Index: ./textproc/ruby-xml-script/Makefile
===================================================================
RCS file: /home/pcvs/ports/textproc/ruby-xml-script/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./textproc/ruby-xml-script/Makefile	11 Nov 2005 01:17:55 -0000	1.2
+++ ./textproc/ruby-xml-script/Makefile	17 Aug 2006 19:52:36 -0000
@@ -16,9 +16,10 @@
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A Ruby module for scripting an XML stream using an ASP-like notation
 
-RUN_DEPENDS=	${RUBY_SITEARCHLIBDIR}/js.so:${PORTSDIR}/lang/ruby-js \
-		${RUBY_SITEARCHLIBDIR}/lua.so:${PORTSDIR}/lang/ruby-lua4
+RUN_DEPENDS=	${RUBY_SITEARCHLIBDIR}/js.so:${PORTSDIR}/lang/ruby-js
 
+USE_LUA=	4.0
+LUA_COMPS=	ruby
 USE_RUBY=	yes
 USE_RUBY_SETUP=	yes
 
@@ -28,6 +29,10 @@
 		README
 EXAMPLES=	tests/*
 
+post-patch:
+	@${REINPLACE_CMD} -Ee 's|(language/lua)|\1-${LUA_VER}|' \
+		${WRKSRC}/lib/xml/script/lua/compiler.rb
+
 post-install:
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${RUBY_MODEXAMPLESDIR}
Index: ./x11-wm/ion-2/Makefile
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-2/Makefile,v
retrieving revision 1.20
diff -u -r1.20 Makefile
--- ./x11-wm/ion-2/Makefile	3 May 2006 13:25:07 -0000	1.20
+++ ./x11-wm/ion-2/Makefile	17 Aug 2006 19:52:36 -0000
@@ -15,15 +15,14 @@
 MAINTAINER=	anthony.ginepro@laposte.net
 COMMENT=	Ion is a tiling tabbed window manager
 
-LIB_DEPENDS=	lua.5:${PORTSDIR}/lang/lua50
-
 CONFLICTS=	ion-2002* ion-devel-* pwm-*
 
-GNU_CONFIGURE=	yes
-USE_AUTOTOOLS=	libtool:15 libltdl:15
 USE_X_PREFIX=	yes
+USE_AUTOTOOLS=	libtool:15 libltdl:15
+USE_LUA=	5.0
 USE_GMAKE=	yes
 MAKE_ENV=	DEFINES="${IONDEFINES}"
+GNU_CONFIGURE=	yes
 
 .if !defined(WITH_MULTIBYTE)
 IONDEFINES+=	-DCF_NO_MB_SUPPORT
Index: ./x11-wm/ion-2/files/patch-rules.mk
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-2/files/patch-rules.mk,v
retrieving revision 1.1
diff -u -r1.1 patch-rules.mk
--- ./x11-wm/ion-2/files/patch-rules.mk	30 May 2004 07:06:29 -0000	1.1
+++ ./x11-wm/ion-2/files/patch-rules.mk	17 Aug 2006 19:52:36 -0000
@@ -1,5 +1,5 @@
---- rules.mk	Wed Apr  7 09:15:54 2004
-+++ rules.mk.bsd	Sun Apr 11 12:55:10 2004
+--- ./rules.mk.orig	Thu Jul 29 00:10:32 2004
++++ ./rules.mk	Mon Jul 17 21:50:19 2006
 @@ -91,6 +91,7 @@
  module_install:
  	$(INSTALLDIR) $(MODULEDIR)
Index: ./x11-wm/ion-2/files/patch-system.mk
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-2/files/patch-system.mk,v
retrieving revision 1.9
diff -u -r1.9 patch-system.mk
--- ./x11-wm/ion-2/files/patch-system.mk	23 Feb 2006 10:40:40 -0000	1.9
+++ ./x11-wm/ion-2/files/patch-system.mk	17 Aug 2006 19:52:36 -0000
@@ -1,5 +1,5 @@
---- system.mk.orig	Tue Jun  1 16:35:23 2004
-+++ system.mk	Sat Jun  5 13:27:08 2004
+--- ./system.mk.orig	Thu Jul 29 00:10:32 2004
++++ ./system.mk	Mon Jul 17 21:53:01 2006
 @@ -7,7 +7,7 @@
  ## Installation paths
  ##
@@ -33,15 +33,23 @@
  
  # The following should do it if you have manually installed libtool 1.5 in
  # $(LIBTOOLDIR).
-@@ -72,7 +72,7 @@
+@@ -72,11 +72,11 @@
  
  # If you have installed Lua 5.0 from the official tarball without changing
  # paths, this should do it.
 -LUA_DIR=/usr/local
+-LUA_LIBS = -L$(LUA_DIR)/lib -R$(LUA_DIR)/lib -llua -llualib
+-LUA_INCLUDES = -I$(LUA_DIR)/include
+-LUA=$(LUA_DIR)/bin/lua
+-LUAC=$(LUA_DIR)/bin/luac
 +LUA_DIR=$(LOCALBASE)
- LUA_LIBS = -L$(LUA_DIR)/lib -R$(LUA_DIR)/lib -llua -llualib
- LUA_INCLUDES = -I$(LUA_DIR)/include
- LUA=$(LUA_DIR)/bin/lua
++LUA_LIBS = -L$(LUA_LIBDIR) -R$(LUA_LIBDIR) -llua -llualib
++LUA_INCLUDES = -I$(LUA_INCDIR)
++LUA=$(LUA_BINDIR)/lua
++LUAC=$(LUA_BINDIR)/luac
+ 
+ # If you are using the Debian packages, the following settings should be
+ # what you want.
 @@ -90,7 +90,7 @@
  ## X libraries, includes and options
  ##
Index: ./x11-wm/ion-3ds/Makefile
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-3ds/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- ./x11-wm/ion-3ds/Makefile	14 Jul 2006 23:51:10 -0000	1.14
+++ ./x11-wm/ion-3ds/Makefile	17 Aug 2006 19:52:36 -0000
@@ -13,12 +13,12 @@
 MAINTAINER=	ed@fxq.nl
 COMMENT=	The development version of the Ion window manager
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.hpp:${PORTSDIR}/lang/lua
 RUN_DEPENDS=	run-mailcap:${PORTSDIR}/misc/mime-support
 
 USE_X_PREFIX=	yes
 USE_GETTEXT=	yes
 USE_GMAKE=	yes
+USE_LUA=	5.1
 MAKE_ENV=	DEFINES="${IONDEFINES}"
 
 .if !defined(WITH_XINERAMA)
Index: ./x11-wm/ion-3ds/files/patch-system.mk
===================================================================
RCS file: /home/pcvs/ports/x11-wm/ion-3ds/files/patch-system.mk,v
retrieving revision 1.3
diff -u -r1.3 patch-system.mk
--- ./x11-wm/ion-3ds/files/patch-system.mk	28 May 2006 15:55:13 -0000	1.3
+++ ./x11-wm/ion-3ds/files/patch-system.mk	17 Aug 2006 19:52:36 -0000
@@ -1,5 +1,5 @@
---- system.mk.orig	Thu May 18 16:06:53 2006
-+++ system.mk	Fri May 19 13:19:25 2006
+--- ./system.mk.orig	Wed May 24 13:23:51 2006
++++ ./system.mk	Mon Jul 17 18:15:24 2006
 @@ -7,7 +7,7 @@
  ## Installation paths
  ##
@@ -27,15 +27,23 @@
  
  
  ##
-@@ -56,7 +56,7 @@
+@@ -56,11 +56,11 @@
  
  # If you have installed Lua 5.1 from the official tarball without changing
  # paths, this should do it.
 -LUA_DIR=/usr/local
+-LUA_LIBS = -L$(LUA_DIR)/lib -llua
+-LUA_INCLUDES = -I$(LUA_DIR)/include
+-LUA=$(LUA_DIR)/bin/lua
+-LUAC=$(LUA_DIR)/bin/luac
 +LUA_DIR=$(LOCALBASE)
- LUA_LIBS = -L$(LUA_DIR)/lib -llua
- LUA_INCLUDES = -I$(LUA_DIR)/include
- LUA=$(LUA_DIR)/bin/lua
++LUA_LIBS = -L$(LUA_LIBDIR) -llua
++LUA_INCLUDES = -I$(LUA_INCDIR)
++LUA=$(LUA_BINDIR)/lua
++LUAC=$(LUA_BINDIR)/luac
+ 
+ # If you are using the Debian packages, the following settings should be
+ # what you want.
 @@ -74,7 +74,7 @@
  ## X libraries, includes and options
  ##
Index: ./games/alephone/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/alephone/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- ./games/alephone/Makefile	12 Aug 2006 21:03:35 -0000	1.24
+++ ./games/alephone/Makefile	17 Aug 2006 19:52:36 -0000
@@ -16,19 +16,18 @@
 COMMENT=	The open source version of Bungie's Marathon game
 
 BUILD_DEPENDS=	${LOCALBASE}/include/boost/function.hpp:${PORTSDIR}/devel/boost
-LIB_DEPENDS=	speex.3:${PORTSDIR}/audio/speex \
-		lua.5:${PORTSDIR}/lang/lua50
+LIB_DEPENDS=	speex.3:${PORTSDIR}/audio/speex
 
 USE_BZIP2=	yes
 USE_X_PREFIX=	yes
+USE_GL=		yes
 USE_GNOME=	gnometarget
+USE_LUA=	5.0
 USE_SDL=	image net sdl sound
-USE_GL=		yes
 GNU_CONFIGURE=	yes
 CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
-
-CPPFLAGS=	-I${LOCALBASE}/include -I${X11BASE}/include
-LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib
+CPPFLAGS=	-I${LOCALBASE}/include -I${X11BASE}/include -I${LUA_INCDIR}
+LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib -L${LUA_LIBDIR}
 
 .include <bsd.port.pre.mk>
 
Index: ./games/enigma/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/enigma/Makefile,v
retrieving revision 1.32
diff -u -r1.32 Makefile
--- ./games/enigma/Makefile	6 Jul 2006 17:54:46 -0000	1.32
+++ ./games/enigma/Makefile	17 Aug 2006 19:52:36 -0000
@@ -15,21 +15,23 @@
 MAINTAINER=	anholt@FreeBSD.org
 COMMENT=	Enigma is a reimplementation of Oxyd, a puzzle game
 
-BUILD_DEPENDS=	${LOCALBASE}/bin/tolua:${PORTSDIR}/lang/tolua4
-LIB_DEPENDS=	zipios.0:${PORTSDIR}/archivers/zipios++ \
-		lua.4:${PORTSDIR}/lang/lua4
+LIB_DEPENDS=	zipios.0:${PORTSDIR}/archivers/zipios++
 
 USE_GCC=	3.4
-
-GNU_CONFIGURE=	yes
-USE_XLIB=	yes
 USE_GMAKE=	yes
 USE_GETTEXT=	yes
+USE_LUA=	4.0
+LUA_COMPS=	lua tolua
 USE_SDL=	gfx image mixer sdl ttf
+USE_XLIB=	yes
+GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--target="" \
 		--with-libintl-prefix="${LOCALBASE}"
-CONFIGURE_ENV=	LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}" \
-		CXXFLAGS="${PTHREAD_CFLAGS} -I${X11BASE}/include"
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" CXXFLAGS="${CXXFLAGS}" \
+		LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${LOCALBASE}/include -I${LUA_INCDIR}
+CXXFLAGS=	-I${X11BASE}/include ${PTHREAD_CFLAGS}
+LDFLAGS=	-L${LOCALBASE}/lib -L${LUA_LIBDIR} ${PTHREAD_LIBS}
 
 MAN6=		enigma.6
 
Index: ./games/fillets-ng/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/fillets-ng/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- ./games/fillets-ng/Makefile	7 May 2006 23:45:15 -0000	1.5
+++ ./games/fillets-ng/Makefile	17 Aug 2006 19:52:36 -0000
@@ -19,15 +19,16 @@
 MAINTAINER=	amdmi3@mail.ru
 COMMENT=	A wonderful puzzle game
 
-LIB_DEPENDS=	lua.5:${PORTSDIR}/lang/lua50
-
 USE_SDL=	sdl mixer image ttf
+USE_LUA=	5.0
 USE_GMAKE=	yes
 GNU_CONFIGURE=	yes
 
-CONFIGURE_ENV=		SDL_CONFIG="${SDL_CONFIG}"
+CONFIGURE_ENV=		CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
 CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
 CONFIGURE_ARGS=		--datadir="${DATADIR}" --with-lua="${LOCALBASE}"
+CPPFLAGS=	-I${LUA_INCDIR}
+LDFLAGS=	-L${LUA_LIBDIR}
 
 OPTIONS=	FRIBIDI		"Enable fribidi support"	off
 
Index: ./games/xmoto/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/xmoto/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- ./games/xmoto/Makefile	28 Jul 2006 15:10:38 -0000	1.8
+++ ./games/xmoto/Makefile	17 Aug 2006 19:52:37 -0000
@@ -18,19 +18,19 @@
 LIB_DEPENDS=	vorbis.3:${PORTSDIR}/audio/libvorbis \
 		png.5:${PORTSDIR}/graphics/png \
 		jpeg.9:${PORTSDIR}/graphics/jpeg
-BUILD_DEPENDS=	${X11BASE}/lib/libode.a:${PORTSDIR}/devel/ode \
-		${LOCALBASE}/include/lua.hpp:${PORTSDIR}/lang/lua
+BUILD_DEPENDS=	${X11BASE}/lib/libode.a:${PORTSDIR}/devel/ode
 
 GNU_CONFIGURE=	yes
 USE_GMAKE=	yes
 USE_GL=		yes
+USE_LUA=	5.1
 USE_SDL=	sdl mixer
 USE_DOS2UNIX=	src/*.cpp src/*.h
 
 CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
-CONFIGURE_ENV=	LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib" \
-		CPPFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include" \
-		SDL_CONFIG="${SDL_CONFIG}"
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${LOCALBASE}/include -I${X11BASE}/include -I${LUA_INCDIR}
+LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib -L${LUA_LIBDIR}
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 
@@ -45,13 +45,14 @@
 .endif
 
 post-patch:
-	@${REINPLACE_CMD} -e 's|SDL/|SDL11/|' ${WRKSRC}/src/VCommon.h
-	@${REINPLACE_CMD} -e 's|malloc.h|stdlib.h|' ${WRKSRC}/src/image/tim_memory_crt.cpp
-	@${REINPLACE_CMD} -e 's|endian.h|sys/endian.h|' ${WRKSRC}/src/VCommon.h
-	@${REINPLACE_CMD} -e '/LIBS/ s|\(-lSDL_mixer\)|\1 `${SDL_CONFIG} --libs`|' ${WRKSRC}/configure
-.if !defined(WITH_CURL)
-	@${REINPLACE_CMD} -e 's|test $$ac_cv_lib_curl_curl_easy_init = yes|false|' ${WRKSRC}/configure
-.endif
+	@${REINPLACE_CMD} -e 's|SDL/||; s|endian.h|sys/endian.h|' \
+		${WRKSRC}/src/VCommon.h
+	@${REINPLACE_CMD} -e 's|malloc.h|stdlib.h|' \
+		${WRKSRC}/src/image/tim_memory_crt.cpp
+	@${REINPLACE_CMD} -e \
+		'/LIBS/ s|\(-lSDL_mixer\)|`${SDL_CONFIG} --libs` \1| ; \
+		 s|test $$ac_cv_lib_curl_curl_easy_init = yes|false|' \
+		${WRKSRC}/configure
 
 .if !defined(NOPORTDOCS)
 post-install:
Index: ./games/stratagus/Makefile
===================================================================
RCS file: /home/pcvs/ports/games/stratagus/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- ./games/stratagus/Makefile	7 May 2006 23:45:35 -0000	1.6
+++ ./games/stratagus/Makefile	17 Aug 2006 19:52:37 -0000
@@ -16,32 +16,21 @@
 MAINTAINER=	tlp@liquidx.org
 COMMENT=	Free cross-platform real-time strategy gaming engine
 
-LIB_DEPENDS=	png.5:${PORTSDIR}/graphics/png \
-		lua.5:${PORTSDIR}/lang/lua50
+LIB_DEPENDS=	png.5:${PORTSDIR}/graphics/png
 
+USE_GMAKE=	yes
+USE_LUA=	5.0
 USE_SDL=	yes
 USE_XLIB=	yes
-USE_GMAKE=	yes
-
-WRKSRC=		${WRKDIR}/stratagus-040702
-
 GNU_CONFIGURE=	yes
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${LOCALBASE}/include -I${X11BASE}/include -I${LUA_INCDIR}
+LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib -L${LUA_LIBDIR}
+WRKSRC=		${WRKDIR}/stratagus-040702
 
-.if defined(WITH_OPENGL)
-CONFIGURE_ARGS+=	--with-opengl
-.endif
-
-.if defined(WITHOUT_VORBIS)
-CONFIGURE_ARGS+=	--without-ogg
-.else
-LIB_DEPENDS+=	vorbisfile.4:${PORTSDIR}/audio/libvorbis
-.endif
-
-.if defined(WITHOUT_MIKMOD)
-CONFIGURE_ARGS+=	--without-mikmod
-.else
-LIB_DEPENDS+=	mikmod.2:${PORTSDIR}/audio/libmikmod
-.endif
+OPTIONS=	OPENGL "Enable OpenGL support" on \
+		MIKMOD "Enable Mikmod support" off \
+		VORBIS "Enable Ogg Vorbis support" off
 
 PLIST_FILES=	bin/stratagus
 
@@ -51,20 +40,21 @@
 IGNORE=		does not run properly on FreeBSD 4.x
 .endif
 
-pre-everything::
-	@${ECHO_MSG} ""
-	@${ECHO_MSG} "Stratagus has the following tunable option(s):"
-	@${ECHO_MSG} ""
-	@${ECHO_MSG} "	WITH_OPENGL=yes		Builds Stratagus with OpenGL"
-	@${ECHO_MSG} ""
-	@${ECHO_MSG} "	WITHOUT_VORBIS=yes	Turns off Ogg Vorbis support"
-	@${ECHO_MSG} "	WITHOUT_MIKMOD=yes	Turns off Mikmod support"
-	@${ECHO_MSG} ""
-
-post-configure:
-	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/Makefile
-	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/Rules.make
-	@${REINPLACE_CMD} -e 's|/usr/X11R6|${X11BASE}|' ${WRKSRC}/Rules.make
+.if defined(WITH_OPENGL)
+CONFIGURE_ARGS+=--with-opengl
+.endif
+
+.if defined(WITH_MIKMOD)
+LIB_DEPENDS+=	mikmod.2:${PORTSDIR}/audio/libmikmod
+.else
+CONFIGURE_ARGS+=--without-mikmod
+.endif
+
+.if defined(WITH_VORBIS)
+LIB_DEPENDS+=	vorbisfile.4:${PORTSDIR}/audio/libvorbis
+.else
+CONFIGURE_ARGS+=--without-ogg
+.endif
 
 post-install:
 	@${CAT} ${PKGMESSAGE}
Index: ./games/stratagus/pkg-message
===================================================================
RCS file: /home/pcvs/ports/games/stratagus/pkg-message,v
retrieving revision 1.1
diff -u -r1.1 pkg-message
--- ./games/stratagus/pkg-message	4 Jul 2004 05:27:40 -0000	1.1
+++ ./games/stratagus/pkg-message	17 Aug 2006 19:52:37 -0000
@@ -1,9 +1,9 @@
--------------------------------------------------------------------------------
-NOTE: This is only the engine. If you wish to play a game that uses the 
-Stratagus engine, you must manually download the Stratagus game data. 
+------------------------------------------------------------------------------
+NOTE: This is only the engine. If you wish to play a game that uses the
+Stratagus engine, you must manually download the Stratagus game data.
 
-You can use the 'games/wargus' port to extract data from a legal copy of 
-Warcraft 2 (original DOS version required, won't work with the battle.net 
+You can use the 'games/wargus' port to extract data from a legal copy of
+Warcraft 2 (original DOS version required, won't work with the battle.net
 edition).
 
 For more information, please take a look at the following URL:
@@ -11,4 +11,4 @@
 http://stratagus.sourceforge.net/games.shtml
 
 Enjoy!
--------------------------------------------------------------------------------
+------------------------------------------------------------------------------
Index: ./games/stratagus/files/patch-Rules.make.in
===================================================================
RCS file: ./games/stratagus/files/patch-Rules.make.in
diff -N ./games/stratagus/files/patch-Rules.make.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ./games/stratagus/files/patch-Rules.make.in	17 Aug 2006 19:52:37 -0000
@@ -0,0 +1,38 @@
+--- ./Rules.make.in.orig	Thu Jul  1 22:38:08 2004
++++ ./Rules.make.in	Mon Jul 17 19:23:39 2006
+@@ -10,17 +10,15 @@
+ ##
+ 
+ # Compile commands
+-CC=gcc
+ CCLD=$(CC)
+ RM=rm -f
+-MAKE=make
+ 
+ # Prefix for 'make install'
+ PREFIX=@PREFIX@
+ 
+ # Use LUA support
+-CCL		= -DUSE_LUA
+-CCLLIB		= -lm
++CCL		= -DUSE_LUA -I$(LUA_INCDIR)
++CCLLIB		= -L$(LUA_LIBDIR) -lm
+ 
+ # Video support
+ VIDEO_CFLAGS = @VIDEO_CFLAGS@
+@@ -49,13 +47,12 @@
+ 
+ IFLAGS=	-I$(TOPDIR)/src/include $(XIFLAGS) -I$(TOPDIR)/src/movie/vp31/include
+ 
+-CFLAGS=@EXTRA_CFLAGS@ @PROFILE_CFLAGS@ @DEBUG_CFLAGS@ $(IFLAGS) \
++CFLAGS=@CFLAGS@ @CPPFLAGS@ @EXTRA_CFLAGS@ @PROFILE_CFLAGS@ @DEBUG_CFLAGS@ $(IFLAGS) \
+     -DUSE_HP_FOR_XP -DMAP_REGIONS \
+     @PROFILE_CFLAGS@ @DEBUG_CFLAGS@ @VIDEO_CFLAGS@ @BZ2_CFLAGS@ \
+     @OGG_CFLAGS@ @MAD_CFLAGS@ @FLAC_CFLAGS@ @CDAUDIO_CFLAGS@ \
+     @MIKMOD_CFLAGS@ @LUA_CFLAGS@ $(CCL) \
+-    $(COMP_CFLAGS) @PLATFORM@ \
+-    -I/usr/local/include
++    $(COMP_CFLAGS) @PLATFORM@
+ 
+ CTAGSFLAGS=-i defptvS -a -f 
+ 
Index: ./games/stratagus/files/patch-aa
===================================================================
RCS file: ./games/stratagus/files/patch-aa
diff -N ./games/stratagus/files/patch-aa
--- ./games/stratagus/files/patch-aa	4 Jul 2004 05:27:40 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- Rules.make.in.orig	Thu Jul  1 00:03:00 2004
-+++ Rules.make.in	Thu Jul  1 00:04:55 2004
-@@ -55,7 +55,8 @@
-     @OGG_CFLAGS@ @MAD_CFLAGS@ @FLAC_CFLAGS@ @CDAUDIO_CFLAGS@ \
-     @MIKMOD_CFLAGS@ @LUA_CFLAGS@ $(CCL) \
-     $(COMP_CFLAGS) @PLATFORM@ \
--    -I/usr/local/include
-+    -I/usr/local/include \
-+    -I/usr/X11R6/include
- 
- CTAGSFLAGS=-i defptvS -a -f 
Index: ./games/stratagus/files/patch-configure
===================================================================
RCS file: /home/pcvs/ports/games/stratagus/files/patch-configure,v
retrieving revision 1.1
diff -u -r1.1 patch-configure
--- ./games/stratagus/files/patch-configure	2 Nov 2004 20:43:22 -0000	1.1
+++ ./games/stratagus/files/patch-configure	17 Aug 2006 19:52:37 -0000
@@ -1,5 +1,5 @@
---- configure.orig	Fri Jul  2 03:46:35 2004
-+++ configure	Tue Nov  2 21:31:50 2004
+--- ./configure.orig	Thu Jul  1 22:46:35 2004
++++ ./configure	Mon Jul 17 19:23:06 2006
 @@ -3229,9 +3229,6 @@
  	VIDEO_LIBS="$VIDEO_LIBS -lwsock32 -lws2_32 -lmingwex -lgmon"
      fi
Index: ./lang/lua4/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/lua4/Makefile,v
retrieving revision 1.22
diff -u -r1.22 Makefile
--- ./lang/lua4/Makefile	4 Jun 2006 12:12:33 -0000	1.22
+++ ./lang/lua4/Makefile	17 Aug 2006 19:52:37 -0000
@@ -17,40 +17,74 @@
 MAINTAINER=	him@richardkiss.com
 COMMENT=	Small, compilable scripting language providing easy access to C code
 
-LATEST_LINK=	lua4
-MAN1=		luac.1
-WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
+USE_LDCONFIG=	yes
+USE_LUA=	4.0
+LUA_COMPS=	# only define variables
 ALL_TARGET=	all so
-INSTALLS_SHLIB=	YES
 
-CONFLICTS=	lua-5*
+MAN1=		lua-${LUA_VER}.1 luac-${LUA_VER}.1
+DOCSDIR=	${PREFIX}/share/doc/${LUA_SUBDIR}
+LATEST_LINK=	${LUA_SUBDIR}
 
-do-install:
-	@ ${MKDIR} ${PREFIX}/share/doc/lua
-	@ ${INSTALL_PROGRAM} ${WRKSRC}/bin/lua ${PREFIX}/bin
-	@ ${INSTALL_PROGRAM} ${WRKSRC}/bin/luac ${PREFIX}/bin
-	@ ${INSTALL_MAN} ${WRKSRC}/doc/luac.1 ${PREFIX}/man/man1/luac.1
-	@ ${INSTALL_DATA} ${WRKSRC}/doc/idx.html ${PREFIX}/share/doc/lua
-	@ ${INSTALL_DATA} ${WRKSRC}/doc/index.html ${PREFIX}/share/doc/lua
-	@ ${INSTALL_DATA} ${WRKSRC}/doc/luac.html ${PREFIX}/share/doc/lua
-	@ ${INSTALL_DATA} ${WRKSRC}/doc/manual.html ${PREFIX}/share/doc/lua
-	@ ${INSTALL_DATA} ${WRKSRC}/include/lua.h ${PREFIX}/include
-	@ ${INSTALL_DATA} ${WRKSRC}/include/luadebug.h ${PREFIX}/include
-	@ ${INSTALL_DATA} ${WRKSRC}/include/lualib.h ${PREFIX}/include
-	@ ${INSTALL_DATA} ${WRKSRC}/include/lauxlib.h ${PREFIX}/include
-	@ ${INSTALL_DATA} ${WRKSRC}/lib/liblua.a ${PREFIX}/lib
-	@ ${INSTALL_DATA} ${WRKSRC}/lib/liblua.so.4.0 ${PREFIX}/lib/liblua.so.4
-	@ ${LN} -s ${PREFIX}/lib/liblua.so.4 ${PREFIX}/lib/liblua.so
-	@ ${INSTALL_DATA} ${WRKSRC}/lib/liblualib.a ${PREFIX}/lib
-	@ ${INSTALL_DATA} ${WRKSRC}/lib/liblualib.so.4.0 ${PREFIX}/lib/liblualib.so.4
-	@ ${LN} -s ${PREFIX}/lib/liblualib.so.4 ${PREFIX}/lib/liblualib.so
-
-post-install:
-	@${STRIP_CMD} ${PREFIX}/bin/lua
-	@${STRIP_CMD} ${PREFIX}/bin/luac
+LUA_BIN=	lua luac
+LUA_LIB=	lua lualib
+LUA_MAN=	${LUA_BIN:S/$/.1/}
+
+.include <bsd.port.pre.mk>
 
-.if ${MACHINE_ARCH:L} == "amd64"
+.if ${ARCH} == "amd64"
 CFLAGS+=	-fPIC
 .endif
 
-.include <bsd.port.mk>
+post-patch:
+	@${REINPLACE_CMD} -Ee \
+		's|^#(POPEN=.*)|\1|; \
+		 s|^(CC=).*|\1 ${CC}|; \
+		 s|^(CFLAGS=) -O2 (.*)|\1 ${CFLAGS} \2|; \
+		 s|^(V=)[[:digit:]]\.0|\1 ${LUA_VER}|' \
+		${WRKSRC}/config
+	@${REINPLACE_CMD} -Ee 's|(ld -o lib/(liblua(lib)?)\.so\.\$$V)|\1 -soname=\2-${LUA_VER}.so.${LUA_VER_SH}|' \
+		${WRKSRC}/${MAKEFILE}
+
+post-build:
+	@${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac
+
+do-install:
+# Programs.
+	${MKDIR} ${LUA_BINDIR}
+.for f in ${LUA_BIN}
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/${f} ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/${f} ${PREFIX}/bin/${f}-${LUA_VER}
+.endfor
+# Include files.
+	${MKDIR} ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/include/*.h ${LUA_INCDIR}
+# Libraries.
+	${MKDIR} ${LUA_LIBDIR}
+.for f in ${LUA_LIB}
+	${INSTALL_PROGRAM} ${WRKSRC}/lib/lib${f}.a ${LUA_LIBDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/lib/lib${f}.so \
+		${LUA_LIBDIR}/lib${f}-${LUA_VER}.so.${LUA_VER_SH}
+	@${LN} -sf lib${f}-${LUA_VER}.so.${LUA_VER_SH} ${LUA_LIBDIR}/lib${f}.so
+	@${LN} -sf ${LUA_SUBDIR}/lib${f}-${LUA_VER}.so.${LUA_VER_SH} \
+		${PREFIX}/lib
+	@${LN} -sf lib${f}-${LUA_VER}.so.${LUA_VER_SH} \
+		${PREFIX}/lib/lib${f}-${LUA_VER}.so
+.endfor
+# Manual pages.
+.for f in ${LUA_MAN}
+	${INSTALL_MAN} ${WRKSRC}/doc/${f} \
+		${PREFIX}/man/man1/${f:C/.1$//}-${LUA_VER}.1
+.endfor
+# Documentation.
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+	cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
+	${CP} -r ${WRKSRC}/etc ${WRKSRC}/test ${DOCSDIR}
+.endif
+# Module directories.
+	${MKDIR} ${LUA_MODSHAREDIR}
+	${MKDIR} ${LUA_MODLIBDIR}
+
+.include <bsd.port.post.mk>
Index: ./lang/lua4/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/lua4/pkg-plist,v
retrieving revision 1.4
diff -u -r1.4 pkg-plist
--- ./lang/lua4/pkg-plist	4 Jun 2006 12:12:33 -0000	1.4
+++ ./lang/lua4/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,17 +1,77 @@
-bin/lua
-bin/luac
-include/lauxlib.h
-include/lua.h
-include/luadebug.h
-include/lualib.h
-lib/liblua.a
-lib/liblua.so
-lib/liblua.so.4
-lib/liblualib.a
-lib/liblualib.so
-lib/liblualib.so.4
+@exec mkdir -p %D/share/lua/%%LUA_VER%%
+@exec mkdir -p %D/lib/lua/%%LUA_VER%%
+bin/lua-%%LUA_VER%%
+%%LUA_BINDIR%%/lua
+%%LUA_BINDIR%%/luac
+bin/luac-%%LUA_VER%%
+%%LUA_INCDIR%%/lauxlib.h
+%%LUA_INCDIR%%/lua.h
+%%LUA_INCDIR%%/luadebug.h
+%%LUA_INCDIR%%/lualib.h
+lib/liblua-%%LUA_VER%%.so
+lib/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+lib/liblualib-%%LUA_VER%%.so
+lib/liblualib-%%LUA_VER%%.so.0
+%%LUA_LIBDIR%%/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblua.a
+%%LUA_LIBDIR%%/liblua.so
+%%LUA_LIBDIR%%/liblualib-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblualib.a
+%%LUA_LIBDIR%%/liblualib.so
+%%PORTDOCS%%%%DOCSDIR%%/etc/Makefile
+%%PORTDOCS%%%%DOCSDIR%%/etc/README
+%%PORTDOCS%%%%DOCSDIR%%/etc/bin2c.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/def.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.ico
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.magic
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.xpm
+%%PORTDOCS%%%%DOCSDIR%%/etc/min.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/setfallback.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/stdcall.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/trace.c
+%%PORTDOCS%%%%DOCSDIR%%/README
 %%PORTDOCS%%%%DOCSDIR%%/idx.html
 %%PORTDOCS%%%%DOCSDIR%%/index.html
+%%PORTDOCS%%%%DOCSDIR%%/logo.gif
+%%PORTDOCS%%%%DOCSDIR%%/lua.html
 %%PORTDOCS%%%%DOCSDIR%%/luac.html
 %%PORTDOCS%%%%DOCSDIR%%/manual.html
+%%PORTDOCS%%%%DOCSDIR%%/readme.html
+%%PORTDOCS%%%%DOCSDIR%%/test/README
+%%PORTDOCS%%%%DOCSDIR%%/test/bisect.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/cf-for.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/cf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/ps/hilbert.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/ps/ps.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/www/README
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/www/db.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/www/staff.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/examples/www/template.html
+%%PORTDOCS%%%%DOCSDIR%%/test/factorial.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fib.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/hello.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/life.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/lisp.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/old.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/qp.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/save.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sort.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/table.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-calls.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/undefined.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/webform.lua
+@dirrm share/lua/%%LUA_VER%%
+@dirrmtry share/lua
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test/examples/www
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test/examples/ps
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test/examples
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/etc
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrm %%LUA_LIBDIR%%
+@dirrm lib/lua/%%LUA_VER%%
+@dirrmtry lib/lua
+@dirrm %%LUA_INCDIR%%
+@dirrm %%LUA_BINDIR%%
Index: ./lang/lua4/files/patch-aa
===================================================================
RCS file: ./lang/lua4/files/patch-aa
diff -N ./lang/lua4/files/patch-aa
--- ./lang/lua4/files/patch-aa	30 Apr 2001 00:05:28 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
---- config	Mon Nov  6 12:28:20 2000
-+++ config.new	Tue Jan  2 15:51:57 2001
-@@ -28,7 +28,6 @@
- # ------------------------------------------------------------------ C compiler
- 
- # You need an ANSI C compiler. gcc is a popular one.
--CC= gcc
- WARN= -ansi -pedantic -Wall
- 
- # On IRIX, cc is a good ANSI compiler.
-@@ -93,7 +93,7 @@
- INCS= -I$(INC) $(EXTRA_INCS)
- DEFS= $(COMPAT) $(NUMBER) $(OLD_ANSI) $(EXTRA_DEFS)
- 
--CFLAGS= -O2 $(WARN) $(INCS) $(DEFS)
-+CFLAGS+= $(WARN) $(INCS) $(DEFS)
- 
- V=4.0
- 
Index: ./lang/lua50/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/lua50/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- ./lang/lua50/Makefile	3 May 2006 13:30:06 -0000	1.24
+++ ./lang/lua50/Makefile	17 Aug 2006 19:52:37 -0000
@@ -19,36 +19,76 @@
 MAINTAINER=	him@richardkiss.com
 COMMENT=	Small, compilable scripting language providing easy access to C code
 
-LATEST_LINK=	lua50
-MAN1=		lua.1 luac.1
+USE_LDCONFIG=	yes
+USE_LUA=	5.0
+LUA_COMPS=	# only define variables
 ALL_TARGET=	all so
-INSTALL_TARGET=	install soinstall
-INSTALLS_SHLIB=	YES
 
-CONFLICTS=	lua-4* lua-5.1*
+MAN1=		lua-${LUA_VER}.1 luac-${LUA_VER}.1
+DOCSDIR=	${PREFIX}/share/doc/${LUA_SUBDIR}
+LATEST_LINK=	${LUA_SUBDIR}
 
-do-configure:
-	${REINPLACE_CMD} \
-		-e 's|^\(MYCFLAGS=\).*$$|\1 ${CFLAGS}|' \
-		-e 's|^\(LOADLIB=\).*$$|\1 -DUSE_DLOPEN=1|' \
-		-e 's|^\(CC=\).*$$|\1 ${CC}|' \
-		-e 's|^\(STRIP=\).*$$|\1 ${STRIP_CMD}|' \
-		-e 's|^\(INSTALL_ROOT=\).*$$|\1 ${PREFIX}|' \
-		-e 's|^\(INSTALL_EXEC=\).*$$|\1 ${INSTALL_PROGRAM}|' \
-		-e 's|^\(INSTALL_DATA=\).*$$|\1 ${INSTALL_DATA}|' \
-		-e 's|^#\(USERCONF.*READLINE.*\)$$|\1|' \
-		-e 's|^\(EXTRA_LIBS=\).*$$|\1 -lm -lreadline -lhistory -lncurses|' \
-		-e 's|V=5.0|V=5|' \
-		${WRKSRC}/config
+LUA_BIN=	lua luac
+LUA_LIB=	lua lualib
+LUA_MAN=	${LUA_BIN:S/$/.1/}
 
-post-install:
-.if !defined(NOPORTDOCS)
-	@${MKDIR} ${DOCSDIR}
-	@cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
-.endif
+.include <bsd.port.pre.mk>
 
-.if ${MACHINE_ARCH:L} == "amd64"
+.if ${ARCH} == "amd64"
 CFLAGS+=	-fPIC
 .endif
 
-.include <bsd.port.mk>
+post-patch:
+	@${REINPLACE_CMD} -Ee \
+		's|^(MYCFLAGS=).*|\1 ${CFLAGS}|; \
+		 s|^(LOADLIB=).*|\1 -DUSE_DLOPEN=1|; \
+		 s|^(CC=).*|\1 ${CC}|; \
+		 s|^#(USERCONF.*READLINE.*)|\1|; \
+		 s|^(EXTRA_LIBS=).*|\1 -lm -lreadline -lhistory -lncurses|; \
+		 s|^(V=[[:digit:]])\.0|\1|' \
+		${WRKSRC}/config
+	@${REINPLACE_CMD} -Ee 's|(ld -o lib/(liblua(lib)?)\.so\.\$$V)|\1 -soname=\2-${LUA_VER}.so.${LUA_VER_SH}|' \
+		${WRKSRC}/${MAKEFILE}
+
+post-build:
+	@${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac
+
+do-install:
+# Programs.
+	${MKDIR} ${LUA_BINDIR}
+.for f in ${LUA_BIN}
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/${f} ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/${f} ${PREFIX}/bin/${f}-${LUA_VER}
+.endfor
+# Include files.
+	${MKDIR} ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/include/*.h ${LUA_INCDIR}
+# Libraries.
+	${MKDIR} ${LUA_LIBDIR}
+.for f in ${LUA_LIB}
+	${INSTALL_PROGRAM} ${WRKSRC}/lib/lib${f}.a ${LUA_LIBDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/lib/lib${f}.so \
+		${LUA_LIBDIR}/lib${f}-${LUA_VER}.so.${LUA_VER_SH}
+	@${LN} -sf lib${f}-${LUA_VER}.so.${LUA_VER_SH} ${LUA_LIBDIR}/lib${f}.so
+	@${LN} -sf ${LUA_SUBDIR}/lib${f}-${LUA_VER}.so.${LUA_VER_SH} \
+		${PREFIX}/lib
+	@${LN} -sf lib${f}-${LUA_VER}.so.${LUA_VER_SH} \
+		${PREFIX}/lib/lib${f}-${LUA_VER}.so
+.endfor
+# Manual pages.
+.for f in ${LUA_MAN}
+	${INSTALL_MAN} ${WRKSRC}/doc/${f} \
+		${PREFIX}/man/man1/${f:C/.1$//}-${LUA_VER}.1
+.endfor
+# Documentation.
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+	cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
+	${CP} -r ${WRKSRC}/etc ${WRKSRC}/test ${DOCSDIR}
+.endif
+# Module directories.
+	${MKDIR} ${LUA_MODLIBDIR}
+	${MKDIR} ${LUA_MODSHAREDIR}
+
+.include <bsd.port.post.mk>
Index: ./lang/lua50/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/lua50/pkg-plist,v
retrieving revision 1.5
diff -u -r1.5 pkg-plist
--- ./lang/lua50/pkg-plist	1 Apr 2004 21:49:20 -0000	1.5
+++ ./lang/lua50/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,18 +1,71 @@
-bin/lua
-bin/luac
-include/lauxlib.h
-include/lua.h
-include/lualib.h
-lib/liblua.a
-lib/liblua.so
-lib/liblua.so.5
-lib/liblualib.a
-lib/liblualib.so
-lib/liblualib.so.5
-%%DOCSDIR%%/contents.html
-%%DOCSDIR%%/logo.gif
-%%DOCSDIR%%/lua.html
-%%DOCSDIR%%/luac.html
-%%DOCSDIR%%/manual.html
-%%DOCSDIR%%/readme.html
-@dirrm %%DOCSDIR%%
+@exec mkdir -p %D/share/lua/%%LUA_VER%%
+@exec mkdir -p %D/lib/lua/%%LUA_VER%%
+bin/lua-%%LUA_VER%%
+%%LUA_BINDIR%%/lua
+%%LUA_BINDIR%%/luac
+bin/luac-%%LUA_VER%%
+%%LUA_INCDIR%%/lauxlib.h
+%%LUA_INCDIR%%/lua.h
+%%LUA_INCDIR%%/lualib.h
+lib/liblua-%%LUA_VER%%.so
+lib/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+lib/liblualib-%%LUA_VER%%.so
+lib/liblualib-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblua.a
+%%LUA_LIBDIR%%/liblua.so
+%%LUA_LIBDIR%%/liblualib-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblualib.a
+%%LUA_LIBDIR%%/liblualib.so
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/contents.html
+%%PORTDOCS%%%%DOCSDIR%%/etc/Makefile
+%%PORTDOCS%%%%DOCSDIR%%/etc/README
+%%PORTDOCS%%%%DOCSDIR%%/etc/bin2c.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/compat.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/doall.lua
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.ico
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.magic
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.xpm
+%%PORTDOCS%%%%DOCSDIR%%/etc/luser_number.h
+%%PORTDOCS%%%%DOCSDIR%%/etc/luser_tests.h
+%%PORTDOCS%%%%DOCSDIR%%/etc/min.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/noparser.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/saconfig.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/trace.c
+%%PORTDOCS%%%%DOCSDIR%%/logo.gif
+%%PORTDOCS%%%%DOCSDIR%%/lua.html
+%%PORTDOCS%%%%DOCSDIR%%/luac.html
+%%PORTDOCS%%%%DOCSDIR%%/manual.html
+%%PORTDOCS%%%%DOCSDIR%%/readme.html
+%%PORTDOCS%%%%DOCSDIR%%/test/README
+%%PORTDOCS%%%%DOCSDIR%%/test/bisect.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/cf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/echo.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/env.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/factorial.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fib.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fibfor.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/hello.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/life.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/luac.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/printf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/readonly.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sieve.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sort.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/table.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-calls.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/undefined.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/xd.lua
+@dirrm share/lua/%%LUA_VER%%
+@dirrmtry share/lua
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/etc
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrm %%LUA_LIBDIR%%
+@dirrm lib/lua/%%LUA_VER%%
+@dirrmtry lib/lua
+@dirrm %%LUA_INCDIR%%
+@dirrm %%LUA_BINDIR%%
Index: ./lang/lua/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/lua/Makefile,v
retrieving revision 1.25
diff -u -r1.25 Makefile
--- ./lang/lua/Makefile	18 Jun 2006 12:41:44 -0000	1.25
+++ ./lang/lua/Makefile	17 Aug 2006 19:52:37 -0000
@@ -19,20 +19,58 @@
 MAINTAINER=	him@richardkiss.com
 COMMENT=	Small, compilable scripting language providing easy access to C code
 
-MAN1=		lua.1 luac.1
-
-MAKE_ARGS=	bsd
-
-CONFLICTS=	lua-4* lua-5.0*
+USE_LUA=	5.1
+LUA_COMPS=	# only define variables
+ALL_TARGET=	bsd
+
+MAN1=		lua-${LUA_VER}.1 luac-${LUA_VER}.1
+DOCSDIR=	${PREFIX}/share/doc/${LUA_SUBDIR}
+LATEST_LINK=	${LUA_SUBDIR}
+
+LUA_BIN=	lua luac
+LUA_INC=	lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
+LUA_MAN=	${LUA_BIN:S/$/.1/}
 
 post-patch:
-	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/Makefile
-
-post-install:
+	@${REINPLACE_CMD} -Ee \
+		 's|^(CC=).*|\1 ${CC}| ; \
+		 s|^(CFLAGS=)|\1 ${CFLAGS}| ; \
+		 s|/usr/local|${PREFIX}|' \
+		 ${WRKSRC}/Makefile ${WRKSRC}/src/Makefile
+
+post-build:
+	@${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac
+
+do-install:
+# Programs.
+	${MKDIR} ${LUA_BINDIR}
+.for f in ${LUA_BIN}
+	${INSTALL_PROGRAM} ${WRKSRC}/src/${f} ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/${f} ${PREFIX}/bin/${f}-${LUA_VER}
+.endfor
+# Include files.
+	${MKDIR} ${LUA_INCDIR}
+.for f in ${LUA_INC}
+	${INSTALL_DATA} ${WRKSRC}/src/${f} ${LUA_INCDIR}
+.endfor
+# Libraries.
+	${MKDIR} ${LUA_LIBDIR}
+	${INSTALL_DATA} ${WRKSRC}/src/liblua.a ${LUA_LIBDIR}
+# Manual pages.
+.for f in ${LUA_MAN}
+	${INSTALL_MAN} ${WRKSRC}/doc/${f} \
+		${PREFIX}/man/man1/${f:C/.1$//}-${LUA_VER}.1
+.endfor
+# Documentation.
 .if !defined(NOPORTDOCS)
-	@${MKDIR} ${DOCSDIR}
-	@cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.css *.gif ${DOCSDIR}
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+	cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
+	${CP} -r ${WRKSRC}/etc ${WRKSRC}/test ${DOCSDIR}
 .endif
+# Module directories.
+	${MKDIR} ${LUA_MODLIBDIR}
+	${MKDIR} ${LUA_MODSHAREDIR}
 
 .if ${MACHINE_ARCH:L} == "amd64"
 CFLAGS+=	-fPIC
Index: ./lang/lua/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/lua/pkg-plist,v
retrieving revision 1.6
diff -u -r1.6 pkg-plist
--- ./lang/lua/pkg-plist	3 May 2006 13:25:42 -0000	1.6
+++ ./lang/lua/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,22 +1,59 @@
-@exec mkdir -p %D/lib/lua/5.1
-@exec mkdir -p %D/share/lua/5.1
-%%DOCSDIR%%/contents.html
-%%DOCSDIR%%/logo.gif
-%%DOCSDIR%%/lua.css
-%%DOCSDIR%%/lua.html
-%%DOCSDIR%%/luac.html
-%%DOCSDIR%%/manual.html
-%%DOCSDIR%%/readme.html
-bin/lua
-bin/luac
-include/lauxlib.h
-include/lua.h
-include/lua.hpp
-include/luaconf.h
-include/lualib.h
-lib/liblua.a
-@dirrm %%DOCSDIR%%
-@dirrm share/lua/5.1
-@dirrm share/lua
-@dirrm lib/lua/5.1
-@dirrm lib/lua
+@exec mkdir -p %D/share/lua/%%LUA_VER%%
+@exec mkdir -p %D/lib/lua/%%LUA_VER%%
+bin/lua-%%LUA_VER%%
+%%LUA_BINDIR%%/lua
+%%LUA_BINDIR%%/luac
+bin/luac-%%LUA_VER%%
+%%LUA_INCDIR%%/lauxlib.h
+%%LUA_INCDIR%%/lua.h
+%%LUA_INCDIR%%/lua.hpp
+%%LUA_INCDIR%%/luaconf.h
+%%LUA_INCDIR%%/lualib.h
+%%LUA_LIBDIR%%/liblua.a
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/contents.html
+%%PORTDOCS%%%%DOCSDIR%%/etc/Makefile
+%%PORTDOCS%%%%DOCSDIR%%/etc/README
+%%PORTDOCS%%%%DOCSDIR%%/etc/all.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.hpp
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.ico
+%%PORTDOCS%%%%DOCSDIR%%/etc/lua.pc
+%%PORTDOCS%%%%DOCSDIR%%/etc/luavs.bat
+%%PORTDOCS%%%%DOCSDIR%%/etc/min.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/noparser.c
+%%PORTDOCS%%%%DOCSDIR%%/etc/strict.lua
+%%PORTDOCS%%%%DOCSDIR%%/logo.gif
+%%PORTDOCS%%%%DOCSDIR%%/lua.html
+%%PORTDOCS%%%%DOCSDIR%%/luac.html
+%%PORTDOCS%%%%DOCSDIR%%/manual.html
+%%PORTDOCS%%%%DOCSDIR%%/readme.html
+%%PORTDOCS%%%%DOCSDIR%%/test/README
+%%PORTDOCS%%%%DOCSDIR%%/test/bisect.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/cf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/echo.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/env.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/factorial.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fib.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/fibfor.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/hello.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/life.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/luac.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/printf.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/readonly.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sieve.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/sort.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/table.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-calls.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/trace-globals.lua
+%%PORTDOCS%%%%DOCSDIR%%/test/xd.lua
+@dirrm share/lua/%%LUA_VER%%
+@dirrmtry share/lua
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/test
+%%PORTDOCS%%@dirrm %%DOCSDIR%%/etc
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrm %%LUA_LIBDIR%%
+@dirrm lib/lua/%%LUA_VER%%
+@dirrmtry lib/lua
+@dirrm %%LUA_INCDIR%%
+@dirrm %%LUA_BINDIR%%
Index: ./lang/tolua/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/tolua/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- ./lang/tolua/Makefile	3 May 2006 13:25:06 -0000	1.3
+++ ./lang/tolua/Makefile	17 Aug 2006 19:52:37 -0000
@@ -15,15 +15,14 @@
 MAINTAINER=	edwin@mavetju.org
 COMMENT=	toLua: accessing C/C++ code from Lua
 
-LIB_DEPENDS=	lua:${PORTSDIR}/lang/lua50
-
-WRKSRC=		${WRKDIR}/${PORTNAME}-5.0
 USE_GMAKE=	yes
-CONFLICTS=	tolua4-.*
+USE_LUA=	5.0
+WRKSRC=		${WRKDIR}/${PORTNAME}-5.0
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${PREFIX}/include
-	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${PREFIX}/lib
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/tolua ${PREFIX}/bin/tolua-${LUA_VER}
+	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${LUA_LIBDIR}
 
 .include <bsd.port.mk>
Index: ./lang/tolua/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/tolua/pkg-plist,v
retrieving revision 1.1
diff -u -r1.1 pkg-plist
--- ./lang/tolua/pkg-plist	21 Nov 2004 08:32:23 -0000	1.1
+++ ./lang/tolua/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,3 +1,4 @@
-bin/tolua
-lib/libtolua.a
-include/tolua.h
+%%LUA_BINDIR%%/tolua
+bin/tolua-%%LUA_VER%%
+%%LUA_LIBDIR%%/libtolua.a
+%%LUA_INCDIR%%/tolua.h
Index: ./lang/tolua++/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/tolua++/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./lang/tolua++/Makefile	3 May 2006 13:25:06 -0000	1.2
+++ ./lang/tolua++/Makefile	17 Aug 2006 19:52:37 -0000
@@ -15,11 +15,10 @@
 COMMENT=	An extended version of tolua, a tool to integrate C/C++ code with Lua
 
 BUILD_DEPENDS=	${LOCALBASE}/bin/scons:${PORTSDIR}/devel/scons
-LIB_DEPENDS=	lua:${PORTSDIR}/lang/lua50
 
-WRKSRC=		${WRKDIR}/tolua++-${PORTVERSION}
 USE_BZIP2=	yes
-INSTALLS_SHLIB=	yes
+USE_LDCONFIG=	yes
+USE_LUA=	5.0
 NO_BUILD=	yes
 
 do-build:
Index: ./lang/tolua4/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/tolua4/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- ./lang/tolua4/Makefile	21 Nov 2004 09:32:06 -0000	1.1
+++ ./lang/tolua4/Makefile	17 Aug 2006 19:52:37 -0000
@@ -6,7 +6,7 @@
 # $FreeBSD: ports/lang/tolua4/Makefile,v 1.1 2004/11/21 09:32:06 edwin Exp $
 #
 
-PORTNAME=	tolua4
+PORTNAME=	tolua
 PORTVERSION=	4.0a
 CATEGORIES=	lang
 MASTER_SITES=	ftp://ftp.tecgraf.puc-rio.br/pub/users/celes/tolua/ \
@@ -16,15 +16,24 @@
 MAINTAINER=	edwin@mavetju.org
 COMMENT=	toLua: accessing C/C++ code from Lua
 
-LIB_DEPENDS=	lua.4:${PORTSDIR}/lang/lua4
-
-WRKSRC=		${WRKDIR}/tolua
 USE_GMAKE=	yes
-CONFLICTS=	tolua-5.*
+USE_LUA=	4.0
+WRKSRC=		${WRKDIR}/tolua
+
+LATEST_LINK=	${PORTNAME}${LUA_VER_STR}
+
+post-patch:
+	@${REINPLACE_CMD} -Ee \
+		's|^(CC=).*|\1 ${CC}|; \
+		 s|^(LUA=).*|\1 ${LOCALBASE}|; \
+		 s|^(LUA(INC\|LIB)=.*)|\1/lua${LUA_VER_STR}|; \
+		 s|^(CFLAGS)(=.*)|\1+\2|;' \
+		${WRKSRC}/config
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${PREFIX}/include
-	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${PREFIX}/lib
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/tolua ${PREFIX}/bin/tolua-${LUA_VER}
+	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${LUA_LIBDIR}
 
 .include <bsd.port.mk>
Index: ./lang/tolua4/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/tolua4/pkg-plist,v
retrieving revision 1.1
diff -u -r1.1 pkg-plist
--- ./lang/tolua4/pkg-plist	21 Nov 2004 09:32:06 -0000	1.1
+++ ./lang/tolua4/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,3 +1,4 @@
-bin/tolua
-lib/libtolua.a
-include/tolua.h
+%%LUA_BINDIR%%/tolua
+bin/tolua-%%LUA_VER%%
+%%LUA_INCDIR%%/tolua.h
+%%LUA_LIBDIR%%/libtolua.a
Index: ./lang/tolua4/files/patch-config
===================================================================
RCS file: ./lang/tolua4/files/patch-config
diff -N ./lang/tolua4/files/patch-config
--- ./lang/tolua4/files/patch-config	21 Nov 2004 09:32:07 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
---- config.orig	Sun Nov 21 20:12:01 2004
-+++ config	Sun Nov 21 20:12:39 2004
-@@ -3,7 +3,7 @@
- # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================
- 
- # you need an ANSI C compiler. gcc is a popular one.
--CC= gcc
-+#CC= gcc
- WARN= -ansi -Wall
- 
- # on SGI's, cc is ANSI.
-@@ -20,7 +20,7 @@
- AR= ar rcu
- 
- # set lua path
--LUA=/usr/local/lua
-+LUA=${LOCALBASE}
- LUAINC=$(LUA)/include
- LUALIB=$(LUA)/lib
- 
-@@ -29,4 +29,4 @@
- INC= -I$(LUAINC) -I$(TOLUA)/include
- LIB= -L$(LUALIB)
- 
--CFLAGS= -O2 $(WARN) $(INC)
-+CFLAGS+= -O2 $(WARN) $(INC)
Index: ./lang/ruby-lua4/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/ruby-lua4/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./lang/ruby-lua4/Makefile	11 Nov 2005 01:17:41 -0000	1.2
+++ ./lang/ruby-lua4/Makefile	17 Aug 2006 19:52:37 -0000
@@ -11,28 +11,33 @@
 MASTER_SITES=	${MASTER_SITE_LOCAL}
 MASTER_SITE_SUBDIR=	knu
 PKGNAMEPREFIX=	${RUBY_PKGNAMEPREFIX}
-PKGNAMESUFFIX=	4
 DISTNAME=	ruby${PORTNAME}-${PORTVERSION}
 DIST_SUBDIR=	ruby
 
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A Ruby extension to make Lua script language as a class
 
-LIB_DEPENDS=	lua.4:${PORTSDIR}/lang/lua4
-
-CONFLICTS=	${RUBY_PKGNAMEPREFIX}lua5-[0-9]*
-
+USE_LUA=	4.0
 USE_ZIP=	yes
 
 USE_RUBY=	yes
 USE_RUBY_EXTCONF=	yes
 RUBY_EXTCONF=	luaconf.rb
+RUBY_MODNAME=	${PORTNAME}-${LUA_VER}
 
 NO_WRKSUBDIR=	yes
 INSTALL_TARGET=	site-install
 
 EXAMPLES=	html_ssi_lua.rb test_*
 
+post-patch:
+	@${REINPLACE_CMD} -Ee 's/[[:<:]](lua(lib)?)[[:>:]]/\1-${LUA_VER}/' \
+		${WRKSRC}/${RUBY_EXTCONF}
+
+post-configure:
+	@${REINPLACE_CMD} -Ee 's|^(CPPFLAGS =.*)|\1 -I${LUA_INCDIR}|' \
+		${WRKSRC}/${MAKEFILE}
+
 post-install:
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${RUBY_MODEXAMPLESDIR}
Index: ./lang/ruby-lua4/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/ruby-lua4/pkg-plist,v
retrieving revision 1.1
diff -u -r1.1 pkg-plist
--- ./lang/ruby-lua4/pkg-plist	25 Dec 2004 19:08:59 -0000	1.1
+++ ./lang/ruby-lua4/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,4 +1,4 @@
-%%RUBY_SITEARCHLIBDIR%%/lua.so
+%%RUBY_SITEARCHLIBDIR%%/lua-%%LUA_VER%%.so
 %%PORTDOCS%%%%RUBY_MODDOCDIR%%/rubylua.txt
 %%PORTDOCS%%@dirrm %%RUBY_MODDOCDIR%%
 %%PORTDOCS%%%%RUBY_MODEXAMPLESDIR%%/html_ssi_lua.rb
Index: ./devel/lua50-app/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-app/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./devel/lua50-app/Makefile	3 May 2006 13:25:03 -0000	1.2
+++ ./devel/lua50-app/Makefile	17 Aug 2006 19:52:37 -0000
@@ -9,24 +9,22 @@
 PORTVERSION=	1.70
 CATEGORIES=	devel
 MASTER_SITES=	http://cvs.bsdinstaller.org/cgi-bin/cvsweb.cgi/installer/src/lib/lua/app/
-PKGNAMEPREFIX=	lua50-
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	app.lua?rev=${PORTVERSION}
-EXTRACT_ONLY=
+EXTRACT_ONLY=	#
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	App framework for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${LOCALBASE}/share/lua/5.0/posix.lua:${PORTSDIR}/devel/lua50-posix \
-		${LOCALBASE}/share/lua/5.0/filename.lua:${PORTSDIR}/devel/lua50-filename \
-		${LOCALBASE}/share/lua/5.0/pty.lua:${PORTSDIR}/devel/lua50-pty
-
-NO_WRKSUBDIR=	yes
+USE_LUA=	5.0
+LUA_COMPS=	filename posix pty
 NO_BUILD=	yes
+NO_WRKSUBDIR=	yes
+
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/app.lua
 
 do-install:
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${DISTDIR}/${DISTFILES} ${PREFIX}/share/lua/5.0/${DISTFILES:C/\?.*$//}
+	${INSTALL_DATA} ${DISTDIR}/${DISTFILES} \
+		${LUA_MODSHAREDIR}/${DISTFILES:C/\?.*$//}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-app/pkg-plist
===================================================================
RCS file: ./devel/lua50-app/pkg-plist
diff -N ./devel/lua50-app/pkg-plist
--- ./devel/lua50-app/pkg-plist	17 Apr 2006 22:15:27 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-share/lua/5.0/app.lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-compat51/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-compat51/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- ./devel/lua50-compat51/Makefile	3 May 2006 13:25:04 -0000	1.3
+++ ./devel/lua50-compat51/Makefile	17 Aug 2006 19:52:37 -0000
@@ -5,31 +5,31 @@
 # $FreeBSD: ports/devel/lua50-compat51/Makefile,v 1.3 2006/05/03 13:25:04 pav Exp $
 #
 
-PORTNAME=	lua50-compat51
+PORTNAME=	compat
 PORTVERSION=	${CVER}.${CREV}
 CATEGORIES=	devel
 MASTER_SITES=	http://luaforge.net/frs/download.php/1410/
-DISTNAME=	compat-${CVER}${CREV}.tar.gz
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	Lua 5.1 package compatibility layer for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
+USE_LUA=	5.0
+WRKSRC=		${WRKDIR}/compat-${CVER}${CREV}
 
-CONFLICTS=	luasocket-2.0
+MAKE_ENV=	CVER="${CVER}"
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/compat-${CVER}.lua \
+		%%LUA_MODLIBDIR%%/lcompat-${CVER}.so
 
-# Update these values when there is a new release
+# Update these values when there is a new release.
 CVER=		5.1
 CREV=		r5
 
-WRKSRC=		${WRKDIR}/compat-${CVER}${CREV}
-LIBDIR=		${PREFIX}/lib
-
 post-extract:
 	@${CP} ${FILESDIR}/Makefile ${WRKSRC}
 
 do-install:
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${WRKSRC}/compat-5.1.lua ${PREFIX}/share/lua/5.0
+	${INSTALL_DATA} ${WRKSRC}/compat-${CVER}.lua ${LUA_MODSHAREDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/lcompat-${CVER}.so ${LUA_MODLIBDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-compat51/distinfo
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-compat51/distinfo,v
retrieving revision 1.1
diff -u -r1.1 distinfo
--- ./devel/lua50-compat51/distinfo	15 Apr 2006 16:54:48 -0000	1.1
+++ ./devel/lua50-compat51/distinfo	17 Aug 2006 19:52:37 -0000
@@ -1,3 +1,3 @@
-MD5 (compat-5.1r5.tar.gz.tar.gz) = 30d50d173ab236e96c4b969347163eb7
-SHA256 (compat-5.1r5.tar.gz.tar.gz) = 93262ad793552c338b825e6b67c903063aa07625952ef643d126ae60949c8ab6
-SIZE (compat-5.1r5.tar.gz.tar.gz) = 2977
+MD5 (compat-5.1.r5.tar.gz) = 30d50d173ab236e96c4b969347163eb7
+SHA256 (compat-5.1.r5.tar.gz) = 93262ad793552c338b825e6b67c903063aa07625952ef643d126ae60949c8ab6
+SIZE (compat-5.1.r5.tar.gz) = 2977
Index: ./devel/lua50-compat51/pkg-plist
===================================================================
RCS file: ./devel/lua50-compat51/pkg-plist
diff -N ./devel/lua50-compat51/pkg-plist
--- ./devel/lua50-compat51/pkg-plist	20 Apr 2006 08:45:35 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-share/lua/5.0/compat-5.1.lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-compat51/files/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-compat51/files/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- ./devel/lua50-compat51/files/Makefile	15 Apr 2006 16:54:49 -0000	1.1
+++ ./devel/lua50-compat51/files/Makefile	17 Aug 2006 19:52:37 -0000
@@ -1,9 +1,10 @@
 # $FreeBSD: ports/devel/lua50-compat51/files/Makefile,v 1.1 2006/04/15 16:54:49 pav Exp $
 
-LIB=		lua-compat-5.1
+SHLIB=		compat-${CVER}
+SHLIB_NAME=	lcompat-${CVER}.so
 
-SRCS=		compat-5.1.c
+SRCS=		compat-${CVER}.c
 
-CFLAGS+=	-I${PREFIX}/include
+CFLAGS+=	-I${LUA_INCDIR}
 
 .include <bsd.lib.mk>
Index: ./devel/lua50-dfui/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-dfui/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./devel/lua50-dfui/Makefile	3 May 2006 13:25:04 -0000	1.2
+++ ./devel/lua50-dfui/Makefile	17 Aug 2006 19:52:37 -0000
@@ -10,29 +10,28 @@
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_LOCAL}
 MASTER_SITE_SUBDIR=	philip
-PKGNAMEPREFIX=	lua50-
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTNAME=	lua-dfui-0.1.20050901
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	DFUI binding for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${NONEXISTENT}:${PORTSDIR}/devel/lua50-compat51:extract
+BUILD_DEPENDS=	${NONEXISTENT}:${PORTSDIR}/devel/lua50-compat51:extract
 LIB_DEPENDS=	dfui4.4:${PORTSDIR}/devel/libdfui
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${LOCALBASE}/share/lua/5.0/compat-5.1.lua:${PORTSDIR}/devel/lua50-compat51 \
-		${LOCALBASE}/share/lua/5.0/posix.lua:${PORTSDIR}/devel/lua50-posix
 
 USE_BZIP2=	yes
+USE_LUA=	5.0
+LUA_COMPS=	compat51 posix
 WRKSRC=		${WRKDIR}/lua-dfui-${PORTVERSION}
 
-COMPAT_SRC=	`(cd ${PORTSDIR}/devel/lua50-compat51 && make -V WRKSRC)`
-MAKE_ENV=	COMPAT=${COMPAT_SRC}
+COMPAT_SRC=	`(cd ${PORTSDIR}/devel/lua50-compat51 && ${MAKE} -V WRKSRC)`
+MAKE_ENV=	COMPAT="${COMPAT_SRC}"
+
+PLIST_FILES=	%%LUA_MODLIBDIR%%/ldfui.so \
+		%%LUA_MODSHAREDIR%%/dfui.lua
 
 do-install:
-	${MKDIR} ${PREFIX}/lib/lua/5.0
-	${INSTALL_PROGRAM} ${WRKSRC}/ldfui.so ${PREFIX}/lib/lua/5.0
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${WRKSRC}/dfui.lua ${PREFIX}/share/lua/5.0
+	${INSTALL_PROGRAM} ${WRKSRC}/ldfui.so ${LUA_MODLIBDIR}
+	${INSTALL_DATA} ${WRKSRC}/dfui.lua ${LUA_MODSHAREDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-dfui/pkg-plist
===================================================================
RCS file: ./devel/lua50-dfui/pkg-plist
diff -N ./devel/lua50-dfui/pkg-plist
--- ./devel/lua50-dfui/pkg-plist	23 Apr 2006 09:31:12 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-lib/lua/5.0/ldfui.so
-share/lua/5.0/dfui.lua
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-dfui/files/patch-Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-dfui/files/patch-Makefile,v
retrieving revision 1.1
diff -u -r1.1 patch-Makefile
--- ./devel/lua50-dfui/files/patch-Makefile	23 Apr 2006 09:31:12 -0000	1.1
+++ ./devel/lua50-dfui/files/patch-Makefile	17 Aug 2006 19:52:37 -0000
@@ -1,5 +1,5 @@
---- Makefile.orig	Tue Apr 18 13:49:53 2006
-+++ Makefile	Tue Apr 18 13:54:23 2006
+--- Makefile.orig	Mon Apr 17 21:40:11 2006
++++ Makefile	Mon Aug  7 13:22:22 2006
 @@ -1,11 +1,6 @@
  # Makefile for luadfui.
  # $Id: Makefile,v 1.13 2005/08/26 22:44:37 cpressey Exp $
@@ -18,13 +18,13 @@
  CFLAGS+=	${WARNS} -fPIC
 -CFLAGS+=	-I${LUA}/include -I${COMPAT} -I../../libdfui
 -CFLAGS+=	-I/usr/local/include -I/usr/pkg/include
-+CFLAGS+=	-I${COMPAT} -I${PREFIX}/include/dfui4
-+CFLAGS+=	-I${PREFIX}/include
++CFLAGS+=	-I${COMPAT} -I${LOCALBASE}/include/dfui4
++CFLAGS+=	-I${LUA_INCDIR}
  CFLAGS+=	${EXTRA_CFLAGS}
 -LDFLAGS+=	-L../../libdfui -L../../libaura -L${LUA}/lib/
 -LDFLAGS+=	-L/usr/local/lib -L/usr/pkg/lib
 -LDFLAGS+=	-ldfui -laura -lm -llua50 -llualib50
-+LDFLAGS+=	-L${PREFIX}/lib
++LDFLAGS+=	-L${LOCALBASE}/lib -L${LUA_LIBDIR}
 +LDFLAGS+=	-ldfui4 -laura3 -lm -llua -llualib
  
  all: ${LIB}
Index: ./devel/lua50-filename/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-filename/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./devel/lua50-filename/Makefile	3 May 2006 13:25:04 -0000	1.2
+++ ./devel/lua50-filename/Makefile	17 Aug 2006 19:52:37 -0000
@@ -5,23 +5,25 @@
 # $FreeBSD: ports/devel/lua50-filename/Makefile,v 1.2 2006/05/03 13:25:04 pav Exp $
 #
 
-PORTNAME=	lua50-filename
+PORTNAME=	filename
 PORTVERSION=	1.2
 CATEGORIES=	devel
 MASTER_SITES=	http://cvs.bsdinstaller.org/cgi-bin/cvsweb.cgi/installer/src/lib/lua/filename/
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	filename.lua?rev=${PORTVERSION}
-EXTRACT_ONLY=
+EXTRACT_ONLY=	#
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	Filename-manipulating functions for Lua 5.0.x
 
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-
-NO_WRKSUBDIR=	yes
+USE_LUA=	5.0
 NO_BUILD=	yes
+NO_WRKSUBDIR=	yes
+
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/filename.lua
 
 do-install:
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${DISTDIR}/${DISTFILES} ${PREFIX}/share/lua/5.0/${DISTFILES:C/\?.*$//}
+	${INSTALL_DATA} ${DISTDIR}/${DISTFILES} \
+		${LUA_MODSHAREDIR}/${DISTFILES:C/\?.*$//}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-filename/pkg-descr
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-filename/pkg-descr,v
retrieving revision 1.1
diff -u -r1.1 pkg-descr
--- ./devel/lua50-filename/pkg-descr	17 Apr 2006 17:09:17 -0000	1.1
+++ ./devel/lua50-filename/pkg-descr	17 Aug 2006 19:52:37 -0000
@@ -1,3 +1,3 @@
-Package of routines for manipulating filenames.
-Also contains convenience functions for querying the
-status of files in the filesystem named by those filenames.
+Package of routines for manipulating filenames. Also contains convenience
+functions for querying the status of files in the filesystem named by those
+filenames.
Index: ./devel/lua50-filename/pkg-plist
===================================================================
RCS file: ./devel/lua50-filename/pkg-plist
diff -N ./devel/lua50-filename/pkg-plist
--- ./devel/lua50-filename/pkg-plist	17 Apr 2006 17:09:17 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-share/lua/5.0/filename.lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-gettext/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-gettext/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- ./devel/lua50-gettext/Makefile	31 May 2006 19:37:41 -0000	1.1
+++ ./devel/lua50-gettext/Makefile	17 Aug 2006 19:52:37 -0000
@@ -9,22 +9,21 @@
 PORTVERSION=	1.5
 CATEGORIES=	devel
 MASTER_SITES=	http://cvs.bsdinstaller.org/cgi-bin/cvsweb.cgi/installer/src/lib/lua/gettext/
-PKGNAMEPREFIX=	lua50-
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	lua_gettext.c?rev=${CVER} gettext.lua?rev=${LVER}
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	Gettext ibinding for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-
+USE_LUA=	5.0
 USE_GETTEXT=	yes
 
-LIBDIR=		${PREFIX}/lib/lua/5.0
-
 CVER=		1.15
 LVER=		${PORTVERSION}
 
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/gettext.lua \
+		%%LUA_MODLIBDIR%%/lgettext.so
+
 do-extract:
 	${MKDIR} ${WRKSRC}
 .for file in ${DISTFILES}
@@ -33,10 +32,7 @@
 	${CP} ${FILESDIR}/Makefile ${WRKSRC}
 
 do-install:
-	${MKDIR} ${PREFIX}/lib/lua/5.0
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${WRKSRC}/gettext.lua ${PREFIX}/share/lua/5.0/
-	${MKDIR} ${PREFIX}/lib/lua/5.0
-	${INSTALL_PROGRAM} ${WRKSRC}/lgettext.so ${PREFIX}/lib/lua/5.0/
+	${INSTALL_DATA} ${WRKSRC}/gettext.lua ${LUA_MODSHAREDIR}
+	${INSTALL_PROGRAM} ${WRKSRC}/lgettext.so ${LUA_MODLIBDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-gettext/pkg-plist
===================================================================
RCS file: ./devel/lua50-gettext/pkg-plist
diff -N ./devel/lua50-gettext/pkg-plist
--- ./devel/lua50-gettext/pkg-plist	31 May 2006 19:37:41 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-lib/lua/5.0/lgettext.so
-share/lua/5.0/gettext.lua
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-gettext/files/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-gettext/files/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- ./devel/lua50-gettext/files/Makefile	31 May 2006 19:37:41 -0000	1.1
+++ ./devel/lua50-gettext/files/Makefile	17 Aug 2006 19:52:37 -0000
@@ -5,7 +5,7 @@
 
 SRCS=		lua_gettext.c
 
-CFLAGS+=	-I${PREFIX}/include
-LDFLAGS+=	-L${PREFIX}/lib -lintl
+CFLAGS+=	-I${LOCALBASE}/include -I${LUA_INCDIR}
+LDFLAGS+=	-L${LOCALBASE}/lib -lintl
 
 .include <bsd.lib.mk>
Index: ./devel/lua50-posix/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-posix/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- ./devel/lua50-posix/Makefile	14 May 2006 12:36:19 -0000	1.3
+++ ./devel/lua50-posix/Makefile	17 Aug 2006 19:52:37 -0000
@@ -5,23 +5,24 @@
 # $FreeBSD: ports/devel/lua50-posix/Makefile,v 1.3 2006/05/14 12:36:19 pav Exp $
 #
 
-PORTNAME=	lua50-posix
+PORTNAME=	posix
 PORTVERSION=	5.0
 CATEGORIES=	devel
 MASTER_SITES=	http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.0/
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	lposix.tar.gz
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	A POSIX layer for Lua
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-
+USE_LUA=	5.0
 WRKSRC=		${WRKDIR}/posix
 
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/posix.lua \
+		%%LUA_MODLIBDIR%%/lposix.so
+
 do-install:
-	@ ${MKDIR} ${PREFIX}/share/lua/5.0
-	@ ${INSTALL_DATA} ${WRKSRC}/posix.lua ${PREFIX}/share/lua/5.0
-	@ ${MKDIR} ${PREFIX}/lib/lua/5.0
-	@ ${INSTALL_PROGRAM} ${WRKSRC}/lposix.so ${PREFIX}/lib/lua/5.0
+	@${INSTALL_DATA} ${WRKSRC}/posix.lua ${LUA_MODSHAREDIR}
+	@${INSTALL_PROGRAM} ${WRKSRC}/lposix.so ${LUA_MODLIBDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-posix/pkg-plist
===================================================================
RCS file: ./devel/lua50-posix/pkg-plist
diff -N ./devel/lua50-posix/pkg-plist
--- ./devel/lua50-posix/pkg-plist	15 Apr 2006 16:59:09 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-share/lua/5.0/posix.lua
-lib/lua/5.0/lposix.so
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
Index: ./devel/lua50-posix/files/patch-Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-posix/files/patch-Makefile,v
retrieving revision 1.1
diff -u -r1.1 patch-Makefile
--- ./devel/lua50-posix/files/patch-Makefile	15 Apr 2006 16:59:09 -0000	1.1
+++ ./devel/lua50-posix/files/patch-Makefile	17 Aug 2006 19:52:37 -0000
@@ -1,20 +1,30 @@
---- Makefile.orig	Mon Mar 27 12:25:04 2006
-+++ Makefile	Mon Mar 27 12:43:24 2006
-@@ -1,7 +1,7 @@
+--- Makefile.orig	Wed Nov  5 21:26:49 2003
++++ Makefile	Mon Aug  7 00:38:38 2006
+@@ -1,13 +1,13 @@
  # makefile for POSIX library for Lua
  
  # change these to reflect your Lua installation
 -LUA= /tmp/lhf/lua-5.0
+-LUAINC= $(LUA)/include
+-LUALIB= $(LUA)/lib
+-LUABIN= $(LUA)/bin
 +LUA= ${PREFIX}
- LUAINC= $(LUA)/include
- LUALIB= $(LUA)/lib
- LUABIN= $(LUA)/bin
++LUAINC= $(LUA_INCDIR)
++LUALIB= $(LUA_LIBDIR)
++LUABIN= $(LUA_BINDIR)
+ 
+ # no need to change anything below here
+-CFLAGS= -fPIC $(INCS) $(WARN) -O2 $G
++CFLAGS+= -fPIC $(INCS) $(WARN) -O2 $G
+ WARN= -pedantic -Wall
+ INCS= -I$(LUAINC)
+ 
 @@ -21,7 +21,7 @@
  all:	test
  
  test:	$T
 -	$(LUABIN)/lua -l$(MYNAME) test.lua
-+	LD_PRELOAD=${PREFIX}/lib/liblua.so:${PREFIX}/lib/liblualib.so $(LUABIN)/lua -l$(MYNAME) test.lua
++	LD_PRELOAD=${LUA_LIBDIR}/liblua.so:${LUA_LIBDIR}/liblualib.so $(LUABIN)/lua -l$(MYNAME) test.lua
  
  $T:	$(OBJS)
  	$(CC) -o $@ -shared $(OBJS)
Index: ./devel/lua50-pty/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-pty/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- ./devel/lua50-pty/Makefile	23 Jun 2006 16:05:24 -0000	1.3
+++ ./devel/lua50-pty/Makefile	17 Aug 2006 19:52:37 -0000
@@ -10,18 +10,20 @@
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_LOCAL}
 MASTER_SITE_SUBDIR= philip
-PKGNAMEPREFIX=	lua50-
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
 DISTFILES=	pty.lua?rev=1.2 pty.c?rev=1.25
 
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	Pty (pseudo-terminal) bindings for Lua 5.0.x
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${NONEXISTENT}:${PORTSDIR}/devel/lua50-compat51:extract
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${LOCALBASE}/share/lua/5.0/compat-5.1.lua:${PORTSDIR}/devel/lua50-compat51
+USE_LUA=	5.0
+LUA_COMPS=	lua compat51
 
-COMPAT_SRC=	`(cd ${PORTSDIR}/devel/lua50-compat51 && make -V WRKSRC)`
+COMPAT_SRC!=	`(cd ${PORTSDIR}/devel/lua50-compat51 && ${MAKE} -V WRKSRC)`
+MAKE_ENV=	COMPATDIR="${COMPAT_SRC}"
+
+PLIST_FILES=	%%LUA_MODSHAREDIR%%/pty.lua \
+		%%LUA_MODLIBDIR%%/lpty.so
 
 do-extract:
 	@${MKDIR} ${WRKSRC}
@@ -30,13 +32,8 @@
 .endfor
 	@${CP} ${FILESDIR}/Makefile ${WRKSRC}
 
-post-patch:
-	@${REINPLACE_CMD} -e "s|%%COMPATDIR%%|${COMPAT_SRC}|" ${WRKSRC}/Makefile
-
 do-install:
-	${MKDIR} ${PREFIX}/lib/lua/5.0
-	${INSTALL_PROGRAM} ${WRKSRC}/lpty.so ${PREFIX}/lib/lua/5.0
-	${MKDIR} ${PREFIX}/share/lua/5.0
-	${INSTALL_DATA} ${WRKSRC}/pty.lua ${PREFIX}/share/lua/5.0
+	${INSTALL_PROGRAM} ${WRKSRC}/lpty.so ${LUA_MODLIBDIR}
+	${INSTALL_DATA} ${WRKSRC}/pty.lua ${LUA_MODSHAREDIR}
 
 .include <bsd.port.mk>
Index: ./devel/lua50-pty/pkg-plist
===================================================================
RCS file: ./devel/lua50-pty/pkg-plist
diff -N ./devel/lua50-pty/pkg-plist
--- ./devel/lua50-pty/pkg-plist	17 Apr 2006 16:21:40 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-lib/lua/5.0/lpty.so
-share/lua/5.0/pty.lua
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
Index: ./devel/lua50-pty/files/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/lua50-pty/files/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- ./devel/lua50-pty/files/Makefile	27 Apr 2006 12:48:48 -0000	1.2
+++ ./devel/lua50-pty/files/Makefile	17 Aug 2006 19:52:37 -0000
@@ -3,9 +3,9 @@
 SHLIB=		pty
 SHLIB_NAME=	lpty.so
 
-SRCS=		pty.c %%COMPATDIR%%/compat-5.1.c
+SRCS=		pty.c ${COMPATDIR}/compat-5.1.c
 
-CFLAGS+=	-I${PREFIX}/include
+CFLAGS+=	-I${LUA_INCDIR}
 LDFLAGS+=	-L/usr/lib -lutil
 
 .include <bsd.lib.mk>
Index: ./www/elinks/Makefile
===================================================================
RCS file: /home/pcvs/ports/www/elinks/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- ./www/elinks/Makefile	3 May 2006 13:25:07 -0000	1.39
+++ ./www/elinks/Makefile	17 Aug 2006 19:52:37 -0000
@@ -74,8 +74,10 @@
 .endif
 
 .if defined(WITH_LUASCRIPT)
-LIB_DEPENDS+=	lua:${PORTSDIR}/lang/lua50
+USE_LUA=	5.0
 CONFIGURE_ARGS+=	--with-lua
+CPPFLAGS+=	-I${LUA_INCDIR}
+LDFLAGS+=	-L${LUA_LIBDIR}
 .else
 CONFIGURE_ARGS+=	--without-lua
 .endif
Index: ./www/lighttpd/Makefile
===================================================================
RCS file: /home/pcvs/ports/www/lighttpd/Makefile,v
retrieving revision 1.40
diff -u -r1.40 Makefile
--- ./www/lighttpd/Makefile	9 Jun 2006 15:35:49 -0000	1.40
+++ ./www/lighttpd/Makefile	17 Aug 2006 19:52:37 -0000
@@ -64,9 +64,9 @@
 .endif
 
 .if defined(WITH_CML)
-LIB_DEPENDS+=		lua.5:${PORTSDIR}/lang/lua50
+USE_LUA=	5.0
 CONFIGURE_ARGS+=	--with-lua
-CONFIGURE_ENV+=		CFLAGS=-I${LOCALBASE}/include LDFLAGS=-L/${LOCALBASE}/lib
+CONFIGURE_ENV+=		CPPFLAGS="-I${LUA_INCDIR}" LDFLAGS="-L${LUA_LIBDIR}"
 .endif
 
 SUB_LIST+=		REQUIRE="${_REQUIRE}"
Index: ./astro/celestia/Makefile
===================================================================
RCS file: /home/pcvs/ports/astro/celestia/Makefile,v
retrieving revision 1.31
diff -u -r1.31 Makefile
--- ./astro/celestia/Makefile	5 May 2006 11:20:51 -0000	1.31
+++ ./astro/celestia/Makefile	17 Aug 2006 19:52:37 -0000
@@ -26,9 +26,9 @@
 USE_X_PREFIX=	yes
 
 CONFIGURE_ARGS=	--program-prefix=""
-CONFIGURE_ENV=	\
-	LDFLAGS="-L${X11BASE}/lib -L${LOCALBASE}/lib -lm ${PTHREAD_LIBS}" \
-	CPPFLAGS="-I${X11BASE}/include -I${LOCALBASE}/include ${PTHREAD_CFLAGS}"
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${X11BASE}/include -I${LOCALBASE}/include ${PTHREAD_CFLAGS}
+LDFLAGS=	-L${X11BASE}/lib -L${LOCALBASE}/lib -lm ${PTHREAD_LIBS}
 
 UI_LIST=	glut gtk gnome
 CELESTIA_UI?=	glut
@@ -77,8 +77,10 @@
 .endif
 
 .if defined(WITH_LUA)
-LIB_DEPENDS+=	lua.5:${PORTSDIR}/lang/lua50
+USE_LUA=	5.0
 CONFIGURE_ARGS+=	--with-lua
+CPPFLAGS+=	-I${LUA_INCDIR}
+LDFLAGS+=	-L${LUA_LIBDIR}
 .endif
 
 pre-patch:
Index: ./net-p2p/verlihub-plugins/Makefile
===================================================================
RCS file: /home/pcvs/ports/net-p2p/verlihub-plugins/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- ./net-p2p/verlihub-plugins/Makefile	3 May 2006 13:25:06 -0000	1.6
+++ ./net-p2p/verlihub-plugins/Makefile	17 Aug 2006 19:52:37 -0000
@@ -16,17 +16,18 @@
 COMMENT=        Plugins for the Verlihub Linux/Unix Direct Connect Hub Software
 
 BUILD_DEPENDS=	${LOCALBASE}/bin/verlihub:${PORTSDIR}/net-p2p/verlihub
-LIB_DEPENDS=	lua.5:${PORTSDIR}/lang/lua50
 
 WRKSRC=         ${WRKDIR}/vh_plugins-0.1
 
 USE_GMAKE=	yes
+USE_LUA=	5.0
+USE_GCC=	3.3
 GNU_CONFIGURE=	yes
 INSTALLS_SHLIB=	yes
 LDCONFIG_DIRS=	%%PREFIX%%/include/verlihub
-CONFIGURE_ENV+=	CPPFLAGS="-I${LOCALBASE}/include -I${LOCALBASE}/include/verlihub -I${LOCALBASE}/include/mysql"
-
-DATADIR=	${PREFIX}/share/${PORTNAME}
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CPPFLAGS=	-I${LOCALBASE}/include -I${LOCALBASE}/include/verlihub -I${LOCALBASE}/include/mysql -I${LUA_INCDIR}
+LDFLAGS=	-L${LUA_LIBDIR}
 
 post-install:
 	@${MKDIR} ${DATADIR}
@@ -45,14 +46,6 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} < 502010
-USE_GCC=	3.3
-.endif
-
-.if ${OSVERSION} > 502126
-BROKEN=		Does not compile with gcc 3.4
-.endif
-
 .if ${PERL_LEVEL} < 500800
 IGNORE=		requires perl 5.8 or later. Install lang/perl5.8 and try again
 .endif
Index: ./net-p2p/luasocket/Makefile
===================================================================
RCS file: /home/pcvs/ports/net/luasocket/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- ./net-p2p/luasocket/Makefile	3 May 2006 13:25:06 -0000	1.7
+++ ./net-p2p/luasocket/Makefile	17 Aug 2006 19:52:37 -0000
@@ -14,35 +14,22 @@
 MAINTAINER=	andrew+ports@fubar.geek.nz
 COMMENT=	IPv4 Sockets support for the Lua language
 
-BUILD_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50
-RUN_DEPENDS=	${LOCALBASE}/include/lua.h:${PORTSDIR}/lang/lua50 \
-		${LOCALBASE}/share/lua/5.0/compat-5.1.lua:${PORTSDIR}/devel/lua50-compat51
+BUILD_DEPENDS=	${NONEXISTENT}:${PORTSDIR}/devel/lua50-compat51:extract
 
 USE_GMAKE=	yes
+USE_LUA=	5.0
+LUA_COMPS=	lua compat51
+
+COMPAT_SRC=	`(cd ${PORTSDIR}/devel/lua50-compat51 && ${MAKE} -V WRKSRC)`
+MAKE_ENV=	COMPATDIR="${COMPAT_SRC}"
 
 post-extract:
-	@ ${MV} ${WRKSRC}/makefile ${WRKSRC}/Makefile
-	@ ${RM} ${WRKSRC}/src/compat-5.1r4/compat-5.1.o
+	@${MV} ${WRKSRC}/makefile ${WRKSRC}/Makefile
 
 post-install:
 .if !defined(NOPORTDOCS)
-	@${MKDIR} ${PREFIX}/share/doc/luasocket
-	@${INSTALL_DATA} ${WRKSRC}/doc/dns.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/ftp.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/home.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/http.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/installation.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/introduction.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/ltn12.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/luasocket.png ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/mime.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/reference.css ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/reference.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/smtp.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/socket.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/tcp.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/udp.html ${DOCSDIR}
-	@${INSTALL_DATA} ${WRKSRC}/doc/url.html ${DOCSDIR}
+	@${MKDIR} ${DOCSDIR}
+	@${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR}
 .endif
 
 .include <bsd.port.mk>
Index: ./net-p2p/luasocket/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/net/luasocket/pkg-plist,v
retrieving revision 1.3
diff -u -r1.3 pkg-plist
--- ./net-p2p/luasocket/pkg-plist	20 Apr 2006 08:58:20 -0000	1.3
+++ ./net-p2p/luasocket/pkg-plist	17 Aug 2006 19:52:37 -0000
@@ -1,13 +1,13 @@
-share/lua/5.0/mime.lua
-share/lua/5.0/socket.lua
-share/lua/5.0/ltn12.lua
-share/lua/5.0/socket/smtp.lua
-share/lua/5.0/socket/ftp.lua
-share/lua/5.0/socket/tp.lua
-share/lua/5.0/socket/url.lua
-share/lua/5.0/socket/http.lua
-lib/lua/5.0/socket/core.so
-lib/lua/5.0/mime/core.so
+%%LUA_MODSHAREDIR%%/mime.lua
+%%LUA_MODSHAREDIR%%/socket.lua
+%%LUA_MODSHAREDIR%%/ltn12.lua
+%%LUA_MODSHAREDIR%%/socket/smtp.lua
+%%LUA_MODSHAREDIR%%/socket/ftp.lua
+%%LUA_MODSHAREDIR%%/socket/tp.lua
+%%LUA_MODSHAREDIR%%/socket/url.lua
+%%LUA_MODSHAREDIR%%/socket/http.lua
+%%LUA_MODLIBDIR%%/socket/core.so
+%%LUA_MODLIBDIR%%/mime/core.so
 %%PORTDOCS%%%%DOCSDIR%%/dns.html
 %%PORTDOCS%%%%DOCSDIR%%/ftp.html
 %%PORTDOCS%%%%DOCSDIR%%/home.html
@@ -25,10 +25,6 @@
 %%PORTDOCS%%%%DOCSDIR%%/udp.html
 %%PORTDOCS%%%%DOCSDIR%%/url.html
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
-@dirrm share/lua/5.0/socket
-@dirrmtry share/lua/5.0
-@dirrmtry share/lua
-@dirrm lib/lua/5.0/socket
-@dirrm lib/lua/5.0/mime
-@dirrmtry lib/lua/5.0
-@dirrmtry lib/lua
+@dirrm %%LUA_MODSHAREDIR%%/socket
+@dirrm %%LUA_MODLIBDIR%%/socket
+@dirrm %%LUA_MODLIBDIR%%/mime
Index: ./net-p2p/luasocket/files/patch-config
===================================================================
RCS file: /home/pcvs/ports/net/luasocket/files/patch-config,v
retrieving revision 1.1
diff -u -r1.1 patch-config
--- ./net-p2p/luasocket/files/patch-config	26 Mar 2006 13:43:34 -0000	1.1
+++ ./net-p2p/luasocket/files/patch-config	17 Aug 2006 19:52:37 -0000
@@ -1,28 +1,35 @@
---- config.orig	Fri Nov 25 09:29:38 2005
-+++ config	Mon Mar  6 19:46:29 2006
-@@ -15,8 +15,8 @@
+--- config.orig	Thu Nov 24 17:29:38 2005
++++ config	Mon Aug  7 13:36:23 2006
+@@ -15,42 +15,42 @@
  #------
  # Lua includes and libraries
  #
 -LUAINC=-Ilua-5.0.2/include
 -LUALIB=-Llua-5.0.2/lib
-+LUAINC=-I$(PREFIX)/include
-+LUALIB=-L$(PREFIX)/lib
++LUAINC=-I$(LUA_INCDIR)
++LUALIB=-L$(LUA_LIBDIR)
  
  #------
  # Compat-5.1 directory
-@@ -27,8 +27,8 @@
+ #
+-COMPAT=compat-5.1r4
++COMPAT=${COMPATDIR}
+ 
+ #------
  # Top of your Lua installation
  # Relative paths will be inside the src tree
  #
 -INSTALL_TOP_SHARE=share
 -INSTALL_TOP_LIB=lib
-+INSTALL_TOP_SHARE=${PREFIX}/share/lua/5.0
-+INSTALL_TOP_LIB=${PREFIX}/lib/lua/5.0
++INSTALL_TOP_SHARE=${LUA_MODSHAREDIR}
++INSTALL_TOP_LIB=${LUA_MODLIBDIR}
  
- INSTALL_DATA=cp
- INSTALL_EXEC=cp
-@@ -37,20 +37,20 @@
+-INSTALL_DATA=cp
+-INSTALL_EXEC=cp
++INSTALL_DATA=${BSD_INSTALL_DATA}
++INSTALL_EXEC=${BSD_INSTALL_PROGRAM}
+ 
+ #------
  # Compiler and linker settings
  # for Mac OS X
  #
@@ -48,7 +55,7 @@
 -#LD=gcc 
 +CFLAGS+= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -fpic
 +LDFLAGS=-O -shared
-+LD=gcc 
++LD=${CC}
  
  #------
  # End of makefile configuration
Comment 6 Alejandro Pulver freebsd_committer 2006-08-27 21:50:58 UTC
This diff has a new bsd.lua.mk (fixes the previous patch to avoid
double-inclusion) plus patches for lang/tolua and lang/tolua++.

Index: Mk/bsd.lua.mk
===================================================================
RCS file: Mk/bsd.lua.mk
diff -N Mk/bsd.lua.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Mk/bsd.lua.mk	27 Aug 2006 20:42:51 -0000
@@ -0,0 +1,420 @@
+#-*- mode: makefile; tab-width: 4; -*-
+# ex:ts=4
+#
+# $FreeBSD$
+#
+# bsd.lua.mk - Support for Lua based ports.
+#
+# Created by: Alejandro Pulver <alepulver@FreeBSD.org>
+#
+# Please view me with 4 column tabs!
+#
+# The following variables can be defined in a port that uses the Lua library,
+# tolua, Ruby bindings or related components like .lua modules (with run
+# and/or build dependencies). It can be used after and/or before
+# bsd.port.pre.mk, but Ruby components will only work if Ruby variables (e.g.
+# USE_RUBY) are defined before it (this is a bsd.ruby.mk limitation), at least
+# it is manually included.
+# USE_LUA		- Set to the list of Lua versions that can be used by the
+#				  port. The syntax allows the following elements:
+#				  - Single version (e.g. "4.0").
+#				  - Range of versions (e.g. "5.0-5.1"). Must be ascending.
+#				  - Partial range: single version and upper (e.g. "5.0+").
+#				  - Partial range: single version and lower (e.g. "5.1-").
+#				  Multiple elements can be specified separated by spaces.
+# USE_LUA_NOT	- Set to the list of Lua versions that can't be used by the
+#				  port. In other words, it removes some versions from USE_LUA.
+#				  If the latter is not defined, it will have the value of all
+#				  the possible versions. The syntax is like USE_LUA.
+# LUA_COMPS		- Set to the list of Lua components the port uses. Several
+#				  components can be specified separated by spaces. By default
+#				  it will have the value of "lua". Suffixes in the form ":xxx"
+#				  may be added to the components to determine the dependency
+#				  type.
+#				  The available components are:
+#				  lua			- The Lua library.
+#				  tolua			- The tolua library (vers 4.0-5.0).
+#				  ruby			- The Ruby bindings for Lua (vers 4.0-5.0).
+#				  app, compat51, dfui, filename, gettext, posix, pty and
+#				  socket		- Modules for Lua 5.0.
+#				  The available dependency types are:
+#				  build			- Requires component for building.
+#				  lib			- Requires component for building and running.
+#				  run			- Requires component for running.
+#				  If no suffix is present then "lib" will be used for "lua"
+#				  4.0-5.0 and "ruby", "build" for lua 5.1 and "tolua" (they
+#				  are static), all others default to "run".
+# LUA_PREMK		- Define to determine version and define variables after
+#				  <bsd.port.pre.mk> (in case the port needs to manually run
+#				  the Lua program or the like).
+# WANT_LUA		- Set to "yes" or a valid single version (no ranges, etc).
+#				  In both cases it will detect the installed Lua components
+#				  and add them to the variable HAVE_LUA. If a version is
+#				  selected, HAVE_LUA will contain a list of components in the
+#				  other case it will contain a list of "component-version"
+#				  pairs (e.g. lua-4.0, tolua-5.1, etc).
+#				  It has to be used before bsd.port.pre.mk.
+# WANT_LUA_VER	- Set to the prefered Lua version for the port. It must be
+#				  present in USE_LUA or missing in USE_LUA_NOT. This is
+#				  overriden by the user variable WITH_LUA_VER if set. It can
+#				  contain multiple versions in order of preference (last ones
+#				  are tried first).
+#
+# The following variables are intended for the user and can be defined in
+# make.conf.
+# WITH_LUA_VER	- Define to the list of prefered versions in reverse order.
+#
+# The following variables are defined by this file, to be read from the port.
+# HAVE_LUA		- The list of Lua components installed, if WANT_LUA was
+#				  defined. The components will have version suffix if it was
+#				  set to "yes".
+# 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 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_MODSHAREDIR	- The directory where Lua module libraries (.so) are
+#					  installed.
+# LUA_PKGNAMEPREFIX	- The package name prefix used by Lua modules.
+#
+# Examples:
+# - A port that needs Lua 4.0 and tolua (also 4.0) libraries (lua for building
+#   and running and tolua for building).
+#	USE_LUA=	4.0
+#	LUA_COMPS=	lua tolua
+# - A port that needs Ruby bindings for Lua 5.0 for building and running.
+#	USE_LUA=	5.0
+#	LUA_COMPS=	ruby
+# - A port that needs tolua 5.0 or 5.1 for building.
+#	USE_LUA=	5.0 5.1
+#	LUA_COMPS=	tolua
+# - A port that needs Lua version 5.0 or higher for building and running.
+#	USE_LUA=	5.0+
+# - A port that needs Lua of any version other than 5.1 for building and
+#   running.
+#	USE_LUA_NOT=5.1
+#
+
+LUA_Include_MAINTAINER=	alepulver@FreeBSD.org
+
+#
+# Global definitions.
+#
+
+.if !defined(_LUA_Definitions_Done)
+_LUA_Definitions_Done=	yes
+
+# Common variables:
+# _LUA_COMPS_ALL		- List of valid components.
+# _LUA_DEP_TYPES_ALL	- List of valid dependency types.
+# _LUA_VERS_ALL			- List of available Lua versions.
+# _LUA_VERS_LISTS=		- Reverse lists preference order.
+# _LUA_PLIST_ALL		- List of variables to be added to PLIST_SUB.
+# _LUA_PLIST_DIR_ALL	- List of path variables (relative to ${LUA_PREFIX})
+#						  to be added to PLIST_SUB.
+#
+
+_LUA_COMPS_ALL=			lua tolua ruby \
+						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
+_LUA_PLIST_DIR_ALL=		LUA_BINDIR LUA_INCDIR LUA_LIBDIR \
+						LUA_MODLIBDIR LUA_MODSHAREDIR
+_LUA_VERS_LISTS=		WANT_LUA_VER WITH_LUA_VER
+
+#
+# Variables used to determine what is needed.
+# _LUA_PORT_comp_ver	- Port directory.
+# _LUA_LIB_comp_ver		- Name of the shared library (optional).
+# _LUA_SHVER_comp_ver	- Shared library version (optional).
+# _LUA_FILE_comp_ver	- File installed by that component.
+# _LUA_DEPTYPE_comp_ver	- Default dependency type.
+#
+
+_LUA_PORT_lua_4.0=		lang/lua4
+_LUA_DEPTYPE_lua_4.0=	lib
+_LUA_PORT_tolua_4.0=	lang/tolua4
+_LUA_PORT_ruby_4.0=		lang/ruby-lua4
+
+_LUA_PORT_lua_5.0=		lang/lua50
+_LUA_DEPTYPE_lua_5.0=	lib
+_LUA_PORT_tolua_5.0=	lang/tolua
+_LUA_PORT_ruby_5.0=		lang/ruby-lua
+
+_LUA_PORT_app_5.0=		devel/lua50-app
+_LUA_PORT_compat51_5.0=	devel/lua50-compat51
+_LUA_FILE_compat51_5.0=	${LUA_MODSHAREDIR}/compat-5.1.lua
+_LUA_PORT_dfui_5.0=		devel/lua50-dfui
+_LUA_PORT_filename_5.0=	devel/lua50-filename
+_LUA_PORT_gettext_5.0=	devel/lua50-gettext
+_LUA_PORT_posix_5.0=	devel/lua50-posix
+_LUA_PORT_pty_5.0=		devel/lua50-pty
+_LUA_PORT_socket_5.0=	net/luasocket
+
+_LUA_PORT_lua_5.1=		lang/lua
+_LUA_DEPTYPE_lua_5.1=	build
+
+.for comp in ${_LUA_COMPS_ALL}
+_LUA_COMP=				${comp}
+.	for ver in ${_LUA_VERS_ALL}
+.		if ${_LUA_COMP} == "lua"
+_LUA_LIB_${comp}_${ver}=	lua-${LUA_VER}.${LUA_VER_SH}
+_LUA_SHVER_${comp}_${ver}=	${LUA_VER_SH}
+_LUA_FILE_${comp}_${ver}=	${LUA_LIBDIR}/liblua.a
+.		elif ${_LUA_COMP} == "tolua"
+_LUA_FILE_${comp}_${ver}=	${LUA_LIBDIR}/libtolua.a
+_LUA_DEPTYPE_${comp}_${ver}=build
+.		elif ${_LUA_COMP} == "ruby"
+_LUA_FILE_${comp}_${ver}=	${RUBY_SITEARCHLIBDIR}/lua-${LUA_VER}.so
+_LUA_DEPTYPE_${comp}_${ver}=lib
+.		else
+.			if !defined(_LUA_FILE_${comp}_${ver})
+_LUA_FILE_${comp}_${ver}=	${LUA_MODSHAREDIR}/${comp}.lua
+.			endif
+_LUA_DEPTYPE_${comp}_${ver}=run
+.		endif
+.	endfor
+.endfor
+
+.endif
+
+#
+# Check for present components.
+#
+
+.if defined(WANT_LUA) && defined(BEFOREPORTMK)
+.	for __WANT_LUA in ${WANT_LUA}
+# Check if WANT_LUA contains more than one word.
+.		if defined(HAVE_LUA)
+IGNORE?=				selected multiple values for WANT_LUA: ${WANT_LUA}
+.		endif
+HAVE_LUA=				#
+# Check for all versions.
+.		if ${WANT_LUA:L} == "yes"
+.			for comp in ${_LUA_COMPS_ALL}
+.				for ver in ${_LUA_VERS_ALL}
+_LUA_COMP=				_LUA_FILE_${comp}_${ver}
+.					if defined(${_LUA_COMP}) && exists(${${_LUA_COMP}})
+HAVE_LUA+=				${comp}-${ver}
+.					endif
+.				endfor
+.			endfor
+# Check for a specific version.
+.		elif ${_LUA_VERS_ALL:M${__WANT_LUA}} != ""
+.			for comp in ${_LUA_COMPS_ALL}
+.				if exists(${_LUA_FILE_${comp}_${__WANT_LUA}})
+HAVE_LUA+=				${comp}
+.				endif
+.			endfor
+.		else
+IGNORE?=				selected an invalid value for WANT_LUA: ${__WANT_LUA}
+.		endif
+.	endfor
+.endif		# WANT_LUA && BEFOREPORTMK
+
+#
+# Select Lua version.
+#
+
+.if !defined(_LUA_Version_Done) && (defined(_POSTMKINCLUDED) || \
+    (defined(LUA_PREMK) && defined(BEFOREPORTMK) && \
+    (defined(USE_LUA) || defined(USE_LUA_NOT))))
+_LUA_Version_Done=		yes
+
+# Set defaults (if one isn't present).
+
+USE_LUA?=				${_LUA_VERS_ALL}
+USE_LUA_NOT?=			#
+
+#
+# Make lists of valid and invalid versions.
+#
+# The following variables are used:
+# _LUA_VER_CHECK		- If the version is a single one, express in a range.
+# _LUA_VER_MIN			- Lower version of the range.
+# _LUA_VER_MAX			- Higher version of the range.
+# _LUA_VER_LIST			- List of requested versions.
+# _LUA_VER_NOT_LIST		- List of disallowed versions.
+# _LUA_VER_FINAL		- List of requested version without disallowed ones.
+#
+
+.for list in VER VER_NOT
+_LUA_${list}_LIST=		#
+.	for ver in ${USE_LUA${list:C/VER//}}
+_LUA_VER_CHECK:=		${ver:C/^([[:digit:]]+(\.[[:digit:]]+)*)$/\1-\1/}
+_LUA_VER_MIN:=			${_LUA_VER_CHECK:C/([[:digit:]]+(\.[[:digit:]]+)*)[-+].*/\1/}
+_LUA_VER_MAX:=			${_LUA_VER_CHECK:C/.*-([[:digit:]]+(\.[[:digit:]]+)*)/\1/}
+# Minimum version not specified.
+.		if ${_LUA_VER_MIN} == ${_LUA_VER_CHECK}
+.			undef _LUA_VER_MIN
+.			for v in ${_LUA_VERS_ALL}
+_LUA_VER_MIN?=			${v}
+.			endfor
+.		endif
+# Maximum version not specified.
+.		if ${_LUA_VER_MAX} == ${_LUA_VER_CHECK}
+.			for v in ${_LUA_VERS_ALL}
+_LUA_VER_MAX=			${v}
+.			endfor
+.		endif
+# Expand versions and add valid ones to each list.
+.		for v in ${_LUA_VERS_ALL}
+.			if ${_LUA_VER_MIN} <= ${v} && ${_LUA_VER_MAX} >= ${v} && \
+			   ${_LUA_${list}_LIST:M${v}} == ""
+_LUA_${list}_LIST+=		${v}
+.			endif
+.		endfor
+.	endfor
+.endfor
+
+# Merge the lists into a single list of valid versions.
+
+_LUA_VER_FINAL=			#
+.for ver in ${_LUA_VER_LIST}
+.	if ${_LUA_VER_NOT_LIST:M${ver}} == ""
+_LUA_VER_FINAL+=		${ver}
+.	endif
+.endfor
+
+# Check for a null version.
+
+.if empty(_LUA_VER_FINAL)
+IGNORE?=				selected a null or invalid Lua version
+.endif
+
+#
+# Choose final version.
+#
+
+#
+# Check for the following (in order):
+# 1) WITH_LUA_VER		- User preference.
+# 2) WANT_LUA_VER		- Port preference.
+# 3) _LUA_VER_FINAL		- Available versions.
+#
+
+.for list in _LUA_VER_FINAL ${_LUA_LISTS_ORDER}
+.	if defined(${list})
+.		for ver in ${${list}}
+.			if ${_LUA_VER_FINAL:M${ver}} != ""
+_LUA_VER=				${ver}
+.			endif
+.		endfor
+.	endif
+.endfor
+
+#
+# Set variables.
+#
+
+# Version.
+LUA_VER=				${_LUA_VER}
+LUA_VER_SH?=			${LUA_VER:C/[[:digit:]]\.([[:digit:]])/\1/}
+LUA_VER_STR?=			${LUA_VER:S/.//g}
+
+# Paths.
+LUA_PREFIX?=			${LOCALBASE}
+LUA_SUBDIR?=			lua${LUA_VER_STR}
+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}
+
+# Package name.
+LUA_PKGNAMEPREFIX?=		lua${LUA_VER_STR}-
+
+.endif		# !_LUA_Version_Done && (_POSTMKINCLUDED || \
+#			(LUA_PREMK && BEFOREPORTMK && (USE_LUA || USE_LUA_NOT)))
+
+#
+# Process components list and add dependencies, variables, etc.
+#
+
+.if defined(_POSTMKINCLUDED)
+
+#
+# Component parsing.
+#
+# The variables used are:
+# _LUA_COMP				- Component part.
+# _LUA_DEP_TYPE			- Dependency type part.
+# _LUA_COMP_NEW			- Component + dependency type.
+# _LUA_COMPS_FINAL		- Final list of components with dependency types.
+#
+
+# Default components.
+
+LUA_COMPS?=				lua
+
+# Detect invalid and duplicated components.
+
+_LUA_COMPS_FINAL=		#
+.for comp in ${LUA_COMPS}
+_LUA_COMP=				${comp:C/:([[:alpha:]]+)$//}
+.	if ${_LUA_COMP} == ${comp}
+_LUA_DEP_TYPE=			${_LUA_DEPTYPE_${comp}_${_LUA_VER}}
+.	else
+_LUA_DEP_TYPE=			${comp:C/.+:([[:alpha:]]+)$/\1/}
+.	endif
+_LUA_COMP_NEW=			${_LUA_COMP}_${_LUA_DEP_TYPE}
+.	for __LUA_COMP in ${_LUA_COMP}
+.		if ${_LUA_COMPS_ALL:M${__LUA_COMP}} == ""
+IGNORE?=				selected an invalid Lua component: ${__LUA_COMP}
+.		endif
+.	endfor
+.	for __LUA_DEP_TYPE in ${_LUA_DEP_TYPE}
+.		if ${_LUA_DEP_TYPES_ALL:M${__LUA_DEP_TYPE}} == ""
+IGNORE?=				selected an invalid Lua dependency type: ${__LUA_DEP_TYPE}
+.		endif
+.	endfor
+.	if !defined(_LUA_PORT_${_LUA_COMP}_${_LUA_VER})
+IGNORE?=				selected a Lua component (${_LUA_COMP}) which is not available for the selected version (${_LUA_VER})
+.	endif
+.	for newcomp in ${_LUA_COMP_NEW}
+.		if ${_LUA_COMPS_FINAL:M${newcomp}} == ""
+_LUA_COMPS_FINAL+=		${newcomp}
+.		endif
+.	endfor
+.endfor
+
+# Add dependencies.
+#
+# The variable used are:
+# _LUA_COMP		-		- Component part.
+# _LUA_DEP_TYPE			- Dependency type part.
+
+.for comp in ${_LUA_COMPS_FINAL}
+_LUA_DEP_TYPE=			${comp:C/.+_([[:alpha:]]+)$/\1/}
+_LUA_COMP=				${comp:C/_([[:alpha:]]+)$//}
+# XXX Need a .for loop here so the variable is expanded before the assignment.
+.	for comp_part in ${_LUA_COMP}
+.		if ${_LUA_DEP_TYPE} == "lib"
+.			if defined(_LUA_LIB_${comp_part}_${_LUA_VER})
+LIB_DEPENDS+=			${_LUA_LIB_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
+.			else
+BUILD_DEPENDS+=			${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
+RUN_DEPENDS+=			${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
+.			endif
+.		else
+${_LUA_DEP_TYPE:U}_DEPENDS+=	${_LUA_FILE_${comp_part}_${_LUA_VER}}:${PORTSDIR}/${_LUA_PORT_${comp_part}_${_LUA_VER}}
+.		endif
+.	endfor
+.endfor
+
+# Packaging list variables.
+.for var in ${_LUA_PLIST_ALL}
+PLIST_SUB+=				${var}="${${var}}"
+.endfor
+.for var in ${_LUA_PLIST_DIR_ALL}
+PLIST_SUB+=				${var}="${${var}:S/${LUA_PREFIX}\///}"
+.endfor
+.for var in ${_LUA_PLIST_ALL} ${_LUA_PLIST_DIR_ALL}
+MAKE_ENV+=				${var}="${${var}}"
+.endfor
+
+.endif		# _POSTMKINCLUDED
Index: lang/tolua/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/tolua/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- lang/tolua/Makefile	3 May 2006 13:25:06 -0000	1.3
+++ lang/tolua/Makefile	27 Aug 2006 20:42:51 -0000
@@ -15,15 +15,25 @@
 MAINTAINER=	edwin@mavetju.org
 COMMENT=	toLua: accessing C/C++ code from Lua
 
-LIB_DEPENDS=	lua:${PORTSDIR}/lang/lua50
-
-WRKSRC=		${WRKDIR}/${PORTNAME}-5.0
 USE_GMAKE=	yes
-CONFLICTS=	tolua4-.*
+USE_LUA=	5.0
+WRKSRC=		${WRKDIR}/${PORTNAME}-5.0
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|make|$${MAKE}|' ${WRKSRC}/${MAKEFILE}
+	@${REINPLACE_CMD} -Ee \
+		's|^(CC=).*|\1 ${CC}|; \
+		 s|^(CCPP=).*|\1 ${CXX}|; \
+		 s|^(LUA=).*|\1 ${LOCALBASE}|; \
+		 s|^(LUA(INC\|LIB)=).*|\1 $${LUA_\2DIR}|; \
+		 s|^(CPPFLAGS)(=.*)|\1+\2 -lstdc++|; \
+		 s|^(CFLAGS)(=.*)|\1+\2|;' \
+		${WRKSRC}/config
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${PREFIX}/include
-	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${PREFIX}/lib
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${LUA_BINDIR}
+	${LN} -sf ${LUA_SUBDIR}/tolua ${PREFIX}/bin/tolua-${LUA_VER}
+	${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${LUA_INCDIR}
+	${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${LUA_LIBDIR}
 
 .include <bsd.port.mk>
Index: lang/tolua/pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/tolua/pkg-plist,v
retrieving revision 1.1
diff -u -r1.1 pkg-plist
--- lang/tolua/pkg-plist	21 Nov 2004 08:32:23 -0000	1.1
+++ lang/tolua/pkg-plist	27 Aug 2006 20:42:51 -0000
@@ -1,3 +1,4 @@
-bin/tolua
-lib/libtolua.a
-include/tolua.h
+%%LUA_BINDIR%%/tolua
+bin/tolua-%%LUA_VER%%
+%%LUA_LIBDIR%%/libtolua.a
+%%LUA_INCDIR%%/tolua.h
Index: lang/tolua/files/patch-Makefile
===================================================================
RCS file: lang/tolua/files/patch-Makefile
diff -N lang/tolua/files/patch-Makefile
--- lang/tolua/files/patch-Makefile	21 Nov 2004 08:32:23 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
---- Makefile.orig	Thu Jul 31 23:27:52 2003
-+++ Makefile	Sun Nov 21 18:50:08 2004
-@@ -1,13 +1,13 @@
- # makefile for tolua hierarchy
- 
- tolua:
--	cd src/lib; make all
--	cd src/bin; make all
-+	cd src/lib; ${MAKE} all
-+	cd src/bin; ${MAKE} all
- 
- tests:
--	cd src/tests; make all
-+	cd src/tests; ${MAKE} all
- 
- all clean klean:
--	cd src/lib; make $@
--	cd src/bin; make $@
--	cd src/tests; make $@
-+	cd src/lib; ${MAKE} $@
-+	cd src/bin; ${MAKE} $@
-+	cd src/tests; ${MAKE} $@
Index: lang/tolua/files/patch-config
===================================================================
RCS file: lang/tolua/files/patch-config
diff -N lang/tolua/files/patch-config
--- lang/tolua/files/patch-config	21 Nov 2004 08:32:23 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
---- config.orig	Tue Jun  8 06:09:19 2004
-+++ config	Sun Nov 21 19:24:24 2004
-@@ -3,8 +3,9 @@
- # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================
- 
- # you need an ANSI C compiler. gcc is a popular one.
--CC= gcc
--CCPP = g++
-+#CC= ${CC}
-+CC = cc
-+CCPP = c++
- WARN= -ansi -Wall
- 
- # on SGI's, cc is ANSI.
-@@ -22,6 +23,7 @@
- 
- # set lua path
- LUA=/usr/local/lua-5.0
-+LUA=${LOCALBASE}
- LUAINC=$(LUA)/include
- LUALIB=$(LUA)/lib
- 
-@@ -30,5 +32,5 @@
- INC= -I$(TOLUA)/include -I$(LUAINC) 
- LIB= -L$(TOLUA)/lib -L$(LUALIB)
- 
--CFLAGS= -O2 $(WARN) $(INC)
--CPPFLAGS=  -O2 $(WARN) $(INC)
-+CFLAGS+= -O2 $(WARN) $(INC)
-+CPPFLAGS+=  -O2 $(WARN) $(INC) -lstdc++
Index: lang/tolua++/Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/tolua++/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- lang/tolua++/Makefile	3 May 2006 13:25:06 -0000	1.2
+++ lang/tolua++/Makefile	27 Aug 2006 20:42:51 -0000
@@ -9,19 +9,24 @@
 PORTVERSION=	1.0.4
 CATEGORIES=	lang devel
 MASTER_SITES=	http://www.codenix.com/~tolua/
-DISTNAME=	tolua++-current
+DISTFILES=	tolua++-current${EXTRACT_SUFX}
 
 MAINTAINER=	aaron@FreeBSD.org
 COMMENT=	An extended version of tolua, a tool to integrate C/C++ code with Lua
 
 BUILD_DEPENDS=	${LOCALBASE}/bin/scons:${PORTSDIR}/devel/scons
-LIB_DEPENDS=	lua:${PORTSDIR}/lang/lua50
 
-WRKSRC=		${WRKDIR}/tolua++-${PORTVERSION}
 USE_BZIP2=	yes
-INSTALLS_SHLIB=	yes
+USE_LDCONFIG=	yes
+USE_LUA=	5.0
 NO_BUILD=	yes
 
+post-patch:
+.for f in LOCALBASE LUA_VER LUA_INCDIR LUA_LIBDIR
+	@${REINPLACE_CMD} -i "" -e 's|%%${f}%%|${${f}}|g' \
+		${WRKSRC}/config_posix.py
+.endfor
+
 do-build:
 	@cd ${WRKSRC} && scons
 
Index: lang/tolua++/files/patch-config_posix.py
===================================================================
RCS file: /home/pcvs/ports/lang/tolua++/files/patch-config_posix.py,v
retrieving revision 1.1
diff -u -r1.1 patch-config_posix.py
--- lang/tolua++/files/patch-config_posix.py	22 Jan 2006 23:42:31 -0000	1.1
+++ lang/tolua++/files/patch-config_posix.py	27 Aug 2006 20:42:51 -0000
@@ -1,18 +1,20 @@
---- config_posix.py.orig	Thu Jan 20 20:01:08 2005
-+++ config_posix.py	Wed Jan 18 11:05:32 2006
+--- ./config_posix.py.orig	Fri Jan 21 00:01:08 2005
++++ ./config_posix.py	Sun Aug 27 14:25:40 2006
 @@ -5,7 +5,7 @@
  
  # flags for the compiler
  #CCFLAGS = []
 -CCFLAGS = ['-O2', '-ansi', '-Wall']
-+CCFLAGS = ['-O2', '-ansi', '-Wall', '-I/usr/local/include']
++CCFLAGS = ['-O2', '-ansi', '-Wall', '-I%%LOCALBASE%%/include', '-I%%LUA_INCDIR%%']
  
  # this is the default directory for installation. Files will be installed on
  # <prefix>/bin, <prefix>/lib and <prefix>/include when you run 'scons install'
-@@ -17,5 +17,5 @@
+@@ -16,6 +16,6 @@
+ prefix = '/usr/local'
  
  # libraries
- LIBS = ['lua', 'lualib', 'm']
+-LIBS = ['lua', 'lualib', 'm']
 -
-+LINKFLAGS = ['-L/usr/local/lib']
++LIBS = ['lua-%%LUA_VER%%', 'lualib-%%LUA_VER%%', 'm']
++LINKFLAGS = ['-L%%LOCALBASE%%/lib', '-L%%LUA_LIBDIR%%']
Comment 7 Mark Linimon freebsd_committer freebsd_triage 2006-08-28 05:45:37 UTC
State Changed
From-To: open->analyzed

Accepted for a test build on the cluster.
Comment 8 dfilter service freebsd_committer 2006-09-15 07:57:14 UTC
linimon     2006-09-15 06:57:07 UTC

  FreeBSD ports repository

  Modified files:
    Mk                   bsd.port.mk 
    .                    CHANGES 
  Added files:
    Mk                   bsd.lua.mk 
  Log:
  * Add PKGVERSION to bsd.port.mk [1]
  
  * Add bsd.lua.mk to support for lua-based ports [2]
  
  * Remove DESTDIR from bsd.scons.mk [3]
  
  * Add some quotes in 'missing' target to improve handling of duplicate
    origins [4]
  
  PR:     98565 [1], 101612 [2], 101952 [3], 102100 [4]
  
  Submitted by:   ahze [1], alepulver [2], alexbl [3], shaun [4]
  
  Revision  Changes    Path
  1.60      +15 -1     ports/CHANGES
  1.1       +420 -0    ports/Mk/bsd.lua.mk (new)
  1.541     +23 -3     ports/Mk/bsd.port.mk
_______________________________________________
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"
Comment 9 Mark Linimon freebsd_committer freebsd_triage 2006-09-15 08:36:49 UTC
State Changed
From-To: analyzed->closed

Committed, thanks.
Comment 10 dfilter service freebsd_committer 2006-09-15 09:17:17 UTC
linimon     2006-09-15 08:17:11 UTC

  FreeBSD ports repository

  Modified files:
    astro/celestia       Makefile 
    devel/lua50-app      Makefile pkg-plist 
    devel/lua50-compat51 Makefile distinfo pkg-plist 
    devel/lua50-compat51/files Makefile 
    devel/lua50-dfui     Makefile pkg-plist 
    devel/lua50-dfui/files patch-Makefile 
    devel/lua50-filename Makefile pkg-descr pkg-plist 
    devel/lua50-gettext  Makefile pkg-plist 
    devel/lua50-gettext/files Makefile 
    devel/lua50-posix    Makefile pkg-plist 
    devel/lua50-posix/files patch-Makefile 
    devel/lua50-pty      Makefile 
    devel/lua50-pty/files Makefile 
    games/enigma         Makefile 
    games/fillets-ng     Makefile 
    games/stratagus      Makefile pkg-message 
    games/stratagus/files patch-aa patch-configure 
    games/xmoto          Makefile 
    lang/lua             Makefile pkg-plist 
    lang/lua4            Makefile pkg-plist 
    lang/lua4/files      patch-aa 
    lang/lua50           Makefile pkg-plist 
    lang/ruby-lua4       Makefile pkg-plist 
    lang/tolua           Makefile pkg-plist 
    lang/tolua/files     patch-Makefile patch-config 
    lang/tolua++         Makefile 
    lang/tolua++/files   patch-config_posix.py 
    lang/tolua4          Makefile pkg-plist 
    lang/tolua4/files    patch-config 
    mail/imapfilter      Makefile 
    mail/imapfilter/files patch-configure 
    net-p2p/verlihub-plugins Makefile 
    textproc/ruby-xml-script Makefile 
    www/elinks           Makefile 
    www/lighttpd         Makefile 
    x11-wm/ion-2         Makefile 
    x11-wm/ion-2/files   patch-rules.mk patch-system.mk 
    x11-wm/ion-3ds       Makefile 
    x11-wm/ion-3ds/files patch-system.mk 
  Log:
  Modify these files to reflect bsd.lua.mk as tested on the cluster.
  
  PR:             ports/101612
  Submitted by:   alepulver
  Hat:            portmgr
  
  Revision  Changes    Path
  1.32      +6 -4      ports/astro/celestia/Makefile
  1.3       +9 -11     ports/devel/lua50-app/Makefile
  1.2       +0 -3      ports/devel/lua50-app/pkg-plist
  1.4       +10 -10    ports/devel/lua50-compat51/Makefile
  1.2       +3 -3      ports/devel/lua50-compat51/distinfo
  1.2       +4 -3      ports/devel/lua50-compat51/files/Makefile
  1.3       +0 -3      ports/devel/lua50-compat51/pkg-plist
  1.3       +11 -12    ports/devel/lua50-dfui/Makefile
  1.2       +5 -5      ports/devel/lua50-dfui/files/patch-Makefile
  1.2       +0 -6      ports/devel/lua50-dfui/pkg-plist
  1.3       +9 -7      ports/devel/lua50-filename/Makefile
  1.2       +3 -3      ports/devel/lua50-filename/pkg-descr
  1.2       +0 -3      ports/devel/lua50-filename/pkg-plist
  1.2       +7 -11     ports/devel/lua50-gettext/Makefile
  1.2       +2 -2      ports/devel/lua50-gettext/files/Makefile
  1.2       +0 -6      ports/devel/lua50-gettext/pkg-plist
  1.4       +8 -7      ports/devel/lua50-posix/Makefile
  1.2       +17 -7     ports/devel/lua50-posix/files/patch-Makefile
  1.2       +0 -6      ports/devel/lua50-posix/pkg-plist
  1.4       +10 -13    ports/devel/lua50-pty/Makefile
  1.3       +2 -2      ports/devel/lua50-pty/files/Makefile
  1.33      +10 -8     ports/games/enigma/Makefile
  1.6       +4 -3      ports/games/fillets-ng/Makefile
  1.7       +25 -35    ports/games/stratagus/Makefile
  1.2       +0 -11     ports/games/stratagus/files/patch-aa
  1.2       +2 -2      ports/games/stratagus/files/patch-configure
  1.2       +6 -6      ports/games/stratagus/pkg-message
  1.9       +13 -12    ports/games/xmoto/Makefile
  1.27      +48 -10    ports/lang/lua/Makefile
  1.7       +59 -22    ports/lang/lua/pkg-plist
  1.23      +64 -30    ports/lang/lua4/Makefile
  1.6       +0 -19     ports/lang/lua4/files/patch-aa
  1.5       +72 -12    ports/lang/lua4/pkg-plist
  1.25      +65 -25    ports/lang/lua50/Makefile
  1.6       +71 -18    ports/lang/lua50/pkg-plist
  1.3       +10 -5     ports/lang/ruby-lua4/Makefile
  1.2       +1 -1      ports/lang/ruby-lua4/pkg-plist
  1.3       +7 -1      ports/lang/tolua++/Makefile
  1.2       +8 -6      ports/lang/tolua++/files/patch-config_posix.py
  1.4       +17 -7     ports/lang/tolua/Makefile
  1.2       +0 -22     ports/lang/tolua/files/patch-Makefile
  1.2       +0 -30     ports/lang/tolua/files/patch-config
  1.2       +4 -3      ports/lang/tolua/pkg-plist
  1.2       +17 -8     ports/lang/tolua4/Makefile
  1.2       +0 -26     ports/lang/tolua4/files/patch-config
  1.2       +4 -3      ports/lang/tolua4/pkg-plist
  1.20      +19 -15    ports/mail/imapfilter/Makefile
  1.2       +0 -73     ports/mail/imapfilter/files/patch-configure
  1.7       +5 -12     ports/net-p2p/verlihub-plugins/Makefile
  1.3       +7 -2      ports/textproc/ruby-xml-script/Makefile
  1.41      +3 -1      ports/www/elinks/Makefile
  1.41      +2 -2      ports/www/lighttpd/Makefile
  1.21      +3 -4      ports/x11-wm/ion-2/Makefile
  1.2       +2 -2      ports/x11-wm/ion-2/files/patch-rules.mk
  1.10      +14 -6     ports/x11-wm/ion-2/files/patch-system.mk
  1.16      +1 -1      ports/x11-wm/ion-3ds/Makefile
  1.4       +14 -6     ports/x11-wm/ion-3ds/files/patch-system.mk
_______________________________________________
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"
Comment 11 dfilter service freebsd_committer 2006-09-16 22:43:04 UTC
linimon     2006-09-16 21:42:04 UTC

  FreeBSD ports repository

  Removed files:
    lang/lua4/files      patch-aa 
    devel/lua50-app      pkg-plist 
    devel/lua50-compat51 pkg-plist 
    devel/lua50-dfui     pkg-plist 
    devel/lua50-filename pkg-plist 
    devel/lua50-gettext  pkg-plist 
    devel/lua50-posix    pkg-plist 
    devel/lua50-pty      pkg-plist 
    lang/tolua/files     patch-Makefile patch-config 
    lang/tolua4/files    patch-config 
  Log:
  Remove zero-length files.
  
  PR:             ports/101612
  Submitted by:   alepulver
  Pointy hat to:  linimon
  
  Revision  Changes    Path
  1.3       +0 -0      ports/devel/lua50-app/pkg-plist (dead)
  1.4       +0 -0      ports/devel/lua50-compat51/pkg-plist (dead)
  1.3       +0 -0      ports/devel/lua50-dfui/pkg-plist (dead)
  1.3       +0 -0      ports/devel/lua50-filename/pkg-plist (dead)
  1.3       +0 -0      ports/devel/lua50-gettext/pkg-plist (dead)
  1.3       +0 -0      ports/devel/lua50-posix/pkg-plist (dead)
  1.2       +0 -6      ports/devel/lua50-pty/pkg-plist (dead)
  1.7       +0 -0      ports/lang/lua4/files/patch-aa (dead)
  1.3       +0 -0      ports/lang/tolua/files/patch-Makefile (dead)
  1.3       +0 -0      ports/lang/tolua/files/patch-config (dead)
  1.3       +0 -0      ports/lang/tolua4/files/patch-config (dead)
_______________________________________________
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"
Comment 12 dfilter service freebsd_committer 2006-09-16 23:01:43 UTC
linimon     2006-09-16 22:01:36 UTC

  FreeBSD ports repository

  Modified files:
    lang/lua             Makefile 
    lang/lua4            Makefile 
    lang/lua50           Makefile 
    lang/ruby-lua4       Makefile 
    lang/tolua           Makefile 
    lang/tolua4          Makefile 
  Log:
  Update PORTREVISION for previous commits where plist changed.
  
  PR:             ports/101612
  Submitted by:   alepulver
  Hat:            portmgr
  Pointy hat to:  linimon
  
  Revision  Changes    Path
  1.28      +1 -1      ports/lang/lua/Makefile
  1.24      +1 -0      ports/lang/lua4/Makefile
  1.26      +1 -1      ports/lang/lua50/Makefile
  1.4       +1 -0      ports/lang/ruby-lua4/Makefile
  1.5       +1 -0      ports/lang/tolua/Makefile
  1.3       +1 -0      ports/lang/tolua4/Makefile
_______________________________________________
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"