On Fri, Jul 02, 2010 at 04:33:43PM +0200, Marc Espie wrote:
> Faster patch... this removes a lot of old cruft, and yields a
> _print-package-args that's about twice as fast, instead of potentially
> slower.
Turns out it must be slightly more complicated.
Namely, we have to bring LIB_DEPENDS files lists from the current package
around...
Index: bsd.port.mk
===================================================================
RCS file: /home/openbsd/cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1007
diff -u -p -r1.1007 bsd.port.mk
--- bsd.port.mk 20 Jun 2010 07:48:20 -0000 1.1007
+++ bsd.port.mk 2 Jul 2010 20:44:06 -0000
@@ -1286,32 +1288,12 @@ _noshared =
.endif
_libresolve_fragment = \
- case "$$d" in \
- */*) shdir="${LOCALBASE}/$${d%/*}";; \
- *) shdir="${LOCALBASE}/lib";; \
- esac; \
- check=`eval $$listlibs 2>/dev/null| \
+ check=`for _lib in $$libs; do echo $$_lib; done | \
LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} \
perl ${PORTSDIR}/infrastructure/build/resolve-lib \
${_noshared} $$d` \
|| check=Failed
-_syslibresolve_fragment = \
- case "$$d" in \
- /*) \
- shdir="$${d%/*}/";; \
- */*) \
- shdir="${DEPBASE}/$${d%/*}";; \
- *) \
- shdir="${DEPBASE}/lib"; \
- listlibs="$$listlibs /usr/lib/lib* ${X11BASE}/lib/lib*";; \
- esac; \
- check=`eval $$listlibs 2>/dev/null| \
- LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} \
- perl ${PORTSDIR}/infrastructure/build/resolve-lib ${_noshared}
$$d` \
- || check=Failed
-
-
PORT_LD_LIBRARY_PATH = ${LOCALBASE}/lib:${X11BASE}/lib:/usr
_set_ld_library_path = :
DEPBASE = ${LOCALBASE}
@@ -1345,6 +1327,7 @@ _BUILDWANTLIB = ${WANTLIB}
. for _s in ${MULTI_PACKAGES}
_BUILDLIB_DEPENDS += ${LIB_DEPENDS${_s}:N*\:${_path}:N*\:${_path},*}
_BUILDWANTLIB += ${WANTLIB${_s}}
+_LIB4${_s} = ${LIB_DEPENDS${_s}:M*\:${_path}}
${LIB_DEPENDS${_s}:M*\:${_path},*}
. endfor
.endfor
@@ -2844,48 +2827,69 @@ _print-package-args:
@echo '${_i}'|{ \
IFS=:; read dep pkg subdir target; \
${_flavor_fragment}; \
- libspecs='';comma=''; \
if default=`eval $$toset ${MAKE} _print-packagename`; then \
case "X$$pkg" in X) pkg=`echo "$$default"
|${_version2default}`;; \
esac; \
- if ${_PKG_QUERY} "$$pkg" -q; then \
- listlibs='echo ${DEPDIR}$$shdir/lib*'; \
- case "$$dir" in ${PKGPATH}) \
- listlibs="$$toset ${MAKE}
print-plist-contents|${_grab_libs_from_plist}; $$listlibs";; \
- esac; \
- else \
- listlibs="$$toset ${MAKE}
print-plist-contents|${_grab_libs_from_plist}"; \
- fi; \
+ libs=`eval $$toset ${MAKE}
print-plist-contents|${_grab_libs_from_plist}`; \
+ needed=false; \
IFS=,; for d in $$dep; do \
- ${_libresolve_fragment}; \
- case "$$check" in \
+ ${_libresolve_fragment}; \
+ case "$$check" in \
*.a) continue;; \
Failed) \
echo 1>&2 "Can't resolve libspec $$d
(in ${SUBPACKAGE})"; \
exit 1;; \
+ *) \
+ needed=true;; \
+ esac; \
+ done; \
+ exec 3>&2; \
+ unset IFS; for d in ${_DEPRUNLIBS:S/>/\>/g}; do \
+ if $$needed; then continue; fi; \
+ exec 2>/dev/null; \
+ ${_libresolve_fragment}; \
+ case "$$check" in \
+ *.a|Failed) \
+ continue;; \
*) \
- echo "-W $$check";; \
+ needed=true;; \
esac; \
done; \
- echo "-P $$subdir:$$pkg:$$default"; \
+ exec 2>&3; \
+ if $$needed; then echo "-P $$subdir:$$pkg:$$default";
fi; \
else \
echo 1>&2 "Problem with dependency ${_i}"; \
exit 1; \
fi; \
}
. endfor
-. for _i in ${WANTLIB${SUBPACKAGE}}
- @d='${_i}'; listlibs='echo $$shdir/lib*'; \
- ${_syslibresolve_fragment}; \
- case "$$check" in \
- *.a) ;; \
- Failed) \
- echo 1>&2 "Can't resolve libspec $$d"; \
- exit 1;; \
- *) \
- echo "-W $$check";; \
- esac
-. endfor
+ @libs=`for i in ${_LIB4${SUBPACKAGE}:S/>/\>/g}; do echo $$i| { \
+ IFS=:; read dep pkg subdir target; \
+ ${_flavor_fragment}; \
+ if default=$$(eval $$toset ${MAKE} _print-packagename); then \
+ case "X$$pkg" in X) pkg=$$(echo "$$default"
|${_version2default});; \
+ esac; \
+ eval $$toset ${MAKE}
print-plist-contents|${_grab_libs_from_plist}; \
+ else \
+ echo 1>&2 "Problem with dependency ${_i}"; \
+ exit 1; \
+ fi; }; \
+ done;`; \
+ listlibs="echo $$libs; echo ${LOCALBASE}/lib/lib* /usr/lib/lib*
${X11BASE}/lib/lib*"; \
+ for d in ${_DEPRUNLIBS:S/>/\>/g}; do \
+ case "$$d" in \
+ /*) listlibs="$$listlibs $${d%/*}/lib*";; \
+ */*) listlibs="$$listlibs ${LOCALBASE}/$${d%/*}/lib*";; \
+ esac; \
+ done; \
+ if found=`eval $$listlibs 2>/dev/null| \
+ LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} perl \
+ ${PORTSDIR}/infrastructure/build/resolve-lib ${_noshared}
${_DEPRUNLIBS:S/>/\>/g}`; then \
+ for k in $$found; do echo "-W $$k"; done; \
+ else \
+ echo 1>&2 "Can't resolve libspec"; \
+ exit 1; \
+ fi
.endif
_list-port-libs: