Index: Mk/Uses/lib32.mk =================================================================== --- /dev/null +++ Mk/Uses/lib32.mk @@ -0,0 +1,91 @@ +# $FreeBSD$ +# +# Create a 'lib32-' companion port. +# +# For ports need to ship 32-bit components, or who have dependant's who need +# 32-bit libraries, this USES adds a FLAVOR that will compile this port +# targetting a 32-bit architecture. +# +# To use this USES a port most not define FLAVORS or PKGNAMEPREFIX and MUST +# define USE_LDCONFIG. All files under ${PREFIX}/lib will then be compiled +# targetting 32-bit and moved to ${PREFIX}/lib32. +# +# All ports with USES=lib32 can be concurrently installed with both the +# native and 32-bit packages (which gets a 'lib32-' prefix). +# +# Usage: +# USES=lib32 +# +# Variables set by lib32: +# +# LIBDIR The path to the library directory +# ${PREFIX}/lib; or +# ${PREFIX}/lib32 + +.if !defined(_LIB32_MK_INCLUDED) +_LIB32_MK_INCLUDED= lib32.mk +_USES_POST+= lib32 + +LIBDIR= ${PREFIX}/lib + +. for var in FLAVORS PKGNAMEPREFIX +. if defined(${var}) +#ERROR+= "USES=lib32: not compatible with ${var}" +. endif +. endfor + +. if !defined(USE_LDCONFIG) +ERROR+= "USES=lib32: USE_LDCONFIG must be defined" +. endif +. if ${USE_LDCONFIG} != yes && "${USE_LDCONFIG:N${LIBDIR}}" != "" +ERROR+= "USES=lib32: USE_LDCONFIG must only define libraries under $${PREFIX}/lib" +. endif + +. if ${ARCH} == amd64 +FLAVORS= default lib32 +. endif + +.endif // _LIB32_MK_INCLUDED + +.if defined(_POSTMKINCLUDED) && !defined(_LIB32_MK_POST_INCLUDED) +_LIB32_MK_POST_INCLUDED= yes + +. if ${FLAVOR} == lib32 + +LIBDIR= ${PREFIX}/lib32 + +PKGNAMEPREFIX= lib32- + +. if defined(LIB_DEPENDS) +LIB32_DEPENDS:= ${LIB_DEPENDS:C|^|${LOCALBASE}/lib32/|g:C/$$/@lib32/g} +BUILD_DEPENDS+= ${LIB32_DEPENDS} +RUN_DEPENDS+= ${LIB32_DEPENDS} +. undef LIB_DEPENDS +. endif + +. for flags in CFLAGS CPPFLAGS +${flags}:= ${CFLAGS:S|${LOCALBASE}/lib|${LOCALBASE}/lib32|g} -m32 +. endfor + +. if ${USE_LDCONFIG} == yes +USE_LDCONFIG32= ${LIBDIR} +. else +USE_LDCONFIG32:=${USE_LDCONFIG:S|${PREFIX}/lib/|${LIBDIR}/} +. endif + +. if defined(HAS_CONFIGURE) || defined(GNU_CONFIGURE) +CONFIGURE_ARGS:=${CONFIGURE_ARGS:S|${LOCALBASE}/lib|${LOCALBASE}/lib32|} --libdir=${LIBDIR} +. endif + +_USES_stage+= 935:post-plist-lib32 + +LIB32_PATTERN= (^lib\/|^@post(un)?exec .* ldconfig|${PREFIX:S|/|\/|g}\/share\/licenses|${PREFIX:S|/|\/|g}\/libdata\/ldconfig32) + +post-plist-lib32: + ${SED} -E -e '/${LIB32_PATTERN}/d' -e '/^@/d' -e 's|^|${STAGEDIR}${PREFIX}/|g' ${TMPPLIST} | ${XARGS} ${RM} + ${REINPLACE_CMD} -E -e '/${LIB32_PATTERN}/!d' -e 's|^lib/|lib32/|g' ${TMPPLIST} + +. undef USE_LDCONFIG + +. endif +.endif // _LIB32_MK_POST_INCLUDED Index: graphics/png/Makefile =================================================================== --- graphics/png/Makefile +++ graphics/png/Makefile @@ -18,7 +18,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept -USES= cpe libtool tar:xz +USES= cpe lib32 libtool tar:xz CPE_PRODUCT= libpng GNU_CONFIGURE= yes CONFIGURE_ARGS= --with-pkgconfigdir=${PREFIX}/libdata/pkgconfig Index: print/freetype2/Makefile =================================================================== --- print/freetype2/Makefile +++ print/freetype2/Makefile @@ -22,7 +22,7 @@ LICENSE_FILE_GPLv2+ = ${WRKSRC}/docs/GPLv2.TXT LICENSE_PERMS_FTL= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept -USES= cpe gmake libtool tar:bzip2 +USES= cpe gmake lib32 libtool tar:bzip2 MAKE_ENV= TOP="" USE_LDCONFIG= yes GNU_CONFIGURE= yes @@ -123,7 +123,7 @@ ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} setup) post-install: - @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libfreetype.so.* + @${STRIP_CMD} ${STAGEDIR}${LIBDIR}/libfreetype.so.* post-install-DOCS-on: (cd ${WRKSRC}/docs && ${COPYTREE_SHARE} "${PORTDOCS}" ${STAGEDIR}${DOCSDIR}) Index: textproc/expat2/Makefile =================================================================== --- textproc/expat2/Makefile +++ textproc/expat2/Makefile @@ -13,7 +13,7 @@ LICENSE_FILE= ${WRKSRC}/COPYING GNU_CONFIGURE= yes -USES= libtool pathfix tar:bz2 +USES= lib32 libtool pathfix tar:bz2 USE_LDCONFIG= yes INSTALL_TARGET= install-strip Index: x11-fonts/fontconfig/Makefile =================================================================== --- x11-fonts/fontconfig/Makefile +++ x11-fonts/fontconfig/Makefile @@ -14,7 +14,9 @@ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING -USES= gperf tar:bzip2 +USES= gperf lib32 tar:bzip2 + +USE_LDCONFIG= yes .if !defined(REFERENCE_PORT)