From b5050df054da8fe8fb1107c52e1c046e503c7f8b Mon Sep 17 00:00:00 2001 From: Xin Li Date: Sat, 23 May 2020 02:52:52 -0700 Subject: [PATCH] Respect liblzma.pc if available. Differential Revision: https://reviews.freebsd.org/D24972 --- ports-mgmt/pkg/Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ports-mgmt/pkg/Makefile b/ports-mgmt/pkg/Makefile index cb6d18fa408e..1d7984587ca6 100644 --- a/ports-mgmt/pkg/Makefile +++ b/ports-mgmt/pkg/Makefile @@ -71,6 +71,13 @@ pre-everything:: .endif .endif +.if !exists(/usr/libdata/pkgconfig/liblzma.pc) +LIBLZMA_LIBS= -llzma +.else +LIBLZMA_PC!= ${EGREP} ^Libs /usr/libdata/pkgconfig/liblzma.pc +LIBLZMA_LIBS= ${LIBLZMA_PC:M-l*} +.endif + #define PKG_DEPENDS to nothing to avoid infinite loop looking for pkg :) PKG_DEPENDS= .undef INSTALLS_DEPENDS @@ -81,6 +88,10 @@ PKG_DEPENDS= PKG_BIN= ${WRKSRC}/src/pkg-static .endif +post-patch: + ${REINPLACE_CMD} -e "s|-llzma|${LIBLZMA_LIBS}|g" ${WRKSRC}/auto.def \ + ${WRKSRC}/src/Makefile.autosetup ${WRKSRC}/tests/Makefile.autosetup + post-install: @${MKDIR} ${STAGEDIR}${PREFIX}/lib/compat/pkg -- 2.26.2