Bug 180786

Summary: lang/lua52 lacks a pkgconfig file
Product: Ports & Packages Reporter: Julio Merino <julio+host-mastodon-jmmv>
Component: Individual Port(s)Assignee: lua
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
lua52.diff
none
lua52.diff none

Description Julio Merino 2013-07-24 02:20:00 UTC
	The lua52 package does not install a pkgconfig file, just like
	other versions of lua did.  This prevents software that rely on
	such file to exist from building.

How-To-Repeat: 	Install lua52.  Attempt to build lutok against it and see it not
	find Lua.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-07-24 02:23:27 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-07-24 02:23:27 UTC
Maintainer of lang/lua52,

Please note that PR ports/180786 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/180786

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 fiziologus 2013-07-24 19:56:31 UTC
Thanks.
Lua-5.2 does not have a itself pc file. create it on my own I did not dare.

-- 
sorry for bad english.
Comment 4 asomers 2013-10-15 20:33:35 UTC
Julio's patch works for me, but I made two changes.
1) Increase PORTREVISION to 2 because somebody else has already
increased it to 1
2) Use SUB_FILES and SUB_LIST instead of a manual sed command

My updated patch is below:

Index: Makefile
===================================================================
--- Makefile    (revision 330331)
+++ Makefile    (working copy)
@@ -3,7 +3,7 @@

 PORTNAME=      lua
 PORTVERSION=   5.2.2
-PORTREVISION=  1
+PORTREVISION=  2
 CATEGORIES=    lang
 MASTER_SITES=  http://www.lua.org/ftp/

@@ -12,7 +12,6 @@

 LICENSE=       MIT

-#USE_LUA=      5.2
 LUA_VER=       5.2
 LUA_VER_SH=    1
 LUA_VER_STR=   52
@@ -25,6 +24,7 @@
 LUA_MODSHAREDIR=       ${LUA_PREFIX}/share/lua/${LUA_VER}

 ALL_TARGET=    freebsd
+USES=          pkgconfig
 USE_LDCONFIG=  yes
 MAKE_ENV=      LUA_SONAME="liblua-${LUA_VER}.so.${LUA_VER_SH}" \
                MYCFLAGS="${CFLAGS}" MYLDFLAGS="${LDFLAGS}"
@@ -58,6 +58,10 @@
        @${REINPLACE_CMD} -e "/LUA_ROOT/s|/usr/local|${LUA_PREFIX}|" \
                ${WRKSRC}/src/luaconf.h

+SUB_FILES=     lua-5.2.pc
+SUB_LIST=      VERSION=${PORTVERSION} LIBDIR=${LUA_LIBDIR} \
+               INCLUDEDIR=${LUA_INCDIR}
+
 post-install:
 .for f in lua luac
        ${LN} -sf ${LUA_BINDIR}/${f} ${PREFIX}/bin/${f}-${LUA_VER}
@@ -65,6 +69,7 @@
        ${LN} -sf ${LUA_LIBDIR}/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
+       ${INSTALL_DATA} ${WRKDIR}/lua-${LUA_VER}.pc ${PREFIX}/libdata/pkgconfig

 # Documentation.
 .if ${PORT_OPTIONS:MDOCS}
Index: files/lua-5.2.pc.in
===================================================================
--- files/lua-5.2.pc.in (revision 0)
+++ files/lua-5.2.pc.in (working copy)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+version=%%VERSION%%
+libdir=%%LIBDIR%%
+includedir=%%INCLUDEDIR%%
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: ${version}
+Libs: -L${libdir} -llua -lm
+Cflags: -I${includedir}
Index: pkg-plist
===================================================================
--- pkg-plist   (revision 330331)
+++ pkg-plist   (working copy)
@@ -12,6 +12,7 @@
 lib/lua52/liblua-5.2.so.1
 lib/lua52/liblua.a
 lib/lua52/liblua.so
+libdata/pkgconfig/lua-5.2.pc
 %%PORTDOCS%%%%DOCSDIR%%/contents.html
 %%PORTDOCS%%%%DOCSDIR%%/logo.gif
 %%PORTDOCS%%%%DOCSDIR%%/lua.css
Comment 5 Julio Merino 2013-12-29 13:03:30 UTC
Here comes an updated version of the patch to add a pkgconfig file for
lua52.  I've also taken the chance to merge in asomer's improvements
of using SUB_FILES instead of a manual sed command.

-- 
Julio Merino / @jmmv
Comment 6 Julio Merino 2013-12-29 13:11:12 UTC
... and now a patch that actually works. The previous one had the
wrong soname and libdir.

Note also that the current lua52 package is broken because LUA_PREFIX
is _not_ defined and thus the replacement that is happening inside
luaconf.h is bogus. This is fixed here as well as a side-effect.

-- 
Julio Merino / @jmmv
Comment 7 Mark Linimon freebsd_committer freebsd_triage 2014-01-04 05:47:46 UTC
Responsible Changed
From-To: freebsd-ports-bugs->lua

reassign.
Comment 8 dfilter service freebsd_committer freebsd_triage 2014-01-10 08:23:00 UTC
Author: bapt
Date: Fri Jan 10 08:22:53 2014
New Revision: 339320
URL: http://svnweb.freebsd.org/changeset/ports/339320

Log:
  Add a .pc file to lua52
  
  PR:		ports/180786
  Submitted by:	jmmv

Modified:
  head/lang/lua52/Makefile
  head/lang/lua52/pkg-plist

