Skip to content

Commit

Permalink
Implement dash as a bootstrap shell.
Browse files Browse the repository at this point in the history
This is the 0.5.8 source, along with a number of patches applied that
are required to satisfy a full bulk build using dash both as the config
shell as well as the default shell executed by bmake.  These patches are
recorded in the patches directory as 'manual-*' to document our changes
and also ensure that they aren't applied twice.

A "--with-dash" bootstrap argument is added, allowing users to choose to
use dash.  For now shells/pdksh is still the default if there is no
suitable shell available, except for SunOS which has been tested on both
illumos and Solaris 9.
  • Loading branch information
Jonathan Perkin committed Dec 4, 2015
1 parent f0fd682 commit 6173446
Show file tree
Hide file tree
Showing 93 changed files with 35,158 additions and 29 deletions.
33 changes: 31 additions & 2 deletions bootstrap/bootstrap
Expand Up @@ -74,6 +74,7 @@ usage="Usage: $0 "'
[ --sysconfdir <sysconfdir> ]
[ --unprivileged | --ignore-user-check ]
[ --varbase <varbase> ]
[ --with-dash ]
[ --workdir <workdir> ]
'

Expand Down Expand Up @@ -410,6 +411,8 @@ make_jobs=1
mk_fragment=
quiet=no

need_dash=no

while [ $# -gt 0 ]; do
case $1 in
--workdir=*) wrkdir=`get_optarg "$1"` ;;
Expand Down Expand Up @@ -455,6 +458,7 @@ while [ $# -gt 0 ]; do
binary_macpkg="$2"; shift ;;
--make-jobs=*) make_jobs=`get_optarg "$1"` ;;
--make-jobs) make_jobs="$2"; shift ;;
--with-dash) need_dash=yes ;;
--full) full=yes ;;
--quiet) quiet=yes ;;
--help) echo "$usage"; exit ;;
Expand Down Expand Up @@ -826,11 +830,11 @@ SunOS)
else
need_sed=yes
fi
if [ -x "/usr/bin/bash" ]; then
if [ "${need_dash}" = "no" -a -x "/usr/bin/bash" ]; then
bootstrap_sh=${SH:-/usr/bin/bash}
bootstrap_sh_set=set
else
need_ksh=yes
need_dash=yes
fi
set_opsys=no
idprog="/usr/xpg4/bin/id"
Expand Down Expand Up @@ -872,6 +876,12 @@ yes)
;;
esac

# dash and ksh are mutually exclusive, prefer dash as it currently has to be
# explicitly enabled.
case "$need_dash" in
yes) need_ksh=no ;;
esac

case "$quiet" in
yes)
configure_quiet_flags="--quiet"
Expand Down Expand Up @@ -1142,6 +1152,22 @@ echo_msg "Building libnbcompat"
copy_src $pkgsrcdir/pkgtools/libnbcompat/files libnbcompat
run_cmd "(cd $wrkdir/libnbcompat; $shprog ./configure $configure_quiet_flags -C --prefix=$prefix --infodir=$infodir --mandir=$mandir --sysconfdir=$sysconfdir --enable-bsd-getopt --enable-db && $bmake -j$make_jobs)"

# bootstrap dash if necessary
case "$need_dash" in
yes) echo_msg "Bootstrapping dash"
copy_src $pkgsrcdir/shells/dash/files dash
test -n "$CC" || CC=gcc # default to gcc if no compiler is specified
run_cmd "(cd $wrkdir/dash && env $BSTRAP_ENV MAKE=$bmake $shprog ./configure $configure_quiet_flags --prefix=$prefix --infodir=$infodir --mandir=$mandir --sysconfdir=$sysconfdir && env MAKE=$bmake $bmake -j$make_jobs)"
run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/dash/src/dash $wrkdir/bin/dash"
echo "TOOLS_PLATFORM.sh?= $prefix/bin/dash" >> ${TARGET_MKCONF}
echo "TOOLS_PLATFORM.sh?= $wrkdir/bin/dash" >> ${BOOTSTRAP_MKCONF}
# Now rebootstrap bmake for dash
echo_msg "Rebootstrapping bmake for dash"
bmakexargs="$bmakexargs --with-defshell=$wrkdir/bin/dash"
bootstrap_bmake
;;
esac

# bootstrap ksh if necessary
case "$need_ksh" in
yes) echo_msg "Bootstrapping ksh"
Expand Down Expand Up @@ -1286,6 +1312,9 @@ yes)
fi
;;
esac
case "$need_dash" in
yes) build_package "shells/dash";;
esac
case "$need_ksh" in
yes) build_package "shells/pdksh";;
esac
Expand Down
12 changes: 9 additions & 3 deletions devel/bmake/Makefile
Expand Up @@ -32,11 +32,17 @@ CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}

