2004-03-11 14:03:58 +01:00
|
|
|
#! /bin/sh
|
|
|
|
|
2005-05-08 00:16:38 +02:00
|
|
|
# $NetBSD: bootstrap,v 1.36 2005/05/07 22:19:16 wiz Exp $
|
2004-03-11 14:03:58 +01:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# Copyright (c) 2001-2002 Alistair G. Crooks. All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
|
|
# must display the following acknowledgement:
|
|
|
|
# This product includes software developed by Alistair G. Crooks
|
|
|
|
# for the NetBSD project.
|
|
|
|
# 4. The name of the author may not be used to endorse or promote
|
|
|
|
# products derived from this software without specific prior written
|
|
|
|
# permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
|
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
|
|
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
#set -x
|
|
|
|
|
2005-04-19 20:24:17 +02:00
|
|
|
BOOTSTRAP_VERSION=20050419
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# set defaults for system locations
|
|
|
|
prefix=/usr/pkg
|
|
|
|
pkgdbdir=/var/db/pkg
|
2004-04-07 14:05:37 +02:00
|
|
|
sysconfdir=${prefix}/etc
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
ignorecasecheck=no
|
|
|
|
ignoreusercheck=no
|
|
|
|
|
2005-04-10 23:54:13 +02:00
|
|
|
preserve_path=no
|
|
|
|
|
2004-03-28 03:55:17 +02:00
|
|
|
# where the building takes place
|
|
|
|
wrkdir=work # default: relative to pkgsrc/bootstrap
|
|
|
|
bootstrapdir=`pwd`
|
2004-05-11 04:07:19 +02:00
|
|
|
pkgsrcdir=`dirname $bootstrapdir`
|
2004-03-28 03:55:17 +02:00
|
|
|
|
2004-03-11 14:03:58 +01:00
|
|
|
usage="Usage: $0 "'
|
2005-04-10 23:54:13 +02:00
|
|
|
[ --workdir <workdir> ]
|
|
|
|
[ --prefix <prefix> ]
|
|
|
|
[ --pkgdbdir <pkgdbdir> ]
|
|
|
|
[ --sysconfdir <sysconfdir> ]
|
2004-03-11 14:03:58 +01:00
|
|
|
[ --ignore-case-check ]
|
|
|
|
[ --ignore-user-check ]
|
2005-04-10 23:54:13 +02:00
|
|
|
[ --preserve-path ]
|
2004-03-11 14:03:58 +01:00
|
|
|
[ --help ]'
|
|
|
|
|
|
|
|
# this replicates some of the logic in bsd.prefs.mk. until
|
|
|
|
# bootstrap-pkgsrc is merged into pkgsrc, we need to determine the
|
|
|
|
# right value for OPSYS and MACHINE_ARCH.
|
|
|
|
|
|
|
|
# strip / for BSD/OS
|
|
|
|
opsys=`uname -s | tr -d /`
|
|
|
|
|
|
|
|
die()
|
|
|
|
{
|
|
|
|
echo >&2 "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
echo_msg()
|
|
|
|
{
|
|
|
|
echo "===> $@"
|
|
|
|
}
|
|
|
|
|
2005-04-10 23:54:13 +02:00
|
|
|
# see if we're using gcc. If so, set $compiler_is_gnu to '1'.
|
|
|
|
get_compiler()
|
|
|
|
{
|
|
|
|
testcc="${CC}"
|
|
|
|
# normally, we'd just use 'cc', but certain configure tools look
|
|
|
|
# for gcc specifically, so we have to see if that comes first
|
|
|
|
if [ -z "${testcc}" ]; then
|
|
|
|
save_IFS="${IFS}"
|
|
|
|
IFS=':'
|
|
|
|
for dir in ${PATH}; do
|
|
|
|
test -z "$dir" && dir=.
|
|
|
|
if [ -x "$dir/gcc" ]; then
|
|
|
|
testcc="$dir/gcc"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
IFS="${save_IFS}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat >${wrkdir}/$$.c <<EOF
|
|
|
|
#ifdef __GNUC__
|
|
|
|
indeed
|
|
|
|
#endif
|
|
|
|
EOF
|
|
|
|
compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed`
|
|
|
|
rm -f ${wrkdir}/$$.c
|
|
|
|
|
|
|
|
}
|
2004-03-11 14:03:58 +01:00
|
|
|
get_abi()
|
|
|
|
{
|
|
|
|
abi_opsys=$@
|
|
|
|
case "$abi_opsys" in
|
|
|
|
IRIX)
|
|
|
|
abi=`sed -e 's/.*\(abi=\)\([on]*[36][24]\).*/\2/' /etc/compiler.defaults`
|
|
|
|
isa=`sed -e 's/.*\(isa=mips\)\([1234]\).*/\2/' /etc/compiler.defaults`
|
|
|
|
case "$abi" in
|
|
|
|
o32)
|
|
|
|
imakeopts="-DBuildO32 -DSgiISAo32=$isa"
|
|
|
|
abi=""
|
|
|
|
;;
|
|
|
|
n32) imakeopts="-DBuildN32 -DSgiISA32=$isa"
|
|
|
|
abi="32"
|
|
|
|
;;
|
|
|
|
64 | n64)
|
|
|
|
imakeopts="-DBuild64bit -DSgiISA64=$isa"
|
|
|
|
abi="64"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2005-02-19 05:07:31 +01:00
|
|
|
get_machine_arch_aix()
|
|
|
|
{
|
|
|
|
_cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
|
|
|
if /usr/sbin/lsattr -El $_cpuid | grep ' POWER' >/dev/null 2>&1; then
|
|
|
|
echo rs6000
|
|
|
|
else
|
|
|
|
echo powerpc
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2004-03-11 14:03:58 +01:00
|
|
|
check_prog()
|
|
|
|
{
|
|
|
|
_var="$1"; _name="$2"
|
|
|
|
|
|
|
|
eval _tmp=\"\$$_var\"
|
|
|
|
if [ "x$_tmp" != "x" ]; then
|
|
|
|
# Variable is already set (by the user, for example)
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for _d in `echo $PATH | tr ':' ' '`; do
|
|
|
|
if [ -x "$_d/$_name" ]; then
|
|
|
|
# Program found
|
|
|
|
eval $_var=\""$_d/$_name"\"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
die "$_name not found in path."
|
|
|
|
}
|
|
|
|
|
|
|
|
opsys_finish()
|
|
|
|
{
|
|
|
|
case "$opsys" in
|
|
|
|
IRIX)
|
|
|
|
# setting X11BASE to /usr breaks buildlink
|
|
|
|
if [ ! -e /usr/X11R6 ]; then
|
|
|
|
ln -sf /usr /usr/X11R6
|
|
|
|
fi
|
|
|
|
if [ ! -z $imakeopts ]; then
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "IMAKEOPTS+=$imakeopts" >> ${MKCONF_EXAMPLE}
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
patch -d / --forward --quiet -E -p0 \
|
|
|
|
< files/irix.patch 2>/dev/null || true
|
|
|
|
;;
|
2004-11-20 05:31:35 +01:00
|
|
|
OSF1)
|
|
|
|
if [ ! -e /usr/X11R6 ]; then
|
|
|
|
ln -sf /usr /usr/X11R6
|
|
|
|
fi
|
|
|
|
;;
|
2004-03-11 14:03:58 +01:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
is_root()
|
|
|
|
{
|
|
|
|
if [ `$idprog -u` != 0 ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# run a command, abort if it fails
|
|
|
|
run_cmd()
|
|
|
|
{
|
|
|
|
echo_msg "running: $@"
|
|
|
|
eval "$@"
|
|
|
|
ret=$?
|
|
|
|
if [ $ret -ne 0 ]; then
|
|
|
|
echo_msg "exited with status $ret"
|
|
|
|
die "aborted."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2004-03-11 18:47:18 +01:00
|
|
|
# Some versions of mkdir (notably SunOS) bail out too easily, so use the
|
|
|
|
# install-sh wrapper instead.
|
|
|
|
mkdir_p()
|
|
|
|
{
|
2004-03-11 21:49:09 +01:00
|
|
|
for dir in $@; do
|
2004-04-23 04:03:18 +02:00
|
|
|
run_cmd "$shprog $wrkdir/install-sh -d -o $user -g $group $dir"
|
2004-03-11 21:49:09 +01:00
|
|
|
done
|
2004-03-11 18:47:18 +01:00
|
|
|
}
|
|
|
|
|
2004-03-11 14:08:06 +01:00
|
|
|
copy_src()
|
|
|
|
{
|
|
|
|
_src="$1"; _dst="$2"
|
|
|
|
if [ ! -d $wrkdir/$_dst ]; then
|
2004-03-11 18:47:18 +01:00
|
|
|
mkdir_p $wrkdir/$_dst
|
2004-03-11 14:08:06 +01:00
|
|
|
fi
|
2005-01-05 22:51:19 +01:00
|
|
|
$cpprog -R $_src/* $wrkdir/$_dst
|
2004-03-11 14:08:06 +01:00
|
|
|
}
|
|
|
|
|
2004-03-11 14:03:58 +01:00
|
|
|
build_start=`date`
|
|
|
|
echo_msg "bootstrap command: $0 $@"
|
|
|
|
echo_msg "bootstrap started: $build_start"
|
|
|
|
|
2005-04-10 23:54:13 +02:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
--workdir) wrkdir="$2"; shift ;;
|
|
|
|
--prefix) prefix="$2"; shift;
|
|
|
|
sysconfdir=${prefix}/etc ;;
|
|
|
|
--pkgdbdir) pkgdbdir="$2"; shift ;;
|
|
|
|
--sysconfdir) sysconfdir="$2"; shift ;;
|
|
|
|
--ignore-case-check) ignorecasecheck=yes ;;
|
|
|
|
--ignore-user-check) ignoreusercheck=yes ;;
|
|
|
|
--preserve-path) preserve_path=yes ;;
|
|
|
|
--help) echo "$usage"; exit ;;
|
|
|
|
-h) echo "$usage"; exit ;;
|
|
|
|
--*) echo "$usage"; exit 1 ;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "x$preserve_path" != "xyes" ]; then
|
|
|
|
PATH="$PATH:/sbin:/usr/sbin"
|
2004-04-24 21:17:09 +02:00
|
|
|
fi
|
|
|
|
|
2004-03-11 14:03:58 +01:00
|
|
|
overpath=""
|
2004-03-11 18:29:11 +01:00
|
|
|
root_user=root
|
2004-03-11 14:03:58 +01:00
|
|
|
case "$opsys" in
|
|
|
|
Darwin)
|
|
|
|
root_group=wheel
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=no
|
|
|
|
need_bsd_install=no
|
|
|
|
need_sed=no
|
|
|
|
set_opsys=no
|
|
|
|
check_prog mtreeprog mtree
|
|
|
|
machine_arch=`uname -p`
|
|
|
|
;;
|
2004-10-31 23:04:26 +01:00
|
|
|
DragonFly)
|
|
|
|
root_group=wheel
|
2005-01-20 23:36:06 +01:00
|
|
|
need_pax=yes
|
2004-10-31 23:04:26 +01:00
|
|
|
need_mtree=no
|
|
|
|
need_bsd_install=no
|
|
|
|
need_sed=no
|
|
|
|
set_opsys=no
|
2005-01-12 12:30:37 +01:00
|
|
|
check_prog tarprog tar
|
|
|
|
check_prog mtreeprog mtree
|
2004-10-31 23:04:26 +01:00
|
|
|
machine_arch=`uname -p`
|
|
|
|
;;
|
2004-03-11 14:03:58 +01:00
|
|
|
FreeBSD)
|
|
|
|
root_group=wheel
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=no
|
|
|
|
need_sed=no
|
|
|
|
set_opsys=no
|
|
|
|
machine_arch=`uname -p`
|
|
|
|
;;
|
|
|
|
HP-UX)
|
|
|
|
root_group=root
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=yes
|
|
|
|
need_sed=yes
|
|
|
|
set_opsys=no
|
|
|
|
;;
|
|
|
|
IRIX*)
|
|
|
|
if [ -d "/usr/freeware/bin" ]; then
|
|
|
|
overpath="/usr/freeware/bin:$overpath"
|
|
|
|
fi
|
|
|
|
if [ -d "/usr/bsd/bin" ]; then
|
|
|
|
overpath="/usr/bsd/bin:$overpath"
|
|
|
|
fi
|
|
|
|
root_group=sys
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=yes
|
|
|
|
need_pax=yes
|
|
|
|
configargs="--with-machine_arch=mipseb"
|
|
|
|
get_abi "IRIX"
|
|
|
|
opsys=IRIX
|
|
|
|
need_sed=yes
|
|
|
|
set_opsys=yes
|
2005-01-12 17:42:13 +01:00
|
|
|
machine_arch=mipseb
|
2005-04-10 23:54:13 +02:00
|
|
|
check_compiler=yes
|
2004-03-11 14:03:58 +01:00
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
if [ -f /etc/debian_version ]; then
|
|
|
|
DEBIAN=yes
|
|
|
|
fi
|
|
|
|
root_group=root
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=no
|
|
|
|
need_sed=no
|
|
|
|
set_opsys=no
|
|
|
|
machine_arch=`uname -m | sed -e 's/i.86/i386/'`
|
|
|
|
;;
|
|
|
|
NetBSD)
|
|
|
|
root_group=wheel
|
|
|
|
need_pax=no
|
|
|
|
need_mtree=no
|
|
|
|
need_bsd_install=no
|
|
|
|
need_sed=no
|
|
|
|
set_opsys=no
|
|
|
|
check_prog paxprog pax
|
|
|
|
check_prog tarprog tar
|
|
|
|
check_prog mtreeprog mtree
|
|
|
|
machine_arch=`uname -p`
|
|
|
|
;;
|
|
|
|
OpenBSD)
|
|
|
|
root_group=wheel
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=no
|
|
|
|
need_bsd_install=no
|
|
|
|
need_sed=no
|
|
|
|
set_opsys=no
|
|
|
|
check_prog mtreeprog mtree
|
2004-03-21 02:06:37 +01:00
|
|
|
machine_arch=`uname -m`
|
2004-03-11 14:03:58 +01:00
|
|
|
;;
|
|
|
|
SunOS)
|
|
|
|
if [ -d "/usr/xpg4/bin" ]; then
|
|
|
|
overpath="/usr/xpg4/bin:$overpath"
|
|
|
|
fi
|
|
|
|
root_group=root
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=no
|
|
|
|
need_sed=yes
|
|
|
|
set_opsys=no
|
|
|
|
whoamiprog=/usr/ucb/whoami
|
|
|
|
machine_arch=`uname -p | sed -e 's/i86pc/i386/'`
|
|
|
|
;;
|
|
|
|
AIX)
|
|
|
|
root_group=system
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=yes
|
|
|
|
need_sed=yes
|
|
|
|
need_fixed_strip=yes
|
|
|
|
set_opsys=no
|
2005-02-19 05:07:31 +01:00
|
|
|
machine_arch=`get_machine_arch_aix`
|
2004-03-11 14:03:58 +01:00
|
|
|
;;
|
|
|
|
Interix)
|
2004-03-11 18:29:11 +01:00
|
|
|
is_root () {
|
2004-05-05 16:39:45 +02:00
|
|
|
if id -G | grep -q 131616; then
|
2004-03-11 18:29:11 +01:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
2004-04-21 22:35:18 +02:00
|
|
|
mkdir_p () {
|
|
|
|
mkdir -p "$@" # allows umask to take effect
|
|
|
|
}
|
2004-04-23 04:03:18 +02:00
|
|
|
default_install_mode=0775
|
2004-05-05 16:39:45 +02:00
|
|
|
root_user=`id -u`
|
|
|
|
root_group=131616
|
2004-03-11 20:45:09 +01:00
|
|
|
need_pax=yes
|
2004-03-11 14:03:58 +01:00
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=yes
|
|
|
|
need_sed=yes
|
|
|
|
set_opsys=no
|
2004-03-29 04:20:04 +02:00
|
|
|
# only used for unprivileged builds
|
|
|
|
groupsprog="id -gn"
|
|
|
|
# for bootstrap only; pkgsrc uses CPPFLAGS
|
2004-03-11 14:03:58 +01:00
|
|
|
CC="gcc -D_ALL_SOURCE"; export CC
|
2004-05-05 16:39:45 +02:00
|
|
|
ac_cv_header_poll_h=no; export ac_cv_header_poll_h
|
|
|
|
ac_cv_func_poll=no; export ac_cv_func_poll
|
2004-03-11 14:03:58 +01:00
|
|
|
;;
|
2004-04-11 05:17:12 +02:00
|
|
|
UnixWare)
|
|
|
|
root_group=sys
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=no
|
|
|
|
BSTRAP_ENV="INSTALL=/usr/ucb/install $BSTRAP_ENV"
|
|
|
|
need_mkdir=yes
|
|
|
|
need_sed=yes
|
|
|
|
whoamiprog=/usr/ucb/whoami
|
|
|
|
set_opsys=no
|
|
|
|
CC="gcc -DUNIXWARE"; export CC
|
|
|
|
;;
|
2004-11-20 05:31:35 +01:00
|
|
|
OSF1)
|
|
|
|
root_group=system
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=yes
|
|
|
|
need_sed=yes
|
|
|
|
set_opsys=no
|
|
|
|
;;
|
2004-03-11 14:03:58 +01:00
|
|
|
*)
|
|
|
|
echo "This platform ($opsys) is untried - good luck, and thanks for using pkgsrc"
|
|
|
|
root_group=wheel
|
|
|
|
need_pax=yes
|
|
|
|
need_mtree=yes
|
|
|
|
need_bsd_install=yes
|
|
|
|
need_sed=yes
|
|
|
|
set_opsys=no
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# export OPSYS and MACHINE_ARCH for pkg_install. we only set
|
|
|
|
# MACHINE_ARCH on platforms where we override bmake's value.
|
|
|
|
OPSYS=${opsys}
|
|
|
|
export OPSYS
|
|
|
|
if [ "${machine_arch}" != "" ]; then
|
|
|
|
MACHINE_ARCH=${machine_arch}
|
|
|
|
export MACHINE_ARCH
|
|
|
|
fi
|
|
|
|
|
2005-04-10 23:54:13 +02:00
|
|
|
if [ "x$preserve_path" != "xyes" ]; then
|
2004-03-11 14:03:58 +01:00
|
|
|
PATH="$overpath:$PATH"
|
|
|
|
fi
|
|
|
|
|
|
|
|
check_prog awkprog awk
|
2004-04-23 04:03:18 +02:00
|
|
|
check_prog chmodprog chmod
|
2004-03-11 14:03:58 +01:00
|
|
|
check_prog cpprog cp
|
|
|
|
check_prog idprog id
|
|
|
|
check_prog groupsprog groups
|
|
|
|
check_prog lsprog ls
|
|
|
|
check_prog rmdirprog rmdir
|
|
|
|
check_prog sedprog sed
|
|
|
|
check_prog shprog sh
|
|
|
|
check_prog whoamiprog whoami
|
|
|
|
|
|
|
|
|
2004-03-28 03:55:17 +02:00
|
|
|
if [ ! -d ${wrkdir} ]; then
|
|
|
|
if mkdir ${wrkdir}; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Could not create the working directory \"${wrkdir}\". Try $0 -h.";
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if touch ${wrkdir}/.writeable; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "\"${wrkdir}\" is not writeable. Try $0 -h.";
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "Working directory is: ${wrkdir}"
|
|
|
|
|
2005-04-10 23:54:13 +02:00
|
|
|
if [ x"$check_compiler" = x"yes" ]; then
|
|
|
|
get_compiler
|
|
|
|
if [ $compiler_is_gnu -gt 0 ]; then
|
|
|
|
compiler="gcc"
|
|
|
|
else
|
|
|
|
case "$opsys" in
|
|
|
|
IRIX)
|
|
|
|
compiler="mipspro"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2004-04-23 04:03:18 +02:00
|
|
|
if [ ! -x ${wrkdir}/install-sh ]; then
|
|
|
|
run_cmd "$sedprog -e 's|@DEFAULT_INSTALL_MODE@|'${default_install_mode-0755}'|' files/install-sh.in > $wrkdir/install-sh"
|
|
|
|
run_cmd "$chmodprog +x $wrkdir/install-sh"
|
|
|
|
fi
|
|
|
|
|
2004-03-11 14:03:58 +01:00
|
|
|
is_root
|
|
|
|
if [ $? = 1 ]; then
|
2004-03-11 18:29:11 +01:00
|
|
|
user=$root_user
|
2004-03-11 14:03:58 +01:00
|
|
|
group=$root_group
|
|
|
|
else
|
|
|
|
if [ $ignoreusercheck = "no" ]; then
|
|
|
|
die "You must be root to install bootstrap-pkgsrc."
|
|
|
|
fi
|
|
|
|
|
|
|
|
user=`$whoamiprog`
|
|
|
|
group=`$groupsprog | $awkprog '{print $1}'`
|
|
|
|
echo_msg "building as unprivileged user $user/$group"
|
|
|
|
|
|
|
|
# force bmake install target to use $user and $group
|
|
|
|
echo "BINOWN=$user
|
|
|
|
BINGRP=$group
|
|
|
|
LIBOWN=$user
|
|
|
|
LIBGRP=$group
|
|
|
|
MANOWN=$user
|
2004-03-28 03:55:17 +02:00
|
|
|
MANGRP=$group" > ${wrkdir}/Makefile.inc
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# make sure we're using a case-sensitive file system on Darwin
|
|
|
|
if [ $ignorecasecheck = "no" ]; then
|
|
|
|
case "$opsys" in
|
2004-03-11 21:47:56 +01:00
|
|
|
Darwin|Interix)
|
2004-03-11 14:03:58 +01:00
|
|
|
echo_msg "Testing file system case sensitivity"
|
|
|
|
for fs in "$prefix" "$pkgsrcdir"; do
|
|
|
|
testdir="pkgsrc-REQUIRES-case-SENSITIVE-filesystem"
|
|
|
|
testdir_mangled="PKGSRC-requires-CASE-sensitive-FILESYSTEM"
|
2004-03-11 18:47:18 +01:00
|
|
|
mkdir_p "$fs/$testdir" || die "can't verify filesystem ($fs) case-sensitivity"
|
2004-03-11 14:03:58 +01:00
|
|
|
if [ -d "$fs/$testdir_mangled" ]; then
|
|
|
|
$rmdirprog "$fs/$testdir"
|
2004-03-11 21:47:56 +01:00
|
|
|
die "\"$fs\" needs to be on a case-sensitive filesystem (see README.$opsys)"
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
$rmdirprog "$fs/$testdir"
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# export the proper environment
|
|
|
|
PATH=$prefix/bin:$prefix/sbin:${PATH}; export PATH
|
|
|
|
if [ -d /usr/ccs/bin -a -x /usr/ccs/bin/make ]; then
|
2005-01-16 03:56:24 +01:00
|
|
|
PATH=${PATH}:/usr/ccs/bin; export PATH
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
PKG_DBDIR=$pkgdbdir; export PKG_DBDIR
|
|
|
|
LOCALBASE=$prefix; export LOCALBASE
|
|
|
|
|
2004-08-23 05:44:34 +02:00
|
|
|
# build libnbcompat
|
|
|
|
echo_msg "Building libnbcompat"
|
|
|
|
copy_src ../pkgtools/libnbcompat/files libnbcompat
|
|
|
|
run_cmd "(cd $wrkdir/libnbcompat; $shprog ./configure -C --prefix=$prefix --sysconfdir=$sysconfdir && make)"
|
|
|
|
|
2004-03-11 14:03:58 +01:00
|
|
|
# set up an example mk.conf file
|
2004-03-28 03:55:17 +02:00
|
|
|
MKCONF_EXAMPLE=${wrkdir}/mk.conf.example
|
|
|
|
export MKCONF_EXAMPLE
|
|
|
|
echo_msg "Creating mk.conf.example in ${wrkdir}"
|
2004-04-07 14:05:37 +02:00
|
|
|
echo "# Example ${sysconfdir}/mk.conf file produced by bootstrap-pkgsrc" > ${MKCONF_EXAMPLE}
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "# `date`" >> ${MKCONF_EXAMPLE}
|
|
|
|
echo "" >> ${MKCONF_EXAMPLE}
|
|
|
|
echo ".ifdef BSD_PKG_MK # begin pkgsrc settings" >> ${MKCONF_EXAMPLE}
|
|
|
|
echo "" >> ${MKCONF_EXAMPLE}
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# IRIX64 needs to be set to IRIX, for example
|
|
|
|
if [ "$set_opsys" = "yes" ]; then
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "OPSYS=$opsys" >> ${MKCONF_EXAMPLE}
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z "$abi" ]; then
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "ABI=$abi" >> ${MKCONF_EXAMPLE}
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
2005-04-10 23:54:13 +02:00
|
|
|
if [ ! -z "$compiler" ]; then
|
|
|
|
echo "PKGSRC_COMPILER=$compiler" >> ${MKCONF_EXAMPLE}
|
|
|
|
fi
|
|
|
|
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# save environment in example mk.conf
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "PKG_DBDIR=$pkgdbdir" >> ${MKCONF_EXAMPLE}
|
|
|
|
echo "LOCALBASE=$prefix" >> ${MKCONF_EXAMPLE}
|
2004-04-07 14:05:37 +02:00
|
|
|
if [ "${sysconfdir}" != "${prefix}/etc" ]; then
|
|
|
|
echo "PKG_SYSCONFBASE=$sysconfdir" >> ${MKCONF_EXAMPLE}
|
|
|
|
fi
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# create directories
|
2004-03-11 18:47:18 +01:00
|
|
|
mkdir_p $prefix $pkgdbdir $prefix/sbin
|
|
|
|
mkdir_p $prefix/man/man1 $prefix/man/cat1
|
|
|
|
mkdir_p $prefix/man/man8 $prefix/man/cat8
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# bootstrap make and *.mk files
|
2004-03-11 18:47:18 +01:00
|
|
|
mkdir_p $prefix/share/mk $prefix/lib
|
2004-03-28 03:55:17 +02:00
|
|
|
copy_src bmake bmake
|
|
|
|
|
|
|
|
(cd ${wrkdir}/bmake/mk;
|
|
|
|
if [ -f ${bootstrapdir}/mods/mk/$opsys.sys.mk ]; then
|
|
|
|
run_cmd "$cpprog ${bootstrapdir}/mods/mk/$opsys.sys.mk $prefix/share/mk/sys.mk"
|
2004-03-11 14:03:58 +01:00
|
|
|
else
|
2004-03-28 03:55:17 +02:00
|
|
|
run_cmd "$cpprog ${bootstrapdir}/mods/mk/generic.sys.mk $prefix/share/mk/sys.mk"
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
run_cmd "$cpprog bsd.*.mk $prefix/share/mk")
|
|
|
|
|
|
|
|
if [ -f mods/mk/$opsys.bsd.lib.mk ] ; then
|
2004-03-28 03:55:17 +02:00
|
|
|
run_cmd "$cpprog mods/mk/$opsys.bsd.lib.mk ${wrkdir}/bmake/mk/bsd.lib.mk"
|
2005-03-08 16:43:10 +01:00
|
|
|
run_cmd "$cpprog mods/mk/$opsys.bsd.lib.mk $prefix/share/mk/bsd.lib.mk"
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f mods/mk/$opsys.bsd.man.mk ] ; then
|
2005-03-08 16:43:10 +01:00
|
|
|
run_cmd "$cpprog mods/mk/$opsys.bsd.man.mk ${wrkdir}/bmake/mk/bsd.man.mk"
|
2004-03-11 14:03:58 +01:00
|
|
|
run_cmd "$cpprog mods/mk/$opsys.bsd.man.mk $prefix/share/mk/bsd.man.mk"
|
|
|
|
fi
|
|
|
|
|
2004-04-07 14:05:37 +02:00
|
|
|
own_mk=mods/mk/bsd.own.mk.in
|
2004-03-11 18:29:11 +01:00
|
|
|
if [ -f mods/mk/$opsys.bsd.own.mk ] ; then
|
2004-04-07 14:05:37 +02:00
|
|
|
own_mk=mods/mk/$opsys.bsd.own.mk.in
|
2004-03-11 18:29:11 +01:00
|
|
|
fi
|
2004-04-07 14:05:37 +02:00
|
|
|
run_cmd "$sedprog -e 's|@ROOT_GROUP@|'$root_group'|g;s|@ROOT_USER@|'$root_user'|g;s|@SYSCONFDIR@|'$sysconfdir'|g' $own_mk > $prefix/share/mk/bsd.own.mk"
|
2004-03-11 18:29:11 +01:00
|
|
|
|
|
|
|
if [ -f mods/mk/$opsys.bsd.prog.mk ] ; then
|
|
|
|
run_cmd "$cpprog mods/mk/$opsys.bsd.prog.mk $prefix/share/mk/bsd.prog.mk"
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f mods/mk/$opsys.bsd.sys.mk ]; then
|
|
|
|
run_cmd "$cpprog mods/mk/$opsys.bsd.sys.mk $prefix/share/mk/bsd.sys.mk"
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$opsys" in
|
2004-03-28 03:55:17 +02:00
|
|
|
NetBSD) run_cmd "$cpprog mods/bmake/Makefile.in ${wrkdir}/bmake/Makefile.in"
|
2004-03-11 14:03:58 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "$need_bsd_install" = "yes" ]; then
|
|
|
|
echo_msg "Installing BSD compatible install script"
|
2004-04-23 04:03:18 +02:00
|
|
|
run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 $wrkdir/install-sh $prefix/bin/install-sh"
|
2004-03-11 14:03:58 +01:00
|
|
|
BSTRAP_ENV="INSTALL='$prefix/bin/install-sh -c' $BSTRAP_ENV"
|
2005-04-11 23:03:21 +02:00
|
|
|
echo "INSTALL=$prefix/bin/install-sh" >> ${MKCONF_EXAMPLE}
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$need_fixed_strip" = "yes" ] ; then
|
|
|
|
echo_msg "Installing fixed strip script"
|
2004-04-23 04:03:18 +02:00
|
|
|
run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 files/strip-sh $prefix/bin/strip"
|
2004-03-11 14:03:58 +01:00
|
|
|
fi
|
|
|
|
|
2004-04-11 05:17:12 +02:00
|
|
|
if [ "$need_mkdir" = "yes" ]; then
|
2004-04-17 01:47:02 +02:00
|
|
|
echo_msg "Installing fixed mkdir script \"mkdir-sh\""
|
2004-04-23 04:03:18 +02:00
|
|
|
run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 files/mkdir-sh $prefix/sbin/mkdir-sh"
|
2004-04-11 05:17:12 +02:00
|
|
|
fi
|
|
|
|
|
2004-03-11 14:03:58 +01:00
|
|
|
echo_msg "Installing bmake"
|
2005-02-15 09:48:34 +01:00
|
|
|
run_cmd "(cd $wrkdir/bmake; env CPPFLAGS='$CPPFLAGS -I../libnbcompat' LDFLAGS='$LDFLAGS -L../libnbcompat' LIBS='-lnbcompat' $shprog ./configure --prefix=$prefix --with-default-sys-path=$prefix/share/mk $configargs && make -f makefile.boot bootstrap && env BINDIR=$prefix/bin MANDIR=$prefix/man $BSTRAP_ENV ./bmake -f Makefile install)"
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# bootstrap tnftp
|
|
|
|
case "$DEBIAN" in
|
|
|
|
yes)
|
|
|
|
LIBS="-lncurses"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo_msg "Installing tnftp"
|
2004-03-11 14:08:06 +01:00
|
|
|
copy_src ../net/tnftp/files tnftp
|
2004-04-07 14:05:37 +02:00
|
|
|
run_cmd "(cd $wrkdir/tnftp; env $BSTRAP_ENV $shprog ./configure --prefix=$prefix --sysconfdir=$sysconfdir && make && (cd src && make install))"
|
2004-03-11 14:03:58 +01:00
|
|
|
pkg_install_args="$pkg_install_args --with-ftp=$prefix/bin/ftp"
|
|
|
|
|
|
|
|
FETCH_CMD=$prefix/bin/ftp
|
|
|
|
export FETCH_CMD
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "FETCH_CMD=$prefix/bin/ftp" >> ${MKCONF_EXAMPLE}
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# bootstrap digest
|
|
|
|
echo_msg "Installing digest"
|
2004-03-11 14:08:06 +01:00
|
|
|
copy_src ../pkgtools/digest/files digest
|
2004-04-07 14:05:37 +02:00
|
|
|
run_cmd "(cd $wrkdir/digest; env $BSTRAP_ENV $shprog ./configure -C --prefix=$prefix --sysconfdir=$sysconfdir && make && make install)"
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# create the digest package's meta files
|
2004-03-11 14:08:06 +01:00
|
|
|
digestversion=digest-`$awkprog -F "'" '/^PACKAGE_VERSION=/ {print $2}' $wrkdir/digest/configure`
|
|
|
|
$lsprog -ld $prefix/bin/digest | $awkprog '{ print $5 }' > $wrkdir/digest/.size
|
2004-03-11 14:03:58 +01:00
|
|
|
env DIGESTPROG=$prefix/bin/digest PKG_DIGEST=md5 PKG_DBDIR=$pkgdbdir \
|
2004-03-11 14:08:06 +01:00
|
|
|
$shprog ./pkg.sh create -d $wrkdir/digest/DESCR -O \
|
2004-03-11 14:03:58 +01:00
|
|
|
-c '-Message digest wrapper utility' -l -p $prefix \
|
2004-03-11 14:08:06 +01:00
|
|
|
-f $wrkdir/digest/PLIST -s $wrkdir/digest/.size -S $wrkdir/digest/.size $digestversion
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# we often need NetBSD's pax as well, nowadays, to make binary packages
|
|
|
|
case "$need_pax" in
|
|
|
|
yes) echo_msg "Installing pax"
|
2004-03-11 14:08:06 +01:00
|
|
|
copy_src ../archivers/pax/files pax
|
2005-02-15 09:48:34 +01:00
|
|
|
run_cmd "(cd $wrkdir/pax; env $BSTRAP_ENV CPPFLAGS='$CPPFLAGS -I../libnbcompat' LDFLAGS='$LDFLAGS -L../libnbcompat' LIBS='-lnbcompat' $shprog ./configure -C --prefix=$prefix --sysconfdir=$sysconfdir && $prefix/bin/bmake && $prefix/bin/bmake install)"
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "PAX=$prefix/bin/pax" >> ${MKCONF_EXAMPLE}
|
2004-03-11 14:03:58 +01:00
|
|
|
pkg_install_args="$pkg_install_args --with-pax=$prefix/bin/pax --with-tar=$prefix/bin/tar"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
pkg_install_args="$pkg_install_args --with-pax=$paxprog --with-tar=$tarprog"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# bootstrap mtree if necessary
|
|
|
|
case "$need_mtree" in
|
|
|
|
yes) echo_msg "Installing mtree"
|
2004-03-11 14:08:06 +01:00
|
|
|
copy_src ../pkgtools/mtree/files mtree
|
2005-02-15 09:48:34 +01:00
|
|
|
run_cmd "(cd $wrkdir/mtree; env $BSTRAP_ENV CPPFLAGS='$CPPFLAGS -I../libnbcompat' LDFLAGS='$LDFLAGS -L../libnbcompat' LIBS='-lnbcompat' $shprog ./configure -C --prefix=$prefix --sysconfdir=$sysconfdir && $prefix/bin/bmake && $prefix/bin/bmake install)"
|
2004-03-11 14:03:58 +01:00
|
|
|
pkg_install_args="$pkg_install_args --with-mtree=$prefix/sbin/mtree"
|
|
|
|
;;
|
|
|
|
*) pkg_install_args="$pkg_install_args --with-mtree=$mtreeprog"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# bootstrap sed if necessary
|
|
|
|
case "$need_sed" in
|
|
|
|
yes) echo_msg "Installing sed"
|
2004-03-11 14:08:06 +01:00
|
|
|
copy_src ../textproc/nbsed/files sed
|
2005-02-15 09:48:34 +01:00
|
|
|
run_cmd "(cd $wrkdir/sed; env $BSTRAP_ENV CPPFLAGS='$CPPFLAGS -I../libnbcompat' LDFLAGS='$LDFLAGS -L../libnbcompat' LIBS='-lnbcompat' $shprog ./configure -C --prefix=$prefix --sysconfdir=$sysconfdir --program-transform-name='s,sed,nbsed,' && make && make install)"
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "SED=$prefix/bin/nbsed" >> ${MKCONF_EXAMPLE}
|
2004-08-23 05:44:34 +02:00
|
|
|
BSTRAP_ENV="SED=\"$prefix/bin/nbsed\" $BSTRAP_ENV"
|
2004-03-11 14:03:58 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# bootstrap pkg_install
|
|
|
|
echo_msg "Installing pkgtools"
|
2004-03-11 14:08:06 +01:00
|
|
|
copy_src ../pkgtools/pkg_install/files pkg_install
|
2004-03-11 14:03:58 +01:00
|
|
|
pkg_install_mandir="$prefix/man"
|
|
|
|
if [ "$prefix" = "/usr" ]; then
|
|
|
|
pkg_install_mandir="$prefix/share/man"
|
|
|
|
fi
|
2005-02-15 09:48:34 +01:00
|
|
|
run_cmd "(cd $wrkdir/pkg_install; env $BSTRAP_ENV CPPFLAGS='$CPPFLAGS -I../libnbcompat -I../../libnbcompat' LDFLAGS='$LDFLAGS -L../libnbcompat -L../../libnbcompat' LIBS='-lnbcompat' $shprog ./configure -C --prefix=$prefix --sysconfdir=$sysconfdir --with-pkgdbdir=$pkgdbdir --mandir=$pkg_install_mandir $pkg_install_args && $prefix/bin/bmake && $prefix/bin/bmake install)"
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# all's ready, install the man page
|
|
|
|
echo_msg "Installing packages(7) man page"
|
2004-04-23 04:03:18 +02:00
|
|
|
run_cmd "$shprog $wrkdir/install-sh -c -m 444 files/packages.cat7 $prefix/man/cat7/packages.0"
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
# opsys specific fiddling
|
|
|
|
opsys_finish
|
|
|
|
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "" >> ${MKCONF_EXAMPLE}
|
|
|
|
echo ".endif # end pkgsrc settings" >> ${MKCONF_EXAMPLE}
|
2004-03-11 14:03:58 +01:00
|
|
|
|
|
|
|
echo ""
|
2004-03-28 03:55:17 +02:00
|
|
|
echo "Please remember to add $prefix/bin to your PATH environment variable"
|
|
|
|
echo "and $prefix/man to your MANPATH environment variable, if necessary."
|
|
|
|
echo ""
|
|
|
|
echo "An example mk.conf file \"${MKCONF_EXAMPLE}\" with the settings you"
|
|
|
|
echo "provided to \"bootstrap\" has been created for you."
|
2004-04-07 14:05:37 +02:00
|
|
|
echo "Please copy ${MKCONF_EXAMPLE} to ${sysconfdir}/mk.conf."
|
2004-03-11 14:03:58 +01:00
|
|
|
echo ""
|
|
|
|
echo "You can find extensive documentation of the NetBSD Packages Collection"
|
2005-05-08 00:16:38 +02:00
|
|
|
echo "in $pkgsrcdir/doc/pkgsrc.txt and packages(7)."
|
2004-03-11 14:03:58 +01:00
|
|
|
echo ""
|
|
|
|
echo "Hopefully everything is now complete."
|
|
|
|
echo "Thank you"
|
|
|
|
|
|
|
|
echo_msg "bootstrap started: $build_start"
|
|
|
|
echo_msg "bootstrap ended: `date`"
|
|
|
|
|
|
|
|
exit 0
|