build process improvements

builds with -Werror -Wall and without -Wno-unused now
GNU now uses improvements and mkstemp, too
correct version variable for sh(1)
This commit is contained in:
tg 2004-04-07 17:14:13 +00:00
parent bc29832339
commit 138338c10d
6 changed files with 33 additions and 28 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $MirBSD: BuildGNU.sh,v 1.5 2004/03/22 19:03:52 tg Exp $
# $MirBSD: BuildGNU.sh,v 1.6 2004/04/07 17:14:11 tg Exp $
#-
# Copyright (c) 2004
# Thorsten "mirabile" Glaser <x86@ePost.de>
@ -18,10 +18,10 @@
# ly, but not by a developer's malice intent, even if advised of the
# possibility of such damage.
#-
# Build the mirbsdksh on GNU operating systems
# Build the mirbsdksh on GNU operating systems (and more?)
CC="${CC:-gcc}"
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I."
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I. -DKSH"
CFLAGS="-O2 -fomit-frame-pointer -fno-strict-aliasing -static $CFLAGS"
if [ -e strlcpy.c -a -e strlcat.c ]; then
@ -31,7 +31,7 @@ if [ -e strlcpy.c -a -e strlcat.c ]; then
/bin/sh ./siglist.sh "gcc -E $CPPFLAGS" <siglist.in >siglist.out
/bin/sh ./emacs-gen.sh emacs.c >emacs.out
echo "Building..."
$CC $CFLAGS $CPPFLAGS -DKSH -o ksh *.c
$CC $CFLAGS $CPPFLAGS -o ksh *.c
echo "Finalizing..."
tbl <ksh.1tbl | nroff -mandoc -Tascii >ksh.cat1
strip -R .note -R .comment -R .rel.dyn -R .sbss \

View File