.include "../../mk/bsd.prefs.mk"

.if ${OPSYS} == "SunOS" && exists(/usr/bin/bash)
CONFIGURE_ARGS+= --with-defshell=/usr/bin/bash
.elif ${OPSYS} == "SunOS" || ${OPSYS} == "OSF1" || ${OPSYS} == "IRIX" || ${OPSYS} == "AIX"
# Use the shell we bootstrapped with or the default for this platform. The
# pattern matching here isn't ideal but due to the bootstrap workdir there's
# no way to do a full path match.
.if !empty(TOOLS_PLATFORM.sh:M?*/bin/dash)
DEPENDS+= dash-[0-9]*:../../shells/dash
CONFIGURE_ARGS+= --with-defshell=${PREFIX}/bin/dash
.elif !empty(TOOLS_PLATFORM.sh:M?*/bin/pdksh)
DEPENDS+= pdksh-[0-9]*:../../shells/pdksh
CONFIGURE_ARGS+= --with-defshell=${PREFIX}/bin/pdksh
.else
CONFIGURE_ARGS+= --with-defshell=${TOOLS_PLATFORM.sh}
.endif
.if ${OPSYS} == "Interix"
MAKE_ENV+= XDEFS=-DUSE_SELECT
Expand Down
31 changes: 28 additions & 3 deletions shells/dash/Makefile
Expand Up @@ -4,14 +4,39 @@
DISTNAME= dash-0.5.8
CATEGORIES= shells
MASTER_SITES= http://gondor.apana.org.au/~herbert/dash/files/
MASTER_SITES= # maintained locally
DISTFILES= # empty

MAINTAINER= cheusov@NetBSD.org
HOMEPAGE= http://gondor.apana.org.au/~herbert/dash/
COMMENT= Debian Almquist shell, POSIX-compliant shell faster than bash
LICENSE= modified-bsd AND gnu-gpl-v2

GNU_CONFIGURE= yes
USE_TOOLS+= gmake
PKG_SHELL= bin/dash
BOOTSTRAP_PKG= yes
NO_CHECKSUM= yes

GNU_CONFIGURE= yes

PKG_SHELL= bin/dash

do-extract:
${CP} -R ${FILESDIR} ${WRKSRC}

INSTALLATION_DIRS= bin ${PKGMANDIR}/cat1 ${PKGMANDIR}/man1

.include "../../mk/bsd.prefs.mk"

do-install:
${INSTALL_PROGRAM} ${WRKSRC}/src/dash ${DESTDIR}${PREFIX}/bin/dash
${INSTALL_MAN} ${WRKSRC}/src/dash.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/dash.1
.if !empty(MANINSTALL:Mcatinstall)
. if defined(CATMAN_SECTION_SUFFIX) && !empty(CATMAN_SECTION_SUFFIX:M[Yy][Ee][Ss])
${INSTALL_MAN} ${WRKSRC}/src/dash.cat1 \
${DESTDIR}${PREFIX}/${PKGMANDIR}/cat1/dash.1
. else
${INSTALL_MAN} ${WRKSRC}/src/dash.cat1 \
${DESTDIR}${PREFIX}/${PKGMANDIR}/cat1/dash.0
. endif
.endif

.include "../../mk/bsd.pkg.mk"
1 change: 1 addition & 0 deletions shells/dash/PLIST
@@ -1,3 +1,4 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2009/07/26 21:27:49 rillig Exp $
bin/dash
man/cat1/dash.0
man/man1/dash.1
7 changes: 0 additions & 7 deletions shells/dash/distinfo

This file was deleted.

56 changes: 56 additions & 0 deletions shells/dash/files/COPYING
@@ -0,0 +1,56 @@
Copyright (c) 1989-1994
The Regents of the University of California. All rights reserved.
Copyright (c) 1997 Christos Zoulas. All rights reserved.
Copyright (c) 1997-2005
Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.

This code is derived from software contributed to Berkeley by Kenneth Almquist.


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. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.

mksignames.c:

This file is not directly linked with dash. However, its output is.

Copyright (C) 1992 Free Software Foundation, Inc.

This file is part of GNU Bash, the Bourne Again SHell.

Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License with
your Debian GNU/Linux system, in /usr/share/common-licenses/GPL, or with the
Debian GNU/Linux hello source package as the file COPYING. If not,
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111 USA.

0 comments on commit 6173446

Please sign in to comment.