Index: Mk/Uses/lib32.mk =================================================================== --- /dev/null +++ Mk/Uses/lib32.mk @@ -0,0 +1,81 @@ +# $FreeBSD$ +# +# Create a 'lib32-' companion port. +# +# For ports need to ship 32-bit components, or who have dependant's who need +# 32-bit libraries. +# +# A port that needs a 'lib32-' companion port must: +# - Add USES=lib32 +# - Create a slave port, in the same category, with a prefix 'lib32-' +# - The slave port needs to: +# - Define 'USE_LIB32' +# - Set 'MASTERDIR' to the port without the 'lib32-' prefix +# - Include '${MASTERDIR}/Makefile' +# +# For the 'lib32-' companion port the following are done: +# - Add 'lib32-' to PKGNAMEPREFIX +# - Patch various variables to use the 'lib32' directory instead of 'lib' +# - Patch the pkg-plist to only include files installed under 'lib32' +# +# 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 + +. if defined(USE_LIB32) +ONLY_FOR_ARCHS= amd64 +ONLY_FOR_ARCHS_REASON= 32-bit libraries only applicable on amd64 +LIBDIR= ${PREFIX}/lib32 +. else +LIBDIR= ${PREFIX}/lib +. endif + +.endif // _LIB32_MK_INCLUDED + +.if defined(_POSTMKINCLUDED) && !defined(_LIB32_MK_POST_INCLUDED) +_LIB32_MK_POST_INCLUDED= yes + +. if defined(USE_LIB32) +PKGNAMEPREFIX:= lib32-${PKGNAMEPREFIX} + +. if defined(LIB_DEPENDS) +LIB32_DEPENDS:= ${LIB_DEPENDS:C|([^:]*):([^/]*)/(.*)|${LOCALBASE}/lib32/\1:\2/lib32-\3|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 !defined(USE_LDCONFIG) || ${USE_LDCONFIG} == yes +USE_LDCONFIG32= ${LIBDIR} +. else +USE_LDCONFIG32= ${USE_LDCONFIG:S|${PREFIX}/lib|${LIBDIR}|g} +. endif +. undef USE_LDCONFIG + +. if defined(HAS_CONFIGURE) || defined(GNU_CONFIGURE) +CONFIGURE_ARGS:=${CONFIGURE_ARGS:S|${LOCALBASE}/lib|${LOCALBASE}/lib32|g} --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} + +. endif +.endif // _LIB32_MK_POST_INCLUDED Index: graphics/Makefile =================================================================== --- graphics/Makefile +++ graphics/Makefile @@ -502,6 +502,7 @@ SUBDIR += lepton SUBDIR += leptonica SUBDIR += lfview + SUBDIR += lib32-png SUBDIR += lib3ds SUBDIR += libGLU SUBDIR += libGLw Index: graphics/lib32-png/Makefile =================================================================== --- /dev/null +++ graphics/lib32-png/Makefile @@ -0,0 +1,6 @@ +# $FreeBSD$ + +USE_LIB32= yes +MASTERDIR= ${.CURDIR}/../png + +.include "${MASTERDIR}/Makefile" 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/Makefile =================================================================== --- print/Makefile +++ print/Makefile @@ -108,6 +108,7 @@ SUBDIR += latex2rtf SUBDIR += latexdiff SUBDIR += lgrind + SUBDIR += lib32-freetype2 SUBDIR += libgnomecups SUBDIR += libgnomeprint SUBDIR += libgnomeprint-reference 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: print/lib32-freetype2/Makefile =================================================================== --- /dev/null +++ print/lib32-freetype2/Makefile @@ -0,0 +1,6 @@ +# $FreeBSD$ + +USE_LIB32= yes +MASTERDIR= ${.CURDIR}/../freetype2 + +.include "${MASTERDIR}/Makefile" 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: textproc/lib32-expat2/Makefile =================================================================== --- /dev/null +++ textproc/lib32-expat2/Makefile @@ -0,0 +1,6 @@ +# $FreeBSD$ + +USE_LIB32= yes +MASTERDIR= ${.CURDIR}/../expat2 + +.include "${MASTERDIR}/Makefile" Index: x11-fonts/Makefile =================================================================== --- x11-fonts/Makefile +++ x11-fonts/Makefile @@ -124,6 +124,7 @@ SUBDIR += khmeros SUBDIR += lfpfonts-fix SUBDIR += lfpfonts-var + SUBDIR += lib32-fontconfig SUBDIR += libFS SUBDIR += libXfont SUBDIR += libXfont2 Index: x11-fonts/fontconfig/Makefile =================================================================== --- x11-fonts/fontconfig/Makefile +++ x11-fonts/fontconfig/Makefile @@ -14,7 +14,7 @@ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING -USES= gperf tar:bzip2 +USES= gperf lib32 tar:bzip2 .if !defined(REFERENCE_PORT) Index: x11-fonts/lib32-fontconfig/Makefile =================================================================== --- /dev/null +++ x11-fonts/lib32-fontconfig/Makefile @@ -0,0 +1,6 @@ +# $FreeBSD$ + +USE_LIB32= yes +MASTERDIR= ${.CURDIR}/../fontconfig + +.include "${MASTERDIR}/Makefile"