build: Simplify.

core: Make mes src/ c files separate compilation units.

* include/mes/constants.h: New file.
* include/mes/macros.h: New file.
* include/mes/mes.h: New file.
* src/gc.c: Update.
* src/hash.c: Update.
* src/lib.c: Update.
* src/math.c: Update.
* src/mes.c: Update.
* src/module.c: Update.
* src/posix.c: Update.
* src/reader.c: Update.
* src/string.c: Update.
* src/struct.c: Update.
* src/vector.c: Update.

    mes: Update datadir.

* src/mes.c (g_datadir): New global.
(open_boot): Rename from read_boot.
(read_boot): New function.
* mes/module/mes/boot-0.scm: Move from boot-0.scm.in
* configure: Update.
* configure.sh: Update.

    mescc: Create libraries from separate files.

* .gitignore: Update.
* build-aux/bootstrap-mes.sh: Remove.
* build-aux/bootstrap.sh.in: Remove.
* build-aux/build-guile.sh: Update.
* build-aux/build-mes.sh: Update.
* build-aux/build-scaffold.sh: New file.
* build-aux/build.sh.in: Update.
* build-aux/cc.sh: Update.
* build-aux/check-tcc.sh: Remove.
* build-aux/config.sh.in: New file.
* build-aux/config.sh: Remove.
* build-aux/install.sh.in: Update.
* build-aux/test-boot.sh: New file.
* build-aux/test-c.sh: New file.
* build-aux/test-driver: New file.
* build-aux/test-suite.sh: New file.
* build-aux/trace.sh: Update.
* build-aux/uninstall.sh.in: Update.
* configure: Update.
* configure.sh: Update.
* lib/linux/x86-mes-mescc/crt1.c: Move from lib/linux/x86-mes.
* lib/linux/x86-mes-mescc/mini.c: Likewise.
* lib/linux/x86_64-mes-mescc/crt1.c: Move from lib/linux/x86_64-mes.
* lib/linux/x86_64-mes-mescc/mini.c: Likewise.
* lib/linux/x86-mes-gcc/syscall.c: Rename from mes.c.
* lib/linux/x86-mes-mescc/syscall.c: Likewise.
* lib/linux/x86_64-mes-gcc/syscall.c: Likewise.
* lib/linux/x86_64-mes-mescc/syscall.c: Likewise.
* lib/mes/mes_open.c: Include config.h.
* lib/tests/stdio/70-printf-hello.c: Likewise.
* lib/tests/stdio/70-printf-simple.c: Likewise.
* scaffold/gc-test.sh: New file.
* simple.sh: Update.
This commit is contained in:
Jan Nieuwenhuizen 2019-06-08 15:36:22 +02:00
parent 3ef5212238
commit 5dc245e739
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
195 changed files with 3356 additions and 2719 deletions

8
.gitignore vendored
View file

@ -14,6 +14,7 @@
*.guile *.guile
*.guile-log *.guile-log
*.log *.log
*.trs
*.mes-gcc *.mes-gcc
*.mes-gcc-o *.mes-gcc-o
*.mes-gcc-out *.mes-gcc-out
@ -140,12 +141,12 @@
/config.status /config.status
/pre-inst-env /pre-inst-env
/bootstrap.sh
/build.sh /build.sh
/check.sh /check.sh
/install.sh /install.sh
/uninstall.sh /uninstall.sh
/mes/module/mes/boot-0.scm /mes/module/mes/boot-0.scm
/scripts/ar
/scripts/mescc.scm /scripts/mescc.scm
/scripts/mescc /scripts/mescc
/doc/images/gcc-mesboot-graph.png /doc/images/gcc-mesboot-graph.png
@ -156,3 +157,8 @@
/doc/web/ /doc/web/
/lib/x86_64-mes/0exit-42 /lib/x86_64-mes/0exit-42
/lib/x86_64-mes/exit-42 /lib/x86_64-mes/exit-42
/config.sh
/include/mes/config.h
/gcc-lib
/mescc-lib
/bin

View file

@ -87,7 +87,7 @@ src/${program_prefix}mes: build
clean: clean:
git clean -dfx\ git clean -dfx\
-e .config.make\ -e .config.make\
-e config.status\ -e config.sh\
-e GNUmakefile\ -e GNUmakefile\
-e build.sh\ -e build.sh\
-e check.sh\ -e check.sh\
@ -95,7 +95,6 @@ clean:
-e uninstall.sh\ -e uninstall.sh\
-e pre-inst-env\ -e pre-inst-env\
-e scripts/mescc\ -e scripts/mescc\
-e "mes"/module/mes/boot-0.scm\
# #

View file

@ -1,101 +0,0 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
set -e
# FIXME?
#mes_program_prefix=boot-$arch-
mes_program_prefix=$program_prefix
trace "HEX2 0exit-42" $HEX2\
$HEX2FLAGS\
-f ${srcdest}lib/$mes_arch/elf$bits-0header.hex2\
-f ${srcdest}lib/$mes_arch/elf$bits-body-exit-42.hex2\
-f ${srcdest}lib/$mes_arch/elf-0footer.hex2\
--exec_enable\
-o lib/$mes_arch/${mes_program_prefix}0exit-42
trace "TEST lib/$mes_arch/${mes_program_prefix}0exit-42" echo lib/$mes_arch/${mes_program_prefix}0exit-42
{ set +e; lib/$mes_arch/${mes_program_prefix}0exit-42; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
trace "HEX2 exit-42" $HEX2\
$HEX2FLAGS\
-f ${srcdest}lib/$mes_arch/elf$bits-header.hex2\
-f ${srcdest}lib/$mes_arch/elf$bits-body-exit-42.hex2\
-f ${srcdest}lib/$mes_arch/elf$bits-footer-single-main.hex2\
--exec_enable\
-o lib/$mes_arch/${mes_program_prefix}exit-42
trace "TEST lib/$mes_arch/${mes_program_prefix}exit-42" echo lib/$mes_arch/${mes_program_prefix}exit-42
{ set +e; lib/$mes_arch/${mes_program_prefix}exit-42; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
mkdir -p lib/$mes_arch
trace "M1 crt1.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/crt1.S\
-o lib/$mes_arch/crt1.o
trace "M1 libc.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/libc.S\
-o lib/$mes_arch/libc.o
trace "M1 mes.S" $M1\
--LittleEndian\
--architecture x86\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/mes.S\
-o src/mes.o
trace "BLOOD_ELF mes.S" $BLOOD_ELF\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/mes.S\
-f $MES_SEED/$mes_arch/libc.S\
-o src/mes.S.blood-elf
trace "M1 mes.blood-elf" $M1\
--LittleEndian\
--architecture x86\
-f src/mes.S.blood-elf\
-o src/mes.o.blood-elf
trace "HEX2 mes.o" $HEX2\
$HEX2FLAGS\
-f ${srcdest}lib/$mes_arch/elf$bits-header.hex2\
-f lib/$mes_arch/crt1.o\
-f lib/$mes_arch/libc.o\
-f src/mes.o\
-f src/mes.o.blood-elf\
--exec_enable\
-o src/${mes_program_prefix}mes
#cp src/${mes_program_prefix}mes src/${program_prefix}mes
trace "M1 libc+tcc.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/libc+tcc.S\
-o lib/$mes_arch/libc+tcc.o
trace "M1 libc+gnu.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/libc+gnu.S\
-o lib/$mes_arch/libc+gnu.o

View file

@ -1,70 +0,0 @@
#! @SHELL@
set -e
if [ "$V" = 1 -o "$V" = 2 ]; then
set -x
fi
MES_ARENA=${MES_ARENA-100000000}
MES_MAX_ARENA=${MES_MAX_ARENA-100000000}
MES_STACK=${MES_STACK-500000}
hex2 --LittleEndian --architecture x86 --BaseAddress 0x1000000 -f lib/x86-mes/elf32-0header.hex2 -f lib/x86-mes/elf32-body-exit-42.hex2 -f lib/x86-mes/elf-0footer.hex2 --exec_enable -o lib/x86-mes/0exit-42
hex2 --LittleEndian --architecture x86 --BaseAddress 0x1000000 -f lib/x86-mes/elf32-header.hex2 -f lib/x86-mes/elf32-body-exit-42.hex2 -f lib/x86-mes/elf32-footer-single-main.hex2 --exec_enable -o lib/x86-mes/exit-42
M1 --LittleEndian --architecture x86 -f lib/x86-mes/x86.M1 -f @MES_SEED@/x86-mes/crt1.S -o lib/x86-mes/crt1.o
M1 --LittleEndian --architecture x86 -f lib/x86-mes/x86.M1 -f @MES_SEED@/x86-mes/libc.S -o lib/x86-mes/libc.o
M1 --LittleEndian --architecture x86 -f lib/x86-mes/x86.M1 -f @MES_SEED@/x86-mes/mes.S -o src/mes.o
blood-elf -f lib/x86-mes/x86.M1 -f @MES_SEED@/x86-mes/mes.S -f @MES_SEED@/x86-mes/libc.S -o src/mes.S.blood-elf
M1 --LittleEndian --architecture x86 -f src/mes.S.blood-elf -o src/mes.o.blood-elf
hex2 --LittleEndian --architecture x86 --BaseAddress 0x1000000 -f lib/x86-mes/elf32-header.hex2 -f lib/x86-mes/crt1.o -f lib/x86-mes/libc.o -f src/mes.o -f src/mes.o.blood-elf --exec_enable -o src/mes
M1 --LittleEndian --architecture x86 -f lib/x86-mes/x86.M1 -f @MES_SEED@/x86-mes/libc+tcc.S -o lib/x86-mes/libc+tcc.o
M1 --LittleEndian --architecture x86 -f lib/x86-mes/x86.M1 -f @MES_SEED@/x86-mes/libc+gnu.S -o lib/x86-mes/libc+gnu.o
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/linux/x86-mes/crt1.o lib/linux/x86-mes/crt1.c
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/libc-mini.x86-mes-o lib/libc-mini.c
mv lib/libc-mini.x86-mes-S lib/x86-mes/libc-mini.S
mv lib/libc-mini.x86-mes-o lib/x86-mes/libc-mini.o
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/libc.x86-mes-o lib/libc.c
mv lib/libc.x86-mes-S lib/x86-mes/libc.S
mv lib/libc.x86-mes-o lib/x86-mes/libc.o
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/libc+tcc.x86-mes-o lib/libc+tcc.c
mv lib/libc+tcc.x86-mes-S lib/x86-mes/libc+tcc.S
mv lib/libc+tcc.x86-mes-o lib/x86-mes/libc+tcc.o
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/libc+gnu.x86-mes-o lib/libc+gnu.c
mv lib/libc+gnu.x86-mes-S lib/x86-mes/libc+gnu.S
mv lib/libc+gnu.x86-mes-o lib/x86-mes/libc+gnu.o
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/main.x86-mes-o scaffold/main.c
@GUILE@ -e main -L module scripts/mescc.scm -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/x86-mes-main scaffold/main.x86-mes-o
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/hello.x86-mes-o scaffold/hello.c
@GUILE@ -e main -L module scripts/mescc.scm -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/x86-mes-hello scaffold/hello.x86-mes-o -l c-mini
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/argv.x86-mes-o scaffold/argv.c
@GUILE@ -e main -L module scripts/mescc.scm -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/x86-mes-argv scaffold/argv.x86-mes-o -l c-mini
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/tests/stdlib/50-malloc.x86-mes-o lib/tests/stdlib/50-malloc.c
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/tests/posix/50-getenv.x86-mes-o lib/tests/posix/50-getenv.c
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/micro-mes.x86-mes-o scaffold/micro-mes.c
@GUILE@ -e main -L module scripts/mescc.scm -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/x86-mes-micro-mes scaffold/micro-mes.x86-mes-o -l c
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/tiny-mes.x86-mes-o scaffold/tiny-mes.c
@GUILE@ -e main -L module scripts/mescc.scm -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/x86-mes-tiny-mes scaffold/tiny-mes.x86-mes-o -l c
@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o src/mes.x86-mes-o src/mes.c
cp src/mes.x86-mes-S src/mes.S
@GUILE@ -e main -L module scripts/mescc.scm -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o src/x86-mes-mes src/mes.x86-mes-o -l c
cp src/x86-mes-mes src/mes

View file

@ -18,37 +18,34 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
if [ ! "$config_status" ]; then set -e
. ./config.status
fi . ./config.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh . ${srcdest}build-aux/trace.sh
GUILE_AUTO_COMPILE=0 GUILE_AUTO_COMPILE=0
set -e
SCM_FILES=" SCM_FILES="
${srcdest}module/mes/getopt-long.scm module/mes/getopt-long.scm
${srcdest}module/mes/guile.scm module/mes/guile.scm
${srcdest}module/mes/misc.scm module/mes/misc.scm
${srcdest}module/mes/test.scm module/mes/test.scm
${srcdest}module/mescc/M1.scm module/mescc/M1.scm
${srcdest}module/mescc/as.scm module/mescc/as.scm
${srcdest}module/mescc/bytevectors.scm module/mescc/bytevectors.scm
${srcdest}module/mescc/compile.scm module/mescc/compile.scm
${srcdest}module/mescc/i386/as.scm module/mescc/i386/as.scm
${srcdest}module/mescc/i386/info.scm module/mescc/i386/info.scm
${srcdest}module/mescc/x86_64/as.scm module/mescc/x86_64/as.scm
${srcdest}module/mescc/x86_64/info.scm module/mescc/x86_64/info.scm
${srcdest}module/mescc/info.scm module/mescc/info.scm
${srcdest}module/mescc.scm module/mescc.scm
${srcdest}module/mescc/mescc.scm module/mescc/mescc.scm
${srcdest}module/mescc/preprocess.scm module/mescc/preprocess.scm
" "
SCRIPTS=" SCRIPTS="
${srcdest}build-aux/mes-snarf.scm build-aux/mes-snarf.scm
" "
export host=$($GUILE -c "(display %host-type)") export host=$($GUILE -c "(display %host-type)")
@ -61,7 +58,8 @@ fi
for i in $SCM_FILES $SCRIPTS; do for i in $SCM_FILES $SCRIPTS; do
b=$(basename $i) b=$(basename $i)
go=${i%%.scm}.go go=${i%%.scm}.go
if [ $i -nt $go ]; then f=${srcdest}$i
trace "GUILEC $i" $GUILD compile -L ${srcdest}module -L ${srcdest}build-aux -L ${srcdest}scripts -o $go $i if test $f -nt $go; then
trace "GUILEC $f" $GUILD compile -L ${srcdest}module -L ${srcdest}build-aux -L ${srcdest}scripts -o $go $f
fi fi
done done

402
build-aux/build-lib.sh Executable file
View file

@ -0,0 +1,402 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
set -u
V=${V-1}
if [ "$V" = 2 ]; then
set -x
fi
. ./config.sh
. ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/cc.sh
trap 'test -f .log && cat .log' EXIT
srcdest=${srcdest-}
libc_mini_SOURCES="
lib/mes/eputs.c
lib/mes/oputs.c
"
if test $mes_libc = mes; then
libc_mini_SOURCES="$libc_mini_SOURCES
lib/posix/write.c
lib/string/strlen.c
lib/stdlib/puts.c
lib/stdlib/exit.c
lib/$mes_kernel/$mes_cpu-mes-$compiler/mini.c
"
fi
libmes_SOURCES="
$libc_mini_SOURCES
lib/mes/itoa.c
lib/mes/ltoa.c
lib/mes/ltoab.c
lib/mes/ultoa.c
lib/mes/utoa.c
lib/mes/eputc.c
lib/mes/fdgetc.c
lib/mes/fdputc.c
lib/mes/fdputs.c
lib/mes/fdungetc.c
lib/mes/mes_open.c
lib/mes/ntoab.c
lib/mes/oputc.c
"
if test $mes_libc = mes; then
libmes_SOURCES="$libmes_SOURCES
lib/stdlib/atoi.c
lib/mes/abtol.c
lib/ctype/isdigit.c
lib/ctype/isnumber.c
lib/ctype/isspace.c
lib/ctype/isxdigit.c
"
fi
libc_SOURCES="
$libmes_SOURCES
lib/mes/__assert_fail.c
lib/mes/__mes_debug.c
lib/posix/execv.c
lib/posix/getenv.c
lib/posix/isatty.c
lib/posix/setenv.c
lib/posix/wait.c
lib/stdio/fgetc.c
lib/stdio/fputc.c
lib/stdio/fputs.c
lib/stdio/getc.c
lib/stdio/getchar.c
lib/stdio/putc.c
lib/stdio/putchar.c
lib/stdio/ungetc.c
lib/stdlib/free.c
lib/stdlib/malloc.c
lib/stdlib/realloc.c
lib/string/memchr.c
lib/string/memcmp.c
lib/string/memcpy.c
lib/string/memset.c
lib/string/strcmp.c
lib/string/strcpy.c
lib/string/strncmp.c
"
if test $mes_kernel = linux; then
libc_SOURCES="$libc_SOURCES
lib/linux/access.c
lib/linux/brk.c
lib/linux/chmod.c
lib/linux/clock_gettime.c
lib/linux/dup.c
lib/linux/dup2.c
lib/linux/execve.c
lib/linux/fork.c
lib/linux/fsync.c
lib/linux/getcwd.c
lib/linux/gettimeofday.c
lib/linux/ioctl.c
lib/linux/open.c
lib/linux/read.c
lib/linux/time.c
lib/linux/unlink.c
lib/linux/waitpid.c
lib/linux/$mes_cpu-mes-$compiler/syscall.c
"
fi
libtcc1_SOURCES="
lib/libtcc1.c
"
libc_tcc_SOURCES="
$libc_SOURCES
lib/ctype/islower.c
lib/ctype/isupper.c
lib/ctype/tolower.c
lib/ctype/toupper.c
lib/mes/search-path.c
lib/posix/execvp.c
lib/stdio/fclose.c
lib/stdio/fdopen.c
lib/stdio/ferror.c
lib/stdio/fflush.c
lib/stdio/fopen.c
lib/stdio/fprintf.c
lib/stdio/fread.c
lib/stdio/fseek.c
lib/stdio/ftell.c
lib/stdio/fwrite.c
lib/stdio/printf.c
lib/stdio/remove.c
lib/stdio/snprintf.c
lib/stdio/sprintf.c
lib/stdio/sscanf.c
lib/stdio/vfprintf.c
lib/stdio/vprintf.c
lib/stdio/vsnprintf.c
lib/stdio/vsprintf.c
lib/stdio/vsscanf.c
lib/stdlib/calloc.c
lib/stdlib/qsort.c
lib/stdlib/strtof.c
lib/stdlib/strtol.c
lib/stdlib/strtold.c
lib/stdlib/strtoll.c
lib/stdlib/strtoul.c
lib/stdlib/strtoull.c
lib/string/memmem.c
lib/string/memmove.c
lib/string/strcat.c
lib/string/strchr.c
lib/string/strlwr.c
lib/string/strncpy.c
lib/string/strrchr.c
lib/string/strstr.c
lib/string/strupr.c
lib/stub/sigaction.c
lib/stub/ldexp.c
lib/stub/mprotect.c
lib/stub/localtime.c
lib/stub/sigemptyset.c
lib/ctype/islower.c
lib/ctype/isupper.c
lib/ctype/tolower.c
lib/ctype/toupper.c
lib/mes/search-path.c
lib/posix/execvp.c
lib/stdio/fclose.c
lib/stdio/fdopen.c
lib/stdio/ferror.c
lib/stdio/fflush.c
lib/stdio/fopen.c
lib/stdio/fprintf.c
lib/stdio/fread.c
lib/stdio/fseek.c
lib/stdio/ftell.c
lib/stdio/fwrite.c
lib/stdio/printf.c
lib/stdio/remove.c
lib/stdio/snprintf.c
lib/stdio/sprintf.c
lib/stdio/sscanf.c
lib/stdio/vfprintf.c
lib/stdio/vprintf.c
lib/stdio/vsnprintf.c
lib/stdio/vsprintf.c
lib/stdio/vsscanf.c
lib/stdlib/calloc.c
lib/stdlib/qsort.c
lib/stdlib/strtof.c
lib/stdlib/strtol.c
lib/stdlib/strtold.c
lib/stdlib/strtoll.c
lib/stdlib/strtoul.c
lib/stdlib/strtoull.c
lib/string/memmem.c
lib/string/memmove.c
lib/string/strcat.c
lib/string/strchr.c
lib/string/strlwr.c
lib/string/strncpy.c
lib/string/strrchr.c
lib/string/strstr.c
lib/string/strupr.c
lib/stub/sigaction.c
lib/stub/ldexp.c
lib/stub/mprotect.c
lib/stub/localtime.c
lib/stub/sigemptyset.c
xslib/stub/strtod.c
lib/$mes_cpu-mes-$compiler/setjmp.c
"
if test $mes_kernel = linux; then
libc_tcc_SOURCES="$libc_tcc_SOURCES
lib/linux/close.c
lib/linux/lseek.c
lib/linux/rmdir.c
lib/linux/stat.c
"
fi
libc_gnu_SOURCES="
$libc_tcc_SOURCES
lib/ctype/isalnum.c
lib/ctype/isalpha.c
lib/ctype/isascii.c
lib/ctype/iscntrl.c
lib/ctype/isprint.c
lib/ctype/ispunct.c
lib/dirent/__getdirentries.c
lib/dirent/closedir.c
lib/dirent/opendir.c
lib/dirent/readdir.c
lib/math/fabs.c
lib/mes/fdgets.c
lib/posix/alarm.c
lib/posix/execl.c
lib/posix/mktemp.c
lib/posix/raise.c
lib/posix/sbrk.c
lib/posix/sleep.c
lib/posix/unsetenv.c
lib/stdio/clearerr.c
lib/stdio/feof.c
lib/stdio/fgets.c
lib/stdio/fileno.c
lib/stdio/freopen.c
lib/stdio/perror.c
lib/stdlib/__exit.c
lib/stdlib/abort.c
lib/stdlib/abs.c
lib/stdlib/alloca.c
lib/stdlib/atexit.c
lib/stdlib/atol.c
lib/stdlib/mbstowcs.c
lib/string/bcmp.c
lib/string/bcopy.c
lib/string/bzero.c
lib/string/index.c
lib/string/rindex.c
lib/string/strcspn.c
lib/string/strdup.c
lib/string/strerror.c
lib/string/strncat.c
lib/string/strpbrk.c
lib/string/strspn.c
lib/stub/__cleanup.c
lib/stub/bsearch.c
lib/stub/chown.c
lib/stub/ctime.c
lib/stub/fpurge.c
lib/stub/freadahead.c
lib/stub/frexp.c
lib/stub/getlogin.c
lib/stub/getpwnam.c
lib/stub/getpwuid.c
lib/stub/gmtime.c
lib/stub/pclose.c
lib/stub/popen.c
lib/stub/rand.c
lib/stub/setbuf.c
lib/stub/setlocale.c
lib/stub/setvbuf.c
lib/stub/sigaddset.c
lib/stub/sigblock.c
lib/stub/sigdelset.c
lib/stub/sigsetmask.c
lib/stub/strftime.c
lib/stub/sys_siglist.c
lib/stub/system.c
lib/stub/times.c
lib/stub/ttyname.c
lib/stub/umask.c
lib/stub/utime.c
"
if test $mes_kernel = linux; then
libc_gnu_SOURCES="$libc_gnu_SOURCES
lib/linux/chdir.c
lib/linux/fcntl.c
lib/linux/fstat.c
lib/linux/getdents.c
lib/linux/getegid.c
lib/linux/geteuid.c
lib/linux/getgid.c
lib/linux/getpid.c
lib/linux/getppid.c
lib/linux/getrusage.c
lib/linux/getuid.c
lib/linux/kill.c
lib/linux/link.c
lib/linux/lstat.c
lib/linux/mkdir.c
lib/linux/nanosleep.c
lib/linux/pipe.c
lib/linux/rename.c
lib/linux/setgid.c
lib/linux/settimer.c
lib/linux/setuid.c
lib/linux/signal.c
lib/linux/sigprogmask.c
"
fi
mkdir -p $mes_cpu-mes
compile lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
cp crt1.o $mes_cpu-mes
if test -e crt1.s; then
cp crt1.s $mes_cpu-mes
fi
archive libc-mini.a $libc_mini_SOURCES
cp libc-mini.a $mes_cpu-mes
if test -e libc-mini.S; then
cp libc-mini.S $mes_cpu-mes
fi
archive libmes.a $libmes_SOURCES
cp libmes.a $mes_cpu-mes
if test -e libmes.S; then
cp libmes.S $mes_cpu-mes
fi
archive libc.a $libc_SOURCES
cp libc.a $mes_cpu-mes
if test -e libc.S; then
cp libc.S $mes_cpu-mes
fi
archive libc+tcc.a $libc_tcc_SOURCES
cp libc+tcc.a $mes_cpu-mes
if test -e libc+tcc.S; then
cp libc+tcc.S $mes_cpu-mes
fi
if $courageous; then
exit 0
fi
archive libc+gnu.a $libc_gnu_SOURCES
cp libc+gnu.a $mes_cpu-mes
if test -e libc+gnu.S; then
cp libc+gnu.S $mes_cpu-mes
fi
archive libtcc1.a $libtcc1_SOURCES
cp libtcc1.a $mes_cpu-mes
if test -e libtcc1.S; then
cp libtcc1.S $mes_cpu-mes
fi
archive libgetopt.a lib/posix/getopt.c
cp libgetopt.a $mes_cpu-mes
if test -e libgetopt.S; then
cp libgetopt.S $mes_cpu-mes
fi

View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -19,68 +19,39 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e set -e
set -u
if [ ! "$config_status" ]; then V=${V-1}
. ./config.status
if [ "$V" = 2 ]; then
set -x
fi fi
. ${srcdest}build-aux/config.sh . ./config.sh
. ${srcdest}build-aux/trace.sh . ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/cc.sh . ${srcdest}build-aux/cc.sh
[ "$mes_p" ] && (program_prefix= compile lib/linux/$mes_arch/crt1) trap 'test -f .log && cat .log' EXIT
[ "$mes_p" -a ! "$gcc_p" ] && cp -f lib/linux/$mes_arch/crt1.S lib/$mes_arch/crt1.S
[ "$mes_p" -a ! "$gcc_p" ] && cp -f lib/linux/$mes_arch/crt1.o lib/$mes_arch/crt1.o
[ ! "$mesc_p" -a ! "$with_glibc_p" ] && (program_prefix= compile lib/linux/$mes_arch/crt0) srcdest=${srcdest-}
[ "$mes_p" -a "$gcc_p" ] && (program_prefix= compile lib/linux/$mes_arch/crti) mes_sources="
[ "$mes_p" -a "$gcc_p" ] && (program_prefix= compile lib/linux/$mes_arch/crtn) src/gc.c
src/hash.c
src/lib.c
src/math.c
src/mes.c
src/module.c
src/posix.c
src/reader.c
src/string.c
src/struct.c
src/vector.c
"
[ ! "$mes_p" -a ! "$mesc_p" ] && compile lib/libmes for c in $mes_sources; do
[ ! "$mes_p" -a ! "$mesc_p" ] && archive lib/libmes compile $c
done
[ "$mes_p" ] && compile lib/libc-mini if test $mes_libc = system; then
[ "$mes_p" ] && archive lib/libc-mini LIBS=-lmes
fi
[ "$mes_p" ] && compile lib/libc
[ "$mes_p" ] && archive lib/libc
[ "$mes_p" ] && compile lib/libc+tcc
[ "$mes_p" ] && archive lib/libc+tcc
[ "$mes_p" ] && compile lib/libc+gnu
[ "$mes_p" ] && archive lib/libc+gnu
[ "$mes_p" -a ! "$mesc_p" ] && compile lib/libtcc1
[ "$mes_p" -a ! "$mesc_p" ] && archive lib/libtcc1
[ "$mes_p" -a ! "$mesc_p" ] && compile lib/libg
[ "$mes_p" -a ! "$mesc_p" ] && archive lib/libg
[ "$mes_p" -a ! "$mesc_p" ] && compile lib/libgetopt
[ "$mes_p" -a ! "$mesc_p" ] && archive lib/libgetopt
compile scaffold/main
(libc= link scaffold/main)
compile scaffold/hello
(libc="-l c-mini" link scaffold/hello)
compile scaffold/argv
(libc="-l c-mini" link scaffold/argv)
[ "$mes_p" ] && compile lib/tests/stdlib/50-malloc
[ "$mes_p" ] && link lib/tests/stdlib/50-malloc
[ "$mes_p" ] && compile lib/tests/posix/50-getenv
[ "$mes_p" ] && link lib/tests/posix/50-getenv
[ "$mes_p" ] && compile scaffold/micro-mes
[ "$mes_p" ] && link scaffold/micro-mes
[ "$mes_p" ] && compile scaffold/tiny-mes
[ "$mes_p" ] && link scaffold/tiny-mes
compile src/mes
link src/mes link src/mes

75
build-aux/build-scaffold.sh Executable file
View file

@ -0,0 +1,75 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
set -u
V=${V-1}
if [ "$V" = 2 ]; then
set -x
fi
. ./config.sh
. ${srcdest}build-aux/trace.sh
if $courageous; then
echo "Applying courage"
set +e
fi
case "$mes_cpu" in
x86_64)
stage0_cpu=amd64;;
x86)
stage0_cpu=x86;;
*)
stage0_cpu=$mes_cpu;;
esac
trace "HEX2 0exit-42.hex2" $HEX2\
--LittleEndian\
--architecture $stage0_cpu\
--BaseAddress 0x1000000\
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0header.hex2\
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\
-f ${srcdest}lib/$mes_cpu-mes/elf-0footer.hex2\
--exec_enable\
-o 0exit-42
trace "TEST 0exit-42"
{ set +e; ./0exit-42; r=$?; set -e; }
[ $r != 42 ] && echo " => $r"
[ $r == 42 ]
trace "HEX2 exit-42.hex2" $HEX2\
--LittleEndian\
--architecture $stage0_cpu\
--BaseAddress 0x1000000\
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-header.hex2\
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-footer-single-main.hex2\
--exec_enable\
-o exit-42
trace "TEST exit-42"
{ set +e; ./exit-42; r=$?; set -e; }
[ $r != 42 ] && echo " => $r"
[ $r == 42 ]

