* major revamp of build system

* whitespace cleanup; junk comment removal
* syndicate debian/copyright file from my port (shrinks sh.h)
* bump to R23
This commit is contained in:
tg
2005-06-08 21:51:22 +00:00
parent faecfafee7
commit 521da70fc8
9 changed files with 114 additions and 123 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# $MirOS: src/bin/mksh/Build.sh,v 1.10 2005/06/08 10:19:33 tg Exp $ # $MirOS: src/bin/mksh/Build.sh,v 1.11 2005/06/08 21:51:20 tg Exp $
#- #-
# Recognised environment variables and their defaults: # Recognised environment variables and their defaults:
# CC gcc # CC gcc
@ -8,21 +8,20 @@
# LDFLAGS -static # LDFLAGS -static
# LIBS (empty) # LIBS (empty)
# srcdir (path of script) # srcdir (path of script)
# NROFF nroff # (ignored if -r option given) # NROFF nroff # (ignored if -r option given)
# Hints (don't take tgem seriously, WFM rather): # Hints (WFM; don't take them seriously):
# GNU/Linux CPPFLAGS='-D_FILE_OFFSET_BITS=64' # GNU/Linux CPPFLAGS='-D_FILE_OFFSET_BITS=64'
# Mac OSX LDFLAGS= # Mac OSX LDFLAGS=
# Solaris LDFLAGS= # Solaris LDFLAGS=
SHELL="${SHELL:-/bin/sh}" SHELL="${SHELL:-/bin/sh}"
srcdir="${srcdir:-`dirname $0`}"
curdir="`pwd`"
CC="${CC:-gcc}" CC="${CC:-gcc}"
CFLAGS="${CFLAGS--O2 -fno-strict-aliasing -fno-strength-reduce}" CFLAGS="${CFLAGS--O2 -fno-strict-aliasing -fno-strength-reduce}"
LDFLAGS="${LDFLAGS--static}" LDFLAGS="${LDFLAGS--static}"
NROFF="${NROFF:-nroff}"
OS="`uname -s || uname`"
export SHELL CC export SHELL CC
srcdir="${srcdir:-`dirname "$0"`}"
curdir="`pwd`"
if [ x"$1" = x"-q" ]; then if [ x"$1" = x"-q" ]; then
e=: e=:
q=1 q=1
@ -38,25 +37,28 @@ else
r=0 r=0
fi fi
v()
{
$e "$*"
eval "$*"
}
SRCS="alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c" SRCS="alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c"
SRCS="$SRCS jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c" SRCS="$SRCS jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c"
# Hello Mr Drepper, we all like you too...</sarcasm> case "`uname -s 2>/dev/null || uname`" in
[ x"$OS" = x"Linux" ] && SRCS="$SRCS strlfun.c" Linux)
# Hello Mr Drepper, we all like you too...</sarcasm>
SRCS="$SRCS strlfun.c"
;;
esac
$e Generating prerequisites... v $SHELL "'$srcdir/gensigs.sh'" || exit 1
$SHELL "$srcdir/gensigs.sh" (v "cd '$srcdir' && exec $CC $CFLAGS -I'$curdir' $CPPFLAGS $LDFLAGS" \
for hdr in errno signal; do "-o '$curdir/mksh' $SRCS $LIBS") || exit 1
h2ph -d . /usr/include/$hdr.h && mv _h2ph_pre.ph $hdr.ph
done
$e Building...
( cd "$srcdir" && exec $CC $CFLAGS -I "$curdir" $CPPFLAGS $LDFLAGS \
-o $curdir/mksh $SRCS $LIBS )
test -x mksh || exit 1 test -x mksh || exit 1
$e Finalising... v "${NROFF:-nroff} -mdoc <'$srcdir/mksh.1' >mksh.cat1" || rm -f mksh.cat1
[ $r = 1 ] || $NROFF -mdoc <"$srcdir/mksh.1" >mksh.cat1 || rm -f mksh.cat1 [ $q = 1 ] || v size mksh
[ $q = 1 ] || size mksh
$e done.
$e $e
$e Testing mirbsdksh: $e Testing mirbsdksh:
$e "$ perl '$srcdir/check.pl' -s '$srcdir/check.t' -p '$curdir/mksh' -C pdksh" $e "$ perl '$srcdir/check.pl' -s '$srcdir/check.t' -p '$curdir/mksh' -C pdksh"

