[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ports tree infra big change ahead, first step



This is a rather small patch, but it has some momentous implications.

With the new pkg tools, there is a new mode, called -Q, where pkg_add
installs stuff directly under a given dir, takes some shortcuts (stops
at and endfake marker), and generally does things which appear to be
useless.

The intent is to be able to `quickly install' some files in a package
to build other stuff, like, hum, yeah, other packages.

The goal is to be able, in most cases, to build packages without installing
anything (or very little) under /usr/local on a build box.

I've recently committed the basic code for make update-plist to grok
@endfake and not touch it.

Here's the bsd.port.mk patch as it stands for now.

This introduces two new variables and an old one.

- DEPBASE refers to the location where you should look for dependencies
in the ports tree, instead of LOCALBASE.
- if FAKE is set to lib, there's a new player called DEPDIR, set under
WRKDIR. The default value should be appropriate for most cases.  Indeed,
it's only overideable if you happen to run into a port that uses
${WRKDIR}/dependencies for its own stuff.
- if FAKE is set to lib, then DEPBASE goes straight to ${DEPDIR}${LOCALBASE}
instead of LOCALBASE.  And build/lib dependencies get resolved by
quick-installing the package there.


Okay, so setting ports to work with FAKE=lib is not straight-forward at
all, and I know there are bumps ahead, but this is the first step, and
having DEPBASE in would allow some experimentation.

I'd like comments wrt the naming and interface to this stuff...


Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.687
diff -u -p -r1.687 bsd.port.mk
--- bsd.port.mk	1 Apr 2005 15:55:36 -0000	1.687
+++ bsd.port.mk	12 Apr 2005 10:00:38 -0000
@@ -282,7 +282,7 @@ CONFIGURE_STYLE+=gnu
 
 USE_LIBTOOL?=No
 .if ${USE_LIBTOOL:L} == "yes"
-LIBTOOL?=			${LOCALBASE}/bin/libtool
+LIBTOOL?=			${DEPBASE}/bin/libtool
 BUILD_DEPENDS+=		::devel/libtool
 CONFIGURE_ENV+=		LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}"
 MAKE_ENV+=			LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}"
@@ -319,7 +319,7 @@ LIB_DEPENDS+=		Xm.2::x11/openmotif
 .  else
 ERRORS+= "Fatal: Unknown USE_MOTIF=${USE_MOTIF} settings."
 .  endif
-MOTIFLIB=-L${LOCALBASE}/lib -lXm
+MOTIFLIB=-L${DEPBASE}/lib -lXm
 .endif
 
 .if !empty(SUBPACKAGE)
@@ -450,7 +450,7 @@ _CIPHERS=		sha1 rmd160 md5
 # This is the one you can override
 PREFERRED_CIPHERS?= ${_CIPHERS}
 
-PORTPATH?= ${WRKDIR}/bin:/usr/bin:/bin:/usr/sbin:/sbin:${LOCALBASE}/bin:${X11BASE}/bin
+PORTPATH?= ${WRKDIR}/bin:/usr/bin:/bin:/usr/sbin:/sbin:${DEPBASE}/bin:${X11BASE}/bin
 
 # Add any COPTS to CFLAGS.  Note: programs that use imake do not
 # use CFLAGS!  Also, many (most?) ports hard code CFLAGS, ignoring
@@ -474,7 +474,7 @@ MAKE_FILE?=		Makefile
 PORTHOME?=		/${PKGNAME}_writes_to_HOME
 
 MAKE_ENV+=		PATH='${PORTPATH}' PREFIX='${PREFIX}' \
-	LOCALBASE='${LOCALBASE}' X11BASE='${X11BASE}' \
+	LOCALBASE='${LOCALBASE}' DEPBASE='${DEPBASE}' X11BASE='${X11BASE}' \
 	MOTIFLIB='${MOTIFLIB}' CFLAGS='${CFLAGS:C/ *$//}' \
 	TRUEPREFIX='${PREFIX}' ${DESTDIRNAME}='' \
 	HOME='${PORTHOME}'
@@ -620,7 +620,7 @@ _SYSTRACE_CMD=
 .endif
 SYSTRACE_FILTER?=	${PORTSDIR}/infrastructure/db/systrace.filter
 _SYSTRACE_POLICIES+=	/bin/sh /usr/bin/env /usr/bin/make \
-	${LOCALBASE}/bin/gmake
+	${DEPBASE}/bin/gmake
 SYSTRACE_SUBST_VARS+=	DISTDIR PKG_TMPDIR PORTSDIR TMPDIR WRKDIR
 .for _v in ${SYSTRACE_SUBST_VARS}
 _SYSTRACE_SED_SUBST+=-e 's,$${${_v}},${${_v}},g'
@@ -917,7 +917,8 @@ SCRIPTS_ENV+= CURDIR=${.CURDIR} DISTDIR=
 		  WRKSRC=${WRKSRC} WRKBUILD=${WRKBUILD} \
 		  PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
 		  PORTSDIR=${PORTSDIR} DEPENDS="${DEPENDS}" \
-		  PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
+		  PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} DEPBASE='${DEPBASE}' \
+		  X11BASE=${X11BASE}
 
 .if defined(BATCH)
 SCRIPTS_ENV+=	BATCH=yes
@@ -1065,9 +1066,19 @@ _lib_depends_fragment = \
 		found=true; \
 	fi
 
+.if ${FAKE:L} == "lib"
+DEPBASE=${DEPDIR}${LOCALBASE}
+DEPDIR?=${WRKDIR}/dependencies
+_build_depends_target=fake
+_lib_depends_target=fake
+.else
+DEPBASE=${LOCALBASE}
+DEPDIR=
 _build_depends_target=${DEPENDS_TARGET}
-_run_depends_target=${DEPENDS_TARGET}
 _lib_depends_target=${DEPENDS_TARGET}
+.endif
+
+_run_depends_target=${DEPENDS_TARGET}
 _regress_depends_target=${DEPENDS_TARGET}
 
 .if ${FORCE_UPDATE:L} == "yes"
@@ -1317,6 +1328,7 @@ ${WRKDIR}/.${_DEP}${_i:C,[|:./<=>*],-,g}
 		case "X$$target" in \
 		Xinstall|Xreinstall) early_exit=false;; \
 		Xpackage) early_exit=true;; \
+		Xfake) early_exit=true; dep="/fake";; \
 		*) \
 			early_exit=true; mkdir -p ${WRKDIR}/$$dir; \
 			toset="$$toset _MASTER='[${FULLPKGNAME${SUBPACKAGE}}]${_MASTER}' WRKDIR=${WRKDIR}/$$dir"; \
@@ -1334,6 +1346,17 @@ ${WRKDIR}/.${_DEP}${_i:C,[|:./<=>*],-,g}
 			what=$$pkg; \
 			case "$$dep" in \
 			"/nonexistent") ;; \
+			"/fake") \
+				${ECHO_MSG} "===>  Verifying package for $$what in $$dir"; \
+				if eval $$toset ${MAKE} package; then \
+					${ECHO_MSG} "===> Returning to build of ${FULLPKGNAME${SUBPACKAGE}}${_MASTER}"; \
+				else \
+					exit 1; \
+				fi; \
+				mkdir -p ${DEPDIR}/pkgdb ${DEPDIR}/usr ${DEPDIR}/usr/X11R6; \
+				ln -sf /usr/lib ${DEPDIR}/usr/lib; \
+				ln -sf /usr/X11R6/lib ${DEPDIR}/usr/X11R6/lib; \
+				cd ${PKGREPOSITORY} && PKG_DBDIR=${DEPDIR}/pkgdb pkg_add -F nonroot -Q ${DEPDIR} $$pkg && exit 0;; \
 			*)  \
 				$$early_exit || ${_force_update_fragment}; \
 				${_${_DEP}_depends_fragment}; \
@@ -1589,7 +1612,7 @@ ${_BULK_COOKIE}: ${_PACKAGE_COOKIES}
 
 ${_WRKDIR_COOKIE}:
 	@rm -rf ${WRKDIR}
-	@mkdir -p ${WRKDIR} ${WRKDIR}/bin
+	@mkdir -p ${WRKDIR} ${WRKDIR}/bin ${DEPDIR}
 	@${_MAKE_COOKIE} $@
 
 ${_EXTRACT_COOKIE}: ${_WRKDIR_COOKIE} ${_SYSTRACE_COOKIE}