summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_comp
diff options
context:
space:
mode:
authorjmmv <jmmv@pkgsrc.org>2004-02-21 13:08:31 +0000
committerjmmv <jmmv@pkgsrc.org>2004-02-21 13:08:31 +0000
commit41d1ef3661696d20bbf6fb4610cbd7b9bdee7e75 (patch)
treea6bb5cf813efb79348a3fb304e633e705624fe4a /pkgtools/pkg_comp
parent2db74558c6b16b8156870ee69debd7bdaf38bdbb (diff)
downloadpkgsrc-41d1ef3661696d20bbf6fb4610cbd7b9bdee7e75.tar.gz
Update to 1.17:
- Recognize the PKGSRC_COMPILER variable and set it automatically in mk.conf. - Add the REAL_CCACHE variable: if set, the directory pointed by it will be null-mounted inside the chroot in a place known by ccache to store the cache. This is useful to keep it across rebuilds of the sandbox. Idea suggested by gavan@.
Diffstat (limited to 'pkgtools/pkg_comp')
-rw-r--r--pkgtools/pkg_comp/Makefile4
-rw-r--r--pkgtools/pkg_comp/files/pkg_comp.820
-rw-r--r--pkgtools/pkg_comp/files/pkg_comp.sh45
3 files changed, 62 insertions, 7 deletions
diff --git a/pkgtools/pkg_comp/Makefile b/pkgtools/pkg_comp/Makefile
index 6c91e120406..794013067cd 100644
--- a/pkgtools/pkg_comp/Makefile
+++ b/pkgtools/pkg_comp/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.22 2004/02/11 22:53:18 jmmv Exp $
+# $NetBSD: Makefile,v 1.23 2004/02/21 13:08:31 jmmv Exp $
-DISTNAME= pkg_comp-1.16
+DISTNAME= pkg_comp-1.17
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/pkg_comp/files/pkg_comp.8 b/pkgtools/pkg_comp/files/pkg_comp.8
index 9f090cf86b4..3df1edf7195 100644
--- a/pkgtools/pkg_comp/files/pkg_comp.8
+++ b/pkgtools/pkg_comp/files/pkg_comp.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_comp.8,v 1.19 2004/01/23 09:48:53 jmmv Exp $
+.\" $NetBSD: pkg_comp.8,v 1.20 2004/02/21 13:08:31 jmmv Exp $
.\"
.\" pkg_comp - Build packages inside a clean chroot environment
.\" Copyright (c) 2002, 2003, 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 23, 2004
+.Dd February 21, 2004
.Dt PKG_COMP 8
.Os
.Sh NAME
@@ -240,6 +240,16 @@ Defaults to
Base directory of configuration files.
Defaults to
.Pa /usr/pkg/etc .
+.It PKGSRC_COMPILER
+List of values specifying the chain of compilers to invoke when building
+packages.
+Defaults to
+.Ql gcc .
+If you are defining
+.Va REAL_CCACHE ,
+remember to prepend
+.Ql ccache
+to this variable's value.
.It PKGVULNDIR
Directory where the
.Pa vulnerabilities
@@ -346,6 +356,12 @@ to unmount the file systems, this status file may get out of sync.
Be sure to check that NO file systems are mounted when issuing a
.Sy removeroot .
.Bl -tag -width indent
+.It REAL_CCACHE
+Specifies where a global ccache directory resides in the real system.
+Defaults to nothing, which disables the global cache.
+Keep in mind that this is specially useful to keep the cache across
+rebuilds of the sandbox, but be very careful if you plan to share a
+cache directory between different sandboxes, as this can lead to problems.
.It REAL_DISTFILES
Specifies where distfiles reside in the real system.
Defaults to
diff --git a/pkgtools/pkg_comp/files/pkg_comp.sh b/pkgtools/pkg_comp/files/pkg_comp.sh
index 7817a321820..095856da800 100644
--- a/pkgtools/pkg_comp/files/pkg_comp.sh
+++ b/pkgtools/pkg_comp/files/pkg_comp.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: pkg_comp.sh,v 1.18 2004/02/13 23:52:07 snj Exp $
+# $NetBSD: pkg_comp.sh,v 1.19 2004/02/21 13:08:31 jmmv Exp $
#
# pkg_comp - Build packages inside a clean chroot environment
# Copyright (c) 2002, 2003, 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
@@ -42,14 +42,14 @@ ProgName="`basename $0`"
_MKCONF_VARS="WRKDIR_BASENAME MKOBJDIRS BSDSRCDIR WRKOBJDIR DISTDIR PACKAGES \
PKG_DEVELOPER CLEANDEPENDS LOCALBASE PKG_SYSCONFBASE \
CFLAGS CPPFLAGS CXXFLAGS USE_AUDIT_PACKAGES PKGVULNDIR \
- USE_XPKGWEDGE"
+ USE_XPKGWEDGE PKGSRC_COMPILER"
_TEMPLATE_VARS="DESTDIR ROOTSHELL COPYROOTCFG BUILD_TARGET DISTRIBDIR SETS \
SETS_X11 REAL_SRC REAL_SRC_OPTS REAL_PKGSRC \
REAL_PKGSRC_OPTS REAL_DISTFILES REAL_DISTFILES_OPTS \
REAL_PACKAGES REAL_PACKAGES_OPTS REAL_PKGVULNDIR \
NETBSD_RELEASE MOUNT_HOOKS UMOUNT_HOOKS SYNC_UMOUNT \
- AUTO_TARGET AUTO_PACKAGES BUILD_PACKAGES"
+ AUTO_TARGET AUTO_PACKAGES BUILD_PACKAGES REAL_CCACHE"
_BUILD_RESUME=
@@ -96,6 +96,7 @@ env_setdefaults()
: ${USE_AUDIT_PACKAGES:=yes}
: ${PKGVULNDIR:=/usr/pkg/share}
: ${USE_XPKGWEDGE:=yes}
+ : ${PKGSRC_COMPILER:=gcc}
# Default values for global variables used in the script.
: ${DESTDIR:=/var/chroot/pkg_comp/default}
@@ -119,6 +120,7 @@ env_setdefaults()
: ${MOUNT_HOOKS:=}
: ${UMOUNT_HOOKS:=}
: ${SYNC_UMOUNT:=no}
+ : ${REAL_CCACHE:=}
if [ -n "${MAKE_PACKAGES}" ]; then
warn "MAKE_PACKAGES is deprecated; use {AUTO,BUILD}_PACKAGES instead."
@@ -264,6 +266,15 @@ fsmount()
mount $REAL_PACKAGES_OPTS $REAL_PACKAGES $DESTDIR/pkg_comp/packages
fi
+ if [ -n "${REAL_CCACHE}" ]; then
+ if [ ! -d "${REAL_CCACHE}" ]; then
+ echo " failed."
+ fsumount
+ err "REAL_CCACHE ${REAL_CCACHE} disappeared"
+ fi
+ mount -t null -o rw ${REAL_CCACHE} ${DESTDIR}/pkg_comp/ccache
+ fi
+
touch $fsstate
for h in ${MOUNT_HOOKS}; do
@@ -314,6 +325,10 @@ fsumount()
umount $DESTDIR/pkg_comp/packages || fsfailed=yes
fi
+ if [ -n "${REAL_CCACHE}" -a -d "${REAL_CCACHE}" ]; then
+ umount ${DESTDIR}/pkg_comp/ccache || fsfailed=yes
+ fi
+
if [ "$SYNC_UMOUNT" != "no" ]; then
printf "Syncing: 1"
sync ; sleep 1
@@ -416,6 +431,13 @@ makeroot()
err "REAL_PACKAGES $REAL_PACKAGES does not exist"
fi
+ if echo ${PKGSRC_COMPILER} | grep ccache >/dev/null 2>&1 && \
+ [ -z "${REAL_CCACHE}" ]; then
+ warn "PKGSRC_COMPILER contains 'ccache' but REAL_CCACHE is unset"
+ elif [ -n "${REAL_CCACHE}" -a ! -d "${REAL_CCACHE}" ]; then
+ err "REAL_CCACHE ${REAL_CCACHE} does not exist"
+ fi
+
# Check for required directories.
if [ ! -d $DISTRIBDIR ]; then
err "DISTRIBDIR $DISTRIBDIR does not exist"
@@ -457,6 +479,11 @@ makeroot()
if [ "$COPYROOTCFG" = "yes" ]; then
cp /root/.* $DESTDIR/root >/dev/null 2>&1
fi
+ if [ -n "${REAL_CCACHE}" ]; then
+ # This is a workaround for older versions of ccache.mk that do not
+ # pass the CCACHE_DIR variable down to ccache.
+ ( cd ${DESTDIR}/root && ln -fs ../pkg_comp/ccache .ccache )
+ fi
echo "Setting up initial configuration..."
@@ -466,6 +493,7 @@ makeroot()
mkdir -p $DESTDIR/pkg_comp/packages
mkdir -p $DESTDIR/pkg_comp/tmp
mkdir -p $DESTDIR/pkg_comp/obj/pkgsrc
+ [ -n "${REAL_CCACHE}" ] && mkdir -p ${DESTDIR}/pkg_comp/ccache
( cd $DESTDIR && ln -s pkg_comp p )
# Set sh configuration
@@ -487,6 +515,7 @@ makeroot()
# signals to umount them.
trap "echo \"*** Process aborted ***\" ; fsumount ; exit 1" INT QUIT
+ makeroot_digest
makeroot_libkver
if [ "$USE_GCC3" = "yes" ]; then
@@ -556,6 +585,16 @@ EOF
fi
}
+# makeroot_digest
+#
+# Ensure digest is always installed, specially because PKGSRC_COMPILER
+# may contain 'ccache' or 'distcc'.
+#
+makeroot_digest()
+{
+ ( PKGSRC_COMPILER=; export PKGSRC_COMPILER; pkg_build pkgtools/digest )
+}
+
# makeroot_libkver
#
# If NETBSD_RELEASE is set to a version string, installs libkver