pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Refactor configure, build, test and wrapper phases ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/99cce6ce1417
branches:  trunk
changeset: 515626:99cce6ce1417
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Jul 05 06:09:15 2006 +0000

description:
Refactor configure, build, test and wrapper phases out of bsd.pkg.mk
and into their own directories.  Also do some cleanups with build/_build
and pkginstall -- we get rid of _build and simply run pkginstall as
part of the "build" target.

Introduce a new mechanism to handle varying directory depths under
${WRKSRC} in which we find files to override, e.g. configure, config.*,
libtool, etc.  OVERRIDE_DIRDEPTH is a package-settable variable that
specifies how far under ${WRKSRC} the various targets should look,
and it defaults to "2".  We preserve the
meaning of the various *_OVERRIDE variables, so if they are defined,
then their values supersede the OVERRIDE_DIRDEPTH mechanism.

devel/tla will need to specially set OVERRIDE_DIRDEPTH to 3 (see log
for revision 1.1857 for bsd.pkg.mk -- to be done in a separate commit.

diffstat:

 mk/bsd.pkg.mk                       |  591 +-----------------------------------
 mk/build/bsd.build-vars.mk          |   47 ++
 mk/build/bsd.build.mk               |   43 ++
 mk/build/build.mk                   |  119 +++++++
 mk/build/test.mk                    |  123 +++++++
 mk/configure/bsd.configure-vars.mk  |   27 +
 mk/configure/bsd.configure.mk       |   39 ++
 mk/configure/config-override.mk     |   51 +++
 mk/configure/configure.mk           |  216 +++++++++++++
 mk/configure/gnu-configure.mk       |  100 ++++++
 mk/configure/libtool-override.mk    |   83 +++++
 mk/configure/pkg-config-override.mk |   33 ++
 mk/configure/replace-interpreter.mk |   48 ++
 mk/configure/replace-localedir.mk   |   45 ++
 mk/pkginstall/bsd.pkginstall.mk     |    3 +-
 mk/wrapper/bsd.wrapper.mk           |   69 +++-
 16 files changed, 1051 insertions(+), 586 deletions(-)

diffs (truncated from 1870 to 300 lines):

diff -r ae722e525257 -r 99cce6ce1417 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed Jul 05 05:37:39 2006 +0000
+++ b/mk/bsd.pkg.mk     Wed Jul 05 06:09:15 2006 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1857 2006/06/18 09:40:25 rillig Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1858 2006/07/05 06:09:15 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -26,6 +26,8 @@
 .include "${PKGSRCDIR}/mk/fetch/bsd.fetch-vars.mk"
 .include "${PKGSRCDIR}/mk/extract/bsd.extract-vars.mk"
 .include "${PKGSRCDIR}/mk/patch/bsd.patch-vars.mk"
+.include "${PKGSRCDIR}/mk/configure/bsd.configure-vars.mk"
+.include "${PKGSRCDIR}/mk/build/bsd.build-vars.mk"
 .include "${PKGSRCDIR}/mk/install/bsd.install-vars.mk"
 .include "${PKGSRCDIR}/mk/bsd.pkg.error.mk"
 
@@ -99,18 +101,13 @@
 ##### Others
 
 BUILD_DEPENDS?=                # empty
-BUILD_TARGET?=         all
 COMMENT?=              (no description)
-CONFIGURE_DIRS?=       ${WRKSRC}
-CONFIGURE_SCRIPT?=     ./configure
 DEPENDS?=              # empty
 DESCR_SRC?=            ${PKGDIR}/DESCR
 DIGEST_ALGORITHMS?=    SHA1 RMD160
 DISTINFO_FILE?=                ${PKGDIR}/distinfo
 INTERACTIVE_STAGE?=    none
 MAINTAINER?=           pkgsrc-users%NetBSD.org@localhost
-MAKE_FLAGS?=           # empty
-MAKEFILE?=             Makefile
 PATCH_DIGEST_ALGORITHM?=SHA1
 PKGWILDCARD?=          ${PKGBASE}-[0-9]*
 SVR4_PKGNAME?=         ${PKGNAME}
@@ -239,40 +236,6 @@
 ALL_ENV+=      PATH=${PATH:Q}:${LOCALBASE}/bin:${X11BASE}/bin
 ALL_ENV+=      PREFIX=${PREFIX}
 
-MAKE_ENV+=     ${ALL_ENV}
-MAKE_ENV+=     ${NO_EXPORT_CPP:D:UCPP=${CPP:Q}}
-MAKE_ENV+=     LINK_ALL_LIBGCC_HACK=${LINK_ALL_LIBGCC_HACK:Q}
-MAKE_ENV+=     LOCALBASE=${LOCALBASE:Q}
-MAKE_ENV+=     NO_WHOLE_ARCHIVE_FLAG=${NO_WHOLE_ARCHIVE_FLAG:Q}
-MAKE_ENV+=     WHOLE_ARCHIVE_FLAG=${WHOLE_ARCHIVE_FLAG:Q}
-MAKE_ENV+=     X11BASE=${X11BASE:Q}
-MAKE_ENV+=     X11PREFIX=${X11PREFIX:Q}
-MAKE_ENV+=     PKGMANDIR=${PKGMANDIR:Q}
-
-# Constants to provide a consistent environment for packages using
-# BSD-style Makefiles.
-MAKE_ENV+=     MAKECONF=${PKGMAKECONF:U/dev/null}
-MAKE_ENV+=     OBJECT_FMT=${OBJECT_FMT:Q}
-MAKE_ENV+=     ${USETOOLS:DUSETOOLS=${USETOOLS:Q}}
-
-SCRIPTS_ENV+=  ${ALL_ENV}
-SCRIPTS_ENV+=  _PKGSRCDIR=${_PKGSRCDIR}
-SCRIPTS_ENV+=  ${BATCH:DBATCH=yes}
-SCRIPTS_ENV+=  CURDIR=${.CURDIR}
-SCRIPTS_ENV+=  DEPENDS=${DEPENDS:Q}
-SCRIPTS_ENV+=  DISTDIR=${DISTDIR}
-SCRIPTS_ENV+=  FILESDIR=${FILESDIR}
-SCRIPTS_ENV+=  LOCALBASE=${LOCALBASE}
-SCRIPTS_ENV+=  PATCHDIR=${PATCHDIR}
-SCRIPTS_ENV+=  PKGSRCDIR=${PKGSRCDIR}
-SCRIPTS_ENV+=  SCRIPTDIR=${SCRIPTDIR}
-SCRIPTS_ENV+=  VIEWBASE=${VIEWBASE}
-SCRIPTS_ENV+=  WRKDIR=${WRKDIR}
-SCRIPTS_ENV+=  WRKSRC=${WRKSRC}
-SCRIPTS_ENV+=  X11BASE=${X11BASE}
-
-CONFIGURE_ENV+=        ${ALL_ENV}
-
 # Store the result in the +BUILD_INFO file so we can query for the build
 # options using "pkg_info -Q PKG_OPTIONS <pkg>".
 #
@@ -295,22 +258,6 @@
 # Automatically increase process limit where necessary for building.
 _ULIMIT_CMD=           ${UNLIMIT_RESOURCES:@_lim_@${ULIMIT_CMD_${_lim_}};@}
 
-# If GNU_CONFIGURE is defined, then pass LIBS to the GNU configure script.
-# also pass in a CONFIG_SHELL to avoid picking up bash
-.if defined(GNU_CONFIGURE)
-CONFIG_SHELL?=         ${SH}
-CONFIGURE_ENV+=                CONFIG_SHELL=${CONFIG_SHELL:Q}
-CONFIGURE_ENV+=                LIBS=${LIBS:M*:Q}
-CONFIGURE_ENV+=                install_sh=${INSTALL:Q}
-.  if (defined(USE_LIBTOOL) || !empty(PKGDIR:M*/libtool-base)) && defined(_OPSYS_MAX_CMDLEN_CMD)
-CONFIGURE_ENV+=                lt_cv_sys_max_cmd_len=${_OPSYS_MAX_CMDLEN_CMD:sh}
-.  endif
-.endif
-
-_WRAPPER_COOKIE=       ${WRKDIR}/.wrapper_done
-_CONFIGURE_COOKIE=     ${WRKDIR}/.configure_done
-_BUILD_COOKIE=         ${WRKDIR}/.build_done
-_TEST_COOKIE=          ${WRKDIR}/.test_done
 _INTERACTIVE_COOKIE=   ${.CURDIR}/.interactive_stage
 _NULL_COOKIE=          ${WRKDIR}/.null
 
@@ -395,6 +342,13 @@
 _PKGSRC_BUILD_TARGETS= build
 .endif
 
+# OVERRIDE_DIRDEPTH represents the common directory depth under
+#      ${WRKSRC} up to which we find the files that need to be
+#      overridden.  By default, we search two levels down, i.e.,
+#      */*/file.
+#
+OVERRIDE_DIRDEPTH?=    2
+
 # The user can override the NO_PACKAGE by specifying this from
 # the make command line
 .if defined(FORCE_PACKAGE)
@@ -447,59 +401,6 @@
 # do something.
 DO_NADA?=              ${TRUE}
 
-.if defined(GNU_CONFIGURE)
-HAS_CONFIGURE=         yes
-
-GNU_CONFIGURE_PREFIX?= ${PREFIX}
-CONFIGURE_ARGS+=       --prefix=${GNU_CONFIGURE_PREFIX:Q}
-
-USE_GNU_CONFIGURE_HOST?=       yes
-.  if !empty(USE_GNU_CONFIGURE_HOST:M[yY][eE][sS])
-CONFIGURE_ARGS+=       --host=${MACHINE_GNU_PLATFORM:Q}
-.  endif
-
-# Support for alternative info directories in packages is very sketchy.
-# For now, if we configure a package to install entirely into a
-# subdirectory of ${PREFIX}, then root the info directory directly under
-# that subdirectory.
-#
-CONFIGURE_HAS_INFODIR?=        yes
-.  if ${GNU_CONFIGURE_PREFIX} == ${PREFIX}
-GNU_CONFIGURE_INFODIR?=        ${GNU_CONFIGURE_PREFIX}/${PKGINFODIR}
-.  else
-GNU_CONFIGURE_INFODIR?=        ${GNU_CONFIGURE_PREFIX}/info
-.  endif
-.  if defined(INFO_FILES) && !empty(CONFIGURE_HAS_INFODIR:M[yY][eE][sS])
-CONFIGURE_ARGS+=       --infodir=${GNU_CONFIGURE_INFODIR:Q}
-.  endif
-
-CONFIGURE_HAS_MANDIR?= yes
-GNU_CONFIGURE_MANDIR?= ${GNU_CONFIGURE_PREFIX}/${PKGMANDIR}
-.  if !empty(CONFIGURE_HAS_MANDIR:M[yY][eE][sS])
-CONFIGURE_ARGS+=       --mandir=${GNU_CONFIGURE_MANDIR:Q}
-.  endif
-
-#
-# By default, override GNU configure scripts so that the generated
-# config.status scripts never do anything on "recheck".
-#
-CONFIGURE_SCRIPTS_OVERRIDE?=   \
-       configure */configure */*/configure
-.endif
-
-.if defined(GNU_CONFIGURE) || defined(OVERRIDE_GNU_CONFIG_SCRIPTS)
-#
-# By default, override config.guess and config.sub for GNU configure
-# packages. pkgsrc's updated versions of these scripts allows GNU
-# configure to recognise NetBSD ports such as shark.
-#
-CONFIG_GUESS_OVERRIDE?=                \
-       config.guess */config.guess */*/config.guess */*/*/config.guess
-CONFIG_SUB_OVERRIDE?=          \
-       config.sub */config.sub */*/config.sub */*/*/config.sub
-CONFIG_RPATH_OVERRIDE?=                # set by platform file as needed
-.endif
-
 #
 # Config file related settings - see doc/pkgsrc.txt
 #
@@ -608,11 +509,6 @@
 PATH=  ${_PATH_CMD:sh} # DOES NOT use :=, to defer evaluation
 .endif
 
-# Add these bits to the environment use when invoking the sub-make
-# processes for build-related phases.
-#
-BUILD_ENV+=            PATH=${PATH:Q}
-
 .MAIN: all
 
 ################################################################
@@ -731,7 +627,6 @@
 BUILD_DEFS+=   PKGPATH
 BUILD_DEFS+=   OPSYS OS_VERSION MACHINE_ARCH MACHINE_GNU_ARCH
 BUILD_DEFS+=   CPPFLAGS CFLAGS FFLAGS LDFLAGS
-BUILD_DEFS+=   CONFIGURE_ENV CONFIGURE_ARGS
 BUILD_DEFS+=   OBJECT_FMT LICENSE RESTRICTED
 BUILD_DEFS+=   NO_SRC_ON_FTP NO_SRC_ON_CDROM
 BUILD_DEFS+=   NO_BIN_ON_FTP NO_BIN_ON_CDROM
@@ -761,27 +656,6 @@
        @${DO_NADA}
 .endif
 
-# Disable wrapper
-.PHONY: wrapper
-.if defined(NO_BUILD) && !target(wrapper)
-wrapper: patch
-       ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${_WRAPPER_COOKIE}
-.endif
-
-# Disable configure
-.PHONY: configure
-.if defined(NO_CONFIGURE) && !target(configure)
-configure: wrapper
-       ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${_CONFIGURE_COOKIE}
-.endif
-
-# Disable build
-.PHONY: _build
-.if defined(NO_BUILD)
-_build: configure
-       ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${_BUILD_COOKIE}
-.endif
-
 ################################################################
 # More standard targets start here.
 #
@@ -880,297 +754,6 @@
        fi
 .endif
 
-
-# Configure
-
-# _CONFIGURE_PREREQ is a list of targets to run after pre-configure but before
-#      do-configure.  These targets typically edit the files used by the
-#      do-configure target.  The targets are run as dependencies of
-#      pre-configure-override.
-#
-# _CONFIGURE_POSTREQ is a list of targets to run after do-configure but before
-#      post-configure.  These targets typically edit the files generated by
-#      the do-configure target that are used during the build phase.
-
-.if defined(USE_PKGLOCALEDIR)
-_PKGLOCALEDIR=                 ${PREFIX}/${PKGLOCALEDIR}/locale
-REPLACE_LOCALEDIR_PATTERNS?=   # empty
-_REPLACE_LOCALEDIR_PATTERNS=   ${REPLACE_LOCALEDIR_PATTERNS}
-.  if defined(HAS_CONFIGURE) || defined(GNU_CONFIGURE)
-_REPLACE_LOCALEDIR_PATTERNS+=  [Mm]akefile.in*
-.  else
-_REPLACE_LOCALEDIR_PATTERNS+=  [Mm]akefile*
-.  endif
-_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd= \
-       cd ${WRKSRC} && \
-       ${ECHO} "__dummy-entry__" && \
-       ${FIND} . \( ${_REPLACE_LOCALEDIR_PATTERNS:C/.*/-o -name "&"/g:S/-o//1} \) -print \
-       | ${SED} -e 's|^\./||' \
-       | ${SORT} -u
-REPLACE_LOCALEDIR?=    # empty
-_REPLACE_LOCALEDIR=    \
-       ${REPLACE_LOCALEDIR}                                            \
-       ${_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd:sh:N__dummy-entry__:N*.orig}
-
-_CONFIGURE_PREREQ+=            subst-pkglocaledir
-.  if empty(USE_PKGLOCALEDIR:M[nN][oO])
-SUBST_CLASSES+=                        pkglocaledir
-.  endif
-SUBST_MESSAGE.pkglocaledir=    Fixing locale directory references.
-SUBST_FILES.pkglocaledir=      ${_REPLACE_LOCALEDIR}
-SUBST_SED.pkglocaledir=                \
-       -e 's|^\(localedir[     :]*=\).*|\1 ${_PKGLOCALEDIR}|'          \
-       -e 's|^\(gnulocaledir[  :]*=\).*|\1 ${_PKGLOCALEDIR}|'          \
-       -e 's|\(-DLOCALEDIR[    ]*=\)[^         ]*\(\.\*\)|\1"\\"${_PKGLOCALEDIR}\\""\2|'
-.endif
-
-.if defined(REPLACE_PERL)
-REPLACE_INTERPRETER+=  perl
-REPLACE.perl.old=      .*/bin/perl
-REPLACE.perl.new=      ${PERL5}
-REPLACE_FILES.perl=    ${REPLACE_PERL}
-.endif
-
-.if defined(REPLACE_INTERPRETER)
-
-# After 2006Q2, all instances of _REPLACE.* and _REPLACE_FILES.* should
-# have been replaced with REPLACE.* and REPLACE_FILES.*. This code is
-# then no longer needed.
-.  for _lang_ in ${REPLACE_INTERPRETER}
-REPLACE.${_lang_}.old?=                ${_REPLACE.${_lang_}.old}
-REPLACE.${_lang_}.new?=                ${_REPLACE.${_lang_}.new}
-REPLACE_FILES.${_lang_}?=      ${_REPLACE_FILES.${_lang_}}
-.  endfor
-
-_CONFIGURE_PREREQ+=    replace-interpreter
-.PHONY: replace-interpreter
-replace-interpreter:
-.  for lang in ${REPLACE_INTERPRETER}
-.    for pattern in ${REPLACE_FILES.${lang}}
-       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       cd ${WRKSRC};                                                   \
-       for f in ${pattern}; do                                         \
-           if [ -f $${f} ]; then                                       \
-                   ${SED} -e '1s|^#!${REPLACE.${lang}.old}|#!${REPLACE.${lang}.new}|' \
-                           $${f} > $${f}.new;                          \



Home | Main Index | Thread Index | Old Index