View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -20,34 +20,128 @@
set -e set -e
. ./config.status if test "$1" = "help"; then
. ${srcdest}build-aux/config.sh cat <<EOF
Run:
./build.sh to build mes
./check.sh to check mes
./install.sh to install mes
EOF
exit 0
fi
if [ -n "$GUILE" -a "$GUILE" != true ]; then if test "$V" = 2; then
set -x
fi
set -u
. ./config.sh
if $courageous; then
echo "Applying courage"
set +e
fi
sh ${srcdest}build-aux/build-scaffold.sh
if test -n "$GUILE" -a "$GUILE" != true; then
sh ${srcdest}build-aux/build-guile.sh sh ${srcdest}build-aux/build-guile.sh
fi fi
if [ "$gcc_p$tcc_p" ]; then debug=
sh ${srcdest}build-aux/build-mes.sh #debug=-g
elif [ -d "$MES_SEED" ]; then
sh ${srcdest}build-aux/bootstrap-mes.sh CFLAGS="
$debug
"
if test $mes_libc = mes; then
CFLASG="$CFLAGS
-nostdinc
-nostdlib
-fno-builtin
"
fi fi
## FIXME: remove this and have user configure/build/install for each compiler? CPPFLAGS="
unset CFLAGS CPPFLAGS LDFLAGS gcc_p tcc_p with_glibc_p -D HAVE_CONFIG_H=1
MES=guile -I ../include
mesc_p=1 -I ${srcdir}/../include
mes_p=1 -I ${srcdir}/../include/$mes_kernel/$mes_cpu
mes_arch=x86-mes "
program_prefix=$mes_arch-
CC="./pre-inst-env mescc"
sh ${srcdest}build-aux/build-mes.sh LDFLAGS="
cp src/${program_prefix}mes src/mes $debug
-L .
if [ "$arch" = x86_64 ]; then "
MES_CFLAGS='-m 64' if test $mes_libc = mes; then
mes_arch=x86_64-mes LDFLAGS="$LDFLAGS
program_prefix=$mes_arch- -nostdlib
sh ${srcdest}build-aux/build-mes.sh "
fi fi
LIBS=-lc
export CFLAGS
export CPPFLAGS
export LDFLAGS
export LIBS
if test $compiler = gcc; then
(
mkdir -p gcc-lib
cp config.sh gcc-lib
cd gcc-lib
if test -z "$srcdest"; then
srcdest=../
srcdir=../
fi
CPPFLAGS="
-D HAVE_CONFIG_H=1
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
sh ${srcdest}build-aux/build-lib.sh
cp crt1.o ..
)
fi
(
if test $compiler = gcc; then
LDFLAGS="$LDFLAGS
-L gcc-lib
"
fi
CPPFLAGS="
-D HAVE_CONFIG_H=1
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
sh ${srcdest}build-aux/build-mes.sh
)
(
mkdir -p mescc-lib
cp config.sh mescc-lib
cd mescc-lib
sed -i s,mes_libc=system,mes_libc=mes, config.sh
mkdir -p include/mes
cp -p ../include/mes/config.h include/mes/config.h
sed -i 's,#define SYSTEM_LIBC 1,#undef SYSTEM_LIBC,' include/mes/config.h
if test -z "$srcdest"; then
srcdest=../
srcdir=../
fi
CPPFLAGS="
-D HAVE_CONFIG_H=1
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
compiler=mescc
AR="${srcdest}pre-inst-env ar"
CC="${srcdest}pre-inst-env mescc -m $mes_bits"
sh ${srcdest}build-aux/build-lib.sh
)

View file

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -16,32 +16,41 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
objects=
compile () { compile () {
flags= c=${srcdest}$1
[ "$mesc_p" ] && flags="$LDFLAGS $MES_CFLAGS" b=$(basename $c .c)
trace "CC $1.c" $CC -c $CPPFLAGS $CFLAGS $flags -o "$1".${program_prefix}o "${srcdest}$1".c o=$b.o
} objects="$objects $o"
if test $c -nt $o; then
archive () { trace "CC $c" $CC -c $CPPFLAGS $CFLAGS -o $o $c
l=$1 $CC -c $CPPFLAGS $CFLAGS -o $o $c
shift
objects=$(for i in $@; do echo $i.${program_prefix}o; done)
[ -z "$objects" ] && objects=$l.${program_prefix}o
out=$(dirname "$l")/$mes_arch/$(basename "$l").a
d=$(dirname $out)
mkdir -p $d
if [ "$mesc_p" ]; then
trace "AR $l.a" mv $l.${program_prefix}o $(dirname $l)/$mes_arch/$(basename $l).o\
&& mv $l.${program_prefix}S $(dirname $l)/$mes_arch/$(basename $l).S
else
trace "AR $l.a" $AR cr $out $objects\
&& mv $objects $d
fi fi
} }
link () { archive () {
lib=$libc archive=$1
[ "$with_glibc_p" ] && lib='-l mes' shift
out=$(dirname "$1")/${program_prefix}$(basename "$1") sources="$@"
trace "CCLD $1" $CC $CFLAGS $LDFLAGS -o" $out" $crt1 "$1".${program_prefix}o $2 $lib objects=
for c in $sources; do
b=$(basename $c .c)
o=$b.o
compile $c
done
trace "AR $archive" $AR crD $archive $objects
objects=
}
link () {
out=$1
d=$(dirname $out)
mkdir -p $d
if test $mes_libc = system; then
crt1=
else
crt1=crt1.o
fi
trace "CCLD $out" $CC $CFLAGS $LDFLAGS -o $out $crt1 $objects $LIBS
objects=
} }

View file

@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -19,120 +19,104 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e set -e
. ./config.sh
set -u
. ./config.status TESTS="
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
tests=" scaffold/boot/00-zero.scm
scaffold/boot/01-true.scm
scaffold/boot/02-symbol.scm
scaffold/boot/03-string.scm
scaffold/boot/04-quote.scm
scaffold/boot/05-list.scm
scaffold/boot/06-tick.scm
scaffold/boot/07-if.scm
scaffold/boot/08-if-if.scm
00-zero.scm scaffold/boot/10-cons.scm
01-true.scm scaffold/boot/11-list.scm
02-symbol.scm scaffold/boot/11-vector.scm
03-string.scm scaffold/boot/12-car.scm
04-quote.scm scaffold/boot/13-cdr.scm
05-list.scm scaffold/boot/14-exit.scm
06-tick.scm scaffold/boot/15-display.scm
07-if.scm
08-if-if.scm
10-cons.scm scaffold/boot/16-if-eq-quote.scm
11-list.scm
11-vector.scm
12-car.scm
13-cdr.scm
14-exit.scm
15-display.scm
16-if-eq-quote.scm scaffold/boot/17-memq.scm
scaffold/boot/17-memq-keyword.scm
scaffold/boot/17-string-equal.scm
scaffold/boot/17-equal2.scm
scaffold/boot/17-string-append.scm
scaffold/boot/17-open-input-string.scm
17-memq.scm scaffold/boot/20-define.scm
17-memq-keyword.scm scaffold/boot/20-define-quoted.scm
17-string-equal.scm scaffold/boot/20-define-quote.scm
17-equal2.scm
17-string-append.scm
17-open-input-string.scm
20-define.scm scaffold/boot/21-define-procedure.scm
20-define-quoted.scm scaffold/boot/22-define-procedure-2.scm
20-define-quote.scm scaffold/boot/23-begin.scm
scaffold/boot/24-begin-define.scm
scaffold/boot/25-begin-define-2.scm
scaffold/boot/26-begin-define-later.scm
scaffold/boot/27-lambda-define.scm
scaffold/boot/28-define-define.scm
scaffold/boot/29-lambda-define.scm
scaffold/boot/2a-lambda-lambda.scm
scaffold/boot/2b-define-lambda.scm
scaffold/boot/2c-define-lambda-recurse.scm
scaffold/boot/2d-define-lambda-set.scm
scaffold/boot/2d-compose.scm
scaffold/boot/2e-define-first.scm
scaffold/boot/2f-define-second.scm
scaffold/boot/2f-define-second-lambda.scm
scaffold/boot/2g-vector.scm
21-define-procedure.scm scaffold/boot/30-capture.scm
22-define-procedure-2.scm scaffold/boot/31-capture-define.scm
23-begin.scm scaffold/boot/32-capture-modify-close.scm
24-begin-define.scm scaffold/boot/32-capture-modify-close.scm
25-begin-define-2.scm scaffold/boot/33-procedure-override-close.scm
26-begin-define-later.scm scaffold/boot/34-cdr-override-close.scm
27-lambda-define.scm scaffold/boot/35-closure-modify.scm
28-define-define.scm scaffold/boot/36-closure-override.scm
29-lambda-define.scm scaffold/boot/37-closure-lambda.scm
2a-lambda-lambda.scm scaffold/boot/38-simple-format.scm
2b-define-lambda.scm scaffold/boot/39-global-define-override.scm
2c-define-lambda-recurse.scm scaffold/boot/3a-global-define-lambda-override.scm
2d-define-lambda-set.scm
2d-compose.scm
2e-define-first.scm
2f-define-second.scm
2f-define-second-lambda.scm
2g-vector.scm
30-capture.scm scaffold/boot/40-define-macro.scm
31-capture-define.scm scaffold/boot/41-when.scm
32-capture-modify-close.scm scaffold/boot/42-if-when.scm
32-capture-modify-close.scm scaffold/boot/43-or.scm
33-procedure-override-close.scm scaffold/boot/44-or-if.scm
34-cdr-override-close.scm scaffold/boot/45-pass-if.scm
35-closure-modify.scm scaffold/boot/46-report.scm
36-closure-override.scm scaffold/boot/47-pass-if-eq.scm
37-closure-lambda.scm scaffold/boot/48-let.scm
38-simple-format.scm scaffold/boot/49-macro-override.scm
39-global-define-override.scm scaffold/boot/4a-define-macro-define-macro.scm
3a-global-define-lambda-override.scm scaffold/boot/4b-define-macro-define.scm
scaffold/boot/4c-quasiquote.scm
scaffold/boot/4d-let-map.scm
scaffold/boot/4e-let-global.scm
scaffold/boot/4f-string-split.scm
40-define-macro.scm scaffold/boot/50-keyword.scm
41-when.scm scaffold/boot/50-make-string.scm
42-if-when.scm scaffold/boot/50-string-join.scm
43-or.scm scaffold/boot/50-primitive-load.scm
44-or-if.scm scaffold/boot/53-closure-display.scm
45-pass-if.scm scaffold/boot/60-let-syntax.scm
46-report.scm scaffold/boot/call-cc.scm
47-pass-if-eq.scm scaffold/boot/memory.scm
48-let.scm scaffold/boot/numbers.scm
49-macro-override.scm
4a-define-macro-define-macro.scm
4b-define-macro-define.scm
4c-quasiquote.scm
4d-let-map.scm
4e-let-global.scm
4f-string-split.scm
50-string-append.scm
50-string-join.scm
50-primitive-load.scm
51-module.scm
52-define-module.scm
53-closure-display.scm
60-let-syntax.scm
" "
for i in $tests; do XFAIL_TESTS=
echo -n $i
if [ ! -f scaffold/boot/$i ]; then test_ext=.scm
echo ' [SKIP]' log_compiler=${srcdest}build-aux/test-boot.sh
continue; . ${srcdest}build-aux/test-suite.sh
fi
x=$(
if [ "$MES" = guile -o "$(basename $MES)" = guile ]; then
trace "TEST $i.guile" $GUILE -L ${srcdest}module -C module -L . <(echo '(use-modules (mes guile))'; cat scaffold/boot/$i)
elif [ -z "${i/5[0-9]-*/}" ]; then
cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-00.scm trace "TEST $i" $MES 2>&1;
elif [ -z "${i/6[0-9]-*/}" ]; then
cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-01.scm trace "TEST $i" $MES 2>&1;
else
MES_BOOT=${srcdest}scaffold/boot/$i trace "TEST $i" $MES 2>&1;
fi
) \
&& echo ' [OK]' \
|| (r=$?; echo ' [FAIL]'; echo -e "$x"; echo scaffold/boot/$i; exit $r)
done

View file

@ -19,12 +19,10 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e set -e
. ./config.sh
set -u
. ./config.status TESTS="
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
tests="
tests/boot.test tests/boot.test
tests/read.test tests/read.test
tests/srfi-0.test tests/srfi-0.test
@ -57,28 +55,8 @@ tests/match.test
tests/psyntax.test tests/psyntax.test
" "
mkdir -p tests XFAIL_TESTS=
set +e
fail=0 test_ext=.test
total=0 log_compiler=sh
for t in $tests; do . ${srcdest}build-aux/test-suite.sh
if [ ! -f $t ]; then
echo $t: [SKIP];
continue
fi
${top_builddir}/pre-inst-env sh "$t" > $t.${mes}log 2>&1
r=$?
total=$(expr $total + 1)
if [ $r = 0 ]; then
echo $t: [${mes}OK]
else
echo $t: [${mes}FAIL]
fail=$(expr $fail + 1)
fi
done
if [ $fail != 0 ]; then
echo FAILED: $fail/$total
exit 1
else
echo PASS: $total
fi

