From owner-freebsd-ports Wed May 29 16:31:51 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA23762 for ports-outgoing; Wed, 29 May 1996 16:31:51 -0700 (PDT) Received: from time.cdrom.com (time.cdrom.com [204.216.27.226]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id QAA23754; Wed, 29 May 1996 16:31:48 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by time.cdrom.com (8.7.5/8.6.9) with SMTP id QAA16318; Wed, 29 May 1996 16:31:29 -0700 (PDT) To: asami@freebsd.org cc: ports@freebsd.org Subject: Request for feedback: REQUIRES_OS_VERSION feature. Date: Wed, 29 May 1996 16:31:28 -0700 Message-ID: <16316.833412688@time.cdrom.com> From: "Jordan K. Hubbard" Sender: owner-ports@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I figured it was easier to show than to explain.. :-) Here's a commit for the feature with a couple of miscellaneous cleanups thrown in at the same time (while I was in there.. :-) The changes add the abstraction of a "check" target which, if it "breaks the link" between build an configure process, essentially short-circuits the fetch/extract/build cycle of the port. The default check target can get as clever as we like as time goes on, but for now it does no more than check for a variable called REQUIRES_OS_VERSION. If this variable is set in a Makefile, the output of `uname -r' will be compared against it and, if no match occurs, refuse to build the port. For example, the top port could have: REQUIRES_OS_VERSION= 2.2 For all variants and 2.1 users could make from the -current tree with impugnity, any ports like top simply getting skipped. Anyway, let me know what you think.. Jordan [diffs relative to -current] *** bsd.port.mk.orig Wed May 29 15:09:28 1996 --- bsd.port.mk Wed May 29 16:26:23 1996 *************** *** 174,179 **** --- 174,180 ---- # patch - Apply any provided patches to the source. # configure - Runs either GNU configure, one or more local configure # scripts or nothing, depending on what's available. + # check - Makes sure the port is compilable on the given platform. # build - Actually compile the sources. # install - Install the results of a build. # reinstall - Install the results of a build, ignoring "already installed" *************** *** 245,250 **** --- 246,252 ---- # Don't change these!!! These names are built into the _TARGET_USE macro, # there is no way to refer to them cleanly from within the macro AFAIK. EXTRACT_COOKIE?= ${WRKDIR}/.extract_done + CHECK_COOKIE?= ${WRKDIR}/.check_done CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done INSTALL_COOKIE?= ${WRKDIR}/.install_done BUILD_COOKIE?= ${WRKDIR}/.build_done *************** *** 443,448 **** --- 445,452 ---- .if defined(IGNORE) all: @${DO_NADA} + check: + @${DO_NADA} build: @${DO_NADA} install: *************** *** 464,470 **** DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \ RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \ ${ALL_HOOK} - .endif .if !target(all) --- 468,473 ---- *************** *** 488,493 **** --- 491,497 ---- # override from an individual Makefile. ################################################################ + # Disable extract .if defined(NO_EXTRACT) && !target(extract) extract: checksum @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} *************** *** 496,521 **** makesum: @${DO_NADA} .endif .if defined(NO_CONFIGURE) && !target(configure) configure: patch @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} .endif .if defined(NO_BUILD) && !target(build) ! build: configure @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} .endif .if defined(NO_PACKAGE) && !target(package) package: @${DO_NADA} .endif .if defined(NO_PACKAGE) && !target(repackage) repackage: @${DO_NADA} .endif .if defined(NO_INSTALL) && !target(install) install: build @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} .endif .if defined(NO_PATCH) && !target(patch) patch: extract @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} --- 500,549 ---- makesum: @${DO_NADA} .endif + + # Disable configure .if defined(NO_CONFIGURE) && !target(configure) configure: patch @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} .endif + + # Disable check + .if defined(NO_CHECK) && !target(check) + check: configure + @${TOUCH} ${TOUCH_FLAGS} ${CHECK_COOKIE} + .endif + + # Disable build .if defined(NO_BUILD) && !target(build) ! build: check @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} .endif + + # Disable package .if defined(NO_PACKAGE) && !target(package) package: @${DO_NADA} .endif + + # Disable repackage .if defined(NO_PACKAGE) && !target(repackage) repackage: @${DO_NADA} .endif + + # Disable install .if defined(NO_INSTALL) && !target(install) install: build @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} .endif + + # Disable reinstall + .if defined(NO_INSTALL) && !target(reinstall) + reinstall: build + @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} + .endif + + # Disable patch .if defined(NO_PATCH) && !target(patch) patch: extract @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} *************** *** 662,667 **** --- 690,711 ---- .endif .endif + # Check. + + .if !target(do-check) + do-check: + .if defined(REQUIRES_OS_VERSION) + @if ! uname -r | grep -q ${REQUIRES_OS_VERSION} ; then \ + ${ECHO_MSG} "${PKGNAME} isn't supported in this OS release; skipping.."; \ + ${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}; \ + else \ + ${MAKE} ${.MAKEFLAGS} configure; \ + fi + .else + @${MAKE} ${.MAKEFLAGS} configure + .endif + .endif + # Configure .if !target(do-configure) *************** *** 841,848 **** configure: patch ${CONFIGURE_COOKIE} .endif .if !target(build) ! build: configure ${BUILD_COOKIE} .endif .if !target(install) --- 885,896 ---- configure: patch ${CONFIGURE_COOKIE} .endif + .if !target(check) + check: ${CHECK_COOKIE} + .endif + .if !target(build) ! build: check ${BUILD_COOKIE} .endif .if !target(install) *************** *** 859,864 **** --- 907,914 ---- @${MAKE} ${.MAKEFLAGS} real-patch ${CONFIGURE_COOKIE}: @${MAKE} ${.MAKEFLAGS} real-configure + ${CHECK_COOKIE}: + @${MAKE} ${.MAKEFLAGS} real-check ${BUILD_COOKIE}: @${MAKE} ${.MAKEFLAGS} real-build ${INSTALL_COOKIE}: *************** *** 868,873 **** --- 918,924 ---- # And call the macros + real-check: do-check real-fetch: _PORT_USE real-extract: _PORT_USE @${ECHO_MSG} "===> Extracting for ${PKGNAME}"