[Midnightbsd-cvs] mports [17712] trunk: rework lua framework
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Oct 10 07:24:59 EDT 2014
Revision: 17712
http://svnweb.midnightbsd.org/mports/?rev=17712
Author: laffer1
Date: 2014-10-10 07:24:59 -0400 (Fri, 10 Oct 2014)
Log Message:
-----------
rework lua framework
Modified Paths:
--------------
trunk/Mk/extensions/lua.mk
trunk/lang/lua51/Makefile
trunk/lang/lua51/pkg-plist
Added Paths:
-----------
trunk/lang/lua51/files/patch-src__Makefile
Removed Paths:
-------------
trunk/lang/lua51/files/patch-src-Makefile
Modified: trunk/Mk/extensions/lua.mk
===================================================================
--- trunk/Mk/extensions/lua.mk 2014-10-10 11:02:19 UTC (rev 17711)
+++ trunk/Mk/extensions/lua.mk 2014-10-10 11:24:59 UTC (rev 17712)
@@ -1,578 +1,102 @@
-#-*- mode: makefile; tab-width: 4; -*-
-# ex:ts=4
-#
# $MidnightBSD$
-# $FreeBSD: ports/Mk/bsd.lua.mk,v 1.13 2007/04/11 03:22:34 alepulver Exp $
#
-# bsd.lua.mk - Support for Lua based ports.
-#
-# 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 (for 4.0-5.1).
-# toluaxx - The tolua++ library (for 5.0-5.1).
-# ruby - The Ruby bindings for Lua (for 4.0-5.0).
-# Other components (modules):
-# 5.0 - app, compat51, dfui, filename, gettext,
-# posix, pty, socket.
-# 5.1 - alien, filename, gettext, posix, pty, socket.
-# The available dependency types are:
-# build - Requires component for building.
-# lib - Requires component for building and running.
-# 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.
-# NOTE: please see comments below about its double function.
-# LUA_SUBDIR - The directory under bin/share/lib where Lua is installed.
-# Also used by Lua ports (lang/lua*) to set LATEST_LINK.
-# LUA_INCDIR - The directory where Lua, tolua and tolua++ header files are
-# installed.
-# LUA_LIBDIR - The directory where Lua, tolua and tolua++ libraries are
-# installed.
-# LUA_MODLIBDIR - The directory where Lua module libraries (.so) are installed.
-# LUA_MODSHAREDIR
-# - The directory where Lua modules (.lua) are installed.
-# LUA_PKGNAMEPREFIX
-# - The package name prefix used by Lua modules.
-# LUA_CMD - The path to the Lua interpreter.
-# LUAC_CMD - The path to the Lua compiler.
-# TOLUA_CMD - The path to the tolua program.
-# TOLUAXX_CMD - The path to the tolua++ program.
-#
-# 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
-#
-# Notes about the integration of lua related ports with bsd.lua.mk:
-# (please read when updating ports referred here, see lang/lua[0-9]*)
-#
-# The lua/tolua ports have to be patched so they can coexist, as the internal
-# application build infrastructure does not handle it automatically. Currently
-# the framework provides variables to the lua ports themselves, so changing
-# some things here won't require changes in lang/{lua,tolua}*.
-#
-# For lua ports: if they install a static library, use the same method for
-# tolua ports, otherwise in addition the libraries have to be symlinked to the
-# common library directory with a versioned name, and linked with the -soname
-# parameter (so when a port links with -L/usr/local/lib/lua51 -llua, it stores
-# the dynamic dependency as the name which figures under /usr/local/lib).
-#
-# For tolua ports: as it is a static library (.a), installing binaries,
-# headers and libraries under a versioned directory is fine (binary has also a
-# symlink).
-#
-# The lua modules install in a separate directory, so there is no problem.
-#
+# Provide support for lua
-.if !defined(_POSTMKINCLUDED) && !defined(Lua_Pre_Include)
+.if !defined(_INCLUDE_USES_LUA_MK)
+_INCLUDE_USES_LUA_MK= yes
-Lua_Pre_Include= lua.mk
-Lua_Include_MAINTAINER= portmgr at MidnightBSD.org
+_LUA_VALID_VERSIONS= 52 51
-#
-# Global definitions.
-#
+.include "${PORTSDIR}/Mk/bsd.default-versions.mk"
+_LUA_DEFAULT_VERSION= ${LUA_DEFAULT:S/.//}
+.if ! ${_LUA_VALID_VERSIONS:M${_LUA_DEFAULT_VERSION}}
+IGNORE= Invalid lua version ${LUA_DEFAULT}
+.endif
-#.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 toluaxx ruby \
- alien app compat51 dfui filename gettext posix \
- pty socket
-_LUA_DEP_TYPES_ALL= build lib run
-_LUA_VERS_ALL= 4.0 5.0 5.1
-_LUA_PLIST_ALL= LUA_VER LUA_VER_SH LUA_VER_STR LUA_PREFIX LUA_SUBDIR
-_LUA_PLIST_DIR_ALL= LUA_BINDIR LUA_INCDIR LUA_LIBDIR \
- LUA_MODLIBDIR LUA_MODSHAREDIR
-_LUA_VERS_LISTS= WANT_LUA_VER WITH_LUA_VER _LUA_VER_INSTALLED
-
+# Parse a ver+ argument
#
-# 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.
-#
+.if ${lua_ARGS:M*+}
+_LUA_MIN_VERSION:= ${lua_ARGS:M*+:S/+//}
+_LUA_WANTED_VERSION:= ${_LUA_DEFAULT_VERSION}
+.endif
-_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/tolua50
-_LUA_PORT_toluaxx_5.0= lang/tolua++50
-_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/lua50-luasocket
-
-_LUA_PORT_lua_5.1= lang/lua
-_LUA_DEPTYPE_lua_5.1= lib
-
-_LUA_PORT_alien_5.1= devel/lua-alien
-_LUA_PORT_filename_5.1= devel/lua-filename
-_LUA_PORT_gettext_5.1= devel/lua-gettext
-_LUA_PORT_posix_5.1= devel/lua-posix
-_LUA_PORT_pty_5.1= devel/lua-pty
-_LUA_PORT_socket_5.1= net/luasocket
-_LUA_PORT_tolua_5.1= lang/tolua
-_LUA_PORT_toluaxx_5.1= lang/tolua++
-
-. for comp in ${_LUA_COMPS_ALL}
-_LUA_COMP= ${comp}
-. for ver in ${_LUA_VERS_ALL}
-# XXX The hardcoded values here have to match LUA_* variables (later), and
-# are here only to allow autodetection of installed versions.
-. if ${_LUA_COMP} == "lua"
-_LUA_LIB_${comp}_${ver}= lua-${ver}.${_LUA_SHVER_${comp}_${ver}}
-_LUA_SHVER_${comp}_${ver}= ${ver:C/[[:digit:]]\.([[:digit:]])/\1/}
-_LUA_FILE_${comp}_${ver}= ${LOCALBASE}/lib/lua${ver:S/.//g}/liblua.a
-. elif ${_LUA_COMP} == "tolua"
-_LUA_FILE_${comp}_${ver}= ${LOCALBASE}/lib/lua${ver:S/.//g}/libtolua.a
-_LUA_DEPTYPE_${comp}_${ver}=build
-. elif ${_LUA_COMP} == "toluaxx"
-_LUA_FILE_${comp}_${ver}= ${LOCALBASE}/lib/lua${ver:S/.//g}/libtolua++.so
-_LUA_DEPTYPE_${comp}_${ver}=lib
-. elif ${_LUA_COMP} == "ruby"
-_LUA_FILE_${comp}_${ver}= ${RUBY_SITEARCHLIBDIR}/lua-${ver}.so
-_LUA_DEPTYPE_${comp}_${ver}=lib
-. elif !defined(_LUA_FILE_${comp}_${ver})
-_LUA_FILE_${comp}_${ver}= ${LOCALBASE}/share/lua/${ver}/${comp}.lua
-. endif
-. if !defined(_LUA_DEPTYPE_${comp}_${ver})
-_LUA_DEPTYPE_${comp}_${ver}=run
-. endif
-. endfor
-. endfor
-#.endif
-
#
-# Check if we are going to determine the version.
+# Parse one or more ver arguments
#
+.if ${lua_ARGS:M5[1-2]}
+_LUA_WANTED_VERSIONS:= ${lua_ARGS:M5[1-2]}
+.endif
-#.if !defined(_LUA_Version_Done) && (defined(_POSTMKINCLUDED) || \
-# (defined(LUA_PREMK) && defined(BEFOREPORTMK) && \
-# (defined(USE_LUA) || defined(USE_LUA_NOT))))
-_LUA_Need_Version= yes
-#.endif
-
#
-# Check for present components.
+# If no version was specified with any of the ver or ver+ arguments, set the
+# default version.
#
-
-# Requested by the user.
-
-.if defined(WANT_LUA) && defined(BEFOREPORTMK)
-_WANT_LUA= ${WANT_LUA}
+.if !defined(_LUA_WANTED_VERSIONS)
+_LUA_WANTED_VERSIONS= ${_LUA_DEFAULT_VERSION}
.endif
-# Used for autodetection of installed versions.
-
-.if defined(_LUA_Need_Version)
-_WANT_LUA= yes
-.endif
-
-.if defined(_WANT_LUA)
-. undef _HAVE_LUA
-. 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:tl} == "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
-
-# Requested by the user.
-
-.if defined(WANT_LUA) && defined(BEFOREPORTMK)
-HAVE_LUA:= ${_HAVE_LUA}
-.endif
-
-# Used for autodetection of installed versions.
-
-.if defined(_LUA_Need_Version)
-_LUA_VER_INSTALLED:= ${_HAVE_LUA:Mlua-*:S/lua-//}
-.endif
-
#
-# Select Lua version.
+# Resolve minimum versions (ver+). Append anything greater or equal than the
+# specified minimum version to the list of wanted versions.
#
+.if defined(_LUA_MIN_VERSION)
+. for _v in ${_LUA_VALID_VERSIONS}
+. if ${_LUA_MIN_VERSION} <= ${_v}
+_LUA_WANTED_VERSIONS+=${_v}
+. endif
+. endfor
+.endif
-.if defined(_LUA_Need_Version)
-_LUA_Version_Done= yes
-
#
-# Basic component parsing (ignores dependency types).
+# Right now we have built a list of potential versions that we may depend on.
+# Let's sort them and remove any duplicates. We then locate the highest one
+# already installed, if any.
#
-# The variables used are:
-# _LUA_COMP - Component part.
-# _LUA_COMPS_FINAL - Final list of components.
-#
-
-# Detect duplicated components.
-
-_LUA_COMPS_FINAL= #
-.for comp in ${LUA_COMPS}
-_LUA_COMP= ${comp:C/:([[:alpha:]]+)$//}
-. for __LUA_COMP in ${_LUA_COMP}
-. if ${_LUA_COMPS_ALL:M${__LUA_COMP}} == ""
-IGNORE?= selected an invalid Lua component: ${__LUA_COMP}
-. endif
-. endfor
-. for newcomp in ${_LUA_COMP}
-. if ${_LUA_COMPS_FINAL:M${newcomp}} == ""
-_LUA_COMPS_FINAL+= ${newcomp}
-. endif
-. endfor
+.for _v in ${_LUA_WANTED_VERSIONS:O:u}
+_LUA_HIGHEST_VERSION:=${_v}
+. if exists(${LOCALBASE}/bin/lua${_v})
+_LUA_WANTED_VERSION:= ${_v}
+. endif
.endfor
-# 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
-
-# Remove unusable installed versions.
-
-.for ver in ${_LUA_VER_INSTALLED}
-. if ${_LUA_VER_FINAL:M${ver}} == ""
-_LUA_VER_INSTALLED:= ${_LUA_VER_INSTALLED:N${ver}}
-. endif
-.endfor
-
-# Check for a null version.
-
-.if empty(_LUA_VER_FINAL)
-IGNORE?= selected a null or invalid Lua version
+# If we couldn't find any wanted version installed, depend on the highest one.
+.if !defined(_LUA_WANTED_VERSION)
+_LUA_WANTED_VERSION:= ${_LUA_HIGHEST_VERSION}
.endif
-# Avoid versions which have unavailable components.
-
-.for ver in ${_LUA_VER_FINAL}
-. for comp in ${_LUA_COMPS_FINAL}
-. if !defined(_LUA_PORT_${comp}_${ver})
-_LUA_WRONG_COMPS+= ${comp}
-_LUA_WRONG_VERS+= ${ver}
-_LUA_VER_FINAL:= ${_LUA_VER_FINAL:N${ver}}
-. endif
-. endfor
-.endfor
-
-.if empty(_LUA_VER_FINAL)
-IGNORE?= selected Lua versions (${_LUA_WRONG_VERS}) which do not have the selected components (${_LUA_WRONG_COMPS})
-.endif
-
#
-# Choose final version.
+# Exported variables
#
+LUA_VER_STR= ${_LUA_WANTED_VERSION}
+LUA_VER= ${_LUA_WANTED_VERSION:S/5/5./}
+LUA_CMD= lua${_LUA_WANTED_VERSION}
+LUAC_CMD= luac${_LUA_WANTED_VERSION}
+LUA_INCDIR= ${LOCALBASE}/include/lua${_LUA_WANTED_VERSION}
+LUA_MODLIBDIR= ${LOCALBASE}/lib/lua/${LUA_VER}
+LUA_MODSHAREDIR= ${LOCALBASE}/share/lua/${LUA_VER}
+LUA_LIBDIR= ${LOCALBASE}/lib
+LUA_PKGNAMEPREFIX= lua${LUA_VER_STR}-
-#
-# Check for the following (in order):
-# 1) WITH_LUA_VER - User preference.
-# 2) WANT_LUA_VER - Port preference.
-# 3) _LUA_VER_INSTALLED - Installed versions.
-# 4) _LUA_VER_FINAL - Available versions.
-#
+PLIST_SUB+= LUA_MODLIBDIR=${LUA_MODLIBDIR:S,^${LOCALBASE}/,,} \
+ LUA_MODSHAREDIR=${LUA_MODSHAREDIR:S,^${LOCALBASE}/,,} \
+ LUA_VER=${LUA_VER} \
+ LUA_INCDIR=${LUA_INCDIR:S,^${LOCALBASE}/,,} \
+ LUA_LIBDIR=${LUA_LIBDIR:S,^${LOCALBASE}/,,} \
+ LUA_VER_STR=${LUA_VER_STR}
+MAKE_ENV+= LUA_MODLIBDIR=${LUA_MODLIBDIR} \
+ LUA_MODSHAREDIR=${LUA_MODSHAREDIR} \
+ LUA_VER=${LUA_VER} \
+ LUA_INCDIR=${LUA_INCDIR} \
+ LUA_LIBDIR=${LUA_LIBDIR}
-.for list in _LUA_VER_FINAL ${_LUA_VERS_LISTS}
-. 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}
-
-# Package name.
-LUA_PKGNAMEPREFIX?= lua${LUA_VER_STR}-
-LUA_SUBDIR?= lua${LUA_VER_STR}
-
-# Currently Lua ports (those which install Lua and modules) must either:
-# 1. Have PORTNAME=lua and LATEST_LINK=${LUA_SUBDIR} (currently Lua ports).
-# 2. Have PKGNAMEPREFIX=${LUA_PKGNAMEPREFIX} (currently Lua modules).
-# 3. Have LUA_PREFIX?=${PREFIX} (currently none).
-#
-# FIXME: the correct solution to this problem could be either:
-# 1. Create a lua*-config script, and make dependent ports use it.
-# 2. Set in each port if it's a "Lua module", or just requires Lua.
-#
-
-.if (defined(PKGNAMEPREFIX) && ${PKGNAMEPREFIX} == ${LUA_PKGNAMEPREFIX}) || \
- (${PORTNAME} == "lua" && defined(LATEST_LINK) && \
- ${LATEST_LINK} == ${LUA_SUBDIR})
-# For Lua and modules, which need to install in LUA_*DIR, respect PREFIX.
-LUA_PREFIX?= ${PREFIX}
+.if ${lua_ARGS:Mbuild}
+BUILD_DEPENDS+= ${LUA_CMD}:${PORTSDIR}/lang/lua${LUA_VER_STR}
+.elfif ${lua_ARGS:Mrun}
+RUN_DEPENDS+= ${LUA_CMD}:${PORTSDIR}/lang/lua${LUA_VER_STR}
.else
-# For dependencies using LUA_{INC,LIB}DIR, use LOCALBASE as expected.
-LUA_PREFIX?= ${LOCALBASE}
+LIB_DEPENDS+= liblua-${LUA_VER}.so:${PORTSDIR}/lang/lua${LUA_VER_STR}
.endif
-# Paths.
-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}
-
-# Programs.
-LUA_CMD?= ${LUA_PREFIX}/bin/lua-${LUA_VER}
-LUAC_CMD?= ${LUA_PREFIX}/bin/luac-${LUA_VER}
-TOLUA_CMD?= ${LUA_PREFIX}/bin/tolua-${LUA_VER}
-TOLUAXX_CMD?= ${LUA_PREFIX}/bin/tolua++-${LUA_VER}
-
-.endif # _LUA_Need_Version
-
-#
-# Process components list and add dependencies, variables, etc.
-#
-.endif # !defined(_POSTMKINCLUDED) && !defined(Lua_Pre_Include)
-.if defined(_POSTMKINCLUDED) && !defined(Lua_Post_Include)
-
-Lua_Post_Include= lua.mk
-
-#
-# 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}} == "" && !defined(IGNORE)
-_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:tu}_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
+.endif
Modified: trunk/lang/lua51/Makefile
===================================================================
--- trunk/lang/lua51/Makefile 2014-10-10 11:02:19 UTC (rev 17711)
+++ trunk/lang/lua51/Makefile 2014-10-10 11:24:59 UTC (rev 17712)
@@ -1,14 +1,13 @@
+# Created by: GreenDog <fiziologus at gmail.com>
# $MidnightBSD$
+# $FreeBSD: head/lang/lua51/Makefile 359939 2014-06-30 22:49:52Z bapt $
PORTNAME= lua
PORTVERSION= 5.1.5
-CATEGORIES= lang lua
-MASTER_SITES= http://www.lua.org/ftp/ \
- ftp://ftp.tecgraf.puc-rio.br/pub/lua/ \
- ftp://csg.uwaterloo.ca/pub/lhf/lua/ \
- ftp://ftp.ntua.gr/pub/lang/lua/ \
- ftp://ftp.uni-trier.de/pub/languages/lua/ \
- ftp://ftp.gwdg.de/pub/languages/lua/
+PORTREVISION= 1
+CATEGORIES= lang
+MASTER_SITES= http://www.lua.org/ftp/
+PKGNAMESUFFIX= 51
MAINTAINER= ports at MidnightBSD.org
COMMENT= Small, compilable scripting language providing easy access to C code
@@ -15,54 +14,48 @@
LICENSE= mit
-PATCH_WRKSRC= ${WRKSRC}/src
-USES= pkgconfig
-USE_LUA= 5.1
-LUA_COMPS= # only define variables
-ALL_TARGET= freebsd
+FAKE_OPTS= prefixhack
+LUA_VER= 5.1
+USES= readline
USE_LDCONFIG= yes
-.include <bsd.mport.options.mk>
+MAKE_ARGS= __MAKE_CONF=${NONEXISTENT}
+LDFLAGS+= -lm -pthread
+BUILD_WRKSRC= ${WRKSRC}/src
+MAKE_ARGS+= MYCFLAGS="${CFLAGS} ${CPPFLAGS} -DLUA_USE_LINUX" \
+ MYLDFLAGS="${LDFLAGS} -Wl,-E -lreadline" \
+ CC="${CC}" \
+ LUA_T=lua51 \
+ LUAC_T=luac51 \
+ LUA_A=liblua-${LUA_VER}.a \
+ LUA_SO=liblua-${LUA_VER}.so \
+ LUA_SONAME=liblua-${LUA_VER}.so \
+ TO_BIN="lua51 luac51" \
+ TO_LIB="liblua-${LUA_VER}.a liblua-${LUA_VER}.so" \
+ INSTALL_TOP=${PREFIX} \
+ INSTALL_INC=${FAKE_DESTDIR}${TRUE_PREFIX}/include/lua51 \
+ INSTALL_EXEC="${INSTALL_PROGRAM}"
+FAKE_MAKEARGS+= ${MAKE_ARGS}
-MAKE_ENV= LUA_SONAME="liblua-${LUA_VER}.so.${LUA_VER_SH}"
+# Cope with the lack of support for Lua 5.2 in bsd.lua.mk. These
+# overrides, which are required below, should be removed once bsd.lua.mk
+# understands this lua version.
+LUA_PREFIX?= ${PREFIX}
+LUA_SUBDIR?= lua${PKGNAMESUFFIX}
+LUA_INCDIR?= ${LUA_PREFIX}/include/${LUA_SUBDIR}
+LUA_LIBDIR?= ${LUA_PREFIX}/lib
-MAN1= lua-${LUA_VER}.1 luac-${LUA_VER}.1
-DOCSDIR= ${PREFIX}/share/doc/${LUA_SUBDIR}
-PORTDOCS= *
-LATEST_LINK= ${LUA_SUBDIR}
+CFLAGS_amd64= -fPIC
-LUA_VER?= ${_LUA_VER}
-LUA_VER_SH?= ${LUA_VER:C/[[:digit:]]\.([[:digit:]])/\1/}
-LUA_VER_STR?= ${LUA_VER:S/.//g}
-
-# Package name.
-LUA_PKGNAMEPREFIX?= lua${LUA_VER_STR}-
-LUA_SUBDIR?= lua${LUA_VER_STR}
-LUA_PREFIX= ${PREFIX}
-LUA_BINDIR?= ${LUA_PREFIX}/bin/${LUA_SUBDIR}
-LUA_INCDIR?= ${LUA_PREFIX}/include/${LUA_SUBDIR}
-LUA_LIBDIR?= ${LUA_PREFIX}/lib/${LUA_SUBDIR}
-LUA_MODLIBDIR?= ${LUA_PREFIX}/lib/lua/${LUA_VER}
-LUA_MODSHAREDIR?= ${LUA_PREFIX}/share/lua/${LUA_VER}
-LUA_BIN= lua luac
-LUA_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-LUA_MAN= ${LUA_BIN:S/$/.1/}
-LUA_ETC= Makefile README all.c lua.ico luavs.bat min.c \
- noparser.c strict.lua
-LUA_TEST= README bisect.lua cf.lua echo.lua env.lua factorial.lua \
- fib.lua fibfor.lua globals.lua hello.lua life.lua luac.lua \
- printf.lua readonly.lua sieve.lua sort.lua table.lua \
- trace-calls.lua trace-globals.lua xd.lua
-
-.include <bsd.port.pre.mk>
-
post-patch:
@${REINPLACE_CMD} -Ee \
'/^INSTALL_.*=/s/INSTALL_TOP/prefix/ ; \
- s|^(CC\|AR\|RANLIB)=|\1?=| ; \
- /^CFLAGS=/ { s/=/+=/; s/-O2//; } ; \
- s|/usr/local|${PREFIX}|' \
- ${WRKSRC}/Makefile ${WRKSRC}/src/Makefile
+ s|/usr/local|${PREFIX}|' \
+ ${WRKSRC}/Makefile ${WRKSRC}/src/Makefile
+ @${REINPLACE_CMD} -e 's,rand *(,random(,g' \
+ ${WRKSRC}/src/lmathlib.c
+ @${REINPLACE_CMD} -e "/LUA_ROOT/s|/usr/local|${LUA_PREFIX}|" \
+ ${WRKSRC}/src/luaconf.h
@${REINPLACE_CMD} -i '' -Ee \
's|^(prefix=).*|\1 ${PREFIX}| ; \
s|^(libdir=).*|\1 ${LUA_LIBDIR}| ; \
@@ -71,65 +64,17 @@
s|^(INSTALL_INC=).*|\1 ${LUA_INCDIR}| ; \
s|^(INSTALL_LIB=).*|\1 ${LUA_LIBDIR}| ; \
s|^(INSTALL_CMOD=).*|\1 ${LUA_MODLIBDIR}| ; \
- s|^(INSTALL_LMOD=).*|\1 ${LUA_MODSHAREDIR}|' \
+ s|^(INSTALL_LMOD=).*|\1 ${LUA_MODSHAREDIR}| ; \
+ s|llua|llua-${LUA_VER}|' \
${WRKSRC}/etc/lua.pc
- @${REINPLACE_CMD} -e 's,rand *(,random(,g' \
- ${WRKSRC}/src/lmathlib.c
- @${REINPLACE_CMD} -e '/LUA_ROOT/s|/usr/local|${TRUE_PREFIX}|' \
- ${WRKSRC}/src/luaconf.h
-post-build:
- @${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac
+post-install:
+ @${STRIP_CMD} ${PREFIX}/lib/liblua-${LUA_VER}.so
+ @${MV} ${PREFIX}/man/man1/lua.1 \
+ ${PREFIX}/man/man1/lua51.1
+ @${MV} ${PREFIX}/man/man1/luac.1 \
+ ${PREFIX}/man/man1/luac51.1
+ ${INSTALL_DATA} ${WRKSRC}/etc/lua.pc \
+ ${PREFIX}/libdata/pkgconfig/lua-${LUA_VER}.pc
-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}
- ${INSTALL_PROGRAM} ${WRKSRC}/src/liblua.so \
- ${LUA_LIBDIR}/liblua-${LUA_VER}.so.${LUA_VER_SH}
- @${LN} -sf liblua-${LUA_VER}.so.${LUA_VER_SH} ${LUA_LIBDIR}/liblua.so
- @${LN} -sf ${LUA_SUBDIR}/liblua-${LUA_VER}.so.${LUA_VER_SH} \
- ${PREFIX}/lib
- @${LN} -sf liblua-${LUA_VER}.so.${LUA_VER_SH} \
- ${PREFIX}/lib/liblua-${LUA_VER}.so
-# 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}
- ${MKDIR} ${DOCSDIR}/etc
- ${MKDIR} ${DOCSDIR}/test
- ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
- cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif ${DOCSDIR}
-.for f in ${LUA_ETC}
- ${INSTALL_DATA} ${WRKSRC}/etc/${f} ${DOCSDIR}/etc
-.endfor
-.for f in ${LUA_TEST}
- ${INSTALL_DATA} ${WRKSRC}/test/${f} ${DOCSDIR}/test
-.endfor
-.endif
-# lua.pc
- ${INSTALL_DATA} ${WRKSRC}/etc/lua.pc ${PREFIX}/libdata/pkgconfig/lua-${LUA_VER}.pc
-# Module directories.
- ${MKDIR} ${LUA_MODLIBDIR}
- ${MKDIR} ${LUA_MODSHAREDIR}
-
-.if ${MACHINE_ARCH:L} == "amd64"
-CFLAGS+= -fPIC
-.endif
-
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
Deleted: trunk/lang/lua51/files/patch-src-Makefile
===================================================================
--- trunk/lang/lua51/files/patch-src-Makefile 2014-10-10 11:02:19 UTC (rev 17711)
+++ trunk/lang/lua51/files/patch-src-Makefile 2014-10-10 11:24:59 UTC (rev 17712)
@@ -1,40 +0,0 @@
---- Makefile.orig 2008-01-19 17:37:58.000000000 -0200
-+++ Makefile 2008-08-10 16:00:41.000000000 -0300
-@@ -9,7 +9,8 @@
-
- CC= gcc
- CFLAGS= -O2 -Wall $(MYCFLAGS)
--AR= ar rcu
-+ARFLAGS= rcu
-+AR= ar
- RANLIB= ranlib
- RM= rm -f
- LIBS= -lm $(MYLIBS)
-@@ -31,12 +32,13 @@
-
- LUA_T= lua
- LUA_O= lua.o
-+LUA_SO= liblua.so
-
- LUAC_T= luac
- LUAC_O= luac.o print.o
-
- ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
--ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
-+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
- ALL_A= $(LUA_A)
-
- default: $(PLAT)
-@@ -47,8 +49,11 @@
-
- a: $(ALL_A)
-
-+$(LUA_SO): $(CORE_O) $(LIB_O)
-+ $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(MYLDFLAGS) -shared -Wl,-soname=$(LUA_SONAME) $?
-+
- $(LUA_A): $(CORE_O) $(LIB_O)
-- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
-+ $(AR) $(ARFLAGS) $@ $?
- $(RANLIB) $@
-
- $(LUA_T): $(LUA_O) $(LUA_A)
Copied: trunk/lang/lua51/files/patch-src__Makefile (from rev 17711, trunk/lang/lua51/files/patch-src-Makefile)
===================================================================
--- trunk/lang/lua51/files/patch-src__Makefile (rev 0)
+++ trunk/lang/lua51/files/patch-src__Makefile 2014-10-10 11:24:59 UTC (rev 17712)
@@ -0,0 +1,27 @@
+--- ./src/Makefile.orig 2012-02-13 21:41:22.000000000 +0100
++++ ./src/Makefile 2014-04-21 18:56:02.738071455 +0200
+@@ -31,12 +31,13 @@
+
+ LUA_T= lua
+ LUA_O= lua.o
++LUA_SO= liblua.so
+
+ LUAC_T= luac
+ LUAC_O= luac.o print.o
+
+ ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
+ ALL_A= $(LUA_A)
+
+ default: $(PLAT)
+@@ -47,6 +48,9 @@
+
+ a: $(ALL_A)
+
++$(LUA_SO): $(CORE_O) $(LIB_O)
++ $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(MYLDFLAGS) -shared -Wl,-soname=$(LUA_SONAME) $?
++
+ $(LUA_A): $(CORE_O) $(LIB_O)
+ $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
+ $(RANLIB) $@
Modified: trunk/lang/lua51/pkg-plist
===================================================================
--- trunk/lang/lua51/pkg-plist 2014-10-10 11:02:19 UTC (rev 17711)
+++ trunk/lang/lua51/pkg-plist 2014-10-10 11:24:59 UTC (rev 17712)
@@ -1,24 +1,17 @@
- at exec mkdir -p %D/share/lua/%%LUA_VER%%
- at 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
-lib/liblua-%%LUA_VER%%.so
-lib/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
-%%LUA_LIBDIR%%/liblua.a
-%%LUA_LIBDIR%%/liblua.so
-%%LUA_LIBDIR%%/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
-libdata/pkgconfig/lua-%%LUA_VER%%.pc
- at dirrm share/lua/%%LUA_VER%%
- at dirrmtry share/lua
- at dirrm %%LUA_LIBDIR%%
- at dirrm lib/lua/%%LUA_VER%%
+bin/lua51
+bin/luac51
+include/lua51/lauxlib.h
+include/lua51/lua.h
+include/lua51/lua.hpp
+include/lua51/luaconf.h
+include/lua51/lualib.h
+lib/liblua-5.1.a
+lib/liblua-5.1.so
+libdata/pkgconfig/lua-5.1.pc
+man/man1/lua51.1.gz
+man/man1/luac51.1.gz
+ at dirrmtry %%DATADIR%%/5.1
+ at dirrmtry %%DATADIR%%
+ at dirrmtry lib/lua/5.1
@dirrmtry lib/lua
- at dirrm %%LUA_INCDIR%%
- at dirrm %%LUA_BINDIR%%
+ at dirrmtry include/lua51
More information about the Midnightbsd-cvs
mailing list