pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: built-in libarchive



On Tue, May 29, 2018 at 11:10:54AM +0200, Thomas Klausner wrote:
> On Tue, May 29, 2018 at 10:03:40AM +0100, Patrick Welche wrote:
> > If a platform provides libarchive, pkgsrc will correctly use it
> > rather than archivers/libarchive. If a package is silly enough to use
> > PKG_CHECK_MODULES instead of AC_CHECK_LIBS (unfortunately there is a
> > lot of it about), the libarchive provided by NetBSD won't be found. I
> > tried fiddling src/external/bsd/libarchive/lib/libarchive/Makefile to
> > generate and install a /usr/lib/pkgconfig/libarchive.pc file, but it
> > seems that pkgsrc doesn't look in /usr/lib/pkgconfig. Any thoughts on
> > what The Right Way is?
> 
> Fake a pc file using builtin.mk like devel/zlib/builtin.mk does.

The attached cargo culted patch works for me, but any comments on:

   sed...          -e s,@LIBS@,-llzma -lbz2 -lz,

for

   Libs.private: @LIBS@

?


Cheers,

Patrick
Index: builtin.mk
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/libarchive/builtin.mk,v
retrieving revision 1.6
diff -u -r1.6 builtin.mk
--- builtin.mk	28 Feb 2017 14:58:09 -0000	1.6
+++ builtin.mk	5 Jun 2018 10:23:16 -0000
@@ -88,3 +88,39 @@
 .  endif  # PREFER.libarchive
 .endif
 MAKEVARS+=	USE_BUILTIN.libarchive
+
+###
+### The section below only applies if we are not including this file
+### solely to determine whether a built-in implementation exists.
+###
+CHECK_BUILTIN.libarchive?= no
+.if !empty(CHECK_BUILTIN.libarchive:M[nN][oO])
+.  if !empty(USE_BUILTIN.libarchive:M[yY][eE][sS])
+
+BUILDLINK_TARGETS+=     fake-libarchive-pc
+
+_FAKE_LIBARCHIVE_PC=${BUILDLINK_DIR}/lib/pkgconfig/libarchive.pc
+
+fake-libarchive-pc:
+	${RUN}  \
+	sedsrc=../../archivers/libarchive/files/build/pkgconfig/libarchive.pc.in;	\
+	src=${BUILDLINK_PREFIX.libarchive}/lib${LIBABISUFFIX}/pkgconfig/libarchive.pc;	\
+	dst=${_FAKE_LIBARCHIVE_PC};				  			\
+	${MKDIR} ${BUILDLINK_DIR}/lib/pkgconfig;					\
+	if [ ! -f $${dst} ]; then       						\
+		if [ -f $${src} ]; then 						\
+			${ECHO_BUILDLINK_MSG} "Symlinking $${src}";     		\
+			${LN} -sf $${src} $${dst};					\
+		else									\
+			${ECHO_BUILDLINK_MSG} "Creating $${dst}";			\
+			${SED}  -e s,@prefix@,${BUILDLINK_PREFIX.libarchive},		\
+					-e s,@exec_prefix@,${BUILDLINK_PREFIX.libarchive},\
+					-e s,@libdir@,${BUILDLINK_PREFIX.libarchive}/lib${LIBABISUFFIX},\
+					-e s,@includedir@,${BUILDLINK_PREFIX.libarchive}/include,\
+					-e s,@VERSION@,${BUILTIN_VERSION.libarchive},	\
+					-e s,@LIBS@,-llzma -lbz2 -lz,			\
+				$${sedsrc} > $${dst};					\
+		fi									\
+	fi
+.  endif
+.endif


Home | Main Index | Thread Index | Old Index