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

View File

@ -1,16 +1,16 @@
# $OpenBSD: Makefile,v 1.16 2004/01/09 17:10:07 brad Exp $ # $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 PROG= ksh
SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \ 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 \ 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 \ 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 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 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}/rksh
LINKS+= ${BINDIR}/ksh ${BINDIR}/sh 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 siglist.out: config.h sh.h siglist.in siglist.sh
/bin/sh ${.CURDIR}/siglist.sh \ /bin/sh ${.CURDIR}/siglist.sh \
"${CC} -E ${CPPFLAGS} ${DEFS} -I${.CURDIR}" \ "${CC} -E ${CPPFLAGS}" <${.CURDIR}/siglist.in >siglist.out
< ${.CURDIR}/siglist.in > siglist.out
emacs.out: emacs.c 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: 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> .include <bsd.prog.mk>

View File

@ -1,5 +1,5 @@
/* $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 $ */ /* $OpenBSD: c_ulimit.c,v 1.10 2003/10/22 07:40:38 jmc Exp $ */
/* /*
ulimit -- handle "ulimit" builtin ulimit -- handle "ulimit" builtin
@ -19,6 +19,8 @@
that was originally under case SYSULIMIT in source file "xec.c". 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 "sh.h"
#include "ksh_time.h" #include "ksh_time.h"
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
@ -77,16 +79,16 @@ c_ulimit(wp)
{ "coredump(blocks)", RLIMIT, RLIMIT_CORE, RLIMIT_CORE, 512, 'c' }, { "coredump(blocks)", RLIMIT, RLIMIT_CORE, RLIMIT_CORE, 512, 'c' },
#endif #endif
#ifdef RLIMIT_DATA #ifdef RLIMIT_DATA
{ "data(kbytes)", RLIMIT, RLIMIT_DATA, RLIMIT_DATA, 1024, 'd' }, { "data(KiB)", RLIMIT, RLIMIT_DATA, RLIMIT_DATA, 1024, 'd' },
#endif #endif
#ifdef RLIMIT_STACK #ifdef RLIMIT_STACK
{ "stack(kbytes)", RLIMIT, RLIMIT_STACK, RLIMIT_STACK, 1024, 's' }, { "stack(KiB)", RLIMIT, RLIMIT_STACK, RLIMIT_STACK, 1024, 's' },
#endif #endif
#ifdef RLIMIT_MEMLOCK #ifdef RLIMIT_MEMLOCK
{ "lockedmem(kbytes)", RLIMIT, RLIMIT_MEMLOCK, RLIMIT_MEMLOCK, 1024, 'l' }, { "lockedmem(KiB)", RLIMIT, RLIMIT_MEMLOCK, RLIMIT_MEMLOCK, 1024, 'l' },
#endif #endif
#ifdef RLIMIT_RSS #ifdef RLIMIT_RSS
{ "memory(kbytes)", RLIMIT, RLIMIT_RSS, RLIMIT_RSS, 1024, 'm' }, { "memory(KiB)", RLIMIT, RLIMIT_RSS, RLIMIT_RSS, 1024, 'm' },
#endif #endif
#ifdef RLIMIT_NOFILE #ifdef RLIMIT_NOFILE
{ "nofiles(descriptors)", RLIMIT, RLIMIT_NOFILE, RLIMIT_NOFILE, 1, 'n' }, { "nofiles(descriptors)", RLIMIT, RLIMIT_NOFILE, RLIMIT_NOFILE, 1, 'n' },
@ -99,7 +101,7 @@ c_ulimit(wp)
{ "processes", RLIMIT, RLIMIT_NPROC, RLIMIT_NPROC, 1, 'p' }, { "processes", RLIMIT, RLIMIT_NPROC, RLIMIT_NPROC, 1, 'p' },
#endif #endif
#ifdef RLIMIT_VMEM #ifdef RLIMIT_VMEM
{ "vmemory(kbytes)", RLIMIT, RLIMIT_VMEM, RLIMIT_VMEM, 1024, 'v' }, { "vmemory(KiB)", RLIMIT, RLIMIT_VMEM, RLIMIT_VMEM, 1024, 'v' },
#else /* RLIMIT_VMEM */ #else /* RLIMIT_VMEM */
/* These are not quite right - really should subtract etext or something */ /* These are not quite right - really should subtract etext or something */
# ifdef UL_GMEMLIM /* svr4/xenix */ # ifdef UL_GMEMLIM /* svr4/xenix */
@ -115,7 +117,7 @@ c_ulimit(wp)
# endif /* UL_GMEMLIM */ # endif /* UL_GMEMLIM */
#endif /* RLIMIT_VMEM */ #endif /* RLIMIT_VMEM */
#ifdef RLIMIT_SWAP #ifdef RLIMIT_SWAP
{ "swap(kbytes)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' }, { "swap(KiB)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' },
#endif #endif
{ (char *) 0 } { (char *) 0 }
}; };

9
io.c
View File

@ -1,4 +1,5 @@
/* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */ /* $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 $ */
/* /*
* shell buffered IO and formatted output * shell buffered IO and formatted output
@ -505,7 +506,9 @@ maketemp(ap, type, tlist)
Temp_type type; Temp_type type;
struct temp **tlist; struct temp **tlist;
{ {
#ifdef NO_MKSTEMP
static unsigned int inc; static unsigned int inc;
#endif
struct temp *tp; struct temp *tp;
int len; int len;
int fd; int fd;
@ -519,7 +522,7 @@ maketemp(ap, type, tlist)
tp->name = path = (char *) &tp[1]; tp->name = path = (char *) &tp[1];
tp->shf = (struct shf *) 0; tp->shf = (struct shf *) 0;
tp->type = type; tp->type = type;
#ifdef __OpenBSD__ #ifndef NO_MKSTEMP
shf_snprintf(path, len, "%s/shXXXXXXXX", dir); shf_snprintf(path, len, "%s/shXXXXXXXX", dir);
fd = mkstemp(path); fd = mkstemp(path);
if (fd >= 0) if (fd >= 0)
@ -550,7 +553,7 @@ maketemp(ap, type, tlist)
*/ */
break; break;
} }
#endif /* __OpenBSD__ */ #endif /* !ndef NO_MKSTEMP */
tp->pid = procpid; tp->pid = procpid;
tp->next = *tlist; tp->next = *tlist;

4
jobs.c
View File

@ -1,4 +1,5 @@
/* $OpenBSD: jobs.c,v 1.21 2003/11/10 21:26:39 millert Exp $ */ /* $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 $ */
/* /*
* Process and job control * Process and job control
@ -815,7 +816,6 @@ j_kill(cp, sig)
int sig; int sig;
{ {
Job *j; Job *j;
Proc *p;
int rv = 0; int rv = 0;
int ecode; int ecode;
#ifdef JOB_SIGS #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 $ .\" _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 $ .\" $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 Please include the version of
.Nm pdksh .Nm pdksh
.Po .Po
.Ic echo $KSH_VERSION .Ic echo $SH_VERSION
shows it shows it
.Pc , .Pc ,
the machine, operating system, and compiler you are using and a description of the machine, operating system, and compiler you are using and a description of