View File

@ -1,4 +1,4 @@
/** $MirOS: src/bin/mksh/alloc.c,v 1.1 2005/05/23 03:06:05 tg Exp $ */ /** $MirOS: src/bin/mksh/alloc.c,v 1.2 2005/06/08 21:51:20 tg Exp $ */
/* $OpenBSD: alloc.c,v 1.7 2004/02/19 18:51:17 deraadt Exp $ */ /* $OpenBSD: alloc.c,v 1.7 2004/02/19 18:51:17 deraadt Exp $ */
/*- /*-
@ -24,15 +24,13 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ *-
/*
* area-based allocation built on malloc/free * area-based allocation built on malloc/free
*/ */
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/alloc.c,v 1.1 2005/05/23 03:06:05 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/alloc.c,v 1.2 2005/06/08 21:51:20 tg Exp $");
struct link { struct link {
struct link *prev; struct link *prev;

42
check.t
View File

@ -1,44 +1,10 @@
# $MirOS: src/bin/mksh/check.t,v 1.16 2005/06/05 16:38:19 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.17 2005/06/08 21:51:20 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
#- #-
# Some information on tests: # You may also want to test IFS with the script at
# The bksl-nl tests deal with how \newline is handled in various situa- # http://www.research.att.com/~gsf/public/ifs.sh
# tions. The first group of tests are places where it shouldn't be col-
# lapsed, the next group tests are places where it should be collapsed.
# In history - Not tested yet:
# - commands in history file are not numbered negatively
# (and a few hundred other things)
# You may also want to test IFS with the script at
# http://www.research.att.com/~gsf/public/ifs.sh
# Read - To test:
# POSIX:
# - if no -r, \ is escape character
# - \newline disappear
# - \<IFS> -> don't break here
# - \<anything-else> -> <anything-else>
# - if -r, backslash is not special
# - if stdin is tty and shell interactive
# - prompt for continuation if \newline (prompt to stderr)
# - a here-document isn't terminated after newline ????
# - remaining vars set to empty string (not null)
# - check field splitting
# - left over fields and their separators assigned to last var
# - exit status is normally 0
# - exit status is > 0 on eof
# - exit status > 0 on error
# - signals interrupt reads
# extra:
# - can't change read-only variables
# - error if var name bogus
# - set -o allexport effects read
# ksh:
# x check default variable: REPLY
# - check -p, -s, -u options
# - check var?prompt stuff
# - "echo a b | read x y" sets x,y in parent shell (at&t)
# Regression: The first 39 of these tests are from the old Bugs script.
name: alias-1 name: alias-1
description: description:
@ -3734,5 +3700,5 @@ category: pdksh
stdin: stdin:
echo $KSH_VERSION echo $KSH_VERSION
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R22 2005/06/05 @(#)MIRBSD KSH R23 2005/06/08
--- ---

55
copyright Normal file
View File

@ -0,0 +1,55 @@
mirbsdksh as a whole is covered by the following terms:
/*-
* Copyright (c) 2002, 2003, 2004, 2005
* Thorsten "mirabile" Glaser <tg@66h.42h.de>
*
* Licensee is hereby permitted to deal in this work without restric-
* tion, including unlimited rights to use, publicly perform, modify,
* merge, distribute, sell, give away or sublicence, provided all co-
* pyright notices above, these terms and the disclaimer are retained
* in all redistributions or reproduced in accompanying documentation
* or other materials provided with binary redistributions.
*
* All advertising materials mentioning features or use of this soft-
* ware must display the following acknowledgement:
* This product includes material provided by Thorsten Glaser.
*
* Licensor hereby provides this work "AS IS" and WITHOUT WARRANTY of
* any kind, expressed or implied, to the maximum extent permitted by
* applicable law, but with the warranty of being written without ma-
* licious intent or gross negligence; in no event shall licensor, an
* author or contributor be held liable for any damage, direct, indi-
* rect or other, however caused, arising in any way out of the usage
* of this work, even if advised of the possibility of such damage.
*/
The author recognises the contributions of the pdksh authors who have
dedicated their work into the Public Domain.
The file "alloc.c" is covered by the following terms:
/*-
* Copyright (c) 2002 Marc Espie.
*
* 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 OPENBSD PROJECT 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 OPENBSD
* PROJECT 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.
*/

36
edit.c
View File

@ -1,4 +1,4 @@
/** $MirOS: src/bin/mksh/edit.c,v 1.5 2005/05/25 23:39:10 tg Exp $ */ /** $MirOS: src/bin/mksh/edit.c,v 1.6 2005/06/08 21:51:20 tg Exp $ */
/* $OpenBSD: edit.c,v 1.29 2005/04/13 02:33:08 deraadt Exp $ */ /* $OpenBSD: edit.c,v 1.29 2005/04/13 02:33:08 deraadt Exp $ */
/* $OpenBSD: edit.h,v 1.8 2005/03/28 21:28:22 deraadt Exp $ */ /* $OpenBSD: edit.h,v 1.8 2005/03/28 21:28:22 deraadt Exp $ */
/* $OpenBSD: emacs.c,v 1.37 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: emacs.c,v 1.37 2005/03/30 17:16:37 deraadt Exp $ */
@ -10,7 +10,7 @@
#include <ctype.h> #include <ctype.h>
#include <libgen.h> #include <libgen.h>
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.5 2005/05/25 23:39:10 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.6 2005/06/08 21:51:20 tg Exp $");
#define BEL 0x07 #define BEL 0x07
@ -1761,31 +1761,31 @@ x_end_of_text(int c __attribute__((unused)))
return KEOL; return KEOL;
} }
static int static int
x_beg_hist(int c __attribute__((unused))) x_beg_hist(int c __attribute__((unused)))
{ {
x_load_hist(history); x_load_hist(history);
return KSTD; return KSTD;
} }
static int static int
x_end_hist(int c __attribute__((unused))) x_end_hist(int c __attribute__((unused)))
{ {
x_load_hist(histptr); x_load_hist(histptr);
return KSTD; return KSTD;
} }
static int static int
x_prev_com(int c __attribute__((unused))) x_prev_com(int c __attribute__((unused)))
{ {
x_load_hist(x_histp - x_arg); x_load_hist(x_histp - x_arg);
return KSTD; return KSTD;
} }
static int static int
x_next_com(int c __attribute__((unused))) x_next_com(int c __attribute__((unused)))
{ {
x_load_hist(x_histp + x_arg); x_load_hist(x_histp + x_arg);
return KSTD; return KSTD;
} }

7
lex.c
View File

@ -1,15 +1,14 @@
/** $MirOS: src/bin/mksh/lex.c,v 1.2 2005/05/25 23:31:07 tg Exp $ */ /** $MirOS: src/bin/mksh/lex.c,v 1.3 2005/06/08 21:51:21 tg Exp $ */
/* $OpenBSD: lex.c,v 1.36 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: lex.c,v 1.36 2005/03/30 17:16:37 deraadt Exp $ */
#include "sh.h" #include "sh.h"
#include <ctype.h> #include <ctype.h>
#include <libgen.h> #include <libgen.h>
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.2 2005/05/25 23:31:07 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/lex.c,v 1.3 2005/06/08 21:51:21 tg Exp $");
/* Structure to keep track of the lexing state and the various pieces of info /* Structure to keep track of the lexing state and the various pieces of info
* needed for each particular state. * needed for each particular state. */
*/
typedef struct lex_state Lex_state; typedef struct lex_state Lex_state;
struct lex_state { struct lex_state {
int ls_state; int ls_state;

6
main.c
View File

@ -1,4 +1,4 @@
/** $MirOS: src/bin/mksh/main.c,v 1.10 2005/06/05 16:38:20 tg Exp $ */ /** $MirOS: src/bin/mksh/main.c,v 1.11 2005/06/08 21:51:21 tg Exp $ */
/* $OpenBSD: main.c,v 1.38 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: main.c,v 1.38 2005/03/30 17:16:37 deraadt Exp $ */
/* $OpenBSD: tty.c,v 1.8 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: tty.c,v 1.8 2005/03/30 17:16:37 deraadt Exp $ */
/* $OpenBSD: io.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: io.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */
@ -13,9 +13,9 @@
#include <time.h> #include <time.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.10 2005/06/05 16:38:20 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/main.c,v 1.11 2005/06/08 21:51:21 tg Exp $");
const char ksh_version[] = "@(#)MIRBSD KSH R22 2005/06/05"; const char ksh_version[] = "@(#)MIRBSD KSH R23 2005/06/08";
extern char **environ; extern char **environ;

6
mksh.1
View File

@ -1,11 +1,11 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.8 2005/06/08 10:59:41 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.9 2005/06/08 21:51:21 tg Exp $
.\" $OpenBSD: ksh.1,v 1.99 2005/05/25 16:52:06 jaredy Exp $ .\" $OpenBSD: ksh.1,v 1.99 2005/05/25 16:52:06 jaredy Exp $
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $ .\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
.\"- .\"
.Dd May 22, 2005 .Dd May 22, 2005
.Dt MKSH 1 .Dt MKSH 1
.Os MirOS .Os MirOS
.\" this macro only exists in MirNroff by default .\" for portability
.de Mx .de Mx
.nr cF \\n(.f .nr cF \\n(.f
.nr cZ \\n(.s .nr cZ \\n(.s

33
sh.h
View File

@ -1,4 +1,4 @@
/** $MirOS: src/bin/mksh/sh.h,v 1.10 2005/05/26 23:12:09 tg Exp $ */ /** $MirOS: src/bin/mksh/sh.h,v 1.11 2005/06/08 21:51:22 tg Exp $ */
/* $OpenBSD: sh.h,v 1.27 2005/03/28 21:33:04 deraadt Exp $ */ /* $OpenBSD: sh.h,v 1.27 2005/03/28 21:33:04 deraadt Exp $ */
/* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */ /* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */
/* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */ /* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */
@ -9,33 +9,6 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ /* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */ /* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
/*-
* Copyright (c) 2005
* Thorsten "mirabile" Glaser <tg@66h.42h.de>
*
* Licensee is hereby permitted to deal in this work without restric-
* tion, including unlimited rights to use, publicly perform, modify,
* merge, distribute, sell, give away or sublicence, provided all co-
* pyright notices above, these terms and the disclaimer are retained
* in all redistributions or reproduced in accompanying documentation
* or other materials provided with binary redistributions.
*
* All advertising materials mentioning features or use of this soft-
* ware must display the following acknowledgement:
* This product includes material provided by Thorsten Glaser.
*
* Licensor hereby provides this work "AS IS" and WITHOUT WARRANTY of
* any kind, expressed or implied, to the maximum extent permitted by
* applicable law, but with the warranty of being written without ma-
* licious intent or gross negligence; in no event shall licensor, an
* author or contributor be held liable for any damage, direct, indi-
* rect or other, however caused, arising in any way out of the usage
* of this work, even if advised of the possibility of such damage.
*/
#ifndef SH_H
#define SH_H
#if defined(__INTERIX) && !defined(_ALL_SOURCE) #if defined(__INTERIX) && !defined(_ALL_SOURCE)
#define _ALL_SOURCE #define _ALL_SOURCE
#endif #endif
@ -53,7 +26,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#if !defined(__sun__) /* not on Solaris */ #if !defined(__sun__)
#include <paths.h> #include <paths.h>
#endif #endif
#include <setjmp.h> #include <setjmp.h>
@ -1348,5 +1321,3 @@ size_t confstr(int, char *, size_t);
#define HAVE_ARC4RANDOM 1 #define HAVE_ARC4RANDOM 1
#endif #endif
#endif #endif
#endif