Modified: head/lang/lua52/Makefile
==============================================================================
--- head/lang/lua52/Makefile	Fri Jan 10 08:12:49 2014	(r339319)
+++ head/lang/lua52/Makefile	Fri Jan 10 08:22:53 2014	(r339320)
@@ -3,6 +3,7 @@
 
 PORTNAME=	lua
 PORTVERSION=	5.2.3
+PORTREVISION=	1
 CATEGORIES=	lang
 MASTER_SITES=	http://www.lua.org/ftp/
 PKGNAMESUFFIX=	52
@@ -15,6 +16,8 @@ LICENSE=	MIT
 LUA_VER=	5.2
 USES=		pkgconfig readline
 USE_LDCONFIG=	yes
+SUB_FILES=	lua-${LUA_VER}.pc
+SUB_LIST=	LUA_VERSION=${PORTVERSION}
 
 # Overriding __MAKE_CONF makes sure that we don't re-parse
 # /etc/make.conf during do-build, which would jeopardize the build
@@ -53,6 +56,8 @@ post-patch:
 		${WRKSRC}/src/luaconf.h
 
 post-install:
+	@${MV} ${WRKDIR}/lua-${LUA_VER}.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig
+	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/liblua-${LUA_VER}.so
 	@${MV} ${STAGEDIR}${PREFIX}/man/man1/lua.1 \
 		${STAGEDIR}${PREFIX}/man/man1/lua52.1
 	@${MV} ${STAGEDIR}${PREFIX}/man/man1/luac.1 \

Modified: head/lang/lua52/pkg-plist
==============================================================================
--- head/lang/lua52/pkg-plist	Fri Jan 10 08:12:49 2014	(r339319)
+++ head/lang/lua52/pkg-plist	Fri Jan 10 08:22:53 2014	(r339320)
@@ -7,6 +7,7 @@ include/lua52/luaconf.h
 include/lua52/lualib.h
 lib/liblua-5.2.a
 lib/liblua-5.2.so
+libdata/pkgconfig/lua-5.2.pc
 man/man1/lua52.1.gz
 man/man1/luac52.1.gz
 @dirrmtry %%DATADIR%%/5.2
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 9 Baptiste Daroussin freebsd_committer freebsd_triage 2014-01-10 08:30:53 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!
Comment 10 dfilter service freebsd_committer freebsd_triage 2014-01-10 08:39:20 UTC
Author: bapt
Date: Fri Jan 10 08:39:12 2014
New Revision: 339329
URL: http://svnweb.freebsd.org/changeset/ports/339329

Log:
  Add missing lua.pc files (missed in previous commits)
  Rework the makefile to use jmmv method from PR which is cleaner than my initial attempt
  
  PR:		ports/180786
  Submitted by:	jmmv

Added:
  head/lang/lua52/files/lua-5.2.pc.in   (contents, props changed)
Modified:
  head/lang/lua52/Makefile

Modified: head/lang/lua52/Makefile
==============================================================================
--- head/lang/lua52/Makefile	Fri Jan 10 08:39:01 2014	(r339328)
+++ head/lang/lua52/Makefile	Fri Jan 10 08:39:12 2014	(r339329)
@@ -16,8 +16,6 @@ LICENSE=	MIT
 LUA_VER=	5.2
 USES=		pkgconfig readline
 USE_LDCONFIG=	yes
-SUB_FILES=	lua-${LUA_VER}.pc
-SUB_LIST=	LUA_VERSION=${PORTVERSION}
 
 # Overriding __MAKE_CONF makes sure that we don't re-parse
 # /etc/make.conf during do-build, which would jeopardize the build
@@ -43,11 +41,22 @@ MAKE_ARGS+=	MYCFLAGS="${CFLAGS} -DLUA_US
 		INSTALL_INC=${STAGEDIR}${PREFIX}/include/lua52 \
 		INSTALL_EXEC="${INSTALL_PROGRAM}"
 
-.include <bsd.port.options.mk>
+# 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
+
+SUB_FILES=	lua-${LUA_VER}.pc
+SUB_LIST=	version=${PORTVERSION} \
+		includedir=${LUA_INCDIR} \
+		libdir=${LUA_LIBDIR} \
+		soname=lua-${LUA_VER}
 
-.if ${ARCH} == "amd64" || ${ARCH} == "powerpc"
-CFLAGS+=	-fPIC
-.endif
+CFLAGS_amd64=	-fPIC
+CFLAGS_powerpc=	-fPIC
 
 post-patch:
 	@${REINPLACE_CMD} -e 's,rand *(,random(,g' \
@@ -56,11 +65,12 @@ post-patch:
 		${WRKSRC}/src/luaconf.h
 
 post-install:
-	@${MV} ${WRKDIR}/lua-${LUA_VER}.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/liblua-${LUA_VER}.so
 	@${MV} ${STAGEDIR}${PREFIX}/man/man1/lua.1 \
 		${STAGEDIR}${PREFIX}/man/man1/lua52.1
 	@${MV} ${STAGEDIR}${PREFIX}/man/man1/luac.1 \
 		${STAGEDIR}${PREFIX}/man/man1/luac52.1
+	${INSTALL_DATA} ${WRKDIR}/lua-${LUA_VER}.pc \
+		${STAGEDIR}${PREFIX}/libdata/pkgconfig
 
 .include <bsd.port.mk>

Added: head/lang/lua52/files/lua-5.2.pc.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/lua52/files/lua-5.2.pc.in	Fri Jan 10 08:39:12 2014	(r339329)
@@ -0,0 +1,10 @@
+version=%%version%%
+libdir=%%libdir%%
+includedir=%%includedir%%
+soname=%%soname%%
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: ${version}
+Libs: -L${libdir} -l${soname} -lm
+Cflags: -I${includedir}
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"