- Merge patch-Makefile into patch-src-Makefile (both actually patch same file).

- Patch lang/lua to behave as expected by the framework.
- Add missing library dependency (only run before) when using lua 5.1.
- Add notes in bsd.lua.mk for updating lang/lua* ports describing how they are
  integrated into the ports tree.

PR:		ports/126207
Submitted by:	Daniel Roethlisberger <daniel@roe.ch>
This commit is contained in:
Alejandro Pulver 2008-08-10 19:29:43 +00:00
parent 344acaf18a
commit b2fe6b6e8d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=218355
5 changed files with 58 additions and 39 deletions

View file

@ -105,6 +105,26 @@
# running. # running.
# USE_LUA_NOT=5.1 # 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.
#
LUA_Include_MAINTAINER= alepulver@FreeBSD.org LUA_Include_MAINTAINER= alepulver@FreeBSD.org
@ -164,7 +184,7 @@ _LUA_PORT_pty_5.0= devel/lua50-pty
_LUA_PORT_socket_5.0= net/lua50-luasocket _LUA_PORT_socket_5.0= net/lua50-luasocket
_LUA_PORT_lua_5.1= lang/lua _LUA_PORT_lua_5.1= lang/lua
_LUA_DEPTYPE_lua_5.1= build _LUA_DEPTYPE_lua_5.1= lib
_LUA_PORT_filename_5.1= devel/lua-filename _LUA_PORT_filename_5.1= devel/lua-filename
_LUA_PORT_gettext_5.1= devel/lua-gettext _LUA_PORT_gettext_5.1= devel/lua-gettext

View file

@ -7,7 +7,7 @@
PORTNAME= lua PORTNAME= lua
PORTVERSION= 5.1.3 PORTVERSION= 5.1.3
PORTREVISION= 2 PORTREVISION= 3
CATEGORIES= lang CATEGORIES= lang
MASTER_SITES= http://www.lua.org/ftp/ \ MASTER_SITES= http://www.lua.org/ftp/ \
ftp://ftp.tecgraf.puc-rio.br/pub/lua/ \ ftp://ftp.tecgraf.puc-rio.br/pub/lua/ \
@ -23,7 +23,8 @@ USE_LUA= 5.1
LUA_COMPS= # only define variables LUA_COMPS= # only define variables
ALL_TARGET= freebsd ALL_TARGET= freebsd
USE_GNOME= pkgconfig USE_GNOME= pkgconfig
USE_LDCONFIG= ${LUA_LIBDIR} USE_LDCONFIG= yes
MAKE_ENV= LUA_SONAME="liblua-${LUA_VER}.so.${LUA_VER_SH}"
MAN1= lua-${LUA_VER}.1 luac-${LUA_VER}.1 MAN1= lua-${LUA_VER}.1 luac-${LUA_VER}.1
DOCSDIR= ${PREFIX}/share/doc/${LUA_SUBDIR} DOCSDIR= ${PREFIX}/share/doc/${LUA_SUBDIR}
@ -46,7 +47,7 @@ post-patch:
s|^(CFLAGS=)|\1 ${CFLAGS}| ; \ s|^(CFLAGS=)|\1 ${CFLAGS}| ; \
s|/usr/local|${PREFIX}|' \ s|/usr/local|${PREFIX}|' \
${WRKSRC}/Makefile ${WRKSRC}/src/Makefile ${WRKSRC}/Makefile ${WRKSRC}/src/Makefile
@${REINPLACE_CMD} -Ee \ @${REINPLACE_CMD} -i '' -Ee \
's|^(prefix=).*|\1 ${PREFIX}| ; \ 's|^(prefix=).*|\1 ${PREFIX}| ; \
s|^(libdir=).*|\1 ${LUA_LIBDIR}| ; \ s|^(libdir=).*|\1 ${LUA_LIBDIR}| ; \
s|^(includedir=).*|\1 ${LUA_INCDIR}| ; \ s|^(includedir=).*|\1 ${LUA_INCDIR}| ; \
@ -55,7 +56,7 @@ post-patch:
s|^(INSTALL_LIB=).*|\1 ${LUA_LIBDIR}| ; \ s|^(INSTALL_LIB=).*|\1 ${LUA_LIBDIR}| ; \
s|^(INSTALL_CMOD=).*|\1 ${LUA_MODLIBDIR}| ; \ s|^(INSTALL_CMOD=).*|\1 ${LUA_MODLIBDIR}| ; \
s|^(INSTALL_LMOD=).*|\1 ${LUA_MODSHAREDIR}|' \ s|^(INSTALL_LMOD=).*|\1 ${LUA_MODSHAREDIR}|' \
${WRKSRC}/etc/lua.pc && ${RM} ${WRKSRC}/etc/lua.pc.bak ${WRKSRC}/etc/lua.pc
post-build: post-build:
@${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac @${RM} -f ${WRKSRC}/test/lua ${WRKSRC}/test/luac
@ -75,8 +76,13 @@ do-install:
# Libraries. # Libraries.
${MKDIR} ${LUA_LIBDIR} ${MKDIR} ${LUA_LIBDIR}
${INSTALL_DATA} ${WRKSRC}/src/liblua.a ${LUA_LIBDIR} ${INSTALL_DATA} ${WRKSRC}/src/liblua.a ${LUA_LIBDIR}
${INSTALL_PROGRAM} ${WRKSRC}/src/liblua.so ${LUA_LIBDIR}/liblua.so.1 ${INSTALL_PROGRAM} ${WRKSRC}/src/liblua.so \
cd ${LUA_LIBDIR} && ${LN} -s liblua.so.1 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. # Manual pages.
.for f in ${LUA_MAN} .for f in ${LUA_MAN}
${INSTALL_MAN} ${WRKSRC}/doc/${f} \ ${INSTALL_MAN} ${WRKSRC}/doc/${f} \
@ -97,7 +103,6 @@ do-install:
.endfor .endfor
.endif .endif
# lua.pc # lua.pc
${MKDIR} ${LOCALBASE}/libdata/pkgconfig
${INSTALL_DATA} ${WRKSRC}/etc/lua.pc ${PREFIX}/libdata/pkgconfig/lua-${LUA_VER}.pc ${INSTALL_DATA} ${WRKSRC}/etc/lua.pc ${PREFIX}/libdata/pkgconfig/lua-${LUA_VER}.pc
# Module directories. # Module directories.
${MKDIR} ${LUA_MODLIBDIR} ${MKDIR} ${LUA_MODLIBDIR}

View file

@ -1,27 +0,0 @@
--- src/Makefile.orig 2008-05-29 19:24:46.000000000 +0900
+++ src/Makefile 2008-05-29 19:27:30.000000000 +0900
@@ -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 $@ $(MYLDFLAGS) -shared $?
+
$(LUA_A): $(CORE_O) $(LIB_O)
$(AR) $@ $?
$(RANLIB) $@

View file

@ -1,5 +1,5 @@
--- src/Makefile.orig 2006-03-21 17:41:49.000000000 -0700 --- ./src/Makefile.orig 2008-01-19 17:37:58.000000000 -0200
+++ src/Makefile 2008-03-18 09:41:01.000000000 -0600 +++ ./src/Makefile 2008-08-10 16:00:41.000000000 -0300
@@ -9,7 +9,8 @@ @@ -9,7 +9,8 @@
CC= gcc CC= gcc
@ -10,9 +10,28 @@
RANLIB= ranlib RANLIB= ranlib
RM= rm -f RM= rm -f
LIBS= -lm $(MYLIBS) LIBS= -lm $(MYLIBS)
@@ -48,7 +49,7 @@ @@ -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) a: $(ALL_A)
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -o $@ $(MYLDFLAGS) -shared -Wl,-soname=$(LUA_SONAME) $?
+
$(LUA_A): $(CORE_O) $(LIB_O) $(LUA_A): $(CORE_O) $(LIB_O)
- $(AR) $@ $? - $(AR) $@ $?
+ $(AR) $(ARFLAGS) $@ $? + $(AR) $(ARFLAGS) $@ $?

View file

@ -9,9 +9,11 @@ bin/luac-%%LUA_VER%%
%%LUA_INCDIR%%/lua.hpp %%LUA_INCDIR%%/lua.hpp
%%LUA_INCDIR%%/luaconf.h %%LUA_INCDIR%%/luaconf.h
%%LUA_INCDIR%%/lualib.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.a
%%LUA_LIBDIR%%/liblua.so %%LUA_LIBDIR%%/liblua.so
%%LUA_LIBDIR%%/liblua.so.1 %%LUA_LIBDIR%%/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
libdata/pkgconfig/lua-%%LUA_VER%%.pc libdata/pkgconfig/lua-%%LUA_VER%%.pc
%%PORTDOCS%%%%DOCSDIR%%/README %%PORTDOCS%%%%DOCSDIR%%/README
%%PORTDOCS%%%%DOCSDIR%%/amazon.gif %%PORTDOCS%%%%DOCSDIR%%/amazon.gif