@ -1,3 +1,4 @@
# $MirBSD: Makefile,v 1.2 2004/04/07 17:14:11 tg Exp $
# $OpenBSD: Makefile,v 1.16 2004/01/09 17:10:07 brad Exp $
PROG= ksh
@ -5,12 +6,11 @@ SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
eval.c exec.c expr.c history.c io.c jobs.c lex.c mail.c \
main.c misc.c missing.c path.c shf.c syn.c table.c trap.c \
tree.c tty.c var.c version.c vi.c
DEFS= -DHAVE_CONFIG_H -Wall -Wno-unused
CFLAGS+=${DEFS} -I. -I${.CURDIR} -DKSH
MAN= ksh.1 sh.1
CLEANFILES+= siglist.out emacs.out
CPPFLAGS+= -DHAVE_CONFIG_H -I. -DKSH
CFLAGS+= -Wall -Werror
CLEANFILES+= siglist.out emacs.out ksh.1 sh.1
LINKS= ${BINDIR}/ksh ${BINDIR}/rksh
LINKS+= ${BINDIR}/ksh ${BINDIR}/sh
@ -21,13 +21,13 @@ MLINKS= ksh.1 rksh.1 ksh.1 ulimit.1
siglist.out: config.h sh.h siglist.in siglist.sh
/bin/sh ${.CURDIR}/siglist.sh \
"${CC} -E ${CPPFLAGS} ${DEFS} -I${.CURDIR}" \
< ${.CURDIR}/siglist.in > siglist.out
"${CC} -E ${CPPFLAGS}" <${.CURDIR}/siglist.in >siglist.out
emacs.out: emacs.c
/bin/sh ${.CURDIR}/emacs-gen.sh ${.CURDIR}/emacs.c > emacs.out
/bin/sh ${.CURDIR}/emacs-gen.sh ${.CURDIR}/emacs.c >emacs.out
check test:
/bin/sh ${.CURDIR}/tests/th.sh ${.CURDIR}/tests/th -s ${.CURDIR}/tests -p ./ksh -C pdksh,sh,ksh,posix,posix-upu
/bin/sh ${.CURDIR}/tests/th.sh ${.CURDIR}/tests/th \
-s ${.CURDIR}/tests -p ./ksh -C pdksh,sh,ksh,posix,posix-upu
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $MirBSD: c_ulimit.c,v 1.3 2003/12/23 13:41:48 tg Exp $ */
/* $MirBSD: c_ulimit.c,v 1.4 2004/04/07 17:14:11 tg Exp $ */
/* $OpenBSD: c_ulimit.c,v 1.10 2003/10/22 07:40:38 jmc Exp $ */
/*
@ -19,6 +19,8 @@
that was originally under case SYSULIMIT in source file "xec.c".
*/
static const char RCSId[] = "$MirBSD: c_ulimit.c,v 1.4 2004/04/07 17:14:11 tg Exp $";
#include "sh.h"
#include "ksh_time.h"
#ifdef HAVE_SYS_RESOURCE_H
@ -77,16 +79,16 @@ c_ulimit(wp)
{ "coredump(blocks)", RLIMIT, RLIMIT_CORE, RLIMIT_CORE, 512, 'c' },
#endif
#ifdef RLIMIT_DATA
{ "data(kbytes)", RLIMIT, RLIMIT_DATA, RLIMIT_DATA, 1024, 'd' },
{ "data(KiB)", RLIMIT, RLIMIT_DATA, RLIMIT_DATA, 1024, 'd' },
#endif
#ifdef RLIMIT_STACK
{ "stack(kbytes)", RLIMIT, RLIMIT_STACK, RLIMIT_STACK, 1024, 's' },
{ "stack(KiB)", RLIMIT, RLIMIT_STACK, RLIMIT_STACK, 1024, 's' },
#endif
#ifdef RLIMIT_MEMLOCK
{ "lockedmem(kbytes)", RLIMIT, RLIMIT_MEMLOCK, RLIMIT_MEMLOCK, 1024, 'l' },
{ "lockedmem(KiB)", RLIMIT, RLIMIT_MEMLOCK, RLIMIT_MEMLOCK, 1024, 'l' },
#endif
#ifdef RLIMIT_RSS
{ "memory(kbytes)", RLIMIT, RLIMIT_RSS, RLIMIT_RSS, 1024, 'm' },
{ "memory(KiB)", RLIMIT, RLIMIT_RSS, RLIMIT_RSS, 1024, 'm' },
#endif
#ifdef RLIMIT_NOFILE
{ "nofiles(descriptors)", RLIMIT, RLIMIT_NOFILE, RLIMIT_NOFILE, 1, 'n' },
@ -99,7 +101,7 @@ c_ulimit(wp)
{ "processes", RLIMIT, RLIMIT_NPROC, RLIMIT_NPROC, 1, 'p' },
#endif
#ifdef RLIMIT_VMEM
{ "vmemory(kbytes)", RLIMIT, RLIMIT_VMEM, RLIMIT_VMEM, 1024, 'v' },
{ "vmemory(KiB)", RLIMIT, RLIMIT_VMEM, RLIMIT_VMEM, 1024, 'v' },
#else /* RLIMIT_VMEM */
/* These are not quite right - really should subtract etext or something */
# ifdef UL_GMEMLIM /* svr4/xenix */
@ -115,7 +117,7 @@ c_ulimit(wp)
# endif /* UL_GMEMLIM */
#endif /* RLIMIT_VMEM */
#ifdef RLIMIT_SWAP
{ "swap(kbytes)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' },
{ "swap(KiB)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' },
#endif
{ (char *) 0 }
};

7
io.c
View File

@ -1,3 +1,4 @@
/* $MirBSD: io.c,v 1.2 2004/04/07 17:14:12 tg Exp $ */
/* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */
/*
@ -505,7 +506,9 @@ maketemp(ap, type, tlist)
Temp_type type;
struct temp **tlist;
{
#ifdef NO_MKSTEMP
static unsigned int inc;
#endif
struct temp *tp;
int len;
int fd;
@ -519,7 +522,7 @@ maketemp(ap, type, tlist)
tp->name = path = (char *) &tp[1];
tp->shf = (struct shf *) 0;
tp->type = type;
#ifdef __OpenBSD__
#ifndef NO_MKSTEMP
shf_snprintf(path, len, "%s/shXXXXXXXX", dir);
fd = mkstemp(path);
if (fd >= 0)
@ -550,7 +553,7 @@ maketemp(ap, type, tlist)
*/
break;
}
#endif /* __OpenBSD__ */
#endif /* !ndef NO_MKSTEMP */
tp->pid = procpid;
tp->next = *tlist;

2
jobs.c
View File

@ -1,3 +1,4 @@
/* $MirBSD: jobs.c,v 1.2 2004/04/07 17:14:12 tg Exp $ */
/* $OpenBSD: jobs.c,v 1.21 2003/11/10 21:26:39 millert Exp $ */
/*
@ -815,7 +816,6 @@ j_kill(cp, sig)
int sig;
{
Job *j;
Proc *p;
int rv = 0;
int ecode;
#ifdef JOB_SIGS

View File

@ -1,4 +1,4 @@
.\" $MirBSD: sh.1tbl,v 1.6 2004/04/07 16:56:19 tg Exp $
.\" $MirBSD: sh.1tbl,v 1.7 2004/04/07 17:14:13 tg Exp $
.\" _MirBSD: ksh.1tbl,v 1.19 2004/04/07 16:54:01 tg Exp $
.\" $OpenBSD: ksh.1tbl,v 1.65 2004/01/23 23:08:45 jmc Exp $
.\"
@ -3835,7 +3835,7 @@ imposed may have introduced different behaviour.
Please include the version of
.Nm pdksh
.Po
.Ic echo $KSH_VERSION
.Ic echo $SH_VERSION
shows it
.Pc ,
the machine, operating system, and compiler you are using and a description of