diff options
author | joerg <joerg@pkgsrc.org> | 2008-01-23 21:12:41 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2008-01-23 21:12:41 +0000 |
commit | 1d688ef2649f9e7076029109bee8e58822ed8d3e (patch) | |
tree | d9f67f343978729d7c0368ea0d0dca743d48e7ba /bootstrap | |
parent | c9e7c15871285d7def847b3aa794a5a75e0f9742 (diff) | |
download | pkgsrc-1d688ef2649f9e7076029109bee8e58822ed8d3e.tar.gz |
Add --binary-kit, --gzip-binary-kit and --binary-macpkg to bootstrap
and retire mkbinarkit. The options take the desired output name as
argument.
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap/bootstrap | 56 | ||||
-rwxr-xr-x | bootstrap/mkbinarykit | 224 |
2 files changed, 55 insertions, 225 deletions
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index 04e3c77e63a..3aa4eddc231 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: bootstrap,v 1.117 2008/01/20 19:55:29 rillig Exp $ +# $NetBSD: bootstrap,v 1.118 2008/01/23 21:12:41 joerg Exp $ # # # Copyright (c) 2001-2002 Alistair G. Crooks. All rights reserved. @@ -71,6 +71,9 @@ usage="Usage: $0 "' [ --preserve-path ] [ --compiler <compiler> ] [ --mk-fragment <mk.conf> ] + [ --binary-kit <tarball> ] + [ --gzip-binary-kit <tarball> ] + [ --binary-macpkg <pkg> ] [ --full ] [ --quiet ] [ --help ]' @@ -82,6 +85,42 @@ usage="Usage: $0 "' # strip / for BSD/OS, strip - for HP-UX opsys=`uname -s | tr -d /-` +mkbinarykit_macpkg() +{ + local macdestdir + macdestdir=${wrkdir}/macpkg-destdir + rm -rf ${macdestdir} || die "cleanup destdir" + + mkdir -p ${macdestdir}${prefix} || die "mkdir destprefix" + rmdir ${macdestdir}${prefix} || die "rmdir destprefix" + cp -Rp ${prefix} ${macdestdir}${prefix} || die "copy prefix" + + if [ ! -d ${macdestdir}${pkgdbdir} ]; then + mkdir -p ${macdestdir}${pkgdbdir} || die "mkdir destdbdir" + rmdir ${macdestdir}${pkgdbdir} || die "rmdir destdbdir" + cp -Rp ${pkgdbdir} ${macdestdir}${pkgdbdir} || die "copy dbdir" + fi + + ${sedprog} -e "s|%WRKDIR%|${wrkdir}|g" \ + -e "s|%TARGETDIR%|${targetdir}|g" -e "s|%DATE%|${date}|g" \ + < macpkg.pmproj.in > ${wrkdir}/macpkg.pmproj + ${packagemaker} -build -proj ${wrkdir}/macpkg.pmproj -p "${binary_macpkg}" +} + +mkbinarykit_tar() +{ + # in case tar was built by bootstrap + PATH="$prefix/bin:$PATH"; export PATH + cd / && tar -hcf "${binary_kit}" .$prefix .$pkgdbdir .$etc_mk_conf +} + +mkbinarykit_tgz() +{ + # in case tar was built by bootstrap + PATH="$prefix/bin:$PATH"; export PATH + cd / && tar -hzcf "${binary_gzip_kit}" .$prefix .$pkgdbdir .$etc_mk_conf +} + die() { echo >&2 "$@" @@ -337,6 +376,17 @@ while [ $# -gt 0 ]; do mk_fragment=`get_optarg "$1"` ;; --mk-fragment) mk_fragment="$2"; shift ;; + + --binary-kit=*) + binary_kit=`get_optarg "$1"` ;; + --binary-kit) + binary_kit="$2"; shift ;; + --gzip-binary-kit=*) + binary_gzip_kit=`get_optarg "$1"` ;; + --gzip-binary-kit) + binary_gzip_kit="$2"; shift ;; + --binary-macpkg) + binary_macpkg=`get_optarg "$1"` ;; --full) full=yes ;; --quiet) quiet=yes ;; --help) echo "$usage"; exit ;; @@ -1016,6 +1066,10 @@ echo "" echo "$hline" echo "" +[ ! -z "${binary_kit}" ] && mkbinarykit_tar +[ ! -z "${binary_gzip_kit}" ] && mkbinarykit_tgz +[ ! -z "${binary_macpkg}" ] && mkbinarykit_macpkg + echo_msg "bootstrap started: $build_start" echo_msg "bootstrap ended: `date`" diff --git a/bootstrap/mkbinarykit b/bootstrap/mkbinarykit deleted file mode 100755 index d5626e6afba..00000000000 --- a/bootstrap/mkbinarykit +++ /dev/null @@ -1,224 +0,0 @@ -#!/bin/sh - -# $NetBSD: mkbinarykit,v 1.27 2007/11/03 17:51:08 minskim Exp $ -# -# Make a binary bootstrap kit and place it in targetdir (or current -# working directory if not specified). The mk.conf.example file is -# copied to ${PREFIX}/etc/mk.conf or to the location specified -# by using --mkconf. Run this program from the pkgsrc/bootstrap -# directory. - -mkbinarykit_macpkg() -{ - local macdestdir - macdestdir=${wrkdir}/macpkg-destdir - rm -rf ${macdestdir} || die "cleanup destdir" - - mkdir -p ${macdestdir}${prefix} || die "mkdir destprefix" - rmdir ${macdestdir}${prefix} || die "rmdir destprefix" - cp -Rp ${prefix} ${macdestdir}${prefix} || die "copy prefix" - - if [ ! -d ${macdestdir}${pkgdbdir} ]; then - mkdir -p ${macdestdir}${pkgdbdir} || die "mkdir destdbdir" - rmdir ${macdestdir}${pkgdbdir} || die "rmdir destdbdir" - cp -Rp ${pkgdbdir} ${macdestdir}${pkgdbdir} || die "copy dbdir" - fi - - ${sedprog} -e "s|%WRKDIR%|${wrkdir}|g" \ - -e "s|%TARGETDIR%|${targetdir}|g" -e "s|%DATE%|${date}|g" \ - < macpkg.pmproj.in > ${wrkdir}/macpkg.pmproj - ${packagemaker} -build -proj ${wrkdir}/macpkg.pmproj -p "$targetdir/bootstrap-pkgsrc-$opsys-$osrev-$ospro-$date.pkg" - ls -dl "$targetdir/bootstrap-pkgsrc-$opsys-$osrev-$ospro-$date.pkg" -} - -mkbinarykit_tar() -{ - # in case tar was built by bootstrap - PATH="$prefix/bin:$PATH"; export PATH - [ ! -d $sysconfdir ] && mkdir -p $sysconfdir - cp ${wrkdir}/mk.conf.example $mkfile && \ - cd / && \ - tar -hcf "$targetdir/bootstrap-pkgsrc-$opsys-$osrev-$ospro-$date.tar" \ - .$prefix .$pkgdbdir .$mkfile && \ - ls -l "$targetdir/bootstrap-pkgsrc-$opsys-$osrev-$ospro-$date.tar" -} - -die() -{ - echo "error: can't $@" >&2 - exit 1 -} - -usage="Usage: $0 "' - [ --force ] [ --targetdir=<tar target dir> ] [ --mkconf=<target> ] - [ --no-build ] [ --workdir=<work dir> ] [ bootstrap script arguments ] - [ --fetch-cmd=<ftp command> ] [ --mk-fragment=<mk.conf> ]' - -opsys=`uname -s | tr -d /-` -osrev=`uname -r` -ospro=`uname -p` -date=`date +%Y%m%d` - -prefix=/usr/pkg -sysconfdir=$prefix/etc -pkgdbdir=/var/db/pkg -compiler= -mkfile= -mk_fragment= -ignorecasecheck=no -ignoreusercheck=no -force=no -build=yes -fetch_cmd="" -targetdir=`pwd` -wrkdir=`pwd`/work # default: relative to pkgsrc/bootstrap - -sedprog="sed" - -case "$opsys" in -AIX) - pkgdbdir=$prefix/pkgdb - ;; -Darwin) - macosx_version=`echo $osrev | awk -F . '{ print "10."$1-4; }'` - case "$macosx_version" in - 10.[0-4]) - universal_sdk="/Developer/SDKs/MacOSX${macosx_version}u.sdk" - packagemaker=/Developer/Tools/packagemaker - ;; - *) - universal_sdk="/Developer/SDKs/MacOSX${macosx_version}.sdk" - packagemaker=/Developer/usr/bin/packagemaker - ;; - esac - if [ -d "${universal_sdk}" ]; then - echo "===> Building Universal binaries." - ospro=universal - export CFLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64 -isysroot ${universal_sdk}" - export LDFLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64 -Wl,-syslibroot,${universal_sdk}" - else - echo "===> Building non-Universal binaries." - fi - unset macosx_version universal_sdk - ;; -DragonFly) - case "$osrev" in - 1.1[0-9]*) - ;; - 1.0* | 1.1 | 1.2.* | 1.3.*) - # Don't use the ports /var/db/pkg - pkgdbdir=$prefix/pkgdb - ;; - esac - ;; -FreeBSD) - # Don't use the ports /var/db/pkg - pkgdbdir=$prefix/pkgdb - ;; -Interix) - # Don't use the interopsystems.com package dir - pkgdbdir=$prefix/pkgdb - ospro=i386 - ;; -HPUX) - ospro=`uname -m | sed 's/^9000.*$/hppa/'` - ;; -NetBSD) - ;; -OpenBSD) - # Don't use the ports /var/db/pkg - pkgdbdir=$prefix/pkgdb - # Use "arch -s" instead of uname -p - ospro=`arch -s` - ;; -SunOS) - sedprog=/usr/xpg4/bin/sed - ;; -esac - -while [ $# -gt 0 ]; do - case $1 in - --force) force=yes ;; - --no-build) build=no ;; - --targetdir=*) targetdir=`echo $1 | $sedprog -e 's|--targetdir=||'` ;; - --prefix=*) prefix=`echo $1 | $sedprog -e 's|--prefix=||'` ;; - --fetch-cmd=*) fetch_cmd="$1" ;; - --mkconf=*) mkfile=`echo $1 | $sedprog -e 's|--mkconf=||'` ;; - --mk-fragment=*) - mk_fragment="$1" ;; - --compiler=*) compiler="$1" ;; - --pkgdbdir=*) pkgdbdir=`echo $1 | $sedprog -e 's|--pkgdbdir=||'` ;; - --ignore-case-check) ignorecasecheck=yes ;; - --ignore-user-check) ignoreusercheck=yes ;; - --workdir=*) wrkdir=`echo $1 | $sedprog -e 's|--workdir=||'` ;; - --*) echo "$usage"; exit 1 ;; - esac - shift -done - -[ -z "${mkfile}" ] && mkfile="$prefix/etc/mk.conf" - -if [ "$build" = "yes" ] && [ "$force" != "yes" ]; then - if [ -d "$prefix" ] || [ -d "$pkgdbdir" ]; then - echo "Some pkgsrc infrastructure exists on this system already." - echo "Use --force to move it out of the way." - exit 1 - fi -elif [ "$build" = "yes" ]; then - mv -f "$prefix" "$prefix.$$" - mv -f "$pkgdbdir" "$pkgdbdir.$$" - mv -f "$mkfile" "$mkfile.$$" -fi - -if [ "$build" != "no" ]; then - - # Bootstrap - bootstrap_flags="--prefix=$prefix --pkgdbdir=$pkgdbdir --workdir=$wrkdir $fetch_cmd" - if [ "$ignorecasecheck" = "yes" ]; then - bootstrap_flags="$bootstrap_flags --ignore-case-check" - fi - if [ -n "${mk_fragment}" ]; then - bootstrap_flags="$bootstrap_flags ${mk_fragment}" - fi - if [ -n "${compiler}" ]; then - bootstrap_flags="$bootstrap_flags ${compiler}" - fi - - if [ "$ignoreusercheck" = "yes" ]; then - bootstrap_flags="$bootstrap_flags --ignore-user-check" - fi - - echo "Making bootstrap kit with" - echo "prefix = $prefix" - echo "pkgdbdir = $pkgdbdir" - echo "mk.conf.example will be copied to $mkfile" - echo "" - - ./cleanup $wrkdir - ./bootstrap $bootstrap_flags - if [ $? != "0" ]; then - echo "Bootstrap error." - exit 1; - fi -fi - -# Make a tar ball - -strip=strip -if [ -x /usr/ccs/bin/strip ]; then - strip=/usr/ccs/bin/strip -fi - -echo "Stripping binaries..." -$strip "$prefix/"bin/* -$strip "$prefix/"sbin/* - -echo "Making binary kit." -case "$opsys" in -Darwin) - mkbinarykit_macpkg - ;; -*) - mkbinarykit_tar - ;; -esac |