View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -19,268 +19,253 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e set -e
. ./config.status . ./config.sh
. ${srcdest}build-aux/config.sh set -u
. ${srcdest}build-aux/trace.sh
test_sh=${test_sh-${srcdest}build-aux/test.sh} TESTS="
lib/tests/scaffold/t.c
tests=" lib/tests/scaffold/00-exit-0.c
lib/tests/scaffold/t lib/tests/scaffold/01-return-0.c
lib/tests/scaffold/00-exit-0 lib/tests/scaffold/02-return-1.c
lib/tests/scaffold/01-return-0 lib/tests/scaffold/03-call.c
lib/tests/scaffold/02-return-1 lib/tests/scaffold/04-call-0.c
lib/tests/scaffold/03-call lib/tests/scaffold/05-call-1.c
lib/tests/scaffold/04-call-0 lib/tests/scaffold/06-call-not-1.c
lib/tests/scaffold/05-call-1 lib/tests/scaffold/06-not-call-1.c
lib/tests/scaffold/06-call-not-1 lib/tests/scaffold/06-call-2.c
lib/tests/scaffold/06-not-call-1 lib/tests/scaffold/06-call-string.c
lib/tests/scaffold/06-call-2 lib/tests/scaffold/06-call-variable.c
lib/tests/scaffold/06-call-string lib/tests/scaffold/06-return-void.c
lib/tests/scaffold/06-call-variable lib/tests/scaffold/07-include.c
lib/tests/scaffold/06-return-void lib/tests/scaffold/08-assign.c
lib/tests/scaffold/07-include lib/tests/scaffold/08-assign-negative.c
lib/tests/scaffold/08-assign lib/tests/scaffold/08-assign-global.c
lib/tests/scaffold/08-assign-negative lib/tests/scaffold/10-if-0.c
lib/tests/scaffold/08-assign-global lib/tests/scaffold/11-if-1.c
lib/tests/scaffold/10-if-0 lib/tests/scaffold/12-if-eq.c
lib/tests/scaffold/11-if-1 lib/tests/scaffold/13-if-neq.c
lib/tests/scaffold/12-if-eq lib/tests/scaffold/14-if-goto.c
lib/tests/scaffold/13-if-neq lib/tests/scaffold/15-if-not-f.c
lib/tests/scaffold/14-if-goto lib/tests/scaffold/16-if-t.c
lib/tests/scaffold/15-if-not-f lib/tests/scaffold/17-compare-char.c
lib/tests/scaffold/16-if-t lib/tests/scaffold/17-compare-ge.c
lib/tests/scaffold/17-compare-char lib/tests/scaffold/17-compare-gt.c
lib/tests/scaffold/17-compare-ge lib/tests/scaffold/17-compare-le.c
lib/tests/scaffold/17-compare-gt lib/tests/scaffold/17-compare-lt.c
lib/tests/scaffold/17-compare-le lib/tests/scaffold/17-compare-unsigned-ge.c
lib/tests/scaffold/17-compare-lt lib/tests/scaffold/17-compare-unsigned-gt.c
lib/tests/scaffold/17-compare-unsigned-ge lib/tests/scaffold/17-compare-unsigned-le.c
lib/tests/scaffold/17-compare-unsigned-gt lib/tests/scaffold/17-compare-unsigned-lt.c
lib/tests/scaffold/17-compare-unsigned-le lib/tests/scaffold/17-compare-unsigned-char-le.c
lib/tests/scaffold/17-compare-unsigned-lt lib/tests/scaffold/17-compare-unsigned-short-le.c
lib/tests/scaffold/17-compare-unsigned-char-le lib/tests/scaffold/17-compare-unsigned-long-le.c
lib/tests/scaffold/17-compare-unsigned-short-le lib/tests/scaffold/17-compare-and.c
lib/tests/scaffold/17-compare-unsigned-long-le lib/tests/scaffold/17-compare-or.c
lib/tests/scaffold/17-compare-and lib/tests/scaffold/17-compare-and-or.c
lib/tests/scaffold/17-compare-or lib/tests/scaffold/17-compare-assign.c
lib/tests/scaffold/17-compare-and-or lib/tests/scaffold/17-compare-call.c
lib/tests/scaffold/17-compare-assign lib/tests/scaffold/18-assign-shadow.c
lib/tests/scaffold/17-compare-call lib/tests/scaffold/20-while.c
lib/tests/scaffold/18-assign-shadow lib/tests/scaffold/21-char-array-simple.c
lib/tests/scaffold/20-while lib/tests/scaffold/21-char-array.c
lib/tests/scaffold/21-char-array-simple lib/tests/scaffold/22-while-char-array.c
lib/tests/scaffold/21-char-array lib/tests/scaffold/23-global-pointer-init-null.c
lib/tests/scaffold/22-while-char-array lib/tests/scaffold/23-global-pointer-init.c
lib/tests/scaffold/23-global-pointer-init-null lib/tests/scaffold/23-global-pointer-ref.c
lib/tests/scaffold/23-global-pointer-init lib/tests/scaffold/23-global-pointer-pointer-ref.c
lib/tests/scaffold/23-global-pointer-ref lib/tests/scaffold/23-pointer-sub.c
lib/tests/scaffold/23-global-pointer-pointer-ref lib/tests/scaffold/23-pointer.c
lib/tests/scaffold/23-pointer-sub lib/tests/mes/30-oputs.c
lib/tests/scaffold/23-pointer lib/tests/string/30-strlen.c
lib/tests/mes/30-oputs lib/tests/scaffold/32-call-wrap.c
lib/tests/string/30-strlen lib/tests/scaffold/32-compare.c
lib/tests/scaffold/32-call-wrap lib/tests/scaffold/33-and-or.c
lib/tests/scaffold/32-compare lib/tests/scaffold/34-pre-post.c
lib/tests/scaffold/33-and-or lib/tests/scaffold/35-compare-char.c
lib/tests/scaffold/34-pre-post lib/tests/scaffold/36-compare-arithmetic.c
lib/tests/scaffold/35-compare-char lib/tests/scaffold/37-compare-assign.c
lib/tests/scaffold/36-compare-arithmetic lib/tests/scaffold/38-compare-call-2.c
lib/tests/scaffold/37-compare-assign lib/tests/scaffold/38-compare-call-3.c
lib/tests/scaffold/38-compare-call-2 lib/tests/scaffold/38-compare-call.c
lib/tests/scaffold/38-compare-call-3 lib/tests/scaffold/40-if-else.c
lib/tests/scaffold/38-compare-call lib/tests/scaffold/41-ternary.c
lib/tests/scaffold/40-if-else lib/tests/scaffold/42-goto-label.c
lib/tests/scaffold/41-ternary lib/tests/scaffold/43-for-do-while.c
lib/tests/scaffold/42-goto-label lib/tests/scaffold/44-switch.c
lib/tests/scaffold/43-for-do-while lib/tests/scaffold/44-switch-fallthrough.c
lib/tests/scaffold/44-switch lib/tests/scaffold/44-switch-body-fallthrough.c
lib/tests/scaffold/44-switch-fallthrough lib/tests/scaffold/45-void-call.c
lib/tests/scaffold/44-switch-body-fallthrough lib/tests/scaffold/46-function-static.c
lib/tests/scaffold/45-void-call lib/tests/scaffold/47-function-expression.c
lib/tests/scaffold/46-function-static lib/tests/scaffold/48-global-static.c
lib/tests/scaffold/47-function-expression lib/tests/assert/50-assert.c
lib/tests/scaffold/48-global-static lib/tests/mes/50-itoa.c
lib/tests/assert/50-assert lib/tests/posix/50-getenv.c
lib/tests/mes/50-itoa lib/tests/string/50-strcmp.c
lib/tests/posix/50-getenv lib/tests/string/50-strcpy.c
lib/tests/string/50-strcmp lib/tests/string/50-strncmp.c
lib/tests/string/50-strcpy lib/tests/scaffold/51-pointer-sub.c
lib/tests/string/50-strncmp lib/tests/scaffold/54-argc.c
lib/tests/scaffold/51-pointer-sub lib/tests/scaffold/55-char-array.c
lib/tests/scaffold/54-argc lib/tests/scaffold/60-math.c
lib/tests/scaffold/54-argv lib/tests/scaffold/61-array.c
lib/tests/scaffold/55-char-array lib/tests/scaffold/62-array.c
lib/tests/scaffold/60-math lib/tests/scaffold/63-struct.c
lib/tests/scaffold/61-array lib/tests/scaffold/63-struct-pointer.c
lib/tests/scaffold/62-array lib/tests/scaffold/63-struct-local.c
lib/tests/scaffold/63-struct lib/tests/scaffold/63-struct-function.c
lib/tests/scaffold/63-struct-pointer lib/tests/scaffold/63-struct-assign.c
lib/tests/scaffold/63-struct-local lib/tests/scaffold/63-struct-array.c
lib/tests/scaffold/63-struct-function lib/tests/scaffold/63-struct-array-assign.c
lib/tests/scaffold/63-struct-assign lib/tests/scaffold/63-struct-array-compare.c
lib/tests/scaffold/63-struct-array lib/tests/scaffold/63-struct-cell.c
lib/tests/scaffold/63-struct-array-assign lib/tests/scaffold/64-make-cell.c
lib/tests/scaffold/63-struct-array-compare lib/tests/scaffold/65-read.c
lib/tests/scaffold/63-struct-cell lib/tests/scaffold/66-local-char-array.c
lib/tests/scaffold/64-make-cell lib/tests/scaffold/70-stdarg.c
lib/tests/scaffold/65-read lib/tests/stdio/70-printf-hello.c
lib/tests/scaffold/66-local-char-array lib/tests/stdio/70-printf-simple.c
lib/tests/scaffold/70-stdarg lib/tests/stdio/70-printf.c
lib/tests/stdio/70-printf-hello lib/tests/stdlib/70-strtoull.c
lib/tests/stdio/70-printf-simple lib/tests/string/70-strchr.c
lib/tests/stdio/70-printf lib/tests/scaffold/71-struct-array.c
lib/tests/stdlib/70-strtoull lib/tests/scaffold/72-typedef-struct-def.c
lib/tests/string/70-strchr lib/tests/scaffold/73-union-hello.c
lib/tests/scaffold/71-struct-array lib/tests/scaffold/73-union.c
lib/tests/scaffold/72-typedef-struct-def lib/tests/scaffold/74-multi-line-string.c
lib/tests/scaffold/73-union-hello lib/tests/scaffold/75-struct-union.c
lib/tests/scaffold/73-union lib/tests/scaffold/76-pointer-arithmetic-pp.c
lib/tests/scaffold/74-multi-line-string lib/tests/scaffold/76-pointer-arithmetic.c
lib/tests/scaffold/75-struct-union lib/tests/scaffold/77-pointer-assign.c
lib/tests/scaffold/76-pointer-arithmetic-pp lib/tests/scaffold/78-union-struct.c
lib/tests/scaffold/76-pointer-arithmetic lib/tests/scaffold/79-int-array-simple.c
lib/tests/scaffold/77-pointer-assign lib/tests/scaffold/79-int-array.c
lib/tests/scaffold/78-union-struct lib/tests/scaffold/7a-struct-char-array.c
lib/tests/scaffold/79-int-array-simple lib/tests/scaffold/7b-struct-int-array-hello.c
lib/tests/scaffold/79-int-array lib/tests/scaffold/7b-struct-int-array-pointer.c
lib/tests/scaffold/7a-struct-char-array lib/tests/scaffold/7b-struct-int-array.c
lib/tests/scaffold/7b-struct-int-array-hello lib/tests/scaffold/7c-dynarray.c
lib/tests/scaffold/7b-struct-int-array-pointer lib/tests/scaffold/7d-cast-char.c
lib/tests/scaffold/7b-struct-int-array lib/tests/scaffold/7e-struct-array-access.c
lib/tests/scaffold/7c-dynarray lib/tests/scaffold/7f-struct-pointer-arithmetic.c
lib/tests/scaffold/7d-cast-char lib/tests/scaffold/7g-struct-byte-word-field.c
lib/tests/scaffold/7e-struct-array-access lib/tests/scaffold/7h-struct-assign.c
lib/tests/scaffold/7f-struct-pointer-arithmetic lib/tests/scaffold/7i-struct-struct-simple.c
lib/tests/scaffold/7g-struct-byte-word-field lib/tests/scaffold/7i-struct-struct.c
lib/tests/scaffold/7h-struct-assign lib/tests/scaffold/7k-empty-for.c
lib/tests/scaffold/7i-struct-struct-simple lib/tests/scaffold/7k-for-each-elem-simple.c
lib/tests/scaffold/7i-struct-struct lib/tests/scaffold/7k-for-each-elem.c
lib/tests/scaffold/7k-empty-for lib/tests/scaffold/7l-struct-any-size-array-simple.c
lib/tests/scaffold/7k-for-each-elem-simple lib/tests/scaffold/7l-struct-any-size-array.c
lib/tests/scaffold/7k-for-each-elem lib/tests/scaffold/7m-struct-char-array-assign.c
lib/tests/scaffold/7l-struct-any-size-array-simple lib/tests/scaffold/7n-struct-struct-array.c
lib/tests/scaffold/7l-struct-any-size-array lib/tests/scaffold/7o-struct-pre-post-simple.c
lib/tests/scaffold/7m-struct-char-array-assign lib/tests/scaffold/7o-struct-pre-post.c
lib/tests/scaffold/7n-struct-struct-array lib/tests/scaffold/7p-struct-cast.c
lib/tests/scaffold/7o-struct-pre-post-simple lib/tests/scaffold/7q-bit-field-simple.c
lib/tests/scaffold/7o-struct-pre-post lib/tests/scaffold/7q-bit-field.c
lib/tests/scaffold/7p-struct-cast lib/tests/scaffold/7r-sign-extend.c
lib/tests/scaffold/7q-bit-field-simple lib/tests/scaffold/7s-struct-short.c
lib/tests/scaffold/7q-bit-field lib/tests/scaffold/7s-unsigned-compare.c
lib/tests/scaffold/7r-sign-extend lib/tests/scaffold/7t-function-destruct.c
lib/tests/scaffold/7s-struct-short lib/tests/scaffold/7u-double.c
lib/tests/scaffold/7s-unsigned-compare lib/tests/scaffold/7u-long-long.c
lib/tests/scaffold/7t-function-destruct lib/tests/scaffold/7u-ternary-expression.c
lib/tests/scaffold/7u-double lib/tests/scaffold/7u-call-ternary.c
lib/tests/scaffold/7u-long-long lib/tests/scaffold/7u-inc-byte-word.c
lib/tests/scaffold/7u-ternary-expression lib/tests/scaffold/7u-struct-func.c
lib/tests/scaffold/7u-call-ternary lib/tests/scaffold/7u-struct-size10.c
lib/tests/scaffold/7u-inc-byte-word lib/tests/scaffold/7u-vstack.c
lib/tests/scaffold/7u-struct-func lib/tests/setjmp/80-setjmp.c
lib/tests/scaffold/7u-struct-size10 lib/tests/stdio/80-sscanf.c
lib/tests/scaffold/7u-vstack lib/tests/stdlib/80-qsort.c
lib/tests/setjmp/80-setjmp lib/tests/stdlib/80-qsort-dupes.c
lib/tests/stdio/80-sscanf lib/tests/string/80-strncpy.c
lib/tests/stdlib/80-qsort lib/tests/string/80-strrchr.c
lib/tests/stdlib/80-qsort-dupes lib/tests/scaffold/82-define.c
lib/tests/string/80-strncpy lib/tests/scaffold/83-heterogenoous-init.c
lib/tests/string/80-strrchr lib/tests/scaffold/84-struct-field-list.c
lib/tests/scaffold/82-define lib/tests/scaffold/85-sizeof.c
lib/tests/scaffold/83-heterogenoous-init lib/tests/dirent/90-readdir.c
lib/tests/scaffold/84-struct-field-list lib/tests/io/90-stat.c
lib/tests/scaffold/85-sizeof lib/tests/posix/90-unsetenv.c
lib/tests/dirent/90-readdir lib/tests/signal/90-signal.c
lib/tests/io/90-stat lib/tests/stdio/90-fopen.c
lib/tests/posix/90-unsetenv lib/tests/stdio/90-fopen-append.c
lib/tests/signal/90-signal lib/tests/stdio/90-fread-fwrite.c
lib/tests/stdio/90-fopen lib/tests/stdio/90-fseek.c
lib/tests/stdio/90-fopen-append lib/tests/stdlib/90-strtol.c
lib/tests/stdio/90-fread-fwrite lib/tests/string/90-snprintf.c
lib/tests/stdio/90-fseek lib/tests/string/90-strpbrk.c
lib/tests/stdlib/90-strtol lib/tests/string/90-strspn.c
lib/tests/string/90-snprintf lib/tests/scaffold/90-goto-var.c
lib/tests/string/90-strpbrk lib/tests/scaffold/91-goto-array.c
lib/tests/string/90-strspn lib/tests/scaffold/a0-call-trunc-char.c
lib/tests/scaffold/a0-call-trunc-char lib/tests/scaffold/a0-call-trunc-short.c
lib/tests/scaffold/a0-call-trunc-short lib/tests/scaffold/a0-call-trunc-int.c
lib/tests/scaffold/a0-call-trunc-int lib/tests/scaffold/a0-math-divide-signed-negative.c
lib/tests/scaffold/a0-math-divide-signed-negative lib/tests/scaffold/a1-global-no-align.c
lib/tests/scaffold/a1-global-no-align lib/tests/scaffold/a1-global-no-clobber.c
lib/tests/scaffold/a1-global-no-clobber
" "
broken="$broken XFAIL_TESTS="
lib/tests/scaffold/17-compare-unsigned-char-le lib/tests/scaffold/54-argv.c
lib/tests/scaffold/17-compare-unsigned-short-le lib/tests/stdio/90-sprintf.c
lib/tests/scaffold/66-local-char-array lib/tests/stdio/90-sprintf.c
lib/tests/scaffold/a0-call-trunc-int
lib/tests/scaffold/a0-math-divide-signed-negative
lib/tests/posix/50-getenv
" "
if [ "$mes_arch" = "x86_64-gcc" ]; then if test $compiler = mescc; then
broken="$broken XFAIL_TESTS="$XFAIL_TESTS
lib/tests/scaffold/21-char-array lib/tests/scaffold/17-compare-unsigned-char-le.c
lib/tests/scaffold/41-ternary lib/tests/scaffold/17-compare-unsigned-short-le.c
lib/tests/scaffold/stdio/70-printf-stdarg lib/tests/scaffold/66-local-char-array.c
lib/tests/scaffold/stdio/70-printf-simple lib/tests/scaffold/90-goto-var.c
lib/tests/scaffold/stdio/70-printf lib/tests/scaffold/91-goto-array.c
lib/tests/setjmp/80-setjmp
lib/tests/scaffold/a1-global-no-align
" "
# Debian: debugme itoa is broken
broken="$broken if test $mes_cpu = x86; then
lib/tests/scaffold/47-function-expression XFAIL_TESTS="$XFAIL_TESTS
lib/tests/scaffold/62-array lib/tests/scaffold/60-math.c
lib/tests/scaffold/65-read
lib/tests/scaffold/85-sizeof
lib/tests/mes/90-abtod
lib/tests/mes/90-dtoab
lib/tests/posix/90-execlp
" "
fi fi
set +e if test $mes_cpu = x86_64; then
expect=$(echo $broken | wc -w) XFAIL_TESTS="$XFAIL_TESTS
pass=0 lib/tests/scaffold/a0-call-trunc-int.c
fail=0 "
total=0
for t in $tests; do
b=$(basename "$t")
if [ -z "${b/[012][0-9]-*/}" ]; then
libc=
elif [ -z "${b/[34][0-9]-*/}" ]; then
libc='-l c-mini'
elif [ -z "${b/[78][0-9a-z]-*/}" ]; then
libc='-l c+tcc'
elif [ -z "${b/9[0-9a-z]-*/}" ]; then
libc='-l c+gnu'
else
libc='-l c'
fi fi
sh $test_sh "$t" > "$t".log 2>&1
r=$?
total=$(expr $total + 1)
if [ $r = 0 ]; then
echo $t: [OK]
pass=$(expr $pass + 1)
else
echo $t: [FAIL]
fail=$(expr $fail + 1)
fi fi
done
[ $expect != 0 ] && echo "expect: $expect" if test $mes_cpu = x86; then
[ $fail != 0 ] && echo "failed: $fail" XFAIL_TESTS="$XFAIL_TESTS
[ $fail -lt $expect ] && echo "solved: $(expr $expect - $fail)" "
echo "passed: $pass"
echo "total: $total"
if [ $fail != 0 -a $fail -gt $expect ]; then
echo FAILED: $fail/$total
exit 1
elif [ $fail != 0 ]; then
echo PASS: $pass/$total
else
echo PASS: $total
fi fi
if test $mes_cpu = x86_64; then
XFAIL_TESTS="$XFAIL_TESTS
lib/tests/stdio/70-printf-simple.c
lib/tests/stdio/70-printf-stdarg.c
lib/tests/stdio/70-printf.c
"
fi
if test $compiler = gcc; then
XFAIL_TESTS="$XFAIL_TESTS
"
if test $mes_cpu = x86; then
XFAIL_TESTS="$XFAIL_TESTS
"
fi
if test $mes_cpu = x86_64; then
XFAIL_TESTS="$XFAIL_TESTS
lib/tests/stdio/70-printf-hello.c
lib/tests/string/90-snprintf.c
"
fi
fi
test_ext=.c
log_compiler=${srcdest}build-aux/test-c.sh
. ${srcdest}build-aux/test-suite.sh

View file

@ -1,161 +0,0 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
tests="
00_assignment
01_comment
02_printf
03_struct
04_for
05_array
06_case
07_function
08_while
09_do_while
10_pointer
11_precedence
12_hashdefine
13_integer_literals
14_if
15_recursion
16_nesting
17_enum
18_include
19_pointer_arithmetic
20_pointer_comparison
21_char_array
22_floating_point
23_type_coercion
24_math_library
25_quicksort
26_character_constants
27_sizeof
28_strings
29_array_address
30_hanoi
31_args
32_led
33_ternary_op
34_array_assignment
35_sizeof
36_array_initialisers
37_sprintf
38_multiple_array_index
39_typedef
40_stdio
41_hashif
42_function_pointer
43_void_param
44_scoped_declarations
45_empty_for
47_switch_return
48_nested_break
49_bracket_evaluation
50_logical_second_arg
51_static
52_unnamed_enum
54_goto
55_lshift_type
"
broken="$broken
18_include
22_floating_point
23_type_coercion
24_math_library
26_character_constants
27_sizeof
28_strings
34_array_assignment
39_typedef
40_stdio
42_function_pointer
49_bracket_evaluation
55_lshift_type
"
#22_floating_point ; float
#23_type_coercion ; float
#24_math_library ; float
#27_sizeof ; float
#28_strings ; TODO: strncpy strchr strrchr memset memcpy memcmp
#30_hanoi ; fails with GCC
#34_array_assignment ; fails with GCC
#39_typedef ;unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (typename "MyFunStruct"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "MoreFunThanEver")))))
#40_stdio ; f* functions
#42_function_pointer ; f* functions
#49_bracket_evaluation ; float
LIBC=c+gnu
MES_LIBS="-l c+gnu"
expect=$(echo $broken | wc -w)
ARGS="arg1 arg2 arg3 arg4 arg5"
export ARGS
pass=0
fail=0
total=0
mkdir -p scaffold/tinycc
set +e
for t in $tests; do
if [ ! -f $TINYCC_PREFIX/tests/tests2/"$t.c" ]; then
echo ' [SKIP]'
continue;
fi
cp $TINYCC_PREFIX/tests/tests2/$i* scaffold/tinycc
sh ${srcdest}build-aux/test.sh "scaffold/tinycc/$t" > scaffold/tinycc/"$t".log 2>&1
r=$?
total=$(expr $total + 1)
if [ $r = 0 ]; then
echo $t: [OK]
pass=$(expr $pass + 1)
else
echo $t: [FAIL]
fail=$(expr $fail + 1)
fi
done
[ $expect != 0 ] && echo "expect: $expect"
[ $fail != 0 ] && echo "failed: $fail"
[ $fail -lt $expect ] && echo "solved: $(expr $expect - $fail)"
echo "passed: $pass"
echo "total: $total"
if [ $fail != 0 -a $fail -gt $expect ]; then
echo FAILED: $fail/$total
exit 1
elif [ $fail != 0 ]; then
echo PASS: $pass/$total
else
echo PASS: $total
fi

View file

@ -20,13 +20,71 @@
set -e set -e
. ./config.status . ./config.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
./pre-inst-env bash ${srcdest}build-aux/check-boot.sh if $courageous; then
./pre-inst-env sh ${srcdest}build-aux/check-mes.sh echo "Applying courage"
./pre-inst-env bash ${srcdest}build-aux/check-mescc.sh set +e
if [ -d $TINYCC_PREFIX/tests/tests2 ] ;then
./pre-inst-env sh ${srcdest}build-aux/check-tcc.sh
fi fi
CFLAGS=
if test $mes_libc = mes; then
CFLAGS="
-nostdinc
-nostdlib
-fno-builtin
"
fi
CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ../include
-I ${srcdir}/include
-I ${srcdir}/include/$mes_kernel/$mes_cpu
"
LIBS=
LDFLAGS=
if test $mes_libc = mes; then
LDFLAGS="
-nostdlib
"
LIBS=-lc
fi
export CFLAGS
export CPPFLAGS
export LDFLAGS
#export LIBS
./pre-inst-env sh ${srcdest}build-aux/check-boot.sh
./pre-inst-env sh ${srcdest}build-aux/check-mes.sh
if test $compiler = gcc; then
(
cd gcc-lib
srcdest=$srcdir/../
srcdir=../$srcdir
../pre-inst-env sh ${srcdest}build-aux/check-mescc.sh
)
fi
(
cd mescc-lib
srcdest=$srcdir/../
srcdir=../$srcdir
compiler=mescc
mes_lib=mes
CFLAGS="
-nostdinc
-nostdlib
-fno-builtin
"
LDFLAGS="
-nostdlib
"
LIBS=-lc
AR="${srcdest}pre-inst-env ar"
CC="${srcdest}pre-inst-env mescc"
../pre-inst-env sh ${srcdest}build-aux/check-mescc.sh
)

View file

@ -20,6 +20,7 @@ AR:=@AR@
BASH:=@BASH@ BASH:=@BASH@
BLOOD_ELF:=@BLOOD_ELF@ BLOOD_ELF:=@BLOOD_ELF@
CC:=@CC@ CC:=@CC@
DIFF:=@DIFF@
DOT:=@DOT@ DOT:=@DOT@
GIT:=@GIT@ GIT:=@GIT@
GUILD:=@GUILD@ GUILD:=@GUILD@
@ -37,10 +38,13 @@ MES_FOR_BUILD:=@MES_FOR_BUILD@
MES_SEED:=@MES_SEED@ MES_SEED:=@MES_SEED@
NYACC:=@NYACC@ NYACC:=@NYACC@
PACKAGE:=@PACKAGE@ PACKAGE:=@PACKAGE@
PACKAGE_NAME:=@PACKAGE_NAME@
PACKAGE_BUGREPORT:=@PACKAGE_BUGREPORT@
PERL:=@PERL@ PERL:=@PERL@
TINYCC_PREFIX:=@TINYCC_PREFIX@ TINYCC_PREFIX:=@TINYCC_PREFIX@
VERSION:=@VERSION@ VERSION:=@VERSION@
V:=@V@ V:=@V@
colors:=@colors@
abs_top_builddir:=@abs_top_builddir@ abs_top_builddir:=@abs_top_builddir@
abs_top_srcdir:=@abs_top_srcdir@ abs_top_srcdir:=@abs_top_srcdir@
@ -48,11 +52,13 @@ arch:=@arch@
build:=@build@ build:=@build@
host:=@host@ host:=@host@
mes_arch:=@mes_arch@ compiler:=@compiler@
gcc_p:=@gcc_p@ courageous:=@courageous@
mes_p:=@mes_p@ mes_system:=@mes_system@
mesc_p:=@mesc_p@ mes_cpu:=@mes_cpu@
tcc_p:=@tcc_p@ mes_bits:=@mes_bits@
mes_libc:=@mes_libc@
mes_kernel:=@mes_kernel@
prefix:=@prefix@ prefix:=@prefix@
@ -61,6 +67,7 @@ datadir:=@datadir@
docdir:=@docdir@ docdir:=@docdir@
guile_site_ccache_dir:=@guile_site_ccache_dir@ guile_site_ccache_dir:=@guile_site_ccache_dir@
guile_site_dir:=@guile_site_dir@ guile_site_dir:=@guile_site_dir@
includedir:=@includedir@
infodir:=@infodir@ infodir:=@infodir@
libdir:=@libdir@ libdir:=@libdir@
mandir:=@mandir@ mandir:=@mandir@

View file

@ -1,164 +0,0 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
srcdir=${srcdir-.}
top_builddir=${top_builddir-.}
if [ "$V" = 2 ]; then
echo $0
echo srcdest=${srcdest}
echo top_builddir=${top_builddir}
fi
if [ -n "$mes_p" -a -n "$gcc_p" ]; then
crt1=lib/linux/$mes_arch/crt1.o
fi
MES=${MES-${program_prefix}mes}
libc=${libc-"-l c"}
export libc
if [ ! "$CC" ]; then
CC="./pre-inst-env mescc"
fi
unset CFLAGS
unset CPPFLAGS
unset HEX2FLAGS
unset LDFLAGS
unset M1FLAGS
export AR
export CC
export CFLAGS
export CPPFLAGS
export GUILD
export GUILE
export GUILE_LOAD_COMPILED_PATH
export GUILE_LOAD_PATH
export HEX2
export HEX2FLAGS
export M1
export M1FLAGS
export MES
export MES_CFLAGS
export MES_FOR_BUILD
export MES_SEED
export MESCC
export MES_DEBUG
export MES_ARENA
export TINYCC_PREFIX
export V
export config_status
export abs_top_builddir
export abs_top_srcdir
export arch
export datadir
export moduledir
export prefix
export program_prefix
export srcdest
export srcdir
export top_builddir
export bits
export build
export host
export compiler
export gcc_p
export mes_p
export mesc_p
export tcc_p
export mes_arch
export with_glibc_p
CPPFLAGS=${CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
-D 'MODULEDIR=\"$moduledir\"'
-D 'PREFIX=\"$prefix\"'
-I ${srcdest}.
-I ${srcdest}lib
-I ${srcdest}include
"}
[ "$with_glibc_p" ] && CPPFLAGS="$CPPFLAGS -D SYSTEM_LIBC=1"
LDFLAGS=${LDFLAGS-"
-v
-g
-L lib/linux/$mes_arch
-L lib/linux
-L lib/$mes_arch
-L lib
"}
if [ -f "$MES_SEED/x86-mes/mes.S" ]; then
LDFLAGS="$LDFLAGS
-L $MES_SEED
"
fi
if [ -n "$gcc_p" ]; then
CFLAGS=${CFLAGS-"
-v
--std=gnu99
-O0
-g
"}
fi
if [ "$mes_p" -a "$gcc_p" ]; then
CFLAGS="$CFLAGS
-fno-builtin
-fno-stack-protector
-nostdinc
-nostdlib
-Wno-discarded-qualifiers
-Wno-int-to-pointer-cast
-Wno-pointer-to-int-cast
-Wno-pointer-sign
-Wno-int-conversion
-Wno-incompatible-pointer-types
"
fi
if [ "$arch" = "x86" ]; then
HEX2FLAGS=${HEX2FLAGS-"
--LittleEndian
--architecture x86
--BaseAddress 0x1000000
"}
M1FLAGS=${M1FLAGS-"
--LittleEndian
--architecture x86
"}
bits=32
elif [ "$arch" = "x86_64" ]; then
HEX2FLAGS=${HEX2FLAGS-"
--LittleEndian
--architecture amd64
--BaseAddress 0x1000000
"}
M1FLAGS=${M1FLAGS-"
--LittleEndian
--architecture amd64
"}
bits=64
fi

View file

@ -16,11 +16,12 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
config_status=1 config_sh=1
AR="@AR@" AR=${AR-"@AR@"}
BASH="@BASH@" BASH="@BASH@"
BLOOD_ELF="@BLOOD_ELF@" BLOOD_ELF="@BLOOD_ELF@"
CC="@CC@" CC=${CC-"@CC@"}
DIFF=${DIFF-@DIFF@}
DOT="@DOT@" DOT="@DOT@"
GIT="@GIT@" GIT="@GIT@"
GUILD="@GUILD@" GUILD="@GUILD@"
@ -37,10 +38,13 @@ MES_FOR_BUILD="@MES_FOR_BUILD@"
MES_SEED="@MES_SEED@" MES_SEED="@MES_SEED@"
NYACC="@NYACC@" NYACC="@NYACC@"
PACKAGE="@PACKAGE@" PACKAGE="@PACKAGE@"
PACKAGE_NAME="@PACKAGE_NAME@"
PACKAGE_BUGREPORT="@PACKAGE_BUGREPORT@"
PERL="@PERL@" PERL="@PERL@"
TINYCC_PREFIX="@TINYCC_PREFIX@" TINYCC_PREFIX="@TINYCC_PREFIX@"
VERSION="@VERSION@" VERSION="@VERSION@"
V="@V@" V=${V-"@V@"}
colors=${colors-@colors@}
abs_top_builddir="@abs_top_builddir@" abs_top_builddir="@abs_top_builddir@"
abs_top_srcdir="@abs_top_srcdir@" abs_top_srcdir="@abs_top_srcdir@"
@ -48,26 +52,44 @@ arch="@arch@"
build="@build@" build="@build@"
host="@host@" host="@host@"
mes_arch="@mes_arch@" compiler=${compiler-@compiler@}
gcc_p="@gcc_p@" courageous=${courageous-@courageous@}
mes_p="@mes_p@" mes_system=@mes_system@
mesc_p="@mesc_p@" mes_cpu=@mes_cpu@
tcc_p="@tcc_p@" mes_bits=@mes_bits@
mes_libc=@mes_libc@
mes_kernel=@mes_kernel@
prefix="@prefix@" prefix="@prefix@"
bindir="@bindir@" bindir="@bindir@"
datadir="@datadir@" datadir="@datadir@"
pkgdatadir="@pkgdatadir@"
docdir="@docdir@" docdir="@docdir@"
guile_site_ccache_dir="@guile_site_ccache_dir@" guile_site_ccache_dir="@guile_site_ccache_dir@"
guile_site_dir="@guile_site_dir@" guile_site_dir="@guile_site_dir@"
includedir="@includedir@"
infodir="@infodir@" infodir="@infodir@"
libdir="@libdir@" libdir="@libdir@"
mandir="@mandir@" mandir="@mandir@"
moduledir="@moduledir@" moduledir="@moduledir@"
with_glibc_p="@with_glibc_p@" with_glibc_p="@with_glibc_p@"
program_prefix="@program_prefix@" program_prefix="@program_prefix@"
srcdest="@srcdest@" srcdest=${srcdest-"@srcdest@"}
srcdir="@srcdir@" srcdir=${srcdir-"@srcdir@"}
sysconfdir="@sysconfdir@" sysconfdir="@sysconfdir@"
top_builddir="@top_builddir@" top_builddir="@top_builddir@"
export PACKAGE
export PACKAGE_NAME
export PACKAGE_BUGREPORT
export AR
export CC
export DIFF
export V
export colors
export compiler
export courageous
export srcdest
export srcdir
export GUILE_AUTO_COMPILE

View file

@ -17,6 +17,8 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
export PACKAGE export PACKAGE
export PACKAGE_NAME
export PACKAGE_BUGREPORT
export VERSION export VERSION
export abs_top_builddir export abs_top_builddir
@ -40,6 +42,14 @@ export mandir
export moduledir export moduledir
export sysconfdir export sysconfdir
export compiler
export courageous
export mes_system
export mes_cpu
export mes_bits
export mes_libc
export mes_kernel
ifdef V ifdef V
export V export V
endif endif
@ -48,18 +58,10 @@ ifdef DESTDIR
export DESTDIR export DESTDIR
endif endif
ifdef arch
export arch
endif
ifdef CC ifdef CC
export CC export CC
endif endif
ifdef CC64
export CC64
endif
ifdef BLOOD_ELF ifdef BLOOD_ELF
export BLOOD_ELF export BLOOD_ELF
endif endif
@ -112,10 +114,6 @@ ifdef PERL
export PERL export PERL
endif endif
ifdef TCC
export TCC
endif
ifdef GUILE_LOAD_PATH ifdef GUILE_LOAD_PATH
export GUILE_LOAD_PATH export GUILE_LOAD_PATH
endif endif
@ -139,7 +137,3 @@ endif
ifdef M1FLAGS ifdef M1FLAGS
export M1FLAGS export M1FLAGS
endif endif
ifdef TINYCC_PREFIX
export TINYCC_PREFIX
endif

View file

@ -1,4 +1,4 @@
#! /bin/sh #! @SHELL@
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
@ -20,34 +20,44 @@
set -e set -e
. ./config.status . ./config.sh
mes_prefix=@prefix@/share/mes v=
_v=
if test "$V" = 2; then
set -x
fi
if test "$V" -gt 0; then
v=v
_v=-v
fi
# use bash or lose if pipes fail set -u
if [ -n "$BASHOPTS" ]; then
# Use bash or lose if pipes fail
if test -n "$BASHOPTS"; then
set -o pipefail set -o pipefail
fi fi
mkdir -p ${DESTDIR}@bindir@ DESTDIR=${DESTDIR-}
if [ -f src/x86-mes-mes ]; then mkdir -p ${DESTDIR}${bindir}
cp src/x86-mes-mes ${DESTDIR}@bindir@/mes cp $_v src/mes ${DESTDIR}${bindir}/mes
fi cp $_v scripts/ar ${DESTDIR}${bindir}/ar
cp scripts/mescc.scm ${DESTDIR}@bindir@/mescc.scm cp $_v scripts/mescc.scm ${DESTDIR}${bindir}/mescc.scm
cp scripts/mescc ${DESTDIR}@bindir@/mescc cp $_v scripts/mescc ${DESTDIR}${bindir}/mescc
sed \ sed \
-e "s,^#! /bin/sh,#! @SHELL@," \ -e "s,^#! /bin/sh,#! ${SHELL}," \
scripts/diff.scm > ${DESTDIR}@bindir@/diff.scm scripts/diff.scm > ${DESTDIR}${bindir}/diff.scm
chmod +x ${DESTDIR}@bindir@/diff.scm chmod +x ${DESTDIR}${bindir}/diff.scm
mkdir -p ${DESTDIR}@docdir@ mkdir -p ${DESTDIR}${docdir}
if [ -n "@PERL@" ]\ if test -n "${PERL}"\
&& [ -n "@GIT@" ]\ && test -n "${GIT}"\
&& @PERL@ -v > /dev/null\ && ${PERL} -v > /dev/null\
&& @GIT@ status > /dev/null; then && ${GIT} status > /dev/null; then
@PERL@ ${srcdest}build-aux/gitlog-to-changelog --srcdir=. > ChangeLog ${PERL} ${srcdest}build-aux/gitlog-to-changelog --srcdir=. > ChangeLog+
fi fi
cp\ cp\
@ -58,66 +68,50 @@ cp\
INSTALL\ INSTALL\
NEWS\ NEWS\
README\ README\
${DESTDIR}@docdir@ ${DESTDIR}${docdir}
if [ -f ChangeLog ]; then if test -f ChangeLog+; then
cp ChangeLog ${DESTDIR}@docdir@ cp $_v ChangeLog+ ${DESTDIR}${docdir}/ChangeLog
rm -f ChangeLog+
else else
cp ChangeLog ${DESTDIR}@docdir@ cp $_v ChangeLog ${DESTDIR}${docdir}
fi fi
mkdir -p $DESTDIR$mes_prefix mkdir -p $DESTDIR$libdir
rm -f $(find lib -type f -a -executable) mkdir -p $DESTDIR$pkgdatadir
rm -f $(find lib/tests -type f -a -name '*.1') # rm -f $(find lib -type f -a -executable)
rm -f $(find lib/tests -type f -a -name '*.2') # rm -f $(find scaffold -type f -a -executable)
rm -f $(find lib/tests -type f -a -name '*.o') tar -cf- -C ${srcdir} include lib/$mes_cpu-mes | tar -${v}xf- -C $DESTDIR$prefix
rm -f $(find lib/tests -type f -a -name '*.log') if test -z "$srcdest"; then
rm -f $(find lib/tests -type f -a -name '*.x86-mes*') tar -cf- --exclude='*.go' module | tar -${v}xf- -C $DESTDIR$pkgdatadir
rm -f $(find lib/tests -type f -a -name '*.x86_64-mes*')
rm -f $(find scaffold -type f -a -executable)
rm -f $(find scaffold -type f -a -name '*.1')
rm -f $(find scaffold -type f -a -name '*.2')
rm -f $(find scaffold -type f -a -name '*.o')
rm -f $(find scaffold -type f -a -name '*.S')
rm -f $(find scaffold -type f -a -name '*.log')
rm -f $(find scaffold -type f -a -name '*.x86-mes*')
rm -f $(find scaffold -type f -a -name '*.x86_64-mes*')
if [ -z "$srcdest" ]; then
tar -cf- include lib | tar -xf- -C $DESTDIR$mes_prefix
tar -cf- --exclude='*.go' module | tar -xf- -C $DESTDIR$mes_prefix
tar -cf- scaffold | tar -xf- -C $DESTDIR$mes_prefix
else else
tar -cf- -C ${srcdest} include lib | tar -xf- -C $DESTDIR$mes_prefix tar -cf- -C ${srcdest} module | tar -${v}xf- -C $DESTDIR$pkgdatadir
tar -cf- -C lib | tar -xf- -C $DESTDIR$mes_prefix
tar -cf- -C ${srcdest} module | tar -xf- -C $DESTDIR$mes_prefix
tar -cf- -C ${srcdest} scaffold | tar -xf- -C $DESTDIR$mes_prefix
fi fi
tar -cf- -C ${srcdest}mes module | tar -xf- -C $DESTDIR$mes_prefix tar -cf- -C ${srcdest}mes module | tar -${v}xf- -C $DESTDIR$pkgdatadir
if test -d gcc-lib/$mes_cpu-mes; then
if [ -f src/mes.x86-mes-S ]; then tar -cf- -C gcc-lib/$mes_cpu-mes . | tar -${v}xf- -C $DESTDIR$libdir
cp src/mes.x86-mes-S $DESTDIR$mes_prefix/lib/x86-mes/mes.S
fi fi
if [ -f src/mes.x86_64-mes-S ]; then if test -d mescc-lib/$mes_cpu-mes; then
cp src/mes.x86_64-mes-S $DESTDIR$mes_prefix/lib/x86_64-mes/mes.S tar -cf- -C mescc-lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
fi fi
mkdir -p ${DESTDIR}@guile_site_dir@ mkdir -p ${DESTDIR}${guile_site_dir}
mkdir -p ${DESTDIR}@guile_site_ccache_dir@ mkdir -p ${DESTDIR}${guile_site_ccache_dir}
tar -cf- -C ${srcdest}module --exclude='*.go' . | tar -xf- -C ${DESTDIR}@guile_site_dir@ tar -cf- -C ${srcdest}module --exclude='*.go' . | tar -${v}xf- -C ${DESTDIR}${guile_site_dir}
tar -cf- -C module --exclude='*.scm' . | tar -xf- -C ${DESTDIR}@guile_site_ccache_dir@ tar -cf- -C module --exclude='*.scm' . | tar -${v}xf- -C ${DESTDIR}${guile_site_ccache_dir}
if [ -f doc/mes.info ]; then if test -f doc/mes.info; then
mkdir -p ${DESTDIR}@infodir@ mkdir -p ${DESTDIR}${infodir}
tar -cf- doc/mes.info* doc/images | tar -xf- --strip-components=1 -C ${DESTDIR}@infodir@ tar -cf- doc/mes.info* doc/images | tar -${v}xf- --strip-components=1 -C ${DESTDIR}${infodir}
install-info --info-dir=${DESTDIR}@infodir@ doc/mes.info install-info --info-dir=${DESTDIR}${infodir} doc/mes.info
fi fi
if [ -f doc/mes.1 ]; then if test -f doc/mes.1; then
mkdir -p ${DESTDIR}@mandir@/man1 mkdir -p ${DESTDIR}${mandir}/man1
cp doc/mes.1 ${DESTDIR}@mandir@/man1/ cp $_v doc/mes.1 ${DESTDIR}${mandir}/man1/
fi fi
if [ -f doc/mescc.1 ]; then if test -f doc/mescc.1; then
mkdir -p ${DESTDIR}@mandir@/man1 mkdir -p ${DESTDIR}${mandir}/man1
cp doc/mescc.1 ${DESTDIR}@mandir@/man1/ cp $_v doc/mescc.1 ${DESTDIR}${mandir}/man1/
fi fi

View file

@ -34,7 +34,7 @@ if [ -n "$srcdest" ]; then
fi fi
export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
PATH="$abs_top_builddir/scripts:$abs_top_builddir/src:$abs_top_builddir/build-aux:$PATH" PATH="$abs_top_builddir/scripts:$abs_top_builddir/scripts:$abs_top_builddir/src:$abs_top_builddir/build-aux:$PATH"
export PATH export PATH
MES=${MES-${abs_top_builddir}/src/${program_prefix}mes} MES=${MES-${abs_top_builddir}/src/${program_prefix}mes}

View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -20,30 +20,19 @@
set -e set -e
if [ ! "$config_status" ]; then if [ "$V" = 2 ]; then
. ./config.status set -x
fi fi
. ${srcdest}build-aux/config.sh t=${1-scaffold/boot/00-zero.scm}
. ${srcdest}build-aux/trace.sh b=$(basename "$t" .scm)
. ${srcdest}build-aux/cc.sh
t=${1-scaffold/tests/t} if [ "$(basename $MES)" = guile ]; then
o="$t" $MES -L ${srcdest}module -C module -L . -c '(begin (use-modules (mes guile)) (include-from-path "'"$t"'"))'
elif [ -z "${b/5[0-9]-*/}" ]; then
rm -f "${program_prefix}$o" cat "$t" | MES_BOOT=boot-00.scm $MES
compile "$t" elif [ -z "${b/6[0-9]-*/}" ]; then
link "$t" cat "$t" | MES_BOOT=boot-01.scm $MES
else
r=0 MES_BOOT=$t $MES;
[ -f "$t".exit ] && r=$(cat "$t".exit)
set +e
$(dirname "$o")/${program_prefix}$(basename "$o") $ARGS > "$o".${program_prefix}1 2> "$o".${program_prefix}2
m=$?
cat "$o".${program_prefix}1
set -e
[ $m = $r ]
if [ -f "$t".stdout ]; then
$DIFF -ub "$t".stdout "$o".${program_prefix}1
fi fi

77
build-aux/test-c.sh Executable file
View file

@ -0,0 +1,77 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
if [ "$V" = 2 ]; then
set -x
fi
t=${1-lib/tests/scaffold/t.c}
b=$(dirname "$t")/$(basename "$t" .c)
o="$b"
o=lib/tests/${b#*lib/tests/}
if [ "$o" = "$b" ]; then
o=$(basename "$t" .c)
fi
rm -f "$o"
CC=${CC-gcc}
i=$(basename "$t" .c)
if [ -z "${i/[012][0-9]-*/}" ]; then
LIBS=
elif [ -z "${i/[34][0-9]-*/}" ]; then
LIBS='-l c-mini'
elif [ -z "${i/[78][0-9a-z]-*/}" ]; then
LIBS='-l c+tcc'
elif [ -z "${i/9[0-9a-z]-*/}" ]; then
LIBS='-l c+gnu'
else
LIBS='-l c'
fi
if test $mes_libc = system; then
crt1=
LIBS=-lmes
else
crt1=crt1.o
fi
$CC -c $CPPFLAGS $CFLAGS -o "$o".o "$t"
$CC $CFLAGS $LDFLAGS -L . -o "$o" $crt1 "$o".o $LIBS
set +e
#timeout 2 "$o" -s --long file0 file1 > "$o".1 2> "$o".2
timeout 2 "$o" > "$o".1 2> "$o".2
r=$?
set -e
if [ -f "$b".exit ]; then
e=$(cat "$b".exit)
else
e=0
fi
[ $r = $e ] || exit 1
if [ -f "$b".stdout ]; then
$DIFF -ub "$b".stdout "$o".1
fi
if [ -f "$b".stderr ]; then
$DIFF -ub "$b".stderr "$o".2
fi

148
build-aux/test-driver Executable file
View file

@ -0,0 +1,148 @@
#!/bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 2011-2018 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
END
}
test_name= # Used for reporting.
log_file= # Where to save the output of the test script.
trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
case $1 in
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) log_file=$2; shift;;
--trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
--) shift; break;;
-*) usage_error "invalid option: '$1'";;
*) break;;
esac
shift
done
missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
if test $# -eq 0; then
usage_error "missing argument"
fi
if test $color_tests = yes; then
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
red='' # Red.
grn='' # Green.
lgn='' # Light green.
blu='' # Blue.
mgn='' # Magenta.
std='' # No color.
else
red= grn= lgn= blu= mgn= std=
fi
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
"$@" >$log_file 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
tweaked_estatus=1
else
tweaked_estatus=$estatus
fi
case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

137
build-aux/test-suite.sh Normal file
View file

@ -0,0 +1,137 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2011-2018 Free Software Foundation, Inc.
# Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
# Adapted from GNU Automake
TEST_SUITE_LOG=test-suite.log
dry_run=false
create_global_log=cat
subdir=$(basename $(pwd))
TEST_LOGS=
for t in $TESTS; do
b=$(dirname $t)/$(basename $t $test_ext)
d=$(dirname $t)
case " `echo $XFAIL_TESTS` " in
*[\ \ ]$t[\ \ ]*)
fail=yes;;
*)
fail=no;;
esac
mkdir -p $d
sh ${srcdest}build-aux/test-driver\
--test-name $t \
--log-file $b.log\
--trs-file $b.trs\
--color-tests $colors\
--enable-hard-errors no\
--expect-failure $fail\
-- $log_compiler\
${srcdest}$t
TEST_LOGS="$TEST_LOGS $b.log"
done
if test $colors = yes; then
red=''
grn=''
lgn=''
blu=''
mgn=''
brg=''
std=''
else
mgn= red= grn= lgn= blu= brg= std=
fi
bases="$TEST_LOGS"
bases=`for i in $bases; do echo $i; done | sed 's/\.log$//'`
bases=`echo $bases`
ws='[ ]'
results=`for b in $bases; do echo $b.trs; done`
test -n "$results" || results=/dev/null
all=` grep "^$ws*:test-result:" $results | wc -l`
pass=` grep "^$ws*:test-result:$ws*PASS" $results | wc -l`
fail=` grep "^$ws*:test-result:$ws*FAIL" $results | wc -l`
skip=` grep "^$ws*:test-result:$ws*SKIP" $results | wc -l`
xfail=`grep "^$ws*:test-result:$ws*XFAIL" $results | wc -l`
xpass=`grep "^$ws*:test-result:$ws*XPASS" $results | wc -l`
error=`grep "^$ws*:test-result:$ws*ERROR" $results | wc -l`
if test `expr $fail + $xpass + $error` -eq 0; then
success=true
else
success=false
fi
br='==================='; br=$br$br$br$br
result_count ()
{
if test x"$1" = x"--maybe-color"; then
maybe_colorize=yes
elif test x"$1" = x"--no-color"; then
maybe_colorize=no
else
echo "$@: invalid 'result_count' usage" >&2; exit 4
fi
shift
desc=$1 count=$2
if test $maybe_colorize = yes && test $count -gt 0; then
color_start=$3 color_end=$std
else
color_start= color_end=
fi
echo "${color_start}# $desc $count${color_end}"
}
create_testsuite_report ()
{
result_count $1 "TOTAL:" $all "$brg"
result_count $1 "PASS: " $pass "$grn"
result_count $1 "SKIP: " $skip "$blu"
result_count $1 "XFAIL:" $xfail "$lgn"
result_count $1 "FAIL: " $fail "$red"
result_count $1 "XPASS:" $xpass "$red"
result_count $1 "ERROR:" $error "$mgn"
}
{
echo "${PACKAGE}: ${subdir}/${TEST_SUITE_LOG}"
create_testsuite_report --no-color
echo
echo
for b in $bases; do echo $b; done\
| $create_global_log
} >${TEST_SUITE_LOG}.tmp || exit 1
mv ${TEST_SUITE_LOG}.tmp ${TEST_SUITE_LOG}
if $success; then
col="$grn"
else
col="$red"
test x"$V" = x0 || cat ${TEST_SUITE_LOG}
fi
echo "${col}$br${std}"
echo "${col}Testsuite summary for ${PACKAGE_NAME}${std}"
echo "${col}$br${std}"
create_testsuite_report --maybe-color
echo "$col$br$std"
if $success; then :; else
echo "${col}See ${subdir}/${TEST_SUITE_LOG}${std}"
if test -n "${PACKAGE_BUGREPORT}"; then
echo "${col}Please report to ${PACKAGE_BUGREPORT}${std}"
fi
echo "$col$br$std"
fi
$success || exit 1

View file

@ -16,26 +16,34 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
LOG=
if [ -z "$V" -o "$V" = 0 ]; then if [ -z "$V" -o "$V" = 0 ]; then
trace () { trace () {
echo " $1" echo " $1"
shift shift
eval "$@" $LOG echo "$@" >> build.log
eval "$@ $LOG"
cat .log 1>&2
cat .log >> build.log
} }
LOG=" >>build.log 2>&1" LOG=" >.log 2>&1"
fi fi
if [ "$V" = 1 ]; then if [ "$V" = 1 ]; then
trace () { trace () {
shift shift
echo "$@" echo "$@"
echo "$@" >> build.log
eval "$@ $LOG" eval "$@ $LOG"
cat .log 1>&2
cat .log >> build.log
} }
LOG=" >>build.log 2>&1" LOG=" >.log 2>&1"
fi fi
if [ "$V" = 2 ]; then if [ "$V" = 2 ]; then
set -x set -x
trace () { trace () {
shift shift
echo "$@" >> build.log
eval "$@" eval "$@"
} }
fi fi

View file

@ -20,31 +20,45 @@
#set -e #set -e
. ./config.status . ./config.sh
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
GUILE=${GUILE-$(command -v guile)} || true v=
if [ -z "$GUILE" -o "$GUILE" = true ]; then _v=
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2} if test "$V" = 2; then
else set -x
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')} fi
if test "$V" -gt 0; then
v=v
_v=-v
fi fi
datadir=${datadir-$prefix/share} set -u
docdir=${docdir-$datadir/doc/mes-$VERSION}
infodir=${infodir-$datadir/info}
mandir=${mandir-$datadir/man}
moduledir=${moduledir-$datadir/mes/module}
guile_site_dir=${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION}
guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
MES_PREFIX=${MES_PREFIX-$prefix/share/mes} rm ${DESTDIR}${bindir}/mes
rm ${DESTDIR}${bindir}/ar
rm ${DESTDIR}${bindir}/mescc
rm ${DESTDIR}${bindir}/mescc.scm
rm ${DESTDIR}${bindir}/diff.scm
rmdir ${DESTDIR}${bindir} || :
rm $DESTDIR$prefix/bin/mes rm -r ${DESTDIR}${libdir}/$mes_cpu-mes
rm $DESTDIR$prefix/bin/mescc rm ${DESTDIR}${libdir}/libc-mini.a
rm -f $DESTDIR$prefix/bin/diff.scm rm ${DESTDIR}${libdir}/libmes.a
rmdir $DESTDIR$prefix/bin || : if cmp gcc-lib/libc.a ${DESTDIR}${libdir}/libc.a; then
rm ${DESTDIR}${libdir}/libc.a
fi
if cmp gcc-lib/libtcc1.a ${DESTDIR}${libdir}/libtcc1.a; then
rm ${DESTDIR}${libdir}/libtcc1.a
fi
rm ${DESTDIR}${libdir}/libc+tcc.a
rm ${DESTDIR}${libdir}/libc+gnu.a
rm -r ${DESTDIR}${includedir}/mes
rm $(grep -lr _MES_ ${DESTDIR}${includedir})
rmdir ${DESTDIR}${includedir}/linux/x86
rmdir ${DESTDIR}${includedir}/linux/x86_64
rmdir ${DESTDIR}${includedir}/linux
rmdir -p ${DESTDIR}${includedir}/sys
for i in\ for i in\
AUTHORS\ AUTHORS\
@ -56,28 +70,27 @@ for i in\
NEWS\ NEWS\
README\ README\
;do ;do
rm $DESTDIR$docdir/$i || :; rm ${DESTDIR}${docdir}/$i || :;
done done
rmdir $DESTDIR$docdir || : rm -r ${DESTDIR}${pkgdatadir}
rm -r ${DESTDIR}${guile_site_ccache_dir}/mes
rm -r ${DESTDIR}${guile_site_ccache_dir}/mescc
rm -r $DESTDIR$MES_PREFIX rm -r ${DESTDIR}${guile_site_dir}/mes
rm -r $DESTDIR$guile_site_ccache_dir/mes rm ${DESTDIR}${guile_site_dir}/mescc.scm
rm -r $DESTDIR$guile_site_ccache_dir/mescc rm -r ${DESTDIR}${guile_site_dir}/mescc
rm -r $DESTDIR$guile_site_dir/mes rm ${DESTDIR}${infodir}/dir
rm -r $DESTDIR$guile_site_dir/mescc rm ${DESTDIR}${infodir}/mes.info*
rm ${DESTDIR}${infodir}/images/gcc-mesboot*
rm ${DESTDIR}${infodir}/images/README
rm ${DESTDIR}${mandir}/man1/mes.1
rm ${DESTDIR}${mandir}/man1/mescc.1
rm $DESTDIR$prefix/share/info/dir rmdir -p ${DESTDIR}${docdir}
rm $DESTDIR$prefix/share/info/mes.info* rmdir -p ${DESTDIR}${infodir}/images
rm $DESTDIR$prefix/share/info/images/gcc-mesboot* rmdir -p ${DESTDIR}${guile_site_dir}
rm $DESTDIR$prefix/share/info/images/README rmdir -p ${DESTDIR}${guile_site_ccache_dir}
rm $DESTDIR$mandir/man1/mes.1 rmdir -p ${DESTDIR}${mandir}/man1
rm $DESTDIR$mandir/man1/mescc.1
rmdir -p $DESTDIR$prefix/share/doc
rmdir -p $DESTDIR$prefix/share/info/images
rmdir -p $DESTDIR$guile_site_dir
rmdir -p $DESTDIR$guile_site_ccache_dir
rmdir -p $DESTDIR$mandir/man1
true true

132
configure vendored
View file

@ -32,6 +32,12 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
#:use-module (ice-9 rdelim) #:use-module (ice-9 rdelim)
#:export (main)) #:export (main))
(define *shell* "sh")
(define PACKAGE "mes")
(define PACKAGE-NAME "GNU Mes")
(define PACKAGE-BUGREPORT "bug-mes@gnu.org")
(define VERSION "0.19")
(cond-expand (cond-expand
(guile) (guile)
(mes (mes-use-module (srfi srfi-1)) (mes (mes-use-module (srfi srfi-1))
@ -63,10 +69,6 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
(and (and warn? (format (current-error-port) "warning: not found: ~a\n" name)) (and (and warn? (format (current-error-port) "warning: not found: ~a\n" name))
default))) default)))
(define *shell* "sh")
(define PACKAGE "mes")
(define VERSION "0.19")
;;; Utility ;;; Utility
(define (logf port string . rest) (define (logf port string . rest)
(apply format (cons* port string rest)) (apply format (cons* port string rest))
@ -279,6 +281,7 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
(bindir (value #t)) (bindir (value #t))
(datadir (value #t)) (datadir (value #t))
(docdir (value #t)) (docdir (value #t))
(includedir (value #t))
(libdir (value #t)) (libdir (value #t))
(srcdir (value #t)) (srcdir (value #t))
(sysconfdir (value #t)) (sysconfdir (value #t))
@ -290,14 +293,15 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
(with-courage) (with-courage)
(infodir (value #t)) (infodir (value #t))
(mandir (value #t)) (mandir (value #t))
(disable-colors)
(enable-colors)
(disable-silent-rules) (disable-silent-rules)
(enable-silent-rules) (enable-silent-rules)
(with-system-libc)
(enable-fast-install) ; Ignored for Guix (enable-fast-install) ; Ignored for Guix
(includedir (value #t)) ; Ignored for Debian
(mandir (value #t)) ; Ignored for Debian (mandir (value #t)) ; Ignored for Debian
(localstatedir (value #t)) ; Ignored for Debian (localstatedir (value #t)) ; Ignored for Debian
(libdir (value #t)) ; Ignored for Debian
(libexecdir (value #t)) ; Ignored for Debian (libexecdir (value #t)) ; Ignored for Debian
(runstatedir (value #t)) ; Ignored for Debian (runstatedir (value #t)) ; Ignored for Debian
(disable-maintainer-mode) ; Ignored for Debian (disable-maintainer-mode) ; Ignored for Debian
@ -320,17 +324,24 @@ Defaults for the options are specified in brackets.
Options: Options:
-h, --help display this help -h, --help display this help
--build=BUILD configure for building on BUILD [guessed] --build=BUILD configure for building on BUILD [guessed]
--colors no colorized output
--disable-silent-rules --disable-silent-rules
verbose build output [V=1] verbose build output [V=1]
--host=HOST cross-compile to build programs to run on HOST [BUILD] --host=HOST cross-compile to build programs to run on HOST [BUILD]
--mes use Mes C Library
-v, --verbose be verbose -v, --verbose be verbose
--with-courage assert being courageous to configure for unsupported platform --with-courage Assert that even if this platform is unsupported,
you will be courageous and port GNU Mes to it
(see \"Porting GNU Mes\" in the manual.)
--with-cheating cheat using Guile instead of Mes --with-cheating cheat using Guile instead of Mes
--with-system-libc use system libc
Installation directories: Installation directories:
--prefix=DIR install in prefix DIR [~a] --prefix=DIR install in prefix DIR [~a]
--bindir=DIR user executables [PREFIX/bin]
--includedir=DIR C header files [PREFIX/include]
--infodir=DIR info documentation [PREFIX/share/info] --infodir=DIR info documentation [PREFIX/share/info]
--libdir=DIR object code libraries [EPREFIX/lib]
--mandir=DIR man pages [PREFIX/share/man] --mandir=DIR man pages [PREFIX/share/man]
Program names: Program names:
@ -343,8 +354,6 @@ Ignored for Guix:
Ignored for Debian: Ignored for Debian:
--disable-dependency-tracking --disable-dependency-tracking
--disable-maintainer-mode --disable-maintainer-mode
--includedir=DIR
--libdir=DIR
--libexecdir=DIR --libexecdir=DIR
--localstatedir=DIR --localstatedir=DIR
--runstatedir=DIR --runstatedir=DIR
@ -356,7 +365,6 @@ Some influential environment variables:
GUILD guild command GUILD guild command
MES_FOR_BUILD build system MES [can be mes or guile] MES_FOR_BUILD build system MES [can be mes or guile]
MES_SEED location of mes-seed MES_SEED location of mes-seed
TINYCC_PREFIX location of tinycc [for tests/test2]
" PACKAGE VERSION (getenv "prefix"))) " PACKAGE VERSION (getenv "prefix")))
(define (main args) (define (main args)
@ -376,11 +384,9 @@ Some influential environment variables:
(bindir (option-ref options 'bindir "${prefix}/bin")) (bindir (option-ref options 'bindir "${prefix}/bin"))
(datadir (option-ref options 'datadir "${prefix}/share")) (datadir (option-ref options 'datadir "${prefix}/share"))
(docdir (option-ref options 'docdir "${datadir}/doc/mes-${VERSION}")) (docdir (option-ref options 'docdir "${datadir}/doc/mes-${VERSION}"))
(includedir (option-ref options 'libdir "${prefix}/include"))
(libdir (option-ref options 'libdir "${prefix}/lib")) (libdir (option-ref options 'libdir "${prefix}/lib"))
(moduledir "${datadir}/mes/module") (pkgdatadir (string-append datadir "/mes"))
(moduledir/ (string-append
(gulp-pipe* "echo" prefix)
"/share/mes/module/"))
(guile-effective-version (effective-version)) (guile-effective-version (effective-version))
(guile-site-dir (if (equal? prefix ".") (canonicalize-path ".") (guile-site-dir (if (equal? prefix ".") (canonicalize-path ".")
(string-append prefix "/share/guile/site/" guile-effective-version))) (string-append prefix "/share/guile/site/" guile-effective-version)))
@ -397,8 +403,11 @@ Some influential environment variables:
(with-cheating? (option-ref options 'with-cheating #f)) (with-cheating? (option-ref options 'with-cheating #f))
(with-courage? (option-ref options 'with-courage #f)) (with-courage? (option-ref options 'with-courage #f))
(disable-colors? (option-ref options 'disable-colors #f))
(enable-colors? (option-ref options 'enable-colors #f))
(disable-silent-rules? (option-ref options 'disable-silent-rules #f)) (disable-silent-rules? (option-ref options 'disable-silent-rules #f))
(enable-silent-rules? (option-ref options 'enable-silent-rules #f)) (enable-silent-rules? (option-ref options 'enable-silent-rules #f))
(with-system-libc? (option-ref options 'with-system-libc #f))
(vars (filter (cut string-index <> #\=) (option-ref options '() '()))) (vars (filter (cut string-index <> #\=) (option-ref options '() '())))
(help? (option-ref options 'help #f)) (help? (option-ref options 'help #f))
(mes? (option-ref options 'mes #f))) (mes? (option-ref options 'mes #f)))
@ -425,6 +434,7 @@ Some influential environment variables:
(list (make-dep "hex2" #:version '(0 3)) (list (make-dep "hex2" #:version '(0 3))
(make-dep "M1" #:version '(0 3)) (make-dep "M1" #:version '(0 3))
(make-dep "blood-elf" #:version '(0 1)) (make-dep "blood-elf" #:version '(0 1))
(make-dep "diff" #:optional? #t)
(make-dep "guile" #:version '(2 0) #:commands '("guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t) (make-dep "guile" #:version '(2 0) #:commands '("guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t)
(make-dep "mes" #:version '(0 18) #:optional? #t) (make-dep "mes" #:version '(0 18) #:optional? #t)
(make-dep "guix" #:version '(0 13) #:optional? #t) (make-dep "guix" #:version '(0 13) #:optional? #t)
@ -483,16 +493,23 @@ Some influential environment variables:
(cons (check-link-c cc (make-dep "if cc can create executables" #:data "int main () {return 0;}")) (cons (check-link-c cc (make-dep "if cc can create executables" #:data "int main () {return 0;}"))
deps) deps)
deps)) deps))
(mes? (or mes? (not (file-name "if cc can create executables" deps)))) (system-libc? (and with-system-libc? (file-name "if cc can create executables" deps)))
(build-type (or (and cc (gulp-pipe* cc "-dumpmachine")) build-type)) (build-type (or (and cc (gulp-pipe* cc "-dumpmachine")) build-type))
(arch (car (string-split build-type #\-))) (build-type-list (string-split build-type #\-))
(arch (if (member arch '("i386" "i486" "i586" "i686")) "x86" (mes-cpu (car build-type-list))
arch)) (mes-cpu (if (member mes-cpu '("i386" "i486" "i586" "i686")) "x86"
(mes-arch arch) mes-cpu))
(mes-arch (if mes? (string-append mes-arch "-mes") mes-arch)) (mes-bits (if (member mes-cpu '("x86_64")) "64"
(mes-arch (if gcc? (string-append mes-arch "-gcc") mes-arch)) "32"))
(mes-arch (if tcc? (string-append mes-arch "-gcc") mes-arch)) (mes-libc (if system-libc? "system" "mes"))
(posix? (and (not mesc?) (not mes?))))
(kernel-list (filter (compose not (cut equal? <> "unknown")) (cdr build-type-list)))
(mes-kernel (cond ((or (equal? '("linux" "gnu") kernel-list)
(equal? "linux" (car kernel-list))) "linux")
((equal? '( "gnu") kernel-list) "gnu")
(else "unknown")))
(compiler (if gcc? "gcc" "mescc"))
(mes-system (string-join (list mes-cpu mes-kernel "mes") "-")))
(define* (substitute file-name pairs (define* (substitute file-name pairs
#:key (target (if (string-suffix? ".in" file-name) #:key (target (if (string-suffix? ".in" file-name)
@ -508,8 +525,8 @@ Some influential environment variables:
line pairs)) line pairs))
(loop (read-line in 'concat)))))))) (loop (read-line in 'concat))))))))
(when (and (not (member arch '("x86" "x86_64"))) (not with-courage?)) (when (and (not (member mes-system '("x86-linux-mes" "x86_64-linux-mes"))) (not with-courage?))
(stderr "platform not supported: ~a, try --with-courage\n" arch) (stderr "platform not supported: ~a, try --with-courage\n" mes-system)
(exit 1)) (exit 1))
(when (pair? missing) (when (pair? missing)
(stderr "\nMissing dependencies: ~a\n" (string-join (map dependency-name missing))) (stderr "\nMissing dependencies: ~a\n" (string-join (map dependency-name missing)))
@ -523,18 +540,20 @@ Some influential environment variables:
(zero? (system* "git" "commit" "--allow-empty" "-m" "Import mes"))))) (zero? (system* "git" "commit" "--allow-empty" "-m" "Import mes")))))
(let ((pairs `(("@PACKAGE@" . ,PACKAGE) (let ((pairs `(("@PACKAGE@" . ,PACKAGE)
("@PACKAGE_NAME@" . ,PACKAGE-NAME)
("@PACKAGE_BUGREPORT@" . ,PACKAGE-BUGREPORT)
("@VERSION@" . ,VERSION) ("@VERSION@" . ,VERSION)
("@arch@" . ,arch)
("@build@" . ,build-type) ("@build@" . ,build-type)
("@host@" . ,host-type) ("@host@" . ,host-type)
("@gcc_p@" . ,(if gcc? "1" "")) ("@courageous@" . ,(if with-courage? "true" "false"))
("@mes_arch@" . ,mes-arch) ("@compiler@" . ,compiler)
("@mes_p@" . ,(if mes? "1" "")) ("@mes_bits@" . ,mes-bits)
("@mesc_p@" . ,(if mesc? "1" "")) ("@mes_kernel@" . ,mes-kernel)
("@with_glibc_p@" . ,(if posix? "1" "")) ("@mes_cpu@" . ,mes-cpu)
("@tcc_p@" . ,(if tcc? "1" "")) ("@mes_libc@" . ,mes-libc)
("@mes_system@" . ,mes-system)
("@abs_top_srcdir@" . ,abs-top-srcdir) ("@abs_top_srcdir@" . ,abs-top-srcdir)
("@abs_top_builddir@" . ,abs-top-builddir) ("@abs_top_builddir@" . ,abs-top-builddir)
@ -547,21 +566,24 @@ Some influential environment variables:
("@program_prefix@" . ,program-prefix) ("@program_prefix@" . ,program-prefix)
("@bindir@" . ,bindir) ("@bindir@" . ,bindir)
("@datadir@" . ,datadir) ("@datadir@" . ,datadir)
("@pkgdatadir@" . ,pkgdatadir)
("@docdir@" . ,docdir) ("@docdir@" . ,docdir)
("@guile_site_ccache_dir@" . ,guile-site-ccache-dir) ("@guile_site_ccache_dir@" . ,guile-site-ccache-dir)
("@guile_site_dir@" . ,guile-site-dir) ("@guile_site_dir@" . ,guile-site-dir)
("@infodir@" . ,infodir) ("@infodir@" . ,infodir)
("@includedir@" . ,includedir)
("@libdir@" . ,libdir) ("@libdir@" . ,libdir)
("@mandir@" . ,mandir) ("@mandir@" . ,mandir)
("@moduledir@" . ,moduledir)
("@sysconfdir@" . ,sysconfdir) ("@sysconfdir@" . ,sysconfdir)
("@GUILE_EFFECTIVE_VERSION@" . ,(effective-version)) ("@GUILE_EFFECTIVE_VERSION@" . ,(effective-version))
("@colors@" . ,(if disable-colors? "no" "yes"))
("@V@" . ,(if disable-silent-rules? "1" "0")) ("@V@" . ,(if disable-silent-rules? "1" "0"))
("@AR@" . ,(or (file-name "ar" deps) "")) ("@AR@" . ,(or (file-name "ar" deps) ""))
("@BASH@" . ,(or (file-name "bash" deps) "")) ("@BASH@" . ,(or (file-name "bash" deps) ""))
("@CC@" . ,(or (file-name "cc" deps) "")) ("@CC@" . ,(or (file-name "cc" deps) ""))
("@DIFF@" . ,(or (file-name "diff" deps) (string-append abs-top-builddir "/pre-inst-env diff.scm")))
("@DOT@" . ,(or (file-name "dot" deps) "")) ("@DOT@" . ,(or (file-name "dot" deps) ""))
("@GIT@" . ,(or (file-name "git" deps) "")) ("@GIT@" . ,(or (file-name "git" deps) ""))
("@GUILE@" . ,guile) ("@GUILE@" . ,guile)
@ -578,7 +600,6 @@ Some influential environment variables:
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") "")) ("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") "")) ("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
("mes/module/" . ,(string-append moduledir/))
,@(map ,@(map
(lambda (o) (lambda (o)
(cons (string-append "@" (variable-name o) "@") (or (format #f "~a" (dependency-file-name o)) ""))) (cons (string-append "@" (variable-name o) "@") (or (format #f "~a" (dependency-file-name o)) "")))
@ -596,35 +617,52 @@ Some influential environment variables:
(substitute src pairs #:target target))) (substitute src pairs #:target target)))
'( '(
"build-aux/GNUmakefile.in" "build-aux/GNUmakefile.in"
"build-aux/config.status.in" "build-aux/config.sh.in"
"build-aux/build.sh.in" "build-aux/build.sh.in"
"build-aux/bootstrap.sh.in"
"build-aux/check.sh.in" "build-aux/check.sh.in"
"build-aux/install.sh.in" "build-aux/install.sh.in"
"build-aux/pre-inst-env.in" "build-aux/pre-inst-env.in"
"build-aux/uninstall.sh.in" "build-aux/uninstall.sh.in"
"mes/module/mes/boot-0.scm.in" "scripts/ar.in"
"scripts/mescc.scm.in" "scripts/mescc.scm.in"
"scripts/mescc.in" "scripts/mescc.in"
)) ))
(chmod "pre-inst-env" #o755) (chmod "pre-inst-env" #o755)
(chmod "scripts/ar" #o755)
(chmod "scripts/mescc" #o755) (chmod "scripts/mescc" #o755)
(chmod "scripts/mescc.scm" #o755) (chmod "scripts/mescc.scm" #o755)
(chmod "build.sh" #o755) (chmod "build.sh" #o755)
(chmod "bootstrap.sh" #o755)
(chmod "check.sh" #o755) (chmod "check.sh" #o755)
(chmod "install.sh" #o755) (chmod "install.sh" #o755)
(chmod "uninstall.sh" #o755) (chmod "uninstall.sh" #o755)
(system* "mkdir" "-p" "include/mes")
(let ((pkgdatadir (gulp-pipe* "sh" "-c" (string-append "prefix=" prefix
";datadir=" datadir
";echo ${datadir}/mes"))))
(with-output-to-file "include/mes/config.h"
(lambda _
(if system-libc?
(display "#define SYSTEM_LIBC 1
")
(display "#undef SYSTEM_LIBC
"))
(display (string-append "
#define VERSION \"" VERSION "\"
#define pkgdatadir \"" pkgdatadir "\"
")))))
(substitute (string-append srcdest "build-aux/config.make.in") pairs #:target ".config.make")) (substitute (string-append srcdest "build-aux/config.make.in") pairs #:target ".config.make"))
(let ((make (and=> (file-name "make" deps) basename))) (let ((make (and=> (file-name "make" deps) basename)))
(format (current-output-port) (display (string-append "
" GNU Mes is configured for
GNU Mes is configured for ~a compiler: " compiler "
cpu: " mes-cpu "
bits: " mes-bits "
libc: " mes-libc "
kernel: " mes-kernel "
system: " mes-system "
Run: Run:
~a to build mes " (or make "./build.sh") " to build mes
~a help for help on other targets\n" " (or make "./build.sh") " help for help on other targets\n"))))))
mes-arch
(or make "./build.sh")
(or make "./build.sh"))))))

View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -24,16 +24,27 @@ VERSION=0.19
srcdir=${srcdir-$(dirname $0)} srcdir=${srcdir-$(dirname $0)}
. ${srcdest}build-aux/trace.sh . ${srcdest}build-aux/trace.sh
# parse --mes # parse --with-system-libc
cmdline=$(echo " $@") cmdline=$(echo " $@")
p=${cmdline/ --mes/} p=${cmdline/ --with-system-libc/}
if [ "$p" != "$cmdline" ]; then if test "$p" != "$cmdline"; then
mes_p=${mes_p-1} mes_libc=${mes_libc-system}
else
mes_libc=mes
fi
# parse --with-courage
cmdline=$(echo " $@")
p=${cmdline/ --with-courage/}
if test "$p" != "$cmdline"; then
courageous=true
else
courageous=false
fi fi
# parse --prefix=PREFIX # parse --prefix=PREFIX
p=${cmdline/ --prefix=/ -prefix=} p=${cmdline/ --prefix=/ -prefix=}
if [ "$p" != "$cmdline" ]; then if test "$p" != "$cmdline"; then
p=${p##* -prefix=} p=${p##* -prefix=}
p=${p% *} p=${p% *}
p=${p% -*} p=${p% -*}
@ -45,7 +56,7 @@ fi
# parse --program-prefix= # parse --program-prefix=
p=${cmdline/ --program-prefix=/ -program-prefix=} p=${cmdline/ --program-prefix=/ -program-prefix=}
if [ "$p" != "$cmdline" ]; then if test "$p" != "$cmdline"; then
p=${p##* -program-prefix=} p=${p##* -program-prefix=}
p=${p% *} p=${p% *}
p=${p% -*} p=${p% -*}
@ -56,10 +67,11 @@ AR=${AR-$(command -v ar)} || true
BASH=${BASH-$(command -v bash)} BASH=${BASH-$(command -v bash)}
BLOOD_ELF=${BLOOD_ELF-$(command -v blood-elf)} BLOOD_ELF=${BLOOD_ELF-$(command -v blood-elf)}
CC=${CC-$(command -v gcc)} || true CC=${CC-$(command -v gcc)} || true
DIFF=${DIFF-$(command -v diff || echo $PWD/pre-inst-env diff.scm)}
GUILD=${GUILD-$(command -v guild)} || true GUILD=${GUILD-$(command -v guild)} || true
GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)} || true GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)} || true
if [ ! "$GUILD" ]; then if test ! "$GUILD"; then
if [ "$GUILE_TOOLS" ]; then if test "$GUILE_TOOLS"; then
GUILD=$GUILE_TOOLS GUILD=$GUILE_TOOLS
else else
GUILD=true GUILD=true
@ -73,7 +85,7 @@ GIT=${GIT-$(command -v git)} || true
PERL=${PERL-$(command -v perl)} || true PERL=${PERL-$(command -v perl)} || true
MES_SEED=${MES_SEED-../mes-seed} MES_SEED=${MES_SEED-../mes-seed}
if [ "$srcdir" = . ]; then if test "$srcdir" = .; then
top_builddir=. top_builddir=.
else else
srcdest=${srcdest} srcdest=${srcdest}
@ -82,7 +94,7 @@ fi
abs_top_srcdir=${abs_top_srcdir-$(cd ${srcdir} && pwd)} abs_top_srcdir=${abs_top_srcdir-$(cd ${srcdir} && pwd)}
abs_top_builddir=$PWD abs_top_builddir=$PWD
if [ -z "$GUILE" -o "$GUILE" = true ]; then if test -z "$GUILE" -o "$GUILE" = true; then
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2} GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2}
else else
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')} GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
@ -91,6 +103,7 @@ bindir=$(eval echo ${bindir-$prefix/bin})
datadir=$(eval echo ${datadir-$prefix/share}) datadir=$(eval echo ${datadir-$prefix/share})
docdir=$(eval echo ${docdir-$datadir/doc/mes-$VERSION}) docdir=$(eval echo ${docdir-$datadir/doc/mes-$VERSION})
infodir=$(eval echo ${infodir-$datadir/info}) infodir=$(eval echo ${infodir-$datadir/info})
includedir=$(eval echo ${libdir-$prefix/include})
libdir=$(eval echo ${libdir-$prefix/lib}) libdir=$(eval echo ${libdir-$prefix/lib})
mandir=$(eval echo ${mandir-$datadir/man}) mandir=$(eval echo ${mandir-$datadir/man})
moduledir=$(eval echo ${moduledir-$datadir/mes/module}) moduledir=$(eval echo ${moduledir-$datadir/mes/module})
@ -101,17 +114,18 @@ guile_site_ccache_dir=$(eval echo ${guile_site_ccache_dir-$prefix/lib/guile/$GUI
subst () { subst () {
sed \ sed \
-e s,"@PACKAGE@,$PACKAGE,"\ -e s,"@PACKAGE@,$PACKAGE,"\
-e s,"@PACKAGE_NAME@,$PACKAGE_NAME,"\
-e s,"@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,"\
-e s,"@VERSION@,$VERSION,"\ -e s,"@VERSION@,$VERSION,"\
-e s,"@arch@,$arch,"\
-e s,"@build@,$build,"\ -e s,"@build@,$build,"\
-e s,"@host@,$host,"\ -e s,"@host@,$host,"\
-e s,"@compiler@,$compiler,"\ -e s,"@compiler@,$compiler,"\
-e s,"@gcc_p@,$gcc_p,"\ -e s,"@courageous@,$courageous,"\
-e s,"@mes_p@,$mes_p,"\ -e s,"@mes_bits@,$mes_bits,"\
-e s,"@mesc_p@,$mesc_p,"\ -e s,"@mes_kernel@,$mes_kernel,"\
-e s,"@tcc_p@,$tcc_p,"\ -e s,"@mes_cpu@,$mes_cpu,"\
-e s,"@mes_arch@,$mes_arch,"\ -e s,"@mes_libc@,$mes_libc,"\
-e s,"@with_glibc_p@,$with_glibc_p,"\ -e s,"@mes_system@,$mes_system,"\
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\ -e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
-e s,"@abs_top_builddir@,$abs_top_builddir,"\ -e s,"@abs_top_builddir@,$abs_top_builddir,"\
-e s,"@top_builddir@,$top_builddir,"\ -e s,"@top_builddir@,$top_builddir,"\
@ -125,6 +139,7 @@ subst () {
-e s,"@guile_site_dir@,$guile_site_dir,"\ -e s,"@guile_site_dir@,$guile_site_dir,"\
-e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\ -e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\
-e s,"@infodir@,$infodir,"\ -e s,"@infodir@,$infodir,"\
-e s,"@includedir@,$includedir,"\
-e s,"@libdir@,$libdir,"\ -e s,"@libdir@,$libdir,"\
-e s,"@mandir@,$mandir,"\ -e s,"@mandir@,$mandir,"\
-e s,"@moduledir@,$moduledir,"\ -e s,"@moduledir@,$moduledir,"\
@ -135,6 +150,7 @@ subst () {
-e s,"@BASH@,$BASH,"\ -e s,"@BASH@,$BASH,"\
-e s,"@BLOOD_ELF@,$BLOOD_ELF,"\ -e s,"@BLOOD_ELF@,$BLOOD_ELF,"\
-e s,"@CC@,$CC,"\ -e s,"@CC@,$CC,"\
-e s,"@DIFF@,$DIFF,"\
-e s,"@GIT@,$GIT,"\ -e s,"@GIT@,$GIT,"\
-e s,"@GUILD@,$GUILD,"\ -e s,"@GUILD@,$GUILD,"\
-e s,"@GUILE@,$GUILE,"\ -e s,"@GUILE@,$GUILE,"\
@ -152,68 +168,88 @@ subst () {
$1 > $2 $1 > $2
} }
subst ${srcdest}build-aux/pre-inst-env.in pre-inst-env host=${host-$($CC -dumpmachine 2>/dev/null)}
chmod +x pre-inst-env if test -z "$host$host_type"; then
subst ${srcdest}scripts/mescc.in scripts/mescc mes_cpu=${arch-$(get_machine || uname -m)}
chmod +x scripts/mescc
subst ${srcdest}scripts/mescc.scm.in scripts/mescc.scm
chmod +x scripts/mescc.scm
host=${host-$($CC -dumpmachine 2>/dev/null || echo x86)}
if [ -z "$host" ]; then
arch=${arch-$(get_machine || uname -m)}
else else
arch=${host%%-*} mes_cpu=${host%%-*}
fi fi
if [ "$arch" = i386\ if test "$mes_cpu" = i386\
-o "$arch" = i486\ || test "$mes_cpu" = i486\
-o "$arch" = i586\ || test "$mes_cpu" = i586\
-o "$arch" = i686\ || test "$mes_cpu" = i686; then
]; then mes_cpu=x86
arch=x86
fi fi
case "$host" in
*linux-gnu|*linux)
mes_kernel=linux;;
*gnu)
mes_kernel=gnu;;
*)
mes_kernel=linux;;
esac
case "$mes_cpu" in
x86_64)
mes_bits=64;;
*)
mes_bits=32;;
esac
# #
if $CC --version | grep gcc; then #2>/dev/null; then if $CC --version | grep gcc; then #2>/dev/null; then
gcc_p=1
compiler=gcc compiler=gcc
elif $CC --version | grep tcc; then #2>/dev/null; then elif $CC --version | grep tcc; then #2>/dev/null; then
tcc_p=1 compiler=gcc
compiler=tcc
else else
mes_p=1
mesc_p=1
compiler=mescc compiler=mescc
fi fi
mes_arch=$arch mes_system=$mes_cpu-$mes_kernel-mes
if [ "$mes_p" -o "$mesc_p" ]; then
mes_arch=$arch-mes
fi
if [ ! "$mesc_p" ]; then
mes_arch=$mes_arch-$compiler
fi
if [ ! "$mesc_p" -a ! "$mes_p" ]; then
with_glibc_p=1
fi
subst ${srcdest}mes/module/mes/boot-0.scm.in mes/module/mes/boot-0.scm
subst ${srcdest}build-aux/GNUmakefile.in GNUmakefile subst ${srcdest}build-aux/GNUmakefile.in GNUmakefile
subst ${srcdest}build-aux/config.status.in config.status subst ${srcdest}build-aux/config.sh.in config.sh
subst ${srcdest}build-aux/build.sh.in build.sh subst ${srcdest}build-aux/build.sh.in build.sh
chmod +x build.sh chmod +x build.sh
subst ${srcdest}build-aux/bootstrap.sh.in bootstrap.sh
chmod +x bootstrap.sh
subst ${srcdest}build-aux/check.sh.in check.sh subst ${srcdest}build-aux/check.sh.in check.sh
chmod +x check.sh chmod +x check.sh
subst ${srcdest}build-aux/install.sh.in install.sh subst ${srcdest}build-aux/install.sh.in install.sh
chmod +x install.sh chmod +x install.sh
subst ${srcdest}build-aux/pre-inst-env.in pre-inst-env
chmod +x pre-inst-env
subst ${srcdest}scripts/ar.in scripts/ar
chmod +x scripts/ar
subst ${srcdest}scripts/mescc.scm.in scripts/mescc.scm
chmod +x scripts/mescc.scm
subst ${srcdest}scripts/mescc.in scripts/mescc
chmod +x scripts/mescc
subst ${srcdest}build-aux/uninstall.sh.in uninstall.sh subst ${srcdest}build-aux/uninstall.sh.in uninstall.sh
chmod +x uninstall.sh chmod +x uninstall.sh
mkdir -p include/mes
if test $mes_libc = system; then
cat >> include/mes/config.h <<EOF
#define SYSTEM_LIBC 1
EOF
else
cat >> include/mes/config.h <<EOF
#undef SYSTEM_LIBC
EOF
fi
cat >> include/mes/config.h <<EOF
#define VERSION '"'$VERSION'"'
#define pkgdatadir "'"$pkgdatadir'"'
EOF
cat <<EOF cat <<EOF
GNU Mes is configured for $mes_arch GNU Mes is configured for
compiler: $compiler
cpu: $mes_cpu
bits: $mes_bits
libc: $mes_libc
kernel: $mes_kernel
system: $mes_system
Run: Run:
./build.sh to build mes ./build.sh to build mes

View file

@ -27,8 +27,8 @@
#undef __MES_ASSERT_H #undef __MES_ASSERT_H
#include_next <assert.h> #include_next <assert.h>
#else // ! SYSTEM_LIBC #else // ! SYSTEM_LIBC
#define assert(x) ((x) ? (void)0 : assert_fail (#x)) #define assert(x) ((x) ? (void)0 : __assert_fail (#x))
void assert_fail (char *s); void __assert_fail (char *s);
#endif // ! SYSTEM_LIBC #endif // ! SYSTEM_LIBC
#endif // __MES_ASSERT_H #endif // __MES_ASSERT_H

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -17,5 +17,29 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __MES_GRP_H
#define __MES_GRP_H 1
#include <posix/getopt.c> #if SYSTEM_LIBC
#undef __MES_GRP_H
#include_next <pwd.h>
#else // ! SYSTEM_LIBC
#include <sys/types.h>
struct group
{
char *gr_name;
gid_t gr_gid;
char **gr_mem;
};
struct group *getgrent (void);
void endgrent (void);
void setgrent (void);
struct group *getgrgid (gid_t gid);
struct group *getgrnam (char const *name);
#endif // ! SYSTEM_LIBC
#endif // __MES_GRP_H

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,18 +18,14 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <errno.h> #ifndef __MES_SYSCALL_H
#define __MES_SYSCALL_H
#if __MESC__ && __i386__ long _sys_call (long sys_call);
#include <linux/x86-mes/mini.c> long _sys_call1 (long sys_call, long one);
#elif __MESC__ && __x86_64__ long _sys_call2 (long sys_call, long one, long two);
#include <linux/x86_64-mes/mini.c> long _sys_call3 (long sys_call, long one, long two, long three);
#elif __i386__ long _sys_call4 (long sys_call, long one, long two, long three, long four);
#include <linux/x86-mes-gcc/mini.c> long _sys_call6 (long sys_call, long one, long two, long three, long four, long five, long six);
#elif __x86_64__
#include <linux/x86_64-mes-gcc/mini.c>
#else
#error arch not supported
#endif
#include <posix/write.c> #endif //__MES_SYSCALL_H

View file

@ -1,3 +1,26 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_BUILTINS_H
#define __MES_BUILTINS_H
// src/gc.mes // src/gc.mes
SCM gc_check (); SCM gc_check ();
SCM gc (); SCM gc ();
@ -389,3 +412,5 @@ SCM vector_entry (SCM x);
SCM vector_set_x (SCM x, SCM i, SCM e); SCM vector_set_x (SCM x, SCM i, SCM e);
SCM list_to_vector (SCM x); SCM list_to_vector (SCM x);
SCM vector_to_list (SCM v); SCM vector_to_list (SCM v);
#endif //__MES_BUILTINS_H

324
include/mes/constants.h Normal file
View file

@ -0,0 +1,324 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_CONSTANTS_H
#define __MES_CONSTANTS_H
/* Symbols */
// CONSTANT cell_nil 1
#define cell_nil 1
// CONSTANT cell_f 2
#define cell_f 2
// CONSTANT cell_t 3
#define cell_t 3
// CONSTANT cell_dot 4
#define cell_dot 4
// CONSTANT cell_arrow 5
#define cell_arrow 5
// CONSTANT cell_undefined 6
#define cell_undefined 6
// CONSTANT cell_unspecified 7
#define cell_unspecified 7
// CONSTANT cell_closure 8
#define cell_closure 8
// CONSTANT cell_circular 9
#define cell_circular 9
// CONSTANT cell_begin 10
#define cell_begin 10
// CONSTANT cell_call_with_current_continuation 11
#define cell_call_with_current_continuation 11
// CONSTANT cell_vm_apply 12
#define cell_vm_apply 12
// CONSTANT cell_vm_apply2 13
#define cell_vm_apply2 13
// CONSTANT cell_vm_begin 14
#define cell_vm_begin 14
// CONSTANT cell_vm_begin_eval 15
#define cell_vm_begin_eval 15
// CONSTANT cell_vm_begin_expand 16
#define cell_vm_begin_expand 16
// CONSTANT cell_vm_begin_expand_eval 17
#define cell_vm_begin_expand_eval 17
// CONSTANT cell_vm_begin_expand_macro 18
#define cell_vm_begin_expand_macro 18
// CONSTANT cell_vm_begin_expand_primitive_load 19
#define cell_vm_begin_expand_primitive_load 19
// CONSTANT cell_vm_begin_primitive_load 20
#define cell_vm_begin_primitive_load 20
// CONSTANT cell_vm_begin_read_input_file 21
#define cell_vm_begin_read_input_file 21
// CONSTANT cell_vm_call_with_current_continuation2 22
#define cell_vm_call_with_current_continuation2 22
// CONSTANT cell_vm_call_with_values2 23
#define cell_vm_call_with_values2 23
// CONSTANT cell_vm_eval 24
#define cell_vm_eval 24
// CONSTANT cell_vm_eval2 25
#define cell_vm_eval2 25
// CONSTANT cell_vm_eval_check_func 26
#define cell_vm_eval_check_func 26
// CONSTANT cell_vm_eval_define 27
#define cell_vm_eval_define 27
// CONSTANT cell_vm_eval_macro_expand_eval 28
#define cell_vm_eval_macro_expand_eval 28
// CONSTANT cell_vm_eval_macro_expand_expand 29
#define cell_vm_eval_macro_expand_expand 29
// CONSTANT cell_vm_eval_pmatch_car 30
#define cell_vm_eval_pmatch_car 30
// CONSTANT cell_vm_eval_pmatch_cdr 31
#define cell_vm_eval_pmatch_cdr 31
// CONSTANT cell_vm_eval_set_x 32
#define cell_vm_eval_set_x 32
// CONSTANT cell_vm_evlis 33
#define cell_vm_evlis 33
// CONSTANT cell_vm_evlis2 34
#define cell_vm_evlis2 34
// CONSTANT cell_vm_evlis3 35
#define cell_vm_evlis3 35
// CONSTANT cell_vm_if 36
#define cell_vm_if 36
// CONSTANT cell_vm_if_expr 37
#define cell_vm_if_expr 37
// CONSTANT cell_vm_macro_expand 38
#define cell_vm_macro_expand 38
// CONSTANT cell_vm_macro_expand_car 39
#define cell_vm_macro_expand_car 39
// CONSTANT cell_vm_macro_expand_cdr 40
#define cell_vm_macro_expand_cdr 40
// CONSTANT cell_vm_macro_expand_define 41
#define cell_vm_macro_expand_define 41
// CONSTANT cell_vm_macro_expand_define_macro 42
#define cell_vm_macro_expand_define_macro 42
// CONSTANT cell_vm_macro_expand_lambda 43
#define cell_vm_macro_expand_lambda 43
// CONSTANT cell_vm_macro_expand_set_x 44
#define cell_vm_macro_expand_set_x 44
// CONSTANT cell_vm_return 45
#define cell_vm_return 45
// CONSTANT cell_symbol_dot 46
#define cell_symbol_dot 46
// CONSTANT cell_symbol_lambda 47
#define cell_symbol_lambda 47
// CONSTANT cell_symbol_begin 48
#define cell_symbol_begin 48
// CONSTANT cell_symbol_if 49
#define cell_symbol_if 49
// CONSTANT cell_symbol_quote 50
#define cell_symbol_quote 50
// CONSTANT cell_symbol_define 51
#define cell_symbol_define 51
// CONSTANT cell_symbol_define_macro 52
#define cell_symbol_define_macro 52
// CONSTANT cell_symbol_quasiquote 53
#define cell_symbol_quasiquote 53
// CONSTANT cell_symbol_unquote 54
#define cell_symbol_unquote 54
// CONSTANT cell_symbol_unquote_splicing 55
#define cell_symbol_unquote_splicing 55
// CONSTANT cell_symbol_syntax 56
#define cell_symbol_syntax 56
// CONSTANT cell_symbol_quasisyntax 57
#define cell_symbol_quasisyntax 57
// CONSTANT cell_symbol_unsyntax 58
#define cell_symbol_unsyntax 58
// CONSTANT cell_symbol_unsyntax_splicing 59
#define cell_symbol_unsyntax_splicing 59
// CONSTANT cell_symbol_set_x 60
#define cell_symbol_set_x 60
// CONSTANT cell_symbol_sc_expand 61
#define cell_symbol_sc_expand 61
// CONSTANT cell_symbol_macro_expand 62
#define cell_symbol_macro_expand 62
// CONSTANT cell_symbol_portable_macro_expand 63
#define cell_symbol_portable_macro_expand 63
// CONSTANT cell_symbol_sc_expander_alist 64
#define cell_symbol_sc_expander_alist 64
// CONSTANT cell_symbol_call_with_values 65
#define cell_symbol_call_with_values 65
// CONSTANT cell_symbol_call_with_current_continuation 66
#define cell_symbol_call_with_current_continuation 66
// CONSTANT cell_symbol_boot_module 67
#define cell_symbol_boot_module 67
// CONSTANT cell_symbol_current_module 68
#define cell_symbol_current_module 68
// CONSTANT cell_symbol_primitive_load 69
#define cell_symbol_primitive_load 69
// CONSTANT cell_symbol_read_input_file 70
#define cell_symbol_read_input_file 70
// CONSTANT cell_symbol_write 71
#define cell_symbol_write 71
// CONSTANT cell_symbol_display 72
#define cell_symbol_display 72
// CONSTANT cell_symbol_car 73
#define cell_symbol_car 73
// CONSTANT cell_symbol_cdr 74
#define cell_symbol_cdr 74
// CONSTANT cell_symbol_not_a_number 75
#define cell_symbol_not_a_number 75
// CONSTANT cell_symbol_not_a_pair 76
#define cell_symbol_not_a_pair 76
// CONSTANT cell_symbol_system_error 77
#define cell_symbol_system_error 77
// CONSTANT cell_symbol_throw 78
#define cell_symbol_throw 78
// CONSTANT cell_symbol_unbound_variable 79
#define cell_symbol_unbound_variable 79
// CONSTANT cell_symbol_wrong_number_of_args 80
#define cell_symbol_wrong_number_of_args 80
// CONSTANT cell_symbol_wrong_type_arg 81
#define cell_symbol_wrong_type_arg 81
// CONSTANT cell_symbol_buckets 82
#define cell_symbol_buckets 82
// CONSTANT cell_symbol_builtin 83
#define cell_symbol_builtin 83
// CONSTANT cell_symbol_frame 84
#define cell_symbol_frame 84
// CONSTANT cell_symbol_hashq_table 85
#define cell_symbol_hashq_table 85
// CONSTANT cell_symbol_module 86
#define cell_symbol_module 86
// CONSTANT cell_symbol_procedure 87
#define cell_symbol_procedure 87
// CONSTANT cell_symbol_record_type 88
#define cell_symbol_record_type 88
// CONSTANT cell_symbol_size 89
#define cell_symbol_size 89
// CONSTANT cell_symbol_stack 90
#define cell_symbol_stack 90
// CONSTANT cell_symbol_argv 91
#define cell_symbol_argv 91
// CONSTANT cell_symbol_mes_datadir 92
#define cell_symbol_mes_datadir 92
// CONSTANT cell_symbol_mes_version 93
#define cell_symbol_mes_version 93
// CONSTANT cell_symbol_internal_time_units_per_second 94
#define cell_symbol_internal_time_units_per_second 94
// CONSTANT cell_symbol_compiler 95
#define cell_symbol_compiler 95
// CONSTANT cell_symbol_arch 96
#define cell_symbol_arch 96
// CONSTANT cell_symbol_pmatch_car 97
#define cell_symbol_pmatch_car 97
// CONSTANT cell_symbol_pmatch_cdr 98
#define cell_symbol_pmatch_cdr 98
// CONSTANT cell_type_bytes 99
#define cell_type_bytes 99
// CONSTANT cell_type_char 100
#define cell_type_char 100
// CONSTANT cell_type_closure 101
#define cell_type_closure 101
// CONSTANT cell_type_continuation 102
#define cell_type_continuation 102
// CONSTANT cell_type_function 103
#define cell_type_function 103
// CONSTANT cell_type_keyword 104
#define cell_type_keyword 104
// CONSTANT cell_type_macro 105
#define cell_type_macro 105
// CONSTANT cell_type_number 106
#define cell_type_number 106
// CONSTANT cell_type_pair 107
#define cell_type_pair 107
// CONSTANT cell_type_port 108
#define cell_type_port 108
// CONSTANT cell_type_ref 109
#define cell_type_ref 109
// CONSTANT cell_type_special 110
#define cell_type_special 110
// CONSTANT cell_type_string 111
#define cell_type_string 111
// CONSTANT cell_type_struct 112
#define cell_type_struct 112
// CONSTANT cell_type_symbol 113
#define cell_type_symbol 113
// CONSTANT cell_type_values 114
#define cell_type_values 114
// CONSTANT cell_type_variable 115
#define cell_type_variable 115
// CONSTANT cell_type_vector 116
#define cell_type_vector 116
// CONSTANT cell_type_broken_heart 117
#define cell_type_broken_heart 117
// CONSTANT cell_test 118
#define cell_test 118
/* Cell types */
// CONSTANT TBYTES 0
#define TBYTES 0
// CONSTANT TCHAR 1
#define TCHAR 1
// CONSTANT TCLOSURE 2
#define TCLOSURE 2
// CONSTANT TCONTINUATION 3
#define TCONTINUATION 3
// CONSTANT TKEYWORD 4
#define TKEYWORD 4
// CONSTANT TMACRO 5
#define TMACRO 5
// CONSTANT TNUMBER 6
#define TNUMBER 6
// CONSTANT TPAIR 7
#define TPAIR 7
// CONSTANT TPORT 8
#define TPORT 8
// CONSTANT TREF 9
#define TREF 9
// CONSTANT TSPECIAL 10
#define TSPECIAL 10
// CONSTANT TSTRING 11
#define TSTRING 11
// CONSTANT TSTRUCT 12
#define TSTRUCT 12
// CONSTANT TSYMBOL 13
#define TSYMBOL 13
// CONSTANT TVALUES 14
#define TVALUES 14
// CONSTANT TVARIABLE 15
#define TVARIABLE 15
// CONSTANT TVECTOR 16
#define TVECTOR 16
// CONSTANT TBROKEN_HEART 17
#define TBROKEN_HEART 17
/* Struct types */
// CONSTANT STRUCT_TYPE 0
#define STRUCT_TYPE 0
// CONSTANT STRUCT_PRINTER 1
#define STRUCT_PRINTER 1
#define FRAME_SIZE 5
#define FRAME_PROCEDURE 4
#endif //__MES_CONSTANTS_H

View file

@ -21,7 +21,40 @@
#ifndef __MES_LIB_MINI_H #ifndef __MES_LIB_MINI_H
#define __MES_LIB_MINI_H #define __MES_LIB_MINI_H
#if !SYSTEM_LIBC #if HAVE_CONFIG_H
#include <mes/config.h>
#endif
// CONSTANT STDIN 0
#ifndef STDIN
#define STDIN 0
#endif
// CONSTANT STDOUT 1
#ifndef STDOUT
#define STDOUT 1
#endif
// CONSTANT STDERR 2
#ifndef STDERR
#define STDERR 2
#endif
char **environ;
int __stdin;
int __stdout;
int __stderr;
int eputs (char const *s);
int puts (char const *s);
int oputs (char const *s);
#if SYSTEM_LIBC
#include <sys/types.h>
#include <unistd.h>
#else //!SYSTEM_LIBC
#ifndef _SIZE_T #ifndef _SIZE_T
#define _SIZE_T #define _SIZE_T
@ -57,33 +90,6 @@ typedef int error_t;
int errno; int errno;
#endif // !__MES_ERRNO_T #endif // !__MES_ERRNO_T
#endif //!WITH_LIBC
// CONSTANT STDIN 0
#ifndef STDIN
#define STDIN 0
#endif
// CONSTANT STDOUT 1
#ifndef STDOUT
#define STDOUT 1
#endif
// CONSTANT STDERR 2
#ifndef STDERR
#define STDERR 2
#endif
char **environ;
int __stdin;
int __stdout;
int __stderr;
int eputs (char const *s);
int puts (char const *s);
int oputs (char const *s);
#if !SYSTEM_LIBC
size_t strlen (char const *s); size_t strlen (char const *s);
ssize_t _write (); ssize_t _write ();
ssize_t write (int filedes, void const *buffer, size_t size); ssize_t write (int filedes, void const *buffer, size_t size);

View file

@ -35,16 +35,12 @@ char *ltoab (long x, int base);
char *ntoab (long number, int base, int signed_p); char *ntoab (long number, int base, int signed_p);
char *ultoa (unsigned long number); char *ultoa (unsigned long number);
char *utoa (unsigned number); char *utoa (unsigned number);
int atoi (char const *s);
int eputc (int c); int eputc (int c);
int fdgetc (int fd); int fdgetc (int fd);
char * fdgets (char *s, int count, int fd);
int fdputc (int c, int fd); int fdputc (int c, int fd);
int fdputs (char const *s, int fd); int fdputs (char const *s, int fd);
int fdungetc (int c, int fd); int fdungetc (int c, int fd);
int _fdungetc_p (int fd);
int isdigit (int c);
int isspace (int c);
int isxdigit (int c);
int mes_open (char const *file_name, int flags, int mask); int mes_open (char const *file_name, int flags, int mask);
int _open2 (char const *file_name, int flags); int _open2 (char const *file_name, int flags);
int _open3 (char const *file_name, int flags, int mask); int _open3 (char const *file_name, int flags, int mask);
@ -52,4 +48,14 @@ int oputc (int c);
int oputs (char const *s); int oputs (char const *s);
char *search_path (char const *file_name); char *search_path (char const *file_name);
#if !SYSTEM_LIBC
extern char *__brk;
extern void (*__call_at_exit) (void);
void __assert_fail (char *s);
void _exit (int code);
long brk (void *addr);
#endif // !SYSTEM_LIBC
#endif //__MES_LIB_H #endif //__MES_LIB_H

80
include/mes/macros.h Normal file
View file

@ -0,0 +1,80 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_MACROS_H
#define __MES_MACROS_H
#define TYPE(x) g_cells[x].type
#define CAR(x) g_cells[x].car
#define CDR(x) g_cells[x].cdr
#define NTYPE(x) g_news[x].type
#define NCAR(x) g_news[x].car
#define NCDR(x) g_news[x].cdr
#define BYTES(x) g_cells[x].car
#define LENGTH(x) g_cells[x].car
#define REF(x) g_cells[x].car
#define START(x) (g_cells[x].car >> 16)
#define LEN(x) (g_cells[x].car & 0xffff)
#define VARIABLE(x) g_cells[x].car
#define CLOSURE(x) g_cells[x].cdr
#define CONTINUATION(x) g_cells[x].cdr
#define CBYTES(x) (char*)&g_cells[x].cdr
#define CSTRING_STRUCT(x) (char*)&g_cells[x.cdr].cdr
#define MACRO(x) g_cells[x].car
#define NAME(x) g_cells[x].cdr
#define PORT(x) g_cells[x].car
#define STRING(x) g_cells[x].cdr
#define STRUCT(x) g_cells[x].cdr
#define VALUE(x) g_cells[x].cdr
#define VECTOR(x) g_cells[x].cdr
#define NLENGTH(x) g_news[x].car
#define NCBYTES(x) (char*)&g_news[x].cdr
#define NVALUE(x) g_news[x].cdr
#define NSTRING(x) g_news[x].cdr
#define NVECTOR(x) g_news[x].cdr
#define CSTRING(x) CBYTES (STRING (x))
#define MAKE_BYTES0(x) make_bytes (x, strlen (x))
#define NAME_SYMBOL(symbol,name) {size_t s = strlen (name); CAR (symbol) = s; CDR (symbol) = make_bytes (name, s);}
#define MAKE_CHAR(n) make_cell__ (TCHAR, 0, n)
#define MAKE_CONTINUATION(n) make_cell__ (TCONTINUATION, n, g_stack)
#define MAKE_NUMBER(n) make_cell__ (TNUMBER, 0, (long)n)
#define MAKE_REF(n) make_cell__ (TREF, n, 0)
#define MAKE_STRING0(x) make_string (x, strlen (x))
#define MAKE_STRING_PORT(x) make_cell__ (TPORT, -length__ (g_ports) - 2, x)
#define MAKE_MACRO(name, x) make_cell__ (TMACRO, x, STRING (name))
#define CAAR(x) CAR (CAR (x))
#define CADR(x) CAR (CDR (x))
#define CDAR(x) CDR (CAR (x))
#define CDDR(x) CDR (CDR (x))
#define CADAR(x) CAR (CDR (CAR (x)))
#define CADDR(x) CAR (CDR (CDR (x)))
#define CDADAR(x) CAR (CDR (CAR (CDR (x))))
#endif //__MES_MACROS_H

106
include/mes/mes.h Normal file
View file

@ -0,0 +1,106 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_MES_H
#define __MES_MES_H
#include <sys/types.h>
typedef long SCM;
struct scm
{
long type;
SCM car;
SCM cdr;
};
// mes
extern int g_debug;
extern char *g_buf;
extern SCM g_continuations;
extern SCM g_symbols;
extern SCM g_symbol_max;
// a/env
extern SCM r0;
// param 1
extern SCM r1;
// save 2
extern SCM r2;
// continuation
extern SCM r3;
// current-module
extern SCM m0;
// macro
extern SCM g_macros;
extern SCM g_ports;
// gc
extern long ARENA_SIZE;
extern long MAX_ARENA_SIZE;
extern long STACK_SIZE;
extern long JAM_SIZE;
extern long GC_SAFETY;
extern long MAX_STRING;
extern char *g_arena;
extern long g_free;
extern SCM g_stack;
extern SCM *g_stack_array;
extern struct scm *g_cells;
extern struct scm *g_news;
SCM alloc (long n);
SCM apply (SCM f, SCM x, SCM a);
SCM apply_builtin (SCM fn, SCM x);
SCM cstring_to_list (char const *s);
SCM cstring_to_symbol (char const *s);
SCM display_ (SCM x);
SCM fdisplay_ (SCM, int, int);
SCM gc_init ();
SCM gc_peek_frame ();
SCM gc_pop_frame ();
SCM gc_push_frame ();
SCM init_time (SCM a);
SCM make_bytes (char const *s, size_t length);
SCM make_cell__ (long type, SCM car, SCM cdr);
SCM make_hash_table_ (long size);
SCM make_hashq_type ();
SCM make_initial_module (SCM a);
SCM make_string (char const *s, size_t length);
SCM make_vector__ (long k);
SCM read_input_file_env (SCM);
SCM string_equal_p (SCM a, SCM b);
SCM struct_ref_ (SCM x, long i);
SCM struct_set_x_ (SCM x, long i, SCM e);
SCM vector_ref_ (SCM x, long i);
SCM vector_set_x_ (SCM x, long i, SCM e);
int peekchar ();
int readchar ();
int unreadchar ();
long length__ (SCM x);
size_t bytes_cells (size_t length);
void assert_max_string (size_t i, char const *msg, char *string);
#include "mes/builtins.h"
#include "mes/constants.h"
#include "mes/macros.h"
#endif //__MES_MES_H

View file

@ -25,6 +25,8 @@
#include_next <pwd.h> #include_next <pwd.h>
#else // ! SYSTEM_LIBC #else // ! SYSTEM_LIBC
#include <sys/types.h>
struct passwd struct passwd
{ {
char *pw_name; char *pw_name;

View file

@ -37,6 +37,7 @@ typedef char *va_list;
#define va_end(ap) (void)((ap) = 0) #define va_end(ap) (void)((ap) = 0)
#define va_copy(dest, src) dest = src #define va_copy(dest, src) dest = src
int vexec (char const *file_name, va_list ap);
int vfprintf (FILE * stream, char const *template, va_list ap); int vfprintf (FILE * stream, char const *template, va_list ap);
int vprintf (char const *format, va_list ap); int vprintf (char const *format, va_list ap);
int vsprintf (char *str, char const *format, va_list ap); int vsprintf (char *str, char const *format, va_list ap);

View file

@ -51,7 +51,7 @@ void *memmove (void *dest, void const *src, size_t n);
void *memset (void *s, int c, size_t n); void *memset (void *s, int c, size_t n);
void *memchr (void const *block, int c, size_t size); void *memchr (void const *block, int c, size_t size);
int memcmp (void const *s1, void const *s2, size_t n); int memcmp (void const *s1, void const *s2, size_t n);
void *memmem (void const *haystack, int haystack_len, void const *needle, int needle_len);
char *strcat (char *dest, char const *src); char *strcat (char *dest, char const *src);
char *strchr (char const *s, int c); char *strchr (char const *s, int c);
int strcasecmp (char const *s1, char const *s2); int strcasecmp (char const *s1, char const *s2);

View file

@ -83,6 +83,7 @@ struct stat
// *INDENT-ON* // *INDENT-ON*
int chmod (char const *file_name, mode_t mode); int chmod (char const *file_name, mode_t mode);
int fstat (int filedes, struct stat *buf);
int mkdir (char const *file_name, mode_t mode); int mkdir (char const *file_name, mode_t mode);
int chown (char const *file_name, uid_t owner, gid_t group); int chown (char const *file_name, uid_t owner, gid_t group);
int rmdir (char const *file_name); int rmdir (char const *file_name);

View file

@ -59,7 +59,6 @@ struct timespec
int clock_gettime (clockid_t clk_id, struct timespec *tp); int clock_gettime (clockid_t clk_id, struct timespec *tp);
struct tm *localtime (time_t const *timep); struct tm *localtime (time_t const *timep);
struct tm *gmtime (time_t const *time); struct tm *gmtime (time_t const *time);
time_t time (time_t * tloc); time_t time (time_t * tloc);
#endif // ! SYSTEM_LIBC #endif // ! SYSTEM_LIBC

View file

@ -65,6 +65,7 @@ int execl (char const *file_name, char const *arg, ...);
int execve (char const *file, char *const argv[], char *const env[]); int execve (char const *file, char *const argv[], char *const env[]);
int execvp (char const *file, char *const argv[]); int execvp (char const *file, char *const argv[]);
int fork (void); int fork (void);
int fsync (int filedes);
char *getcwd (char *buf, size_t size); char *getcwd (char *buf, size_t size);
uid_t getuid (void); uid_t getuid (void);
gid_t getgid (void); gid_t getgid (void);
@ -72,6 +73,8 @@ int setgid (gid_t newgid);
int setuid (uid_t newuid); int setuid (uid_t newuid);
uid_t geteuid (void); uid_t geteuid (void);
gid_t getegid (void); gid_t getegid (void);
pid_t getpid (void);
pid_t getppid (void);
int isatty (int fd); int isatty (int fd);
int link (char const *oldname, char const *newname); int link (char const *oldname, char const *newname);
off_t lseek (int fd, off_t offset, int whence); off_t lseek (int fd, off_t offset, int whence);

View file

@ -1,10 +0,0 @@
void
assert_fail (char *s)
{
eputs ("assert fail: ");
eputs (s);
eputs ("\n");
char *fail = s;
fail = 0;
*fail = 0;
}

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -19,6 +19,7 @@
*/ */
#include <mes/lib.h> #include <mes/lib.h>
#include <ctype.h>
int int
isxdigit (int c) isxdigit (int c)

View file

@ -1,7 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright (C) 1993 Free Software Foundation, Inc. * Copyright (C) 1993 Free Software Foundation, Inc.
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -31,5 +31,5 @@ __getdirentries (int filedes, char *buffer, size_t nbytes, off_t * basep)
if (basep) if (basep)
*basep = lseek (filedes, (off_t) 0, SEEK_CUR); *basep = lseek (filedes, (off_t) 0, SEEK_CUR);
return read (filedes, buf, nbytes); return read (filedes, buffer, nbytes);
} }

View file

@ -32,6 +32,8 @@
#include <dirstream.h> #include <dirstream.h>
int getdents (int filedes, char *buffer, size_t nbytes);
/* Read a directory entry from DIRP. */ /* Read a directory entry from DIRP. */
struct dirent * struct dirent *
readdir (DIR * dirp) readdir (DIR * dirp)

View file

@ -1,121 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libc+tcc.c>
#if __GNU__
#error TODO, see wip-hurd
#elif __linux__
#include <linux/gnu.c>
#else
#error both __GNU__ and _linux__ are undefined, choose one
#endif
// m4
#include <stdlib/abort.c>
#include <stdlib/atol.c>
#include <stub/atof.c>
#include <string/bcmp.c>
#include <string/bcopy.c>
#include <string/bzero.c>
#include <stdio/fileno.c>
#include <stub/fpurge.c>
#include <stub/freadahead.c>
#include <string/index.c>
#include <ctype/isalnum.c>
#include <ctype/isalpha.c>
#include <ctype/iscntrl.c>
#include <ctype/isprint.c>
#include <ctype/ispunct.c>
#include <posix/mktemp.c>
#include <stub/pclose.c>
#include <stub/popen.c>
#include <string/rindex.c>
#include <stub/rewind.c>
#include <stub/setbuf.c>
#include <stub/system.c>
#include <string/strerror.c>
// binutils
#include <stdlib/abs.c>
#include <stub/chown.c>
#include <stub/ctime.c>
#include <stdio/fdgets.c>
#include <stdio/feof.c>
#include <stdio/fgets.c>
#include <stub/frexp.c>
#include <stdio/perror.c>
#include <stub/sigsetmask.c>
#include <string/strcspn.c>
#include <string/strncat.c>
#include <string/strpbrk.c>
#include <string/strspn.c>
#include <stub/sys_siglist.c>
#include <stub/umask.c>
#include <stub/utime.c>
#include <stub/fscanf.c>
#include <ctype/isascii.c>
#include <stdlib/bsearch.c>
#include <stub/gmtime.c>
#include <posix/sbrk.c>
#include <string/strdup.c>
#include <posix/raise.c>
#include <stub/strftime.c>
#include <stdlib/mbstowcs.c>
#include <stdio/clearerr.c>
#include <math/fabs.c>
// gcc
#include <stdio/freopen.c>
#include <stub/times.c>
#include <posix/sleep.c>
#include <posix/unsetenv.c>
#include <stdlib/atexit.c>
#include <posix/alarm.c>
#include <stub/getpwnam.c>
#if !__GNU__
#include <stdlib/alloca.c>
#endif
#include <stdlib/__exit.c>
#include <stub/__cleanup.c>
#include <dirent/__getdirentries.c>
#include <dirent/closedir.c>
#include <dirent/opendir.c>
#include <dirent/readdir.c>
// diffutils
#include <posix/execl.c>
// make
#include <stub/getlogin.c>
#include <stub/setvbuf.c>
#include <stub/sigblock.c>
#include <stub/sigaddset.c>
#include <stub/setlocale.c>
// bash
#include <stub/getpwuid.c>
#include <stub/rand.c>
#include <stub/sigdelset.c>
#include <stub/ttyname.c>

View file

@ -1,108 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include <libc.c>
int errno;
#if __GNU__
#include <hurd/tcc.c>
#elif __linux__
#include <linux/tcc.c>
#else
#error both __GNU__ and _linux__ are undefined, choose one
#endif
#if __MESC__ && __i386__
#include <x86-mes/setjmp.c>
#elif __MESC__ && __x86_64__
#include <x86_64-mes/setjmp.c>
#elif __i386__
#include <x86-mes-gcc/setjmp.c>
#elif __x86_64__
#include <x86_64-mes-gcc/setjmp.c>
#else
#error arch not supported
#endif
#include <ctype/islower.c>
#include <ctype/isupper.c>
#include <ctype/tolower.c>
#include <ctype/toupper.c>
#include <mes/search-path.c>
#include <posix/execvp.c>
#include <stdio/fclose.c>
#include <stdio/fdopen.c>
#include <stdio/ferror.c>
#include <stdio/fflush.c>
#include <stdio/fopen.c>
#include <stdio/fprintf.c>
#include <stdio/fread.c>
#include <stdio/fseek.c>
#include <stdio/ftell.c>
#include <stdio/fwrite.c>
#include <stdio/printf.c>
#include <stdio/remove.c>
#include <stdio/snprintf.c>
#include <stdio/sprintf.c>
#include <stdio/sscanf.c>
#include <stdio/vfprintf.c>
#include <stdio/vprintf.c>
#include <stdio/vsnprintf.c>
#include <stdio/vsprintf.c>
#include <stdio/vsscanf.c>
#include <stdlib/calloc.c>
#include <stdlib/qsort.c>
#include <stdlib/strtof.c>
#include <stdlib/strtol.c>
#include <stdlib/strtold.c>
#include <stdlib/strtoll.c>
#include <stdlib/strtoul.c>
#include <stdlib/strtoull.c>
#include <string/memmem.c>
#include <string/memmove.c>
#include <string/strcat.c>
#include <string/strchr.c>
#include <string/strlwr.c>
#include <string/strncpy.c>
#include <string/strrchr.c>
#include <string/strstr.c>
#include <string/strupr.c>
#include <stub/sigaction.c>
#include <stub/ldexp.c>
#include <stub/mprotect.c>
#include <stub/localtime.c>
#include <stub/strtod.c>
#include <stub/sigemptyset.c>

View file

@ -1,89 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sys/ioctl.h>
#include <stdarg.h>
#include <stdlib.h>
#include <mes/lib.h>
#include <stdio.h>
#include <mes/lib.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
#include <libc-mini.c>
#include <libmes.c>
#if __GNU__
#include <hurd/libc.c>
#elif __linux__
#include <linux/libc.c>
#else
#error both __GNU__ and _linux__ are undefined, choose one
#endif
void _env ();
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
int
__mes_debug ()
{
static int __mes_debug = -1;
if (__mes_debug == -1)
{
char *p = getenv ("MES_DEBUG");
__mes_debug = p ? MAX (atoi (p), 1) : 0;
}
return __mes_debug;
}
#if !___GNU__
#include <assert/assert.c>
#include <stdlib/malloc.c>
#include <string/memcpy.c>
#endif
#include <stdio/getchar.c>
#include <stdio/putchar.c>
#include <stdio/fputc.c>
#include <stdio/fputs.c>
#include <stdio/putc.c>
#include <stdio/getc.c>
#include <stdio/fgetc.c>
#include <stdio/ungetc.c>
#include <string/memchr.c>
#include <string/memcmp.c>
#include <string/memset.c>
#include <string/strcmp.c>
#include <string/strcpy.c>
#include <string/strncmp.c>
#include <stdlib/free.c>
#include <stdlib/realloc.c>
#include <posix/getenv.c>
#include <posix/isatty.c>
#include <posix/setenv.c>
#include <posix/wait.c>
#include <posix/execv.c>

View file

@ -1,147 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
// gcc/xgcc wants -lg with all these
// what's the story here?
#include <sys/time.h>
#define exit __exit
#define fprintf _fprintf
#define longjmp _longjmp
#define malloc _malloc
#define printf _printf
#define putchar _putchar
#define puts _puts
#define setjmp _setjmp
#define signal _signal
#define strcmp _strcmp
#define sprintf _sprintf
#define sscanf _sscanf
#include <libc+tcc.c>
#if __GNU__
#include <linux/gnu.c>
#elif __linux__
#include <linux/gnu.c>
#else
#error both __GNU__ and _linux__ are undefined, choose one
#endif
// m4
#include <stdlib/abort.c>
#include <stub/atof.c>
#include <string/bcmp.c>
#include <string/bcopy.c>
#include <string/bzero.c>
#include <stdio/fileno.c>
#include <stub/fpurge.c>
#include <stub/freadahead.c>
#include <string/index.c>
#include <ctype/isalnum.c>
#include <ctype/isalpha.c>
#include <ctype/iscntrl.c>
#include <ctype/isprint.c>
#include <ctype/ispunct.c>
#include <posix/mktemp.c>
#include <stub/pclose.c>
#include <stub/popen.c>
#include <string/rindex.c>
#include <stub/rewind.c>
#include <stub/setbuf.c>
#include <stub/system.c>
#include <string/strerror.c>
// binutils
#include <stdlib/abs.c>
#include <stub/chown.c>
#include <stub/ctime.c>
#include <stdio/fdgets.c>
#include <stdio/feof.c>
#include <stdio/fgets.c>
#include <stub/frexp.c>
#include <stdio/perror.c>
#include <stub/sigsetmask.c>
#include <string/strcspn.c>
#include <string/strncat.c>
#include <string/strpbrk.c>
#include <string/strspn.c>
#include <stub/sys_siglist.c>
#include <stub/umask.c>
#include <stub/utime.c>
#include <stub/fscanf.c>
#include <ctype/isascii.c>
#include <stdlib/bsearch.c>
#include <stub/gmtime.c>
#include <posix/sbrk.c>
#include <string/strdup.c>
#include <posix/raise.c>
#include <stub/strftime.c>
#include <stdlib/mbstowcs.c>
#include <stdio/clearerr.c>
#include <math/fabs.c>
// gcc
#include <stdio/freopen.c>
#include <stub/times.c>
#include <posix/sleep.c>
#include <posix/unsetenv.c>
#include <stdlib/atexit.c>
#include <posix/alarm.c>
#include <stub/getpwnam.c>
#if !__GNU__
#include <stdlib/alloca.c>
#endif
//#include <stdlib/__exit.c>
#include <stub/__cleanup.c>
int
__libc_subinit ()
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("__libc_subinit stub\n");
stub = 1;
return 0;
}
int
__syscall_error ()
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("__syscall_error stub\n");
stub = 1;
return 0;
}
int
__fpu_control ()
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("__fpu_control stub\n");
stub = 1;
return 0;
}

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
access (char const *file_name, int how) access (char const *file_name, int how)
{ {

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
long long
brk (void *addr) brk (void *addr)
{ {

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
chdir (char const *file_name) chdir (char const *file_name)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int int
chmod (char const *file_name, mode_t mask) chmod (char const *file_name, mode_t mask)
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,6 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <time.h> #include <time.h>
int int

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,10 +18,14 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
int int
close (int filedes) close (int filedes)
{ {
if (filedes > 2) if (filedes > 2)
__ungetc_buf[filedes] = -1; __ungetc_clear (filedes);
return _sys_call1 (SYS_close, (int) filedes); return _sys_call1 (SYS_close, (int) filedes);
} }

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
dup (int old) dup (int old)
{ {

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
dup2 (int old, int new) dup2 (int old, int new)
{ {

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
execve (char const *file_name, char *const argv[], char *const env[]) execve (char const *file_name, char *const argv[], char *const env[])
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <stdarg.h>
int int
fcntl (int filedes, int command, ...) fcntl (int filedes, int command, ...)
{ {

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
fork () fork ()
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int int
fstat (int filedes, struct stat *statbuf) fstat (int filedes, struct stat *statbuf)
{ {

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
fsync (int filedes) fsync (int filedes)
{ {

View file

@ -18,6 +18,11 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <limits.h>
#include <sys/types.h>
char * char *
_getcwd (char *buffer, size_t size) _getcwd (char *buffer, size_t size)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/types.h>
int int
getdents (int filedes, char *buffer, size_t nbytes) getdents (int filedes, char *buffer, size_t nbytes)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
gid_t gid_t
getegid () getegid ()
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
uid_t uid_t
geteuid () geteuid ()
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
gid_t gid_t
getgid () getgid ()
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
pid_t pid_t
getpid () getpid ()
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
pid_t pid_t
getppid () getppid ()
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/resource.h>
int int
getrusage (int processes, struct rusage *rusage) getrusage (int processes, struct rusage *rusage)
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,6 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/time.h> #include <sys/time.h>
int int

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
uid_t uid_t
getuid () getuid ()
{ {

View file

@ -1,43 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/chdir.c>
#include <linux/fcntl.c>
#include <linux/fstat.c>
#include <linux/getdents.c>
#include <linux/getegid.c>
#include <linux/geteuid.c>
#include <linux/getgid.c>
#include <linux/getpid.c>
#include <linux/getppid.c>
#include <linux/getrusage.c>
#include <linux/getuid.c>
#include <linux/kill.c>
#include <linux/link.c>
#include <linux/lstat.c>
#include <linux/mkdir.c>
#include <linux/nanosleep.c>
#include <linux/pipe.c>
#include <linux/rename.c>
#include <linux/setgid.c>
#include <linux/settimer.c>
#include <linux/setuid.c>
#include <linux/signal.c>
#include <linux/sigprogmask.c>

View file

@ -18,6 +18,11 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <stdarg.h>
#include <sys/ioctl.h>
int int
ioctl (int filedes, unsigned long command, ...) ioctl (int filedes, unsigned long command, ...)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
int int
kill (pid_t pid, int signum) kill (pid_t pid, int signum)
{ {

View file

@ -1,60 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <fcntl.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
#if __MESC__ && __i386__
#include <linux/x86-mes/mes.c>
#elif __MESC__ && __x86_64__
#include <linux/x86_64-mes/mes.c>
#elif __i386__
#include <linux/x86-mes-gcc/mes.c>
#elif __x86_64__
#include <linux/x86_64-mes-gcc/mes.c>
#else
#error arch not supported
#endif
#include <linux/access.c>
#include <linux/brk.c>
#include <linux/chmod.c>
#include <linux/clock_gettime.c>
#include <linux/dup.c>
#include <linux/dup2.c>
#include <linux/execve.c>
#include <linux/fork.c>
#include <linux/fsync.c>
#include <linux/getcwd.c>
#include <linux/gettimeofday.c>
#include <linux/ioctl.c>
#include <linux/open.c>
#include <linux/read.c>
#include <linux/time.c>
#include <linux/unlink.c>
#include <linux/waitpid.c>

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
link (char const *old_name, char const *new_name) link (char const *old_name, char const *new_name)
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/types.h>
off_t off_t
lseek (int filedes, off_t offset, int whence) lseek (int filedes, off_t offset, int whence)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int int
lstat (char const *file_name, struct stat *statbuf) lstat (char const *file_name, struct stat *statbuf)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int int
mkdir (char const *file_name, mode_t mode) mkdir (char const *file_name, mode_t mode)
{ {

View file

@ -18,8 +18,13 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <time.h>
#include <sys/time.h>
int int
nanosleep (const struct timespec *requested_time, struct timespec *remaining) nanosleep (struct timespec const *requested_time, struct timespec const *remaining)
{ {
return _sys_call2 (SYS_nanosleep, (long) requested_time, (long) remaining); return _sys_call2 (SYS_nanosleep, (long) requested_time, (long) remaining);
} }

View file

@ -18,13 +18,19 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
#include <fcntl.h>
#include <stdarg.h>
int int
_open3 (char const *file_name, int flags, int mask) _open3 (char const *file_name, int flags, int mask)
{ {
int r = _sys_call3 (SYS_open, (long) file_name, (int) flags, (int) mask); int r = _sys_call3 (SYS_open, (long) file_name, (int) flags, (int) mask);
__ungetc_init (); __ungetc_init ();
if (r > 2) if (r > 2)
__ungetc_buf[r] = -1; __ungetc_clear (r);
return r; return r;
} }

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
int int
pipe (int filedes[2]) pipe (int filedes[2])
{ {

View file

@ -18,6 +18,11 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
#include <fcntl.h>
ssize_t ssize_t
read (int filedes, void *buffer, size_t size) read (int filedes, void *buffer, size_t size)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
int int
rename (char const *old_name, char const *new_name) rename (char const *old_name, char const *new_name)
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
rmdir (char const *file_name) rmdir (char const *file_name)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
int int
setgid (gid_t newgid) setgid (gid_t newgid)
{ {

View file

@ -18,6 +18,11 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/time.h>
#include <unistd.h>
int int
setitimer (int which, struct itimerval const *new, struct itimerval *old) setitimer (int which, struct itimerval const *new, struct itimerval *old)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
int int
setuid (uid_t newuid) setuid (uid_t newuid)
{ {

View file

@ -18,6 +18,11 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <unistd.h>
#include <signal.h>
#if __x86_64__ #if __x86_64__
void void
_restorer (void) _restorer (void)

View file

@ -18,6 +18,11 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <signal.h>
#include <unistd.h>
int int
sigprocmask (int how, sigset_t const *set, sigset_t * oldset) sigprocmask (int how, sigset_t const *set, sigset_t * oldset)
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int int
stat (char const *file_name, struct stat *statbuf) stat (char const *file_name, struct stat *statbuf)
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,6 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <time.h> #include <time.h>
time_t time_t

View file

@ -18,6 +18,9 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
int int
unlink (char const *file_name) unlink (char const *file_name)
{ {

View file

@ -18,6 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <linux/syscall.h>
#include <syscall.h>
#include <sys/types.h>
pid_t pid_t
waitpid (pid_t pid, int *status_ptr, int options) waitpid (pid_t pid, int *status_ptr, int options)
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -18,6 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "mes/lib-mini.h"
#define SYS_exit "0x01" #define SYS_exit "0x01"
#define SYS_write "0x04" #define SYS_write "0x04"

Some files were not shown because too many files have changed in this diff Show more