make this actually call getopt.sh, correctly, and Heirloom sh compatible
This commit is contained in:
39
Build.sh
39
Build.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.650 2013/11/17 22:22:50 tg Exp $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.651 2013/11/20 21:14:49 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013
|
# 2011, 2012, 2013
|
||||||
@@ -66,7 +66,7 @@ vq() {
|
|||||||
rmf() {
|
rmf() {
|
||||||
for _f in "$@"; do
|
for _f in "$@"; do
|
||||||
case $_f in
|
case $_f in
|
||||||
Build.sh|check.pl|check.t|dot.mkshrc|*.c|*.h|*.ico|*.1) ;;
|
Build.sh|check.pl|check.t|dot.mkshrc|genopt.sh|*.1|*.c|*.h|*.ico|*.opt) ;;
|
||||||
*) rm -f "$_f" ;;
|
*) rm -f "$_f" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -327,8 +327,17 @@ addsrcs() {
|
|||||||
|
|
||||||
curdir=`pwd` srcdir=`dirname "$0" 2>/dev/null`
|
curdir=`pwd` srcdir=`dirname "$0" 2>/dev/null`
|
||||||
case x$srcdir in
|
case x$srcdir in
|
||||||
x) srcdir=. ;;
|
x)
|
||||||
*"'"*) echo Source directory must not contain single quotes.; exit 1 ;;
|
srcdir=.
|
||||||
|
;;
|
||||||
|
*\ *|*" "*|*"$nl"*)
|
||||||
|
echo >&2 Source directory should not contain space or tab or newline.
|
||||||
|
echo >&2 Errors may occur.
|
||||||
|
;;
|
||||||
|
*"'"*)
|
||||||
|
echo Source directory must not contain single quotes.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
dstversion=`sed -n '/define MKSH_VERSION/s/^.*"\([^"]*\)".*$/\1/p' "$srcdir/sh.h"`
|
dstversion=`sed -n '/define MKSH_VERSION/s/^.*"\([^"]*\)".*$/\1/p' "$srcdir/sh.h"`
|
||||||
add_cppflags -DMKSH_BUILDSH
|
add_cppflags -DMKSH_BUILDSH
|
||||||
@@ -427,7 +436,7 @@ if test -d $tfn || test -d $tfn.exe; then
|
|||||||
echo "$me: Error: ./$tfn is a directory!" >&2
|
echo "$me: Error: ./$tfn is a directory!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
rmf a.exe* a.out* conftest.c *core core.* lft ${tfn}* no *.bc *.ll *.o \
|
rmf a.exe* a.out* conftest.c *core core.* lft ${tfn}* no *.bc *.ll *.o *.gen \
|
||||||
Rebuild.sh signames.inc test.sh x vv.out
|
Rebuild.sh signames.inc test.sh x vv.out
|
||||||
|
|
||||||
SRCS="lalloc.c eval.c exec.c expr.c funcs.c histrap.c jobs.c"
|
SRCS="lalloc.c eval.c exec.c expr.c funcs.c histrap.c jobs.c"
|
||||||
@@ -466,7 +475,7 @@ oswarn=
|
|||||||
ccpc=-Wc,
|
ccpc=-Wc,
|
||||||
ccpl=-Wl,
|
ccpl=-Wl,
|
||||||
tsts=
|
tsts=
|
||||||
ccpr='|| for _f in ${tcfn}*; do case $_f in Build.sh|check.pl|check.t|dot.mkshrc|*.c|*.h|*.ico|*.1) ;; *) rm -f "$_f" ;; esac; done'
|
ccpr='|| for _f in ${tcfn}*; do case $_f in Build.sh|check.pl|check.t|dot.mkshrc|genopt.sh|*.1|*.c|*.h|*.ico|*.opt) ;; *) rm -f "$_f" ;; esac; done'
|
||||||
|
|
||||||
# Evil hack
|
# Evil hack
|
||||||
if test x"$TARGET_OS" = x"Android"; then
|
if test x"$TARGET_OS" = x"Android"; then
|
||||||
@@ -1602,7 +1611,7 @@ else
|
|||||||
#define EXTERN
|
#define EXTERN
|
||||||
#define MKSH_INCLUDES_ONLY
|
#define MKSH_INCLUDES_ONLY
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.650 2013/11/17 22:22:50 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.651 2013/11/20 21:14:49 tg Exp $");
|
||||||
int main(void) { printf("Hello, World!\n"); return (0); }
|
int main(void) { printf("Hello, World!\n"); return (0); }
|
||||||
EOF
|
EOF
|
||||||
case $cm in
|
case $cm in
|
||||||
@@ -2228,6 +2237,10 @@ llvm)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
echo ": # work around NeXTstep bug" >Rebuild.sh
|
echo ": # work around NeXTstep bug" >Rebuild.sh
|
||||||
|
for file in "$srcdir"/*.opt; do
|
||||||
|
echo "echo + Running \\\$srcdir/genopt.sh on '$file'..."
|
||||||
|
echo "(srcfile='$file'; . '$srcdir/genopt.sh')"
|
||||||
|
done >>Rebuild.sh
|
||||||
echo set -x >>Rebuild.sh
|
echo set -x >>Rebuild.sh
|
||||||
for file in $SRCS; do
|
for file in $SRCS; do
|
||||||
op=`echo x"$file" | sed 's/^x\(.*\)\.c$/\1./'`
|
op=`echo x"$file" | sed 's/^x\(.*\)\.c$/\1./'`
|
||||||
@@ -2259,6 +2272,13 @@ echo "test -f \$tcfn || exit 1; $SIZE \$tcfn" >>Rebuild.sh
|
|||||||
if test $cm = makefile; then
|
if test $cm = makefile; then
|
||||||
extras='emacsfn.h genopt.sh rlimits.opt sh.h sh_flags.opt var_spec.h'
|
extras='emacsfn.h genopt.sh rlimits.opt sh.h sh_flags.opt var_spec.h'
|
||||||
test 0 = $HAVE_SYS_SIGNAME && extras="$extras signames.inc"
|
test 0 = $HAVE_SYS_SIGNAME && extras="$extras signames.inc"
|
||||||
|
gens= genq=
|
||||||
|
for file in "$srcdir"/*.opt; do
|
||||||
|
genf=`basename "$file" | sed 's/.opt$/.gen/'`
|
||||||
|
gens="$gens $genf"
|
||||||
|
genq="$genq$nl$genf: $srcdir/genopt.sh $file
|
||||||
|
srcfile=$file; . $srcdir/genopt.sh"
|
||||||
|
done
|
||||||
cat >Makefrag.inc <<EOF
|
cat >Makefrag.inc <<EOF
|
||||||
# Makefile fragment for building mksh $dstversion
|
# Makefile fragment for building mksh $dstversion
|
||||||
|
|
||||||
@@ -2276,6 +2296,8 @@ CPPFLAGS= $CPPFLAGS
|
|||||||
LDFLAGS= $LDFLAGS
|
LDFLAGS= $LDFLAGS
|
||||||
LIBS= $LIBS
|
LIBS= $LIBS
|
||||||
|
|
||||||
|
.depend \$(OBJS_BP):$gens$genq
|
||||||
|
|
||||||
# not BSD make only:
|
# not BSD make only:
|
||||||
#VPATH= $srcdir
|
#VPATH= $srcdir
|
||||||
#all: \$(PROG)
|
#all: \$(PROG)
|
||||||
@@ -2299,6 +2321,9 @@ EOF
|
|||||||
$e Generated Makefrag.inc successfully.
|
$e Generated Makefrag.inc successfully.
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
for file in "$srcdir"/*.opt; do
|
||||||
|
v "(srcfile='$file'; . '$srcdir/genopt.sh')" || exit 1
|
||||||
|
done
|
||||||
if test $cm = combine; then
|
if test $cm = combine; then
|
||||||
objs="-o $mkshexe"
|
objs="-o $mkshexe"
|
||||||
for file in $SRCS; do
|
for file in $SRCS; do
|
||||||
|
4
Makefile
4
Makefile
@@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/Makefile,v 1.127 2013/11/17 22:21:17 tg Exp $
|
# $MirOS: src/bin/mksh/Makefile,v 1.128 2013/11/20 21:14:50 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013
|
# 2011, 2012, 2013
|
||||||
@@ -85,7 +85,7 @@ OPTGENS!= cd ${.CURDIR:Q} && echo *.opt
|
|||||||
.for _i in ${OPTGENS}
|
.for _i in ${OPTGENS}
|
||||||
GENERATED+= ${_i:R}.gen
|
GENERATED+= ${_i:R}.gen
|
||||||
${_i:R}.gen: ${_i} ${.CURDIR}/genopt.sh
|
${_i:R}.gen: ${_i} ${.CURDIR}/genopt.sh
|
||||||
${MKSH} ${.CURDIR:Q}/genopt.sh ${.CURDIR:Q}/${_i}
|
(srcfile=${.CURDIR:Q}/${_i}; . ${.CURDIR:Q}/genopt.sh)
|
||||||
.endfor
|
.endfor
|
||||||
CLEANFILES+= ${GENERATED}
|
CLEANFILES+= ${GENERATED}
|
||||||
|
|
||||||
|
12
genopt.sh
12
genopt.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $MirOS: src/bin/mksh/genopt.sh,v 1.3 2013/11/20 20:55:01 tg Exp $
|
# $MirOS: src/bin/mksh/genopt.sh,v 1.4 2013/11/20 21:14:50 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2013
|
# Copyright (c) 2013
|
||||||
# Thorsten Glaser <tg@mirbsd.org>
|
# Thorsten Glaser <tg@mirbsd.org>
|
||||||
@@ -87,8 +87,7 @@ scond() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
for srcfile
|
test -f "$srcfile" || die Source file \$srcfile not set.
|
||||||
do
|
|
||||||
bn=`basename "$srcfile" | sed 's/.opt$//'`
|
bn=`basename "$srcfile" | sed 's/.opt$//'`
|
||||||
o_gen=
|
o_gen=
|
||||||
o_str=
|
o_str=
|
||||||
@@ -103,9 +102,7 @@ do
|
|||||||
o_sym=`echo "$line" | sed 's/^.//'`
|
o_sym=`echo "$line" | sed 's/^.//'`
|
||||||
o_gen=$o_gen$nl"#undef F0"
|
o_gen=$o_gen$nl"#undef F0"
|
||||||
o_gen=$o_gen$nl"#undef FN"
|
o_gen=$o_gen$nl"#undef FN"
|
||||||
for sym in $ddefs; do
|
o_gen=$o_gen$ddefs
|
||||||
o_gen=$o_gen$nl"#undef $sym"
|
|
||||||
done
|
|
||||||
state=3
|
state=3
|
||||||
;;
|
;;
|
||||||
1:@@)
|
1:@@)
|
||||||
@@ -126,7 +123,7 @@ do
|
|||||||
else
|
else
|
||||||
o_gen=$o_gen$nl"#elif defined($sym)"
|
o_gen=$o_gen$nl"#elif defined($sym)"
|
||||||
fi
|
fi
|
||||||
ddefs="$ddefs $sym"
|
ddefs="$ddefs$nl#undef $sym"
|
||||||
state=1
|
state=1
|
||||||
;;
|
;;
|
||||||
0:*|3:*)
|
0:*|3:*)
|
||||||
@@ -171,5 +168,4 @@ do
|
|||||||
echo "#undef $o_sym"
|
echo "#undef $o_sym"
|
||||||
echo "#endif"
|
echo "#endif"
|
||||||
} >"$bn.gen"
|
} >"$bn.gen"
|
||||||
done
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Reference in New Issue
Block a user