NetBSD Problem Report #54535

From www@netbsd.org  Sun Sep  8 17:00:28 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 026697A186
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  8 Sep 2019 17:00:28 +0000 (UTC)
Message-Id: <20190908170026.EC8727A1DB@mollari.NetBSD.org>
Date: Sun,  8 Sep 2019 17:00:26 +0000 (UTC)
From: clement.bouvier.europe@gmail.com
Reply-To: clement.bouvier.europe@gmail.com
To: gnats-bugs@NetBSD.org
Subject: devel/lua-filesystem does not build on macOS patch
X-Send-Pr-Version: www-1.0

>Number:         54535
>Category:       pkg
>Synopsis:       devel/lua-filesystem does not build on macOS patch
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 08 17:05:00 +0000 2019
>Last-Modified:  Wed May 27 19:40:40 +0000 2020
>Originator:     clement bouvier
>Release:        current
>Organization:
>Environment:
macOS Mojave 10.14;6
>Description:
devel/lua-filesystem does not build on macOS due to undefined symbols.

http://us-east.manta.joyent.com/pkgsrc/public/reports/Darwin/trunk/x86_64/20190831.0944/lua53-filesystem-1.7.0/build.log

>How-To-Repeat:
build the package on macOS
>Fix:
The patch migrates the targets of the makefile to use libtool.

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-filesystem/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile	28 May 2019 20:43:04 -0000	1.11
+++ Makefile	8 Sep 2019 16:56:51 -0000
@@ -16,12 +16,14 @@
 WRKSRC=			${WRKDIR}/luafilesystem-${PKGVERSION_NOREV:S/./_/g}_2

 USE_TOOLS+=		gmake pkg-config
+USE_LIBTOOL=		yes
 BUILD_TARGET=		lib

 TEST_TARGET=		test

 MAKE_ENV+=		LUA_CDIR=${LUA_CDIR}
 MAKE_ENV+=		LUA_VERS=${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+MAKE_ENV+=		LUA=${LUA_INTERPRETER:Q}

 .include "../../lang/lua/module.mk"
 .include "../../mk/bsd.pkg.mk"
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-filesystem/distinfo,v
retrieving revision 1.6
diff -u -r1.6 distinfo
--- distinfo	28 May 2019 20:43:04 -0000	1.6
+++ distinfo	8 Sep 2019 16:56:51 -0000
@@ -4,5 +4,5 @@
 RMD160 (luafilesystem-1.7.0.tar.gz) = 6770d25f1d0928c347560425d7c5758788038fd9
 SHA512 (luafilesystem-1.7.0.tar.gz) = a1d4d077776e57cd878dbcd21656da141ea3686c587b5420a2b039aeaf086b7e7d05d531ee1cc2bbd7d06660d1315b09593e52143f6711f033ce8eecdc550511
 Size (luafilesystem-1.7.0.tar.gz) = 30877 bytes
-SHA1 (patch-Makefile) = 1fd838ba0f5a716ed1f8f7b7ed4fda816e702806
-SHA1 (patch-config) = 5d459797960118aa387f1f5cfb8bc6d7923965c8
+SHA1 (patch-Makefile) = 7c6826c3253f8255f2b069ff42be238c823e6ea0
+SHA1 (patch-config) = 220473c34842267d388b7daf1e5556749a5c38eb
Index: patches/patch-Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-filesystem/patches/patch-Makefile,v
retrieving revision 1.1
diff -u -r1.1 patch-Makefile
--- patches/patch-Makefile	28 May 2019 20:43:04 -0000	1.1
+++ patches/patch-Makefile	8 Sep 2019 16:56:51 -0000
@@ -2,15 +2,30 @@

  - Remove MACOSX_DEPLOYMENT_TARGET as it will give problem on newer macOS
      and also targeting/building for current macOS version is enough
+ - Adapt the makefile targets to libtool.

 --- Makefile.orig	2017-09-15 23:07:33.000000000 +0000
 +++ Makefile
-@@ -12,7 +12,7 @@ OBJS= src/$T.o
+@@ -11,15 +11,17 @@ OBJS= src/$T.o
+ 
  lib: src/lfs.so

++$(OBJS): $(SRCS)
++	${LIBTOOL} --tag=CC --mode=compile $(CC) $(CFLAGS) -shared -c -o $(OBJS:.o=.lo) $<
++
  src/lfs.so: $(OBJS)
 -	MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(LIB_OPTION) -o src/lfs.so $(OBJS)
-+	$(CC) $(LIB_OPTION) -o src/lfs.so $(OBJS)
++	${LIBTOOL} --tag=CC --mode=link	$(CC) $(LDFLAGS) -shared -module -avoid-version -export-dynamic -rpath $(PREFIX)/$(LUA_CDIR) -o $(@:.so=.la) $(OBJS:.o=.lo) $(LIBS)

  test: lib
- 	LUA_CPATH=./src/?.so lua tests/test.lua
+-	LUA_CPATH=./src/?.so lua tests/test.lua
++	LUA_CPATH=src/.libs/lfs.so $(LUA) tests/test.lua
+ 
+ install:
+-	mkdir -p $(LUA_LIBDIR)
+-	cp src/lfs.so $(LUA_LIBDIR)
++	${LIBTOOL} --mode=install $(BSD_INSTALL_LIB) src/lfs.la $(LUA_LIBDIR) 
+ 
+ clean:
+-	rm -f src/lfs.so $(OBJS)
++	${LIBTOOL} --mode=clean rm -f src/lfs.la $(OBJS:.o=.lo)
Index: patches/patch-config
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-filesystem/patches/patch-config,v
retrieving revision 1.1
diff -u -r1.1 patch-config
--- patches/patch-config	28 May 2019 20:43:04 -0000	1.1
+++ patches/patch-config	8 Sep 2019 16:56:51 -0000
@@ -6,9 +6,7 @@

 --- config.orig	2017-09-15 23:07:33.000000000 +0000
 +++ config
-@@ -1,22 +1,28 @@
- # Installation directories
- 
+@@ -3,6 +3,7 @@
  # Default installation prefix
 -PREFIX=/usr/local
 +PREFIX?=/usr/local
@@ -18,25 +16,15 @@
 +LUA_LIBS= $(pkg-config --libs lua-$(LUA_VERS))
 +LUA_LIBDIR= $(DESTDIR)$(PREFIX)/$(LUA_CDIR)

- # Lua includes directory
- LUA_INC= $(PREFIX)/include
- 
+@@ -12,3 +13,3 @@ LUA_INC= $(PREFIX)/include
  # OS dependent
 -LIB_OPTION= -shared #for Linux
--#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
-+ifeq ($(shell uname -s 2>/dev/null), Darwin)
-+# for macOS
-+LIB_OPTION+= -L$(PREFIX)/lib $(LUA_LIBS) -shared -install_name $(PREFIX)/$(LUA_CDIR)/$(notdir $@)
-+else
-+# for Linux & other unix
-+LIB_OPTION+= -L$(PREFIX)/lib $(LUA_LIBS) -shared
-+endif
- 
- LIBNAME= $T.so.$V
- 
- # Compilation directives
--WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic
-+WARN= -O2 -fPIC 
++#LIB_OPTION= -shared #for Linux
+ #LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
+@@ -20,4 +21,4 @@ WARN= -O2 -Wall -fPIC -W -Waggregate-ret
  INCS= -I$(LUA_INC)
- CFLAGS= $(WARN) $(INCS)
- CC= gcc
+-CFLAGS= $(WARN) $(INCS)
+-CC= gcc
++#CFLAGS= $(WARN) $(INCS)
++#CC= gcc
+

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->fhajny
Responsible-Changed-By: hauke@NetBSD.org
Responsible-Changed-When: Mon, 09 Sep 2019 13:44:21 +0000
Responsible-Changed-Why:
Over to maintainer.


Responsible-Changed-From-To: fhajny->pkg-manager
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Wed, 27 May 2020 19:40:40 +0000
Responsible-Changed-Why:
Maintainer was reset


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.