pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg/54349: bootstrap with --prefix fails on Solaris 10
Dear Benny,
/bin/sh on Solaris 10 is Bourne Shell.
> Do you happen to know where in the file this
> happens, i.e. can you get a line number?
line 501, probably.
Hiroshi
env CFLAGS=-O2 CC=/opt/csw/gcc4/bin/gcc GCCBASE=/opt/csw/gcc4 ./bootstrap --prefix=/usr/pkg2 --varbase
# $NetBSD: bootstrap,v 1.268 2019/07/08 19:44:08 sevan Exp $
#
# Copyright (c) 2001-2011 Alistair Crooks <agc%NetBSD.org@localhost>
# 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.
#
# 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
# the following environment variables are honored:
# compiler/linker flags: CFLAGS, CPPFLAGS, LDFLAGS, LIBS
# tools: CP, GREP, ID, MKDIR, SH, TEST, TOUCH, XARGS
BOOTSTRAP_VERSION=20060721
# Don't let the bootstrap program get confused by a pre-existing mk.conf
# file.
MAKECONF=/dev/null
export MAKECONF
# No vulnerability checks since there might be an incompatible checker installed
NO_PKGTOOLS_REQD_CHECK=yes
export NO_PKGTOOLS_REQD_CHECK
unprivileged=no
preserve_path=no
# where the building takes place
bootstrapdir=`dirname "$0"`
bootstrapdir=`cd "${bootstrapdir}" && pwd`
pkgsrcdir=`dirname "${bootstrapdir}"`
wrkdir="`pwd`/work"
usage="Usage: $0 "'
[ --abi [32|64] ]
[ --binary-kit <tarball> ]
[ --binary-macpkg <pkg> ]
[ --compiler <compiler> ]
[ --cwrappers <auto|yes|no> ]
[ --full ]
[ --gzip-binary-kit <tarball> ]
[ --help ]
[ --make-jobs <num> ]
[ --mk-fragment <mk.conf> ]
[ --pkgdbdir <pkgdbdir> ]
[ --pkginfodir <pkginfodir> ]
[ --pkgmandir <pkgmandir> ]
[ --prefer-pkgsrc <list|yes|no> ]
[ --prefix <prefix> ]
[ --preserve-path ]
[ --quiet ]
[ --sysconfdir <sysconfdir> ]
[ --unprivileged | --ignore-user-check ]
[ --varbase <varbase> ]
[ --workdir <workdir> ]
'
# 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 -hcf - .$prefix .$pkgdbdir .$etc_mk_conf | gzip > "${binary_gzip_kit}"
}
die()
{
echo >&2 "$@"
exit 1
}
echo_msg()
{
echo "===> $@"
}
# 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
# Clang compiler pretends to be GCC, so we have to check that
cat >${wrkdir}/$$.c <<EOF
#ifdef __clang__
indeed
#endif
EOF
compiler_is_clang=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed`
rm -f ${wrkdir}/$$.c
cat >${wrkdir}/$$.c <<EOF
#ifdef __GNUC__
#ifndef __clang__
indeed
#endif
#endif
EOF
compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed`
rm -f ${wrkdir}/$$.c
}
get_abi()
{
abi_opsys=$@
if [ -n "$abi" ]; then
case "$abi_opsys" in
IRIX)
die "ERROR: $abi_opsys has special ABI handling, --abi not supported (yet)."
;;
esac
fi
case "$abi_opsys" in
IRIX)
if [ `uname -r` -ge 6 ]; then
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
else # IRIX before 6
abi=32
fi
;;
esac
}
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
}
get_machine_arch_darwin()
{
case `uname -p` in
i386)
# Returns "i386" or "x86_64" depending on CPU
echo `uname -m`
;;
powerpc)
# sysctl mib exists on 64-bit hardware
if [ -n "`sysctl -n hw.optional.64bitops 2>/dev/null`" ]; then
echo "powerpc64"
else
echo "powerpc"
fi
;;
esac
}
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 [ -f "$_d/$_name" ] && [ -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)
if [ -n "$imakeopts" ]; then
echo "IMAKEOPTS+= $imakeopts" >> ${TARGET_MKCONF}
fi
if [ `uname -r` -lt 6 ]; then
echo_msg "Installing fake ldd script"
run_cmd "$install_sh -c -o $user -g $group -m 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/fakeldd $prefix/sbin"
need_extras=yes
echo "LDD= $prefix/sbin/fakeldd" >> ${TARGET_MKCONF}
fi
;;
Haiku)
need_extras=yes
echo "LDD= $prefix/sbin/fakeldd" >> ${TARGET_MKCONF}
;;
esac
}
is_root()
{
if [ `uname -s` = "IRIX" ]; then
if [ `uname -r` -lt 6 -a -z "$ID" ]; then
# older version of IRIX have an id command with limited features
if [ "`$idprog`" != "uid=0(root) gid=0(sys)" ]; then
return 1
fi
return 0
fi
fi
if [ `$idprog -u` != 0 ]; then
return 1
fi
return 0
}
# 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
}
# Some versions of mkdir (notably SunOS) bail out too easily, so use the
# install-sh wrapper instead.
mkdir_p()
{
for dir in $@; do
run_cmd "$install_sh -d -o $user -g $group $dir"
done
}
mkdir_p_early()
{
[ -d "$1" ] && return 0
mkdir -p "$1" 2> /dev/null && return 0
parent=`dirname "$1"`
mkdir_p_early "$parent"
if [ ! -d "$1" ] && mkdir "$1"; then
echo_msg "mkdir $1 exited with status $?"
die "aborted."
fi
return 0
}
copy_src()
{
_src="$1"; _dst="$2"
if [ ! -d $wrkdir/$_dst ]; then
mkdir_p $wrkdir/$_dst
fi
$cpprog -r $_src/* $wrkdir/$_dst
if [ -f $wrkdir/$_dst/config.guess ]; then
$cpprog $pkgsrcdir/mk/gnu-config/config.guess $wrkdir/$_dst/
fi
if [ -f $wrkdir/$_dst/config.sub ]; then
$cpprog $pkgsrcdir/mk/gnu-config/config.sub $wrkdir/$_dst/
fi
}
get_optarg()
{
expr "x$1" : "x[^=]*=\\(.*\\)"
}
checkarg_sane_absolute_path()
{
case "$1" in
"") ;; # the default value will be used.
*[!-A-Za-z0-9_./]*)
die "ERROR: Invalid characters in path $1 (from $2)." ;;
*/) die "ERROR: The argument to $2 must not end in /." ;;
*//* | */. | */./* | */.. | */../*)
die "ERROR: The path $1 (from $2) must be canonical." ;;
/*) [ "${3-}" = "may-be-symlink" ] \
|| checkarg_no_symlink_path "$1" "$2" ;;
*) die "ERROR: The argument to $2 must be an absolute path." ;;
esac
}
checkarg_no_symlink_path()
{
_dir=$1
while [ ! -d "$_dir" ]; do
_dir=${_dir%/*}
[ "$_dir" ] || _dir="/"
done
_realdir=`cd "$_dir" && exec pwd`
[ "$_realdir" = "$_dir" ] && return
die "ERROR: The path $1 (from $2) must not contain symlinks.
Given path : $1
Resolved path: $_realdir${1##${_dir}}
Several packages assume that the given path of $2 stays the same when
symlinks are resolved. When that assumption fails, they will:
* not find some include files or libraries during the build phase
since the files from dependencies are not installed in
\${WRKDIR}/.buildlink.
* install their files into the wrong path inside \${WRKDIR}/.destdir,
which will fail the PLIST check during the install phase."
}
checkarg_sane_relative_path() {
case "$1" in
"") ;; # the default value will be used.
*[!-A-Za-z0-9_./]*)
die "ERROR: Invalid characters in path $1 (from $2)." ;;
/*) die "ERROR: The argument to $2 must be a relative path." ;;
*) ;;
esac
}
bootstrap_sh=${SH-/bin/sh}
bootstrap_sh_set=${SH+set}
case "$bootstrap_sh" in
/*)
;;
*)
die "ERROR: The variable SH must contain an absolute path"
;;
esac
# On some newer Ubuntu installations, /bin/sh is a symlink to /bin/dash,
# whose echo(1) is not BSD-compatible.
# On all Debian GNU/kFreeBSD 7.0, /bin/sh is a symlink to /bin/dash, and
# use /bin/bash. bootstrap forces /bin/bash is used.
dash_echo_test=`$bootstrap_sh -c 'echo "\\100"'`
if [ "$opsys" != "GNUkFreeBSD" ] && [ "$dash_echo_test" = "@" ]; then
{ echo "ERROR: Your shell's echo command is not BSD-compatible."
echo "ERROR: Please select another shell by setting the environment"
echo "ERROR: variable SH."
} 1>&2
exit 1;
fi
if [ -n "$PKG_PATH" ]; then
die "ERROR: Please unset PKG_PATH before running bootstrap."
fi
build_start=`date`
echo_msg "bootstrap command: $0 $@"
===> bootstrap command: ./bootstrap --prefix=/usr/pkg2 --varbase
echo_msg "bootstrap started: $build_start"
===> bootstrap started: Thu Jul 11 19:26:29 JST 2019
# ensure system locations are empty; we will set them later when we know
# whether they will be system wide or user specific
prefix=
pkgdbdir=
pkginfodir=
pkgmandir=
sysconfdir=
varbase=
compiler=""
cwrappers=auto
full=no
make_jobs=1
mk_fragment=
quiet=no
while [ $# -gt 0 ]; do
case $1 in
--workdir=*) wrkdir=`get_optarg "$1"` ;;
--workdir) wrkdir="$2"; shift ;;
--prefix=*) prefix=`get_optarg "$1"` ;;
--prefix) prefix="$2"; shift ;;
--pkgdbdir=*) pkgdbdir=`get_optarg "$1"` ;;
--pkgdbdir) pkgdbdir="$2"; shift ;;
--pkginfodir=*) pkginfodir=`get_optarg "$1"` ;;
--pkginfodir) pkginfodir="$2"; shift ;;
--pkgmandir=*) pkgmandir=`get_optarg "$1"` ;;
--pkgmandir) pkgmandir="$2"; shift ;;
--sysconfdir=*) sysconfdir=`get_optarg "$1"` ;;
--sysconfdir) sysconfdir="$2"; shift ;;
--varbase=*) varbase=`get_optarg "$1"` ;;
--varbase) varbase="$2"; shift ;;
--compiler=*) compiler=`get_optarg "$1"` ;;
--compiler) compiler="$2"; shift ;;
--abi=*) abi=`get_optarg "$1"` ;;
--abi) abi="$2"; shift ;;
--cwrappers=*) cwrappers=`get_optarg "$1"` ;;
--cwrappers) cwrappers="$2"; shift ;;
--unprivileged | --ignore-user-check) unprivileged=yes ;;
--prefer-pkgsrc=*)
prefer_pkgsrc=`get_optarg "$1"` ;;
--prefer-pkgsrc)
prefer_pkgsrc="$2"; shift ;;
--preserve-path) preserve_path=yes ;;
--mk-fragment=*)
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"` ;;
--binary-macpkg)
binary_macpkg="$2"; shift ;;
--make-jobs=*) make_jobs=`get_optarg "$1"` ;;
--make-jobs) make_jobs="$2"; shift ;;
--full) full=yes ;;
--quiet) quiet=yes ;;
--help) echo "$usage"; exit ;;
-h) echo "$usage"; exit ;;
-*) echo "${0##*/}: unknown option \"$1\"" 1>&2
echo "$usage" 1>&2; exit 1 ;;
esac
shift
done
./bootstrap: cannot shift
> 2019/07/07 18:05、Benny Siegert <bsiegert%gmail.com@localhost>のメール:
>
> The following reply was made to PR pkg/54349; it has been noted by GNATS.
>
> From: Benny Siegert <bsiegert%gmail.com@localhost>
> To: gnats-bugs%netbsd.org@localhost
> Cc: pkg-manager%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, pkgsrc-bugs%netbsd.org@localhost
> Subject: Re: pkg/54349: bootstrap with --prefix fails on Solaris 10
> Date: Sun, 7 Jul 2019 11:01:16 +0200
>
> On Sun, Jul 7, 2019 at 8:49 AM <hiroshi-hakoyama%nagano.ac.jp@localhost> wrote:
>
>> ===> bootstrap started: Sat Jul 6 18:58:16 JST 2019
>> ./bootstrap: bad substitution
>
>>> Fix:
>> a workaround:
>>
>> vi bootstrap
>> #! /bin/sh -> #! /usr/bin/bash
>
> Thank you for the report! Do you happen to know where in the file this
> happens, i.e. can you get a line number?
>
>
> --
> Benny
>
Home |
Main Index |
Thread Index |
Old Index