Subject: Re: REQUIRES/PROVIDES for pkg/foo/bin and pkg/foo/lib
To: NetBSD Packages Technical Discussion List <tech-pkg@netbsd.org>
From: Johnny Lam <jlam@pkgsrc.org>
List: tech-pkg
Date: 08/04/2006 09:23:52
Jeremy C. Reed wrote:
> I had this patch for a couple years that I merged over to new flavor mk 
> files.
> 
> This was for requires and libs to be set correctly for qt3 
> packages for example.
> 
> Index: mk/flavor/pkg/metadata.mk
> ===================================================================
> RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/metadata.mk,v
> retrieving revision 1.9
> diff -u -r1.9 metadata.mk
> --- mk/flavor/pkg/metadata.mk	27 Jul 2006 22:16:06 -0000	1.9
> +++ mk/flavor/pkg/metadata.mk	4 Aug 2006 02:27:51 -0000
> @@ -61,14 +61,14 @@
>  	"")	ldd=`${TYPE} ldd 2>/dev/null | ${AWK} '{ print $$NF }'` ;; \
>  	*)	ldd=${LDD:Q} ;;						\
>  	esac;								\
> -	bins=`${AWK} '/^(bin|sbin|libexec)\// { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
> +	bins=`${AWK} '/(^|\/)(bin|sbin|libexec)\// { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
>  	case ${OBJECT_FMT:Q}"" in					\
>  	ELF)								\
> -		libs=`${AWK} '/^lib\/lib.*\.so\.[0-9]+$$/ { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
> +		libs=`${AWK} '/(^|\/)lib\/lib.*\.so\.[0-9]+$$/ { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
>  		if ${TEST} -n "$$bins" -o -n "$$libs"; then		\
>  			requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} '$$2 == "=>" && $$3 ~ "/" { print $$3 }' | ${SORT} -u`; \
>  		fi;							\
> -		linklibs=`${AWK} '/^[^@].*\.so\.[0-9\.]+$$/ { print "${PREFIX}/" $$0 }' ${PLIST}`; \
> +		linklibs=`${AWK} '/[^@].*\.so\.[0-9\.]+$$/ { print "${PREFIX}/" $$0 }' ${PLIST}`; \
>  		for i in $$linklibs; do					\
>  			if ${TEST} -r $$i -a ! -x $$i -a ! -h $$i; then	\
>  				${TEST} ${PKG_DEVELOPER:Uno:Q} = "no" || \
> @@ -78,7 +78,7 @@
>  		done;							\
>  		;;							\
>  	Mach-O)								\
> -		libs=`${AWK} '/^lib\/lib.*\.dylib/ { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
> +		libs=`${AWK} '/(^|\/)lib\/lib.*\.dylib/ { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
>  		if ${TEST} "$$bins" != "" -o "$$libs" != ""; then	\
>  			requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} '/compatibility version/ { print $$1 }' | ${SORT} -u`; \
>  		fi;							\

This patch is correct.  Please commit this.

	Thanks,

	-- Johnny Lam <jlam@pkgsrc.org>