* 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
# $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:
# CC gcc
@ -8,21 +8,20 @@
# LDFLAGS -static
# LIBS (empty)
# srcdir (path of script)
# NROFF nroff # (ignored if -r option given)
# Hints (don't take tgem seriously, WFM rather):
# NROFF nroff # (ignored if -r option given)
# Hints (WFM; don't take them seriously):
# GNU/Linux CPPFLAGS='-D_FILE_OFFSET_BITS=64'
# Mac OSX LDFLAGS=
# Solaris LDFLAGS=
SHELL="${SHELL:-/bin/sh}"
srcdir="${srcdir:-`dirname $0`}"
curdir="`pwd`"
CC="${CC:-gcc}"
CFLAGS="${CFLAGS--O2 -fno-strict-aliasing -fno-strength-reduce}"
LDFLAGS="${LDFLAGS--static}"
NROFF="${NROFF:-nroff}"
OS="`uname -s || uname`"
export SHELL CC
srcdir="${srcdir:-`dirname "$0"`}"
curdir="`pwd`"
if [ x"$1" = x"-q" ]; then
e=:
q=1
@ -38,25 +37,28 @@ else
r=0
fi
v()
{
$e "$*"
eval "$*"
}
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"
# Hello Mr Drepper, we all like you too...</sarcasm>
[ x"$OS" = x"Linux" ] && SRCS="$SRCS strlfun.c"
case "`uname -s 2>/dev/null || uname`" in
Linux)
# Hello Mr Drepper, we all like you too...</sarcasm>
SRCS="$SRCS strlfun.c"
;;
esac
$e Generating prerequisites...
$SHELL "$srcdir/gensigs.sh"
for hdr in errno signal; do
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 )
v $SHELL "'$srcdir/gensigs.sh'" || exit 1
(v "cd '$srcdir' && exec $CC $CFLAGS -I'$curdir' $CPPFLAGS $LDFLAGS" \
"-o '$curdir/mksh' $SRCS $LIBS") || exit 1
test -x mksh || exit 1
$e Finalising...
[ $r = 1 ] || $NROFF -mdoc <"$srcdir/mksh.1" >mksh.cat1 || rm -f mksh.cat1
[ $q = 1 ] || size mksh
$e done.
v "${NROFF:-nroff} -mdoc <'$srcdir/mksh.1' >mksh.cat1" || rm -f mksh.cat1
[ $q = 1 ] || v size mksh
$e
$e Testing mirbsdksh:
$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 $ */
/*-
@ -24,15 +24,13 @@
* 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.
*/
/*
*-
* area-based allocation built on malloc/free
*/
#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 *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: 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 $
#-
# Some information on tests:
# The bksl-nl tests deal with how \newline is handled in various situa-
# 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.
# You may also want to test IFS with the script at
# http://www.research.att.com/~gsf/public/ifs.sh
name: alias-1
description:
@ -3734,5 +3700,5 @@ category: pdksh
stdin:
echo $KSH_VERSION
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.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 $ */
@ -10,7 +10,7 @@
#include <ctype.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
@ -1761,31 +1761,31 @@ x_end_of_text(int c __attribute__((unused)))
return KEOL;
}
static int
x_beg_hist(int c __attribute__((unused)))
{
x_load_hist(history);
static int
x_beg_hist(int c __attribute__((unused)))
{
x_load_hist(history);
return KSTD;
}
static int
x_end_hist(int c __attribute__((unused)))
{
x_load_hist(histptr);
static int
x_end_hist(int c __attribute__((unused)))
{
x_load_hist(histptr);
return KSTD;
}
static int
x_prev_com(int c __attribute__((unused)))
{
x_load_hist(x_histp - x_arg);
static int
x_prev_com(int c __attribute__((unused)))
{
x_load_hist(x_histp - x_arg);
return KSTD;
}
static int
x_next_com(int c __attribute__((unused)))
{
x_load_hist(x_histp + x_arg);
static int
x_next_com(int c __attribute__((unused)))
{
x_load_hist(x_histp + x_arg);
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 $ */
#include "sh.h"
#include <ctype.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
* needed for each particular state.
*/
* needed for each particular state. */
typedef struct lex_state Lex_state;
struct lex_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: 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 $ */
@ -13,9 +13,9 @@
#include <time.h>
#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;

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: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
.\"-
.\"
.Dd May 22, 2005
.Dt MKSH 1
.Os MirOS
.\" this macro only exists in MirNroff by default
.\" for portability
.de Mx
.nr cF \\n(.f
.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: 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 $ */
@ -9,33 +9,6 @@
/* $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 $ */
/*-
* 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)
#define _ALL_SOURCE
#endif
@ -53,7 +26,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#if !defined(__sun__) /* not on Solaris */
#if !defined(__sun__)
#include <paths.h>
#endif
#include <setjmp.h>
@ -1348,5 +1321,3 @@ size_t confstr(int, char *, size_t);
#define HAVE_ARC4RANDOM 1
#endif
#endif
#endif