Add mes and mescc-tools-extra

mescc-tools-extra contains two important tools:
- cp
- chmod

mes first builds itself from a mes 0.21 seed as used by guix, and then
builds a mes 0.22 and then mes 0.22 using that created mes 0.22.

It does /not/ use bootstrap.sh as we don't have a proper shell at this
point, it has been manually adapted for kaem.
This commit is contained in:
fosslinux 2020-12-25 18:40:14 +11:00
parent 2706e07556
commit 649d7b68dc
1029 changed files with 120985 additions and 18 deletions

View file

@ -0,0 +1,402 @@
# 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/>.
SHELL=@BASH@
srcdest=@srcdest@
srcdir=@srcdir@
abs_top_srcdir=@abs_top_srcdir@
abs_top_builddir=@abs_top_builddir@
GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module
cleaning-p:=$(filter clean%, $(MAKECMDGOALS))$(filter %clean, $(MAKECMDGOALS))
ifndef cleaning-p
include .config.make
ifneq ($(prefix),)
prefix-arg=--prefix=$(prefix)
endif
ifneq ($(build),)
build-arg=--build=$(build)
endif
ifneq ($(host),)
host-arg=--host=$(host)
endif
ifeq ($(mes_libc),system)
--with-system-libc=system
endif
.config.make:
${srcdir}/configure $(prefix_arg) $(host-arg) $(build-arg) $(with-system-libc)
endif
PHONY_TARGETS:=\
TAGS\
all-go\
all\
build\
check\
clean-go\
clean\
default\
dist\
distclean\
doc\
dvi\
gcc\
generate-ChangeLog\
help\
html\
info\
install-dvi\
install-html\
install-pdf\
install-ps\
install-strip\
install\
installcheck\
installdirs\
maintainer-clean\
man\
mes-gcc\
mes-tcc\
mes\
mostlyclean\
pdf\
ps\
sign-dist\
uninstall\
web\
#
.PHONY: $(PHONY_TARGETS)
default: all
all: doc
doc: build
build:
$(SHELL) build.sh
src/${program_prefix}mes: build
clean:
rm -f *.o *.s bin/mes bin/mes-gcc bin/mes-mescc
rm -f mes.{aux,cp,cps,fn,info,log,tmp,toc,vr,vrs}
rm -f .log build.log
rm -f 0exit-42 0hello-mes exit-42 body-exit-42 body-hello-mes hello-mes
rm -f build-aux/mes-snarf.go
rm -f module/mescc.go
rm -f module/mes/*.go module/mescc/*.go
rm -f module/mescc/i386/*.go
rm -f module/mescc/x86_64/*.go
rm -rf gcc-lib/*.o gcc-lib/*.s gcc-lib/*.a gcc-lib/*-mes
rm -f gcc-lib/libc+gnu.c
rm -f gcc-lib/.log gcc-lib/build.log
rm -rf mescc-lib/*.o mescc-lib/*.s mescc-lib/*.a mescc-lib/*-mes
rm -f mescc-lib/libc+gnu.c
rm -f mescc-lib/.log mescc-lib/build.log
rm -rf mescc/bin
rm -f scaffold/boot/*.log scaffold/boot/*.trs
rm -f test-suite.log tests/*.log tests/*.trs
rm -f scaffold/*.s scaffold/*.o
rm -f doc/images/gcc-mesboot-graph.{eps,pdf,png}
rm -f doc/mes.1 doc/mesar.1 doc/mescc.1
rm -f .config .config.E .config.o
distclean: clean
rm -f GNUmakefile bootstrap.sh build.sh check.sh install.sh uninstall.sh
rm -f include/mes/config.h
rm -f .config.make config.sh mescc-lib/config.sh gcc-lib/config.sh
rm -f scripts/mesar scripts/mescc scripts/mescc.scm scripts/m2-merge
rm -f TAGS
mostlyclean: clean
maintainer-clean: distclean
rm -f doc/mes.info
rm -f doc/version.texi
TAGS:
etags ${srcdest}lib/*.c ${srcdest}lib/*/*.c ${srcdest}src/*.c ${srcdest}include/*.h ${srcdest}include/sys/*.h
all-go:
${srcdest}build-aux/build-guile.sh
clean-go:
rm -f $(shell find . -name '*.go')
check:
$(SHELL) check.sh
check-mescc:
$(SHELL) pre-inst-env build-aux/check-mescc.sh
# Mes does not feature post-install checks yet, so we're great!
installcheck:
true
install:
$(SHELL) install.sh
uninstall:
$(SHELL) uninstall.sh
doc/version.texi: ${srcdest}doc/mes.texi GNUmakefile
@mkdir -p $(@D)
(set `LANG= date -r $< +'%d %B %Y'`;\
echo "@set UPDATED $$1 $$2 $$3"; \
echo "@set UPDATED-MONTH $$2 $$3"; \
echo "@set EDITION $(VERSION)"; \
echo "@set VERSION $(VERSION)") > $@
doc: doc/version.texi
ifdef MAKEINFO
doc: info
else
$(warning skipping info: no makeinfo)
endif
ifdef HELP2MAN
doc: man
else
$(warning skipping man: no help2man)
endif
info: doc/mes.info
doc/mes.info: ${srcdest}doc/mes.texi doc/version.texi ${srcdest}doc/images/gcc-mesboot-graph.png GNUmakefile
$(MAKEINFO) -o $@ -I doc -I doc $<
doc/images/%.eps: ${srcdest}doc/images/%.dot
ifdef DOT
$(DOT) -T eps $< > $@
else
touch $@
endif
doc/images/%.pdf: ${srcdest}doc/images/%.dot
ifdef DOT
$(DOT) -T pdf $< > $@
else
touch $@
endif
doc/images/%.png: ${srcdest}doc/images/%.dot
ifdef DOT
$(DOT) -T png $< > $@
else
touch $@
$(warning info: graphvis missing: no images)
endif
man: doc/mes.1 doc/mescc.1 doc/mesar.1
# disable builtin-rules
%.o: %.s
%.s: %.S
%.o: %.S
%.o: %.c
%: %.S
%: %.o
%: %.c
doc/mes.1: src/${program_prefix}mes | build
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) \
--name="Scheme interpreter for bootstrapping the GNU system" \
$(<F) > $@
doc/mescc.1: scripts/mescc src/${program_prefix}mes | build
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) \
--name="C99 compiler in Scheme for bootstrapping the GNU system" \
$(<F) > $@
doc/mesar.1: scripts/mescc src/${program_prefix}mes | build
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) \
--name="Archiver for MesCC" \
$(<F) > $@
html: doc/html/index.html
doc/html/index.html: ${srcdest}doc/mes.texi doc/version.texi doc/images/gcc-mesboot-graph.png
$(MAKEINFO) --html -o $(@D) -I ${srcdest}doc -I doc $<
dvi: doc/mes.dvi
doc/mes.dvi: ${srcdest}doc/mes.texi
$(MAKEINFO) --dvi -I ${srcdest}doc -I doc -o doc/mes.dvi $<
pdf: doc/mes.pdf
doc/mes.pdf: ${srcdest}doc/mes.texi
$(MAKEINFO) --pdf -I ${srcdest}doc -I doc -o doc/mes.pdf $<
ps: doc/mes.ps
doc/mes.ps: ${srcdest}doc/mes.texi
$(MAKEINFO) --ps -I ${srcdest}doc -I doc -o doc/mes.ps $<
WEB_IMAGES:=\
doc/images/gcc-mesboot-graph.eps\
doc/images/gcc-mesboot-graph.pdf\
doc/images/gcc-mesboot-graph.png
web: info $(WEB_IMAGES)
GENDOCS_TEMPLATE_DIR=doc build-aux/gendocs.sh -I doc -s ${srcdest}doc/mes.texi -o doc/web/manual --email bug-mes@gnu.org mes "GNU Mes manual"
### dist
COMMIT=$(shell test -e ${srcdest}.git && (cd ${srcdir} && git describe --dirty 2>/dev/null) || cat ${srcdest}.tarball-version)
TARBALL_VERSION=$(COMMIT:v%=%)
TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION)
TARBALL:=$(TARBALL_DIR).tar.gz
# Be friendly to Debian; avoid using EPOCH
MTIME=$(shell git show HEAD --format=%ct --no-patch 2>/dev/null)
# Reproducible tarball
TAR_FLAGS=--sort=name --mtime=@$(MTIME) --owner=0 --group=0 --numeric-owner --mode=go=rX,u+rw,a-s
.tarball-version:
echo $(COMMIT) > $@
GIT_ARCHIVE_HEAD:=git archive HEAD --
GIT_LS_FILES:=git ls-files
ifeq ($(wildcard .git),)
GIT_ARCHIVE_HEAD:=tar -cf-
GIT_LS_FILES:=find
MTIME:=0
endif
dist: $(TARBALL)
sign-dist: $(TARBALL)
gpg -a --output $(TARBALL).sig --detach-sig $(TARBALL)
git checkout ChangeLog
tree-clean-p:
test ! -d .git || git diff --exit-code > /dev/null
test ! -d .git || git diff --cached --exit-code > /dev/null
@echo commit:$(COMMIT)
generate-ChangeLog:
$(PERL) ${srcdest}build-aux/gitlog-to-changelog --srcdir=${srcdir} > $@
cat ChangeLog >> generate-ChangeLog
mv generate-ChangeLog ChangeLog
$(TARBALL): .tarball-version | generate-ChangeLog
($(GIT_LS_FILES) \
--exclude=$(TARBALL_DIR); \
echo $^ | tr ' ' '\n') \
| tar $(TAR_FLAGS) \
--transform=s,^,$(TARBALL_DIR)/,S -T- -cf- \
| gzip -c --no-name > $@
git checkout ChangeLog
ifdef GUIX
update-hash: $(TARBALL)
$(GUIX) download file://$(PWD)/$<
sed -i -e 's,(base32 #!mes!# "[^"]*"),(base32 #!mes!# "$(shell $(GUIX) hash $<)"),' guix/git/mes.scm
else
$(warning update-hash: no guix)
endif
tag:
git tag -s v$(VERSION) -m "GNU Mes $(VERSION)."
# Release process
# 0. Prepare git, see history:
# - doc: Release update
# + NEWS, etc.
# + doc/announce/ANNOUNCE-0.22, using xxx for checksums
# - Release 0.22
# 1. make tag VERSION=0.22
# 2. make sign-dist
# 3. make release
# - Update doc/announce/ANNOUNCE-0.22
# - doc: Post-release update.
# 4. verify bootstrap
guix-build:
./pre-inst-env $(GUIX) build mes@$(VERSION) --with-source=$(TARBALL)
release: update-hash | gen-announce guix-build
GPG_KEY_ID:=1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273
GEN_ANNOUNCE=$(GNULIB)/build-aux/announce-gen
GNULIB=../../gnulib
gen-announce:
$(GEN_ANNOUNCE)\
--release-type=beta\
--package-name=mes\
--previous-version='0.21 '\
--current-version=$(VERSION)\
--gpg-key-id=$(GPG_KEY_ID)\
--url-directory=https://ftp.gnu.org/gnu/mes\
--news=NEWS\
> doc/announce/ANNOUNCE-$(VERSION)-
installdirs: mkinstalldirs
mkdir -p\
$(DESTDIR)$(bindir)\
$(DESTDIR)$(datadir)\
$(DESTDIR)$(libdir)\
$(DESTDIR)$(infodir)\
$(DESTDIR)$(mandir)
install-dvi: dvi
mkdir -p $(DESTDIR)${docdir}
cp doc/mes.dvi $(DESTDIR)${docdir}
install-html: html
mkdir -p $(DESTDIR)${docdir}
tar -cf- -C doc html | tar -xf- -C $(DESTDIR)${docdir}
install-pdf: pdf
mkdir -p $(DESTDIR)${docdir}
cp doc/mes.pdf $(DESTDIR)${docdir}
install-ps: ps
mkdir -p $(DESTDIR)${docdir}
cp doc/mes.ps $(DESTDIR)${docdir}
# We do not strip binaries, binutils' strip corrupts M1+hex2-generated ELFs
install-strip: install
define HELP_TOP
Usage: make [OPTION]... [TARGET]...
Main and non-standard targets:
all update everything
all-go update .go files
dist update $(TARBALL)
doc update documentation
check run unit tests
clean run git clean -dfx
clean-go clean .go files
info update info documentation
install install in $(prefix)
install-info install info docs in $(prefix)/share/info
release dist and tag
uninstall uninstall from $(prefix)
endef
export HELP_TOP
help:
@echo "$$HELP_TOP"
include ${srcdest}build-aux/export.make

View file

@ -0,0 +1,114 @@
#! @SHELL@
# 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/>.
LANG=
MES_ARENA=${MES_ARENA-20000000}
export MES_ARENA
MES_MAX_ARENA=${MES_MAX_ARENA-${MES_ARENA}}
export MES_MAX_ARENA
MES_STACK=${MES_STACK-5000000}
export MES_STACK
MES_PREFIX=${MES_PREFIX-$PWD}
. ./config.sh
. ${srcdest}build-aux/configure-lib.sh
. ${srcdest}build-aux/cflags.sh
CPPFLAGS="-D HAVE_CONFIG_H=1 -I include"
AM_CFLAGS=""
mkdir -p mescc-lib
cp config.sh mescc-lib/config.sh
cd mescc-lib
srcdest=../${srcdest}
ln -sf ${srcdest}mes .
ln -sf ${srcdest}module .
ln -sf ${srcdest}src .
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
mkdir -p $mes_cpu-mes
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
cp crt1.o $mes_cpu-mes
cp crt1.s $mes_cpu-mes
objects=
for c in $libc_mini_SOURCES; do
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
echo " AR $mes_cpu-mes/libc-mini.a"
$AR crD $mes_cpu-mes/libc-mini.a $objects
objects=
for c in $libc_SOURCES; do
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
echo " AR $mes_cpu-mes/libc.a"
$AR crD $mes_cpu-mes/libc.a $objects
objects=
for c in $libc_tcc_SOURCES; do
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
echo " AR $mes_cpu-mes/libc+tcc.a"
$AR crD $mes_cpu-mes/libc+tcc.a $objects
cd ..
srcdest=
CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
objects=
for c in $mes_SOURCES; do
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
echo " CCLD bin/mes-mescc"
mkdir -p bin
$CC -nostdlib -o bin/mes-mescc -L mescc-lib mescc-lib/crt1.o $objects -lc
cp bin/mes-mescc bin/mes
(
mkdir -p gcc-lib
cp config.sh gcc-lib
cd gcc-lib
compiler=gcc
if test -z "$srcdest"; then
srcdest=../
srcdir=../
fi
@SHELL@ ${srcdest}build-aux/build-source-lib.sh
)

View file

@ -0,0 +1,65 @@
#! /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.sh
. ${srcdest}build-aux/trace.sh
GUILE_AUTO_COMPILE=0
SCM_FILES="
module/mes/getopt-long.scm
module/mes/guile.scm
module/mes/misc.scm
module/mes/test.scm
module/mescc/M1.scm
module/mescc/as.scm
module/mescc/bytevectors.scm
module/mescc/compile.scm
module/mescc/i386/as.scm
module/mescc/i386/info.scm
module/mescc/x86_64/as.scm
module/mescc/x86_64/info.scm
module/mescc/info.scm
module/mescc.scm
module/mescc/mescc.scm
module/mescc/preprocess.scm
"
SCRIPTS="
build-aux/mes-snarf.scm
"
export host=$($GUILE -c "(display %host-type)")
abs=$srcdest
if [ "$GUILE_EFFECTIVE_VERSION" = "2.0" ]; then
srcdest=$abs_top_srcdir/
fi
for i in $SCM_FILES $SCRIPTS; do
b=$(basename $i)
go=${i%%.scm}.go
f=${srcdest}$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
done

View file

@ -0,0 +1,81 @@
#! /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/>.
. ./config.sh
. ${srcdest}build-aux/configure-lib.sh
. ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/cc.sh
trap 'test -f .log && cat .log' EXIT
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
if test $mes_libc = mes; then
archive libc.a $libc_SOURCES
cp libc.a $mes_cpu-mes
if test -e libc.s; then
cp libc.s $mes_cpu-mes
fi
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

@ -0,0 +1,57 @@
#! /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-}
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
mes_sources="
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
"
for c in $mes_sources; do
compile $c
done
if test $mes_libc = system; then
LIBS=-lmes
fi
link bin/mes-$compiler
cp bin/mes-$compiler bin/mes

View file

@ -0,0 +1,149 @@
#! /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
set +e
set_min_e () {
echo "Applying courage"
}
set_min_e
else
set_min_e () {
set -e
}
fi
case "$mes_cpu" in
arm)
stage0_arch=40
stage0_cpu=armv7l
;;
x86_64)
stage0_arch=2
stage0_cpu=amd64
;;
x86)
stage0_arch=1
stage0_cpu=x86
;;
*)
stage0_arch=1
stage0_cpu=$mes_cpu
;;
esac
trace "CCLD ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/exit-42.S" $CC\
-nostdlib\
-g\
${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/exit-42.S\
-o exit-42
trace "TEST exit-42"
{ set +e; ./exit-42; r=$?; set_min_e; }
[ $r != 42 ] && echo " => $r"
[ $r = 42 ]
if $numbered_arch; then
stage0_cpu_flag="--Architecture $stage0_arch";
else
stage0_cpu_flag="--architecture $stage0_cpu";
fi
trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2" $HEX2\
--LittleEndian\
$stage0_cpu_flag\
--BaseAddress 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2\
--exec_enable\
-o 0exit-42
trace "TEST 0exit-42"
{ set +e; ./0exit-42; r=$?; set_min_e; }
[ $r != 42 ] && echo " => $r"
[ $r = 42 ]
trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2" $HEX2\
--LittleEndian\
$stage0_cpu_flag\
--BaseAddress 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-footer-single-main.hex2\
--exec_enable\
-o body-exit-42
trace "TEST body-exit-42"
{ set +e; ./body-exit-42; r=$?; set_min_e; }
[ $r != 42 ] && echo " => $r"
[ $r = 42 ]
### FIXME: c&p from exit-42
trace "CCLD ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/hello-mes.S" $CC\
-nostdlib\
-g\
${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/hello-mes.S\
-o hello-mes
trace "TEST hello-mes"
{ set +e; ./hello-mes; r=$?; set_min_e; }
[ $r != 0 ] && echo " => $r"
[ $r = 0 ]
trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2" $HEX2\
--LittleEndian\
$stage0_cpu_flag\
--BaseAddress 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2\
--exec_enable\
-o 0hello-mes
trace "TEST 0hello-mes"
{ set +e; ./0hello-mes; r=$?; set_min_e; }
[ $r != 0 ] && echo " => $r"
[ $r = 0 ]
trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2" $HEX2\
--LittleEndian\
$stage0_cpu_flag\
--BaseAddress 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-footer-single-main.hex2\
--exec_enable\
-o body-hello-mes
trace "TEST body-hello-mes"
{ set +e; ./body-hello-mes; r=$?; set_min_e; }
[ $r != 0 ] && echo " => $r"
[ $r = 0 ]

View file

@ -0,0 +1,53 @@
#! /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
if test "$V" = 2; then
set -x
fi
set -u
srcdest=${srcdest-}
. ${srcdest}build-aux/configure-lib.sh
mkdir -p $mes_cpu-mes
cp ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt*.c $mes_cpu-mes
rm -f libc+gnu.c
cat > libc+gnu.c <<EOF
// Generated from Mes -- do not edit
// compiler: $compiler
// cpu: $mes_cpu
// bits: $mes_bits
// libc: $mes_libc
// kernel: $mes_kernel
// system: $mes_system
EOF
for c in $libc_gnu_SOURCES; do
echo "// $c" >> libc+gnu.c
cat ${srcdest}$c >> libc+gnu.c
echo >> libc+gnu.c
done
cp libc+gnu.c $mes_cpu-mes
cp ${srcdest}lib/libtcc1.c $mes_cpu-mes
cp ${srcdest}lib/posix/getopt.c $mes_cpu-mes/libgetopt.c

View file

@ -0,0 +1,141 @@
#! /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 test "$1" = "help"; then
cat <<EOF
Run:
./build.sh to build mes
./check.sh to check mes
./install.sh to install mes
EOF
exit 0
fi
if test "$V" = 2; then
set -x
fi
set -u
. ./config.sh
. ${srcdest}build-aux/cflags.sh
if $courageous; then
echo "Applying courage"
set +e
fi
if test "$compiler" != bootstrap; then
${SHELL} ${srcdest}build-aux/build-scaffold.sh
fi
if test -n "$GUILE" -a "$GUILE" != true; then
${SHELL} ${srcdest}build-aux/build-guile.sh
fi
(
mkdir -p gcc-lib
cp config.sh gcc-lib
cd gcc-lib
if test -z "$srcdest"; then
srcdest=../
srcdir=../
fi
if test $compiler = gcc; then
AM_LDFLAGS="$AM_LDFLAGS
-L gcc-lib
"
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
if test $mes_kernel = gnu; then
AM_CPPFLAGS="$AM_CPPFLAGS
-I /usr/include
"
fi
${SHELL} ${srcdest}build-aux/build-lib.sh
cp crt1.o ..
fi
compiler=gcc ${SHELL} ${srcdest}build-aux/build-source-lib.sh
)
(
if test $compiler = gcc; then
AM_LDFLAGS="$AM_LDFLAGS
-L gcc-lib
"
fi
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
if test $compiler = gcc; then
${SHELL} ${srcdest}build-aux/build-mes.sh
fi
)
(
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 ../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
ln -sf ${srcdest}mes .
ln -sf ${srcdest}module .
ln -sf ${srcdest}src .
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
compiler=mescc
AR=${MESAR-"${srcdest}pre-inst-env mesar"}
CC=${MESCC-"${srcdest}pre-inst-env mescc -m $mes_bits"}
# No user overrides for MesCC, they are probably intended for GCC
CFLAGS=
CPPFLAGS=
LDFLAGS=
${SHELL} ${srcdest}build-aux/build-lib.sh
${SHELL} ${srcdest}build-aux/build-source-lib.sh
if $bootstrap; then
${SHELL} ${srcdest}build-aux/build-mes.sh
cp -f bin/mes-mescc ../bin
cp -f bin/mes ../bin
fi
)

56
sysa/mes-0.22/build-aux/cc.sh Executable file
View file

@ -0,0 +1,56 @@
# 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/>.
objects=
compile () {
c=${srcdest}$1
b=$(basename $c .c)
o=$b.o
objects="$objects $o"
if test ! -e $o -o $c -nt $o; then
trace "CC $c" $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o $c
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o $c
fi
}
archive () {
archive=$1
shift
sources="$@"
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 $AM_CFLAGS $CFLAGS $AM_LDFLAGS $LDFLAGS -o $out $crt1 $objects $LIBS
objects=
}

View file

@ -0,0 +1,56 @@
# 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/>.
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
if test $mes_kernel = gnu; then
AM_CPPFLAGS="$AM_CPPFLAGS
-I /usr/include
"
fi
AM_CFLAGS=
if test $mes_libc = mes; then
AM_CFLAGS="$AM_CFLAGS
-static
-nostdinc
-nostdlib
-fno-builtin
"
fi
AM_LDFLAGS="
-L .
"
if test $mes_libc = mes; then
AM_LDFLAGS="$AM_LDFLAGS
-static
-nostdlib
"
fi
LIBS=-lc
export AM_CFLAGS CFLAGS
export AM_CPPFLAGS CPPFLAGS
export AM_LDFLAGS LDFLAGS
export LIBS

View file

@ -0,0 +1,121 @@
#! /bin/bash
# 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
. ./config.sh
set -u
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
scaffold/boot/10-cons.scm
scaffold/boot/11-list.scm
scaffold/boot/11-vector.scm
scaffold/boot/12-car.scm
scaffold/boot/13-cdr.scm
scaffold/boot/14-exit.scm
scaffold/boot/15-display.scm
scaffold/boot/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
scaffold/boot/20-define.scm
scaffold/boot/20-define-quoted.scm
scaffold/boot/20-define-quote.scm
scaffold/boot/21-define-procedure.scm
scaffold/boot/22-define-procedure-2.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
scaffold/boot/30-capture.scm
scaffold/boot/31-capture-define.scm
scaffold/boot/32-capture-modify-close.scm
scaffold/boot/33-procedure-override-close.scm
scaffold/boot/34-cdr-override-close.scm
scaffold/boot/35-closure-modify.scm
scaffold/boot/36-closure-override.scm
scaffold/boot/37-closure-lambda.scm
scaffold/boot/38-simple-format.scm
scaffold/boot/39-global-define-override.scm
scaffold/boot/3a-global-define-lambda-override.scm
scaffold/boot/40-define-macro.scm
scaffold/boot/41-when.scm
scaffold/boot/42-if-when.scm
scaffold/boot/43-or.scm
scaffold/boot/44-or-if.scm
scaffold/boot/45-pass-if.scm
scaffold/boot/46-report.scm
scaffold/boot/47-pass-if-eq.scm
scaffold/boot/48-let.scm
scaffold/boot/49-macro-override.scm
scaffold/boot/4a-define-macro-define-macro.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
scaffold/boot/50-keyword.scm
scaffold/boot/50-make-string.scm
scaffold/boot/50-string-join.scm
scaffold/boot/50-primitive-load.scm
scaffold/boot/53-closure-display.scm
scaffold/boot/60-let-syntax.scm
scaffold/boot/call-cc.scm
scaffold/boot/memory.scm
scaffold/boot/numbers.scm
"
XFAIL_TESTS=
test_ext=.scm
log_compiler="${SHELL} ${srcdest}build-aux/test-boot.sh"
. ${srcdest}build-aux/test-suite.sh

View file

@ -0,0 +1,62 @@
#! /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.sh
set -u
TESTS="
tests/boot.test
tests/read.test
tests/srfi-0.test
tests/macro.test
tests/perform.test
tests/base.test
tests/quasiquote.test
tests/let.test
tests/closure.test
tests/scm.test
tests/display.test
tests/cwv.test
tests/math.test
tests/vector.test
tests/srfi-1.test
tests/srfi-9.test
tests/srfi-13.test
tests/srfi-14.test
tests/srfi-43.test
tests/optargs.test
tests/fluids.test
tests/catch.test
tests/getopt-long.test
tests/guile.test
tests/syntax.test
tests/let-syntax.test
tests/pmatch.test
tests/posix.test
tests/match.test
tests/psyntax.test
"
XFAIL_TESTS=
test_ext=.test
log_compiler=${SHELL}
. ${srcdest}build-aux/test-suite.sh

View file

@ -0,0 +1,290 @@
#! /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
. ./config.sh
set -u
TESTS="
lib/tests/scaffold/t.c
lib/tests/scaffold/01-return-0.c
lib/tests/scaffold/02-return-1.c
lib/tests/scaffold/03-call.c
lib/tests/scaffold/04-call-0.c
lib/tests/scaffold/05-call-1.c
lib/tests/scaffold/06-call-not-1.c
lib/tests/scaffold/06-not-call-1.c
lib/tests/scaffold/06-call-2.c
lib/tests/scaffold/06-call-string.c
lib/tests/scaffold/06-call-variable.c
lib/tests/scaffold/06-return-void.c
lib/tests/scaffold/07-include.c
lib/tests/scaffold/08-assign.c
lib/tests/scaffold/08-assign-negative.c
lib/tests/scaffold/08-assign-global.c
lib/tests/scaffold/10-if-0.c
lib/tests/scaffold/11-if-1.c
lib/tests/scaffold/12-if-eq.c
lib/tests/scaffold/13-if-neq.c
lib/tests/scaffold/14-if-goto.c
lib/tests/scaffold/15-if-not-f.c
lib/tests/scaffold/16-if-t.c
lib/tests/scaffold/17-compare-char.c
lib/tests/scaffold/17-compare-ge.c
lib/tests/scaffold/17-compare-gt.c
lib/tests/scaffold/17-compare-le.c
lib/tests/scaffold/17-compare-lt.c
lib/tests/scaffold/17-compare-unsigned-ge.c
lib/tests/scaffold/17-compare-unsigned-gt.c
lib/tests/scaffold/17-compare-unsigned-le.c
lib/tests/scaffold/17-compare-unsigned-lt.c
lib/tests/scaffold/17-compare-unsigned-char-le.c
lib/tests/scaffold/17-compare-unsigned-short-le.c
lib/tests/scaffold/17-compare-unsigned-long-le.c
lib/tests/scaffold/17-compare-and.c
lib/tests/scaffold/17-compare-or.c
lib/tests/scaffold/17-compare-and-or.c
lib/tests/scaffold/17-compare-assign.c
lib/tests/scaffold/17-compare-call.c
lib/tests/scaffold/18-assign-shadow.c
lib/tests/scaffold/20-while.c
lib/tests/scaffold/21-char-array-simple.c
lib/tests/scaffold/21-char-array.c
lib/tests/scaffold/22-while-char-array.c
lib/tests/scaffold/23-global-pointer-init-null.c
lib/tests/scaffold/23-global-pointer-init.c
lib/tests/scaffold/23-global-pointer-ref.c
lib/tests/scaffold/23-global-pointer-pointer-ref.c
lib/tests/scaffold/23-pointer-sub.c
lib/tests/scaffold/23-pointer.c
lib/tests/mes/30-oputs.c
lib/tests/mes/30-eputs.c
lib/tests/string/30-strlen.c
lib/tests/scaffold/30-exit-0.c
lib/tests/scaffold/30-exit-42.c
lib/tests/scaffold/32-call-wrap.c
lib/tests/scaffold/32-compare.c
lib/tests/scaffold/33-and-or.c
lib/tests/scaffold/34-pre-post.c
lib/tests/scaffold/35-compare-char.c
lib/tests/scaffold/36-compare-arithmetic.c
lib/tests/scaffold/37-compare-assign.c
lib/tests/scaffold/38-compare-call-2.c
lib/tests/scaffold/38-compare-call-3.c
lib/tests/scaffold/38-compare-call.c
lib/tests/scaffold/40-if-else.c
lib/tests/scaffold/41-ternary.c
lib/tests/scaffold/42-goto-label.c
lib/tests/scaffold/43-for-do-while.c
lib/tests/scaffold/44-switch.c
lib/tests/scaffold/44-switch-fallthrough.c
lib/tests/scaffold/44-switch-body-fallthrough.c
lib/tests/scaffold/45-void-call.c
lib/tests/scaffold/46-function-static.c
lib/tests/scaffold/47-function-expression.c
lib/tests/scaffold/48-global-static.c
lib/tests/assert/50-assert.c
lib/tests/mes/50-itoa.c
lib/tests/posix/50-getenv.c
lib/tests/stdlib/50-malloc.c
lib/tests/string/50-strcmp.c
lib/tests/string/50-strcpy.c
lib/tests/string/50-strncmp.c
lib/tests/posix/50-open-read.c
lib/tests/scaffold/51-pointer-sub.c
lib/tests/scaffold/54-argc.c
lib/tests/scaffold/54-argv.c
lib/tests/scaffold/55-char-array.c
lib/tests/scaffold/60-math.c
lib/tests/scaffold/61-array.c
lib/tests/scaffold/62-array.c
lib/tests/scaffold/63-struct.c
lib/tests/scaffold/63-struct-pointer.c
lib/tests/scaffold/63-struct-local.c
lib/tests/scaffold/63-struct-function.c
lib/tests/scaffold/63-struct-assign.c
lib/tests/scaffold/63-struct-array.c
lib/tests/scaffold/63-struct-array-assign.c
lib/tests/scaffold/63-struct-array-compare.c
lib/tests/scaffold/63-struct-cell.c
lib/tests/scaffold/64-make-cell.c
lib/tests/scaffold/65-read.c
lib/tests/scaffold/66-local-char-array.c
lib/tests/scaffold/70-stdarg.c
lib/tests/stdio/70-printf-hello.c
lib/tests/stdio/70-printf-simple.c
lib/tests/stdio/70-printf.c
lib/tests/stdlib/70-strtoull.c
lib/tests/string/70-strchr.c
lib/tests/scaffold/71-struct-array.c
lib/tests/scaffold/72-typedef-struct-def.c
lib/tests/scaffold/72-typedef-struct-def-local.c
lib/tests/scaffold/73-union-hello.c
lib/tests/scaffold/73-union.c
lib/tests/scaffold/74-multi-line-string.c
lib/tests/scaffold/75-struct-union.c
lib/tests/scaffold/76-pointer-arithmetic-pp.c
lib/tests/scaffold/76-pointer-arithmetic.c
lib/tests/scaffold/77-pointer-assign.c
lib/tests/scaffold/78-union-struct.c
lib/tests/scaffold/79-int-array-simple.c
lib/tests/scaffold/79-int-array.c
lib/tests/scaffold/7a-struct-char-array.c
lib/tests/scaffold/7b-struct-int-array-hello.c
lib/tests/scaffold/7b-struct-int-array-pointer.c
lib/tests/scaffold/7b-struct-int-array.c
lib/tests/scaffold/7c-dynarray.c
lib/tests/scaffold/7d-cast-char.c
lib/tests/scaffold/7e-struct-array-access.c
lib/tests/scaffold/7f-struct-pointer-arithmetic.c
lib/tests/scaffold/7g-struct-byte-word-field.c
lib/tests/scaffold/7h-struct-assign.c
lib/tests/scaffold/7i-struct-struct-simple.c
lib/tests/scaffold/7i-struct-struct.c
lib/tests/scaffold/7k-empty-for.c
lib/tests/scaffold/7k-for-each-elem-simple.c
lib/tests/scaffold/7k-for-each-elem.c
lib/tests/scaffold/7l-struct-any-size-array-simple.c
lib/tests/scaffold/7l-struct-any-size-array.c
lib/tests/scaffold/7m-struct-char-array-assign.c
lib/tests/scaffold/7n-struct-struct-array.c
lib/tests/scaffold/7o-struct-pre-post-simple.c
lib/tests/scaffold/7o-struct-pre-post.c
lib/tests/scaffold/7p-struct-cast.c
lib/tests/scaffold/7q-bit-field-simple.c
lib/tests/scaffold/7q-bit-field.c
lib/tests/scaffold/7r-sign-extend.c
lib/tests/scaffold/7s-struct-short.c
lib/tests/scaffold/7s-unsigned-compare.c
lib/tests/scaffold/7t-function-destruct.c
lib/tests/scaffold/7u-double.c
lib/tests/scaffold/7u-long-long.c
lib/tests/scaffold/7u-ternary-expression.c
lib/tests/scaffold/7u-call-ternary.c
lib/tests/scaffold/7u-inc-byte-word.c
lib/tests/scaffold/7u-struct-func.c
lib/tests/scaffold/7u-struct-size10.c
lib/tests/scaffold/7u-vstack.c
lib/tests/scaffold/70-array-in-struct-init.c
lib/tests/scaffold/70-struct-short-enum-init.c
lib/tests/scaffold/70-struct-post.c
lib/tests/scaffold/70-extern.c
lib/tests/setjmp/80-setjmp.c
lib/tests/stdio/80-sscanf.c
lib/tests/stdlib/80-qsort.c
lib/tests/stdlib/80-qsort-dupes.c
lib/tests/string/80-strncpy.c
lib/tests/string/80-strrchr.c
lib/tests/scaffold/82-define.c
lib/tests/scaffold/83-heterogenoous-init.c
lib/tests/scaffold/84-struct-field-list.c
lib/tests/scaffold/85-sizeof.c
"
if test -z "$bootstrap"; then
TESTS="$TESTS
lib/tests/dirent/90-readdir.c
lib/tests/io/90-stat.c
lib/tests/mes/90-abtod.c
lib/tests/mes/90-dtoab.c
lib/tests/posix/90-execlp.c
lib/tests/posix/90-unsetenv.c
lib/tests/signal/90-signal.c
lib/tests/stdio/90-fopen.c
lib/tests/stdio/90-fopen-append.c
lib/tests/stdio/90-fread-fwrite.c
lib/tests/stdio/90-fseek.c
lib/tests/stdio/90-sprintf.c
lib/tests/stdlib/90-strtol.c
lib/tests/string/90-snprintf.c
lib/tests/string/90-strpbrk.c
lib/tests/string/90-strspn.c
lib/tests/scaffold/90-goto-var.c
lib/tests/scaffold/91-goto-array.c
lib/tests/scaffold/a0-call-trunc-char.c
lib/tests/scaffold/a0-call-trunc-short.c
lib/tests/scaffold/a0-call-trunc-int.c
lib/tests/scaffold/a0-math-divide-signed-negative.c
lib/tests/scaffold/a1-global-no-align.c
lib/tests/scaffold/a1-global-no-clobber.c
"
fi
XFAIL_TESTS="
lib/tests/stdio/90-sprintf.c
"
if test $compiler = mescc; then
XFAIL_TESTS="$XFAIL_TESTS
lib/tests/scaffold/17-compare-unsigned-char-le.c
lib/tests/scaffold/17-compare-unsigned-short-le.c
lib/tests/scaffold/66-local-char-array.c
lib/tests/scaffold/72-typedef-struct-def-local.c
lib/tests/mes/90-abtod.c
lib/tests/mes/90-dtoab.c
lib/tests/scaffold/90-goto-var.c
lib/tests/scaffold/91-goto-array.c
"
if test $mes_cpu = x86; then
XFAIL_TESTS="$XFAIL_TESTS
"
fi
if test $mes_cpu = x86_64; then
XFAIL_TESTS="$XFAIL_TESTS
lib/tests/scaffold/a0-call-trunc-int.c
"
fi
fi
if test $mes_cpu = x86_64; then
XFAIL_TESTS="$XFAIL_TESTS
lib/tests/stdio/70-printf-stdarg.c
"
fi
if test $compiler = gcc; then
XFAIL_TESTS="$XFAIL_TESTS
"
if test $mes_cpu = x86; then
XFAIL_TESTS="$XFAIL_TESTS
lib/tests/mes/90-dtoab.c
"
fi
if test $mes_cpu = x86_64; then
XFAIL_TESTS="$XFAIL_TESTS
lib/tests/stdio/70-printf-hello.c
lib/tests/stdio/70-printf-simple.c
lib/tests/stdio/70-printf.c
lib/tests/scaffold/70-extern.c
lib/tests/stdio/80-sscanf.c
lib/tests/posix/90-execlp.c
lib/tests/string/90-snprintf.c
"
fi
fi
recheck=${recheck-false}
test_ext=.c
log_compiler="${SHELL} ${srcdest}build-aux/test-c.sh"
. ${srcdest}build-aux/test-suite.sh

View file

@ -0,0 +1,101 @@
#! /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
MES_ARENA=${MES_ARENA-20000000}
export MES_ARENA
MES_MAX_ARENA=${MES_MAX_ARENA-${MES_ARENA}}
export MES_MAX_ARENA
MES_STACK=${MES_STACK-5000000}
export MES_STACK
. ./config.sh
if $courageous; then
echo "Applying courage"
set +e
fi
CFLAGS=
if test $mes_libc = mes; then
CFLAGS="${CFLAGS}
-static
-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
recheck=${recheck-false}
export recheck
./pre-inst-env ${SHELL} ${srcdest}build-aux/check-boot.sh
./pre-inst-env ${SHELL} ${srcdest}build-aux/check-mes.sh
if test $compiler = gcc; then
(
cd gcc-lib
srcdest=$srcdir/../
srcdir=../$srcdir
../pre-inst-env ${SHELL} ${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 mesar"
CC="${srcdest}pre-inst-env mescc"
../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh
)

View file

@ -0,0 +1,82 @@
# 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/>.
AR:=@AR@
BASH:=@BASH@
BLOOD_ELF:=@BLOOD_ELF@
CC:=@CC@
CFLAGS:=@CFLAGS@
CPPFLAGS:=@CPPFLAGS@
DIFF:=@DIFF@
DOT:=@DOT@
GIT:=@GIT@
GUILD:=@GUILD@
GUILE:=@GUILE@
GUILE_EFFECTIVE_VERSION:=@GUILE_EFFECTIVE_VERSION@
GUILE_LOAD_PATH:=@GUILE_LOAD_PATH@
GUIX:=@GUIX@
HELP2MAN:=@HELP2MAN@
HEX2:=@HEX2@
LDFLAGS:=@LDFLAGS@
MAKEINFO:=@MAKEINFO@
M1:=@M1@
MES_FOR_BUILD:=@MES_FOR_BUILD@
NYACC:=@NYACC@
PACKAGE:=@PACKAGE@
PACKAGE_NAME:=@PACKAGE_NAME@
PACKAGE_BUGREPORT:=@PACKAGE_BUGREPORT@
PERL:=@PERL@
SCHEME:=@SCHEME@
SHELL:=@SHELL@
VERSION:=@VERSION@
V:=@V@
colors:=@colors@
abs_top_builddir:=@abs_top_builddir@
abs_top_srcdir:=@abs_top_srcdir@
arch:=@arch@
build:=@build@
host:=@host@
bootstrap:=@bootstrap@
compiler:=@compiler@
courageous:=@courageous@
mes_system:=@mes_system@
mes_cpu:=@mes_cpu@
mes_bits:=@mes_bits@
mes_libc:=@mes_libc@
mes_kernel:=@mes_kernel@
prefix:=@prefix@
bindir:=@bindir@
datadir:=@datadir@
docdir:=@docdir@
guile_site_ccache_dir:=@guile_site_ccache_dir@
guile_site_dir:=@guile_site_dir@
includedir:=@includedir@
infodir:=@infodir@
libdir:=@libdir@
mandir:=@mandir@
moduledir:=@moduledir@
with_glibc_p:=@with_glibc_p@
program_prefix:=@program_prefix@
srcdest:=@srcdest@
srcdir:=@srcdir@
sysconfdir:=@sysconfdir@
top_builddir:=@top_builddir@

View file

@ -0,0 +1,104 @@
# 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/>.
config_sh=1
AR=${AR-"@AR@"}
BASH="@BASH@"
BLOOD_ELF="@BLOOD_ELF@"
CC=${CC-"@CC@"}
CFLAGS=${CFLAGS-"@CFLAGS@"}
CPPFLAGS=${CPPFLAGS-"@CPPFLAGS@"}
DIFF=${DIFF-@DIFF@}
DOT="@DOT@"
GIT="@GIT@"
GUILD="@GUILD@"
GUILE="@GUILE@"
GUILE_EFFECTIVE_VERSION="@GUILE_EFFECTIVE_VERSION@"
GUILE_LOAD_PATH="@GUILE_LOAD_PATH@"
GUIX="@GUIX@"
HELP2MAN="@HELP2MAN@"
HEX2="@HEX2@"
LDFLAGS=${LDFLAGS-"@LDFLAGS@"}
MAKEINFO="@MAKEINFO@"
M1="@M1@"
MES_FOR_BUILD="@MES_FOR_BUILD@"
NYACC="@NYACC@"
PACKAGE="@PACKAGE@"
PACKAGE_NAME="@PACKAGE_NAME@"
PACKAGE_BUGREPORT="@PACKAGE_BUGREPORT@"
PERL="@PERL@"
#SCHEME="@SCHEME@"
SHELL="@SHELL@"
TINYCC_PREFIX="@TINYCC_PREFIX@"
VERSION="@VERSION@"
V=${V-"@V@"}
colors=${colors-@colors@}
abs_top_builddir="@abs_top_builddir@"
abs_top_srcdir="@abs_top_srcdir@"
arch="@arch@"
build="@build@"
host="@host@"
numbered_arch=${numbered_arch-"@numbered_arch@"}
bootstrap=${bootstrap-@bootstrap@}
compiler=${compiler-@compiler@}
courageous=${courageous-@courageous@}
mes_system=@mes_system@
mes_cpu=@mes_cpu@
mes_bits=@mes_bits@
mes_libc=@mes_libc@
mes_kernel=@mes_kernel@
prefix="@prefix@"
bindir="@bindir@"
datadir="@datadir@"
pkgdatadir="@pkgdatadir@"
docdir="@docdir@"
guile_site_ccache_dir="@guile_site_ccache_dir@"
guile_site_dir="@guile_site_dir@"
includedir="@includedir@"
infodir="@infodir@"
libdir="@libdir@"
mandir="@mandir@"
moduledir="@moduledir@"
with_glibc_p="@with_glibc_p@"
program_prefix="@program_prefix@"
srcdest=${srcdest-"@srcdest@"}
srcdir=${srcdir-"@srcdir@"}
sysconfdir="@sysconfdir@"
top_builddir="@top_builddir@"
MES_PREFIX=${MES_PREFIX-$abs_top_srcdir}
export PACKAGE
export PACKAGE_NAME
export PACKAGE_BUGREPORT
export AR
export CC
export DIFF
export SHELL
export V
export colors
export compiler
export courageous
export srcdest
export srcdir
export GUILE_AUTO_COMPILE
export MES_PREFIX

View file

@ -0,0 +1,422 @@
#! /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
libc_mini_shared_SOURCES="
lib/mes/eputs.c
lib/mes/oputs.c
"
if test $mes_libc = mes; then
libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES
lib/$mes_kernel/$mes_cpu-mes-$compiler/mini.c
lib/stdlib/exit.c
lib/stdlib/puts.c
lib/string/strlen.c
"
if test $mes_kernel = gnu; then
libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES
lib/gnu/_exit.c
lib/gnu/exec-startup-get-data.c
lib/gnu/fd-get.c
lib/gnu/fd-write.c
lib/gnu/io-write.c
lib/gnu/_write.c
lib/gnu/hurd-start.c
lib/gnu/proc-mark-exit.c
lib/gnu/syscall.c
lib/gnu/task-get-special-port.c
lib/gnu/task-terminate.c
lib/gnu/vm-statistics.c
lib/mach/mach-init.c
lib/mach/mach_host_self.S
lib/mach/mach_msg_trap.S
lib/mach/mach_reply_port.S
lib/mach/mach_task_self.S
lib/mach/mach_thread_self.S
lib/mach/msg.c
lib/string/argz-extract.c
"
fi
fi
libc_mini_SOURCES="$libc_mini_shared_SOURCES"
if test $mes_libc = mes; then
libc_mini_SOURCES="$libc_mini_SOURCES
lib/mes/mini-write.c
"
fi
libmes_SOURCES="
$libc_mini_shared_SOURCES
lib/ctype/isnumber.c
lib/mes/abtol.c
lib/mes/div.c
lib/mes/eputc.c
lib/mes/fdgetc.c
lib/mes/fdputc.c
lib/mes/fdputs.c
lib/mes/fdungetc.c
lib/mes/itoa.c
lib/mes/ltoa.c
lib/mes/ltoab.c
lib/mes/mes_open.c
lib/mes/ntoab.c
lib/mes/oputc.c
lib/mes/ultoa.c
lib/mes/utoa.c
"
if test $mes_libc = mes; then
libmes_SOURCES="$libmes_SOURCES
lib/ctype/isdigit.c
lib/ctype/isspace.c
lib/ctype/isxdigit.c
lib/posix/write.c
lib/stdlib/atoi.c
"
if test $mes_kernel = gnu; then
libmes_SOURCES="$libmes_SOURCES
lib/stub/lseek.c
"
fi
if test $mes_kernel = linux; then
libmes_SOURCES="$libmes_SOURCES
lib/linux/lseek.c
"
fi
else
libmes_SOURCES="$libmes_SOURCES
lib/mes/abtod.c
lib/mes/dtoab.c
"
fi
libc_SOURCES="
$libmes_SOURCES
lib/mes/__assert_fail.c
lib/mes/__buffered_read.c
lib/mes/__mes_debug.c
lib/posix/execv.c
lib/posix/getcwd.c
lib/posix/getenv.c
lib/posix/isatty.c
lib/posix/open.c
lib/posix/buffered-read.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/memmove.c
lib/string/memset.c
lib/string/strcmp.c
lib/string/strcpy.c
lib/string/strncmp.c
"
if test $mes_kernel = gnu; then
libc_SOURCES="$libc_SOURCES
lib/gnu/_open3.c
lib/gnu/_read.c
lib/gnu/dir-lookup.c
lib/gnu/fd-read.c
lib/gnu/io-read.c
lib/gnu/malloc.c
lib/gnu/vm-allocate.c
lib/stub/access.c
lib/stub/brk.c
lib/stub/chmod.c
lib/stub/clock_gettime.c
lib/stub/dup2.c
lib/stub/dup.c
lib/stub/execve.c
lib/stub/fork.c
lib/stub/_getcwd.c
lib/stub/gettimeofday.c
lib/stub/ioctl.c
lib/stub/time.c
lib/stub/unlink.c
lib/stub/waitpid.c
"
fi
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/_open3.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/abtod.c
lib/mes/dtoab.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/strtod.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/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/$mes_cpu-mes-$compiler/setjmp.c
"
if test $mes_kernel = linux; then
libc_tcc_SOURCES="$libc_tcc_SOURCES
lib/linux/close.c
lib/linux/rmdir.c
lib/linux/stat.c
"
fi
if test $mes_kernel = gnu; then
libc_tcc_SOURCES="$libc_tcc_SOURCES
lib/stub/close.c
lib/stub/rmdir.c
lib/stub/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/isgraph.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/ceil.c
lib/math/fabs.c
lib/math/floor.c
lib/mes/fdgets.c
lib/posix/alarm.c
lib/posix/execl.c
lib/posix/execlp.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/fscanf.c
lib/stdio/perror.c
lib/stdio/vfscanf.c
lib/stdlib/__exit.c
lib/stdlib/abort.c
lib/stdlib/abs.c
lib/stdlib/alloca.c
lib/stdlib/atexit.c
lib/stdlib/atof.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/atan2.c
lib/stub/bsearch.c
lib/stub/chown.c
lib/stub/cos.c
lib/stub/ctime.c
lib/stub/exp.c
lib/stub/fpurge.c
lib/stub/freadahead.c
lib/stub/frexp.c
lib/stub/getgrgid.c
lib/stub/getgrnam.c
lib/stub/getlogin.c
lib/stub/getpgid.c
lib/stub/getpgrp.c
lib/stub/getpwnam.c
lib/stub/getpwuid.c
lib/stub/gmtime.c
lib/stub/log.c
lib/stub/mktime.c
lib/stub/modf.c
lib/stub/pclose.c
lib/stub/popen.c
lib/stub/pow.c
lib/stub/rand.c
lib/stub/rewind.c
lib/stub/setbuf.c
lib/stub/setgrent.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/sin.c
lib/stub/sqrt.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/mknod.c
lib/linux/nanosleep.c
lib/linux/pipe.c
lib/linux/readlink.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
lib/linux/symlink.c
"
fi
mes_SOURCES="
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
"

View file

@ -0,0 +1,160 @@
# 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/>.
export PACKAGE
export PACKAGE_NAME
export PACKAGE_BUGREPORT
export VERSION
export abs_top_builddir
export abs_top_srcdir
export top_builddir
export config.make
export srcdest
export srcdir
export prefix
export datadir
export docdir
export bindir
export guile_site_ccache_dir
export guile_site_dir
export infodir
export libdir
export mandir
export moduledir
export sysconfdir
export bootstrap
export compiler
export courageous
export mes_system
export mes_cpu
export mes_bits
export mes_libc
export mes_kernel
ifdef V
export V
endif
ifdef DESTDIR
export DESTDIR
endif
ifdef CC
export CC
endif
ifdef BLOOD_ELF
export BLOOD_ELF
endif
ifdef DOT
export DOT
endif
ifdef M1
export M1
endif
ifdef MES
export MES
endif
ifdef MES_FOR_BUILD
export MES_FOR_BUILD
endif
ifdef MESCC
export MESCC
endif
ifdef HEX2
export HEX2
endif
ifdef HELP2MAN
export HELP2MAN
endif
ifdef GUILE
export GUILE
endif
ifdef GUILD
export GUILD
endif
ifdef GUIX
export GUIX
endif
ifdef PERL
export PERL
endif
ifdef SCHEME
export SCHEME
endif
ifdef SHELL
export SHELL
endif
ifdef GUILE_LOAD_PATH
export GUILE_LOAD_PATH
endif
ifdef GUILE_LOAD_COMPILED_PATH
export GUILE_LOAD_COMPILED_PATH
endif
ifdef AM_CFLAGS
export AM_CFLAGS
endif
ifdef AM_CPPFLAGS
export AM_CPPFLAGS
endif
ifdef AM_LDFLAGS
export AM_LDFLAGS
endif
ifdef CFLAGS
export CFLAGS
endif
ifdef CPPFLAGS
export CPPFLAGS
endif
ifdef LDFLAGS
export LDFLAGS
endif
ifdef HEX2FLAGS
export HEX2FLAGS
endif
ifdef M1FLAGS
export M1FLAGS
endif

View file

@ -0,0 +1,510 @@
#!/bin/sh -e
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
scriptversion=2018-03-06.19
# Copyright 2003-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 3 of the License, 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/>.
#
# Original author: Mohit Agarwal.
# Send bug reports and any other correspondence to bug-gnulib@gnu.org.
#
# The latest version of this script, and the companion template, is
# available from the Gnulib repository:
#
# https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh
# https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template
# TODO:
# - image importing was only implemented for HTML generated by
# makeinfo. But it should be simple enough to adjust.
# - images are not imported in the source tarball. All the needed
# formats (PDF, PNG, etc.) should be included.
prog=`basename "$0"`
srcdir=`pwd`
scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}
: ${MAKEINFO="makeinfo"}
: ${TEXI2DVI="texi2dvi"}
: ${DOCBOOK2HTML="docbook2html"}
: ${DOCBOOK2PDF="docbook2pdf"}
: ${DOCBOOK2TXT="docbook2txt"}
: ${GENDOCS_TEMPLATE_DIR="."}
: ${PERL='perl'}
: ${TEXI2HTML="texi2html"}
unset CDPATH
unset use_texi2html
MANUAL_TITLE=
PACKAGE=
EMAIL=webmasters@gnu.org # please override with --email
commonarg= # passed to all makeinfo/texi2html invcations.
dirargs= # passed to all tools (-I dir).
dirs= # -I directories.
htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
default_htmlarg=true
infoarg=--no-split
generate_ascii=true
generate_html=true
generate_info=true
generate_tex=true
outdir=manual
source_extra=
split=node
srcfile=
texarg="-t @finalout"
version="gendocs.sh $scriptversion
Copyright 2018 Free Software Foundation, Inc.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
Generate output in various formats from PACKAGE.texinfo (or .texi or
.txi) source. See the GNU Maintainers document for a more extensive
discussion:
https://www.gnu.org/prep/maintain_toc.html
Options:
--email ADR use ADR as contact in generated web pages; always give this.
-s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
-o OUTDIR write files into OUTDIR, instead of manual/.
-I DIR append DIR to the Texinfo search path.
--common ARG pass ARG in all invocations.
--html ARG pass ARG to makeinfo or texi2html for HTML targets,
instead of '$htmlarg'.
--info ARG pass ARG to makeinfo for Info, instead of --no-split.
--no-ascii skip generating the plain text output.
--no-html skip generating the html output.
--no-info skip generating the info output.
--no-tex skip generating the dvi and pdf output.
--source ARG include ARG in tar archive of sources.
--split HOW make split HTML by node, section, chapter; default node.
--tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout.
--texi2html use texi2html to make HTML target, with all split versions.
--docbook convert through DocBook too (xml, txt, html, pdf).
--help display this help and exit successfully.
--version display version information and exit successfully.
Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
Typical sequence:
cd PACKAGESOURCE/doc
wget \"$scripturl\"
wget \"$templateurl\"
$prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
Output will be in a new subdirectory \"manual\" (by default;
use -o OUTDIR to override). Move all the new files into your web CVS
tree, as explained in the Web Pages node of maintain.texi.
Please use the --email ADDRESS option so your own bug-reporting
address will be used in the generated HTML pages.
MANUAL-TITLE is included as part of the HTML <title> of the overall
manual/index.html file. It should include the name of the package being
documented. manual/index.html is created by substitution from the file
$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the
generic template for your own purposes.)
If you have several manuals, you'll need to run this script several
times with different MANUAL values, specifying a different output
directory with -o each time. Then write (by hand) an overall index.html
with links to them all.
If a manual's Texinfo sources are spread across several directories,
first copy or symlink all Texinfo sources into a single directory.
(Part of the script's work is to make a tar.gz of the sources.)
As implied above, by default monolithic Info files are generated.
If you want split Info, or other Info options, use --info to override.
You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
and PERL to control the programs that get executed, and
GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
looked for. With --docbook, the environment variables DOCBOOK2HTML,
DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
By default, makeinfo and texi2dvi are run in the default (English)
locale, since that's the language of most Texinfo manuals. If you
happen to have a non-English manual and non-English web site, see the
SETLANG setting in the source.
Email bug reports or enhancement requests to bug-gnulib@gnu.org.
"
while test $# -gt 0; do
case $1 in
-s) shift; srcfile=$1;;
-o) shift; outdir=$1;;
-I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";;
--common) shift; commonarg=$1;;
--docbook) docbook=yes;;
--email) shift; EMAIL=$1;;
--html) shift; default_htmlarg=false; htmlarg=$1;;
--info) shift; infoarg=$1;;
--no-ascii) generate_ascii=false;;
--no-html) generate_ascii=false;;
--no-info) generate_info=false;;
--no-tex) generate_tex=false;;
--source) shift; source_extra=$1;;
--split) shift; split=$1;;
--tex) shift; texarg=$1;;
--texi2html) use_texi2html=1;;
--help) echo "$usage"; exit 0;;
--version) echo "$version"; exit 0;;
-*)
echo "$0: Unknown option \`$1'." >&2
echo "$0: Try \`--help' for more information." >&2
exit 1;;
*)
if test -z "$PACKAGE"; then
PACKAGE=$1
elif test -z "$MANUAL_TITLE"; then
MANUAL_TITLE=$1
else
echo "$0: extra non-option argument \`$1'." >&2
exit 1
fi;;
esac
shift
done
# makeinfo uses the dirargs, but texi2dvi doesn't.
commonarg=" $dirargs $commonarg"
# For most of the following, the base name is just $PACKAGE
base=$PACKAGE
if $default_htmlarg && test -n "$use_texi2html"; then
# The legacy texi2html doesn't support TOP_NODE_UP_URL
htmlarg="--css-ref=/software/gnulib/manual.css"
fi
if test -n "$srcfile"; then
# but here, we use the basename of $srcfile
base=`basename "$srcfile"`
case $base in
*.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;;
esac
PACKAGE=$base
elif test -s "$srcdir/$PACKAGE.texinfo"; then
srcfile=$srcdir/$PACKAGE.texinfo
elif test -s "$srcdir/$PACKAGE.texi"; then
srcfile=$srcdir/$PACKAGE.texi
elif test -s "$srcdir/$PACKAGE.txi"; then
srcfile=$srcdir/$PACKAGE.txi
else
echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2
exit 1
fi
if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2
echo "$0: it is available from $templateurl." >&2
exit 1
fi
# Function to return size of $1 in something resembling kilobytes.
calcsize()
{
size=`ls -ksl $1 | awk '{print $1}'`
echo $size
}
# copy_images OUTDIR HTML-FILE...
# -------------------------------
# Copy all the images needed by the HTML-FILEs into OUTDIR.
# Look for them in . and the -I directories; this is simpler than what
# makeinfo supports with -I, but hopefully it will suffice.
copy_images()
{
local odir
odir=$1
shift
$PERL -n -e "
BEGIN {
\$me = '$prog';
\$odir = '$odir';
@dirs = qw(. $dirs);
}
" -e '
/<img src="(.*?)"/g && ++$need{$1};
END {
#print "$me: @{[keys %need]}\n"; # for debugging, show images found.
FILE: for my $f (keys %need) {
for my $d (@dirs) {
if (-f "$d/$f") {
use File::Basename;
my $dest = dirname ("$odir/$f");
#
use File::Path;
-d $dest || mkpath ($dest)
|| die "$me: cannot mkdir $dest: $!\n";
#
use File::Copy;
copy ("$d/$f", $dest)
|| die "$me: cannot copy $d/$f to $dest: $!\n";
next FILE;
}
}
die "$me: $ARGV: cannot find image $f\n";
}
}
' -- "$@" || exit 1
}
case $outdir in
/*) abs_outdir=$outdir;;
*) abs_outdir=$srcdir/$outdir;;
esac
echo "Making output for $srcfile"
echo " in `pwd`"
mkdir -p "$outdir/"
#
if $generate_info; then
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
echo "Generating info... ($cmd)"
rm -f $PACKAGE.info* # get rid of any strays
eval "$cmd"
tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
ls -l "$outdir/$PACKAGE.info.tar.gz"
info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
# do not mv the info files, there's no point in having them available
# separately on the web.
fi # end info
#
if $generate_tex; then
cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
printf "\nGenerating dvi... ($cmd)\n"
eval "$cmd"
# compress/finish dvi:
gzip -f -9 $PACKAGE.dvi
dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
mv $PACKAGE.dvi.gz "$outdir/"
ls -l "$outdir/$PACKAGE.dvi.gz"
cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
printf "\nGenerating pdf... ($cmd)\n"
eval "$cmd"
pdf_size=`calcsize $PACKAGE.pdf`
mv $PACKAGE.pdf "$outdir/"
ls -l "$outdir/$PACKAGE.pdf"
fi # end tex (dvi + pdf)
#
if $generate_ascii; then
opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
printf "\nGenerating ascii... ($cmd)\n"
eval "$cmd"
ascii_size=`calcsize $PACKAGE.txt`
gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
mv $PACKAGE.txt "$outdir/"
ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
fi
#
if $generate_html; then
# Split HTML at level $1. Used for texi2html.
html_split()
{
opt="--split=$1 --node-files $commonarg $htmlarg"
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
printf "\nGenerating html by $1... ($cmd)\n"
eval "$cmd"
split_html_dir=$PACKAGE.html
(
cd ${split_html_dir} || exit 1
ln -sf ${PACKAGE}.html index.html
tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
)
eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
rm -f "$outdir"/html_$1/*.html
mkdir -p "$outdir/html_$1/"
mv ${split_html_dir}/*.html "$outdir/html_$1/"
rmdir ${split_html_dir}
}
if test -z "$use_texi2html"; then
opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
printf "\nGenerating monolithic html... ($cmd)\n"
rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html`
gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
copy_images "$outdir/" $PACKAGE.html
mv $PACKAGE.html "$outdir/"
ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
# Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
# it just always split by node. So if we're splitting by node anyway,
# leave it out.
if test "x$split" = xnode; then
split_arg=
else
split_arg=--split=$split
fi
#
opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
printf "\nGenerating html by $split... ($cmd)\n"
eval "$cmd"
split_html_dir=$PACKAGE.html
copy_images $split_html_dir/ $split_html_dir/*.html
(
cd $split_html_dir || exit 1
tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
)
eval \
html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
rm -rf "$outdir/html_$split/"
mv $split_html_dir "$outdir/html_$split/"
du -s "$outdir/html_$split/"
ls -l "$outdir/$PACKAGE.html_$split.tar.gz"
else # use texi2html:
opt="--output $PACKAGE.html $commonarg $htmlarg"
cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
printf "\nGenerating monolithic html with texi2html... ($cmd)\n"
rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html`
gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
mv $PACKAGE.html "$outdir/"
html_split node
html_split chapter
html_split section
fi
fi # end html
#
printf "\nMaking .tar.gz for sources...\n"
d=`dirname $srcfile`
(
cd "$d"
srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true
tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
)
texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
#
# Do everything again through docbook.
if test -n "$docbook"; then
opt="-o - --docbook $commonarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
printf "\nGenerating docbook XML... ($cmd)\n"
eval "$cmd"
docbook_xml_size=`calcsize $PACKAGE-db.xml`
gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
mv $PACKAGE-db.xml "$outdir/"
split_html_db_dir=html_node_db
opt="$commonarg -o $split_html_db_dir"
cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
printf "\nGenerating docbook HTML... ($cmd)\n"
eval "$cmd"
(
cd ${split_html_db_dir} || exit 1
tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
)
html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
rm -f "$outdir"/html_node_db/*.html
mkdir -p "$outdir/html_node_db"
mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
rmdir ${split_html_db_dir}
cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
printf "\nGenerating docbook ASCII... ($cmd)\n"
eval "$cmd"
docbook_ascii_size=`calcsize $PACKAGE-db.txt`
mv $PACKAGE-db.txt "$outdir/"
cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
printf "\nGenerating docbook PDF... ($cmd)\n"
eval "$cmd"
docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
mv $PACKAGE-db.pdf "$outdir/"
fi
#
printf "\nMaking index.html for $PACKAGE...\n"
if test -z "$use_texi2html"; then
CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
/%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
else
# should take account of --split here.
CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d"
fi
curdate=`$SETLANG date '+%B %d, %Y'`
sed \
-e "s!%%TITLE%%!$MANUAL_TITLE!g" \
-e "s!%%EMAIL%%!$EMAIL!g" \
-e "s!%%PACKAGE%%!$PACKAGE!g" \
-e "s!%%DATE%%!$curdate!g" \
-e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
-e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
-e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
-e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
-e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
-e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
-e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
-e "s!%%PDF_SIZE%%!$pdf_size!g" \
-e "s!%%ASCII_SIZE%%!$ascii_size!g" \
-e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
-e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
-e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
-e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
-e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
-e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
-e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
-e "s,%%SCRIPTURL%%,$scripturl,g" \
-e "s!%%SCRIPTNAME%%!$prog!g" \
-e "$CONDS" \
$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
echo "Done, see $outdir/ subdirectory for new files."
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -0,0 +1,499 @@
eval '(exit $?0)' && eval 'exec perl -wS "$0" "$@"'
& eval 'exec perl -wS "$0" $argv:q'
if 0;
# Convert git log output to ChangeLog format.
my $VERSION = '2019-12-08 20:13'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
# Copyright (C) 2008-2016 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 3 of the License, 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 <http://www.gnu.org/licenses/>.
# Written by Jim Meyering
use strict;
use warnings;
use Getopt::Long;
use POSIX qw(strftime);
(my $ME = $0) =~ s|.*/||;
# use File::Coda; # http://meyering.net/code/Coda/
END {
defined fileno STDOUT or return;
close STDOUT and return;
warn "$ME: failed to close standard output: $!\n";
$? ||= 1;
}
sub usage ($)
{
my ($exit_code) = @_;
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
if ($exit_code != 0)
{
print $STREAM "Try '$ME --help' for more information.\n";
}
else
{
print $STREAM <<EOF;
Usage: $ME [OPTIONS] [ARGS]
Convert git log output to ChangeLog format. If present, any ARGS
are passed to "git log". To avoid ARGS being parsed as options to
$ME, they may be preceded by '--'.
OPTIONS:
--amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that
makes a change to SHA1's commit log text or metadata.
--append-dot append a dot to the first line of each commit message if
there is no other punctuation or blank at the end.
--no-cluster never cluster commit messages under the same date/author
header; the default is to cluster adjacent commit messages
if their headers are the same and neither commit message
contains multiple paragraphs.
--srcdir=DIR the root of the source tree, from which the .git/
directory can be derived.
--since=DATE convert only the logs since DATE;
the default is to convert all log entries.
--until=DATE convert only the logs older than DATE.
--ignore-matching=PAT ignore commit messages whose first lines match PAT.
--ignore-line=PAT ignore lines of commit messages that match PAT.
--format=FMT set format string for commit subject and body;
see 'man git-log' for the list of format metacharacters;
the default is '%s%n%b%n'
--strip-tab remove one additional leading TAB from commit message lines.
--strip-cherry-pick remove data inserted by "git cherry-pick";
this includes the "cherry picked from commit ..." line,
and the possible final "Conflicts:" paragraph.
--help display this help and exit
--version output version information and exit
EXAMPLE:
$ME --since=2008-01-01 > ChangeLog
$ME -- -n 5 foo > last-5-commits-to-branch-foo
SPECIAL SYNTAX:
The following types of strings are interpreted specially when they appear
at the beginning of a log message line. They are not copied to the output.
Copyright-paperwork-exempt: Yes
Append the "(tiny change)" notation to the usual "date name email"
ChangeLog header to mark a change that does not require a copyright
assignment.
Co-authored-by: Joe User <user\@example.com>
List the specified name and email address on a second
ChangeLog header, denoting a co-author.
Signed-off-by: Joe User <user\@example.com>
These lines are simply elided.
In a FILE specified via --amend, comment lines (starting with "#") are ignored.
FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on
a line) referring to a commit in the current project, and CODE refers to one
or more consecutive lines of Perl code. Pairs must be separated by one or
more blank line.
Here is sample input for use with --amend=FILE, from coreutils:
3a169f4c5d9159283548178668d2fae6fced3030
# fix typo in title:
s/all tile types/all file types/
1379ed974f1fa39b12e2ffab18b3f7a607082202
# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself.
# Change the author to be Paul. Note the escaped "@":
s,Jim .*>,Paul Eggert <eggert\\\@cs.ucla.edu>,
EOF
}
exit $exit_code;
}
# If the string $S is a well-behaved file name, simply return it.
# If it contains white space, quotes, etc., quote it, and return the new string.
sub shell_quote($)
{
my ($s) = @_;
if ($s =~ m![^\w+/.,-]!)
{
# Convert each single quote to '\''
$s =~ s/\'/\'\\\'\'/g;
# Then single quote the string.
$s = "'$s'";
}
return $s;
}
sub quoted_cmd(@)
{
return join (' ', map {shell_quote $_} @_);
}
# Parse file F.
# Comment lines (starting with "#") are ignored.
# F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1
# (alone on a line) referring to a commit in the current project, and
# CODE refers to one or more consecutive lines of Perl code.
# Pairs must be separated by one or more blank line.
sub parse_amend_file($)
{
my ($f) = @_;
open F, '<', $f
or die "$ME: $f: failed to open for reading: $!\n";
my $fail;
my $h = {};
my $in_code = 0;
my $sha;
while (defined (my $line = <F>))
{
$line =~ /^\#/
and next;
chomp $line;
$line eq ''
and $in_code = 0, next;
if (!$in_code)
{
$line =~ /^([0-9a-fA-F]{40})$/
or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"),
$fail = 1, next;
$sha = lc $1;
$in_code = 1;
exists $h->{$sha}
and (warn "$ME: $f:$.: duplicate SHA1\n"),
$fail = 1, next;
}
else
{
$h->{$sha} ||= '';
$h->{$sha} .= "$line\n";
}
}
close F;
$fail
and exit 1;
return $h;
}
# git_dir_option $SRCDIR
#
# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR
# is undef). Return as a list (0 or 1 element).
sub git_dir_option($)
{
my ($srcdir) = @_;
my @res = ();
if (defined $srcdir)
{
my $qdir = shell_quote $srcdir;
my $cmd = "cd $qdir && git rev-parse --show-toplevel";
my $qcmd = shell_quote $cmd;
my $git_dir = qx($cmd);
defined $git_dir
or die "$ME: cannot run $qcmd: $!\n";
$? == 0
or die "$ME: $qcmd had unexpected exit code or signal ($?)\n";
chomp $git_dir;
push @res, "--git-dir=$git_dir/.git";
}
@res;
}
{
my $since_date;
my $until_date;
my $format_string = '%s%n%b%n';
my $amend_file;
my $append_dot = 0;
my $cluster = 1;
my $ignore_matching;
my $ignore_line;
my $strip_tab = 0;
my $strip_cherry_pick = 0;
my $srcdir;
GetOptions
(
help => sub { usage 0 },
version => sub { print "$ME version $VERSION\n"; exit },
'since=s' => \$since_date,
'until=s' => \$until_date,
'format=s' => \$format_string,
'amend=s' => \$amend_file,
'append-dot' => \$append_dot,
'cluster!' => \$cluster,
'ignore-matching=s' => \$ignore_matching,
'ignore-line=s' => \$ignore_line,
'strip-tab' => \$strip_tab,
'strip-cherry-pick' => \$strip_cherry_pick,
'srcdir=s' => \$srcdir,
) or usage 1;
defined $since_date
and unshift @ARGV, "--since=$since_date";
defined $until_date
and unshift @ARGV, "--until=$until_date";
# This is a hash that maps an SHA1 to perl code (i.e., s/old/new/)
# that makes a correction in the log or attribution of that commit.
my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
my @cmd = ('git',
git_dir_option $srcdir,
qw(log --log-size),
'--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV);
open PIPE, '-|', @cmd
or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n"
. "(Is your Git too old? Version 1.5.1 or later is required.)\n");
my $prev_multi_paragraph;
my $prev_date_line = '';
my @prev_coauthors = ();
my @skipshas = ();
while (1)
{
defined (my $in = <PIPE>)
or last;
$in =~ /^log size (\d+)$/
or die "$ME:$.: Invalid line (expected log size):\n$in";
my $log_nbytes = $1;
my $log;
my $n_read = read PIPE, $log, $log_nbytes;
$n_read == $log_nbytes
or die "$ME:$.: unexpected EOF\n";
# Extract leading hash.
my ($sha, $rest) = split ':', $log, 2;
defined $sha
or die "$ME:$.: malformed log entry\n";
$sha =~ /^[0-9a-fA-F]{40}$/
or die "$ME:$.: invalid SHA1: $sha\n";
my $skipflag = 0;
if (@skipshas)
{
foreach(@skipshas)
{
if ($sha =~ /^$_/)
{
$skipflag = $_;
last;
}
}
}
# If this commit's log requires any transformation, do it now.
my $code = $amend_code->{$sha};
if (defined $code)
{
eval 'use Safe';
my $s = new Safe;
# Put the unpreprocessed entry into "$_".
$_ = $rest;
# Let $code operate on it, safely.
my $r = $s->reval("$code")
or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n";
# Note that we've used this entry.
delete $amend_code->{$sha};
# Update $rest upon success.
$rest = $_;
}
# Remove lines inserted by "git cherry-pick".
if ($strip_cherry_pick)
{
$rest =~ s/^\s*Conflicts:\n.*//sm;
$rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m;
}
my @line = split /[ \t]*\n/, $rest;
my $author_line = shift @line;
defined $author_line
or die "$ME:$.: unexpected EOF\n";
$author_line =~ /^(\d+) (.*>)$/
or die "$ME:$.: Invalid line "
. "(expected date/author/email):\n$author_line\n";
# Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog
# `(tiny change)' annotation.
my $tiny = (grep (/^(?:Copyright-paperwork-exempt|Tiny-change):\s+[Yy]es$/, @line)
? ' (tiny change)' : '');
my $date_line = sprintf "%s %s$tiny\n",
strftime ("%Y-%m-%d", gmtime ($1)), $2;
my @coauthors = grep /^Co-authored-by:.*$/, @line;
# Omit meta-data lines we've already interpreted.
@line = grep !/^(?:Signed-off-by:[ ].*>$
|Co-authored-by:[ ]
|Copyright-paperwork-exempt:[ ]
|Tiny-change:[ ]
)/x, @line;
# Remove leading and trailing blank lines.
if (@line)
{
while ($line[0] =~ /^\s*$/) { shift @line; }
while ($line[$#line] =~ /^\s*$/) { pop @line; }
}
# Handle Emacs gitmerge.el "skipped" commits.
# Yes, this should be controlled by an option. So sue me.
if ( grep /^(; )?Merge from /, @line )
{
my $found = 0;
foreach (@line)
{
if (grep /^The following commit.*skipped:$/, $_)
{
$found = 1;
## Reset at each merge to reduce chance of false matches.
@skipshas = ();
next;
}
if ($found && $_ =~ /^([0-9a-fA-F]{7,}) [^ ]/)
{
push ( @skipshas, $1 );
}
}
}
# Ignore commits that match the --ignore-matching pattern, if specified.
if (defined $ignore_matching && @line && $line[0] =~ /$ignore_matching/)
{
$skipflag = 1;
}
elsif ($skipflag)
{
## Perhaps only warn if a pattern matches more than once?
warn "$ME: warning: skipping $sha due to $skipflag\n";
}
if (! $skipflag)
{
if (defined $ignore_line && @line)
{
@line = grep ! /$ignore_line/, @line;
while ($line[$#line] =~ /^\s*$/) { pop @line; }
}
# Record whether there are two or more paragraphs.
my $multi_paragraph = grep /^\s*$/, @line;
# Format 'Co-authored-by: A U Thor <email@example.com>' lines in
# standard multi-author ChangeLog format.
for (@coauthors)
{
s/^Co-authored-by:\s*/\t /;
s/\s*</ </;
/<.*?@.*\..*>/
or warn "$ME: warning: missing email address for "
. substr ($_, 5) . "\n";
}
# If clustering of commit messages has been disabled, if this header
# would be different from the previous date/name/etc. header,
# or if this or the previous entry consists of two or more paragraphs,
# then print the header.
if ( ! $cluster
|| $date_line ne $prev_date_line
|| "@coauthors" ne "@prev_coauthors"
|| $multi_paragraph
|| $prev_multi_paragraph)
{
$prev_date_line eq ''
or print "\n";
print $date_line;
@coauthors
and print join ("\n", @coauthors), "\n";
}
$prev_date_line = $date_line;
@prev_coauthors = @coauthors;
$prev_multi_paragraph = $multi_paragraph;
# If there were any lines
if (@line == 0)
{
warn "$ME: warning: empty commit message:\n $date_line\n";
}
else
{
if ($append_dot)
{
# If the first line of the message has enough room, then
if (length $line[0] < 72)
{
# append a dot if there is no other punctuation or blank
# at the end.
$line[0] =~ /[[:punct:]\s]$/
or $line[0] .= '.';
}
}
# Remove one additional leading TAB from each line.
$strip_tab
and map { s/^\t// } @line;
# Prefix each non-empty line with a TAB.
@line = map { length $_ ? "\t$_" : '' } @line;
print "\n", join ("\n", @line), "\n";
}
}
defined ($in = <PIPE>)
or last;
$in ne "\n"
and die "$ME:$.: unexpected line:\n$in";
}
close PIPE
or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
# FIXME-someday: include $PROCESS_STATUS in the diagnostic
# Complain about any unused entry in the --amend=F specified file.
my $fail = 0;
foreach my $sha (keys %$amend_code)
{
warn "$ME:$amend_file: unused entry: $sha\n";
$fail = 1;
}
exit $fail;
}
# Local Variables:
# mode: perl
# indent-tabs-mode: nil
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "my $VERSION = '"
# time-stamp-format: "%:y-%02m-%02d %02H:%02M"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "'; # UTC"
# End:

View file

@ -0,0 +1,21 @@
#! /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/>.
for i in $(find . -name '*.c' -o -name '*.h' -o -name '*.i'); do indent $i --no-tabs --line-length 110 --honour-newlines; done

View file

@ -0,0 +1,133 @@
#! @SHELL@
# 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
. ./config.sh
v=
_v=
if test "$V" = 2; then
set -x
fi
if test -n "$V"; then
if test "$V" -gt 0; then
v=v
_v=-v
fi
fi
set -u
# Use bash or lose if pipes fail
if test -n "$BASHOPTS"; then
set -o pipefail
fi
DESTDIR=${DESTDIR-}
mkdir -p ${DESTDIR}${bindir}
cp $_v bin/mes ${DESTDIR}${bindir}/mes
if test -f bin/mes-gcc; then
cp $_v bin/mes-gcc ${DESTDIR}${bindir}/mes-gcc
fi
if test -f bin/mes-mescc; then
cp $_v bin/mes-mescc ${DESTDIR}${bindir}/mes-mescc
fi
cp $_v scripts/mesar ${DESTDIR}${bindir}/mesar
cp $_v scripts/mescc.scm ${DESTDIR}${bindir}/mescc.scm
cp $_v scripts/mescc ${DESTDIR}${bindir}/mescc
sed \
-e "s,^#! /bin/sh,#! ${SHELL}," \
scripts/diff.scm > ${DESTDIR}${bindir}/diff.scm
chmod +x ${DESTDIR}${bindir}/diff.scm
mkdir -p ${DESTDIR}${docdir}
if test -n "${PERL}"\
&& test -n "${GIT}"\
&& ${PERL} -v > /dev/null\
&& ! test -f .git-for-build; then
${PERL} ${srcdest}build-aux/gitlog-to-changelog --srcdir=. > ChangeLog+
fi
cp\
AUTHORS\
BOOTSTRAP\
COPYING\
HACKING\
NEWS\
README\
ROADMAP\
${DESTDIR}${docdir}
if test -f ChangeLog+; then
cp $_v ChangeLog+ ${DESTDIR}${docdir}/ChangeLog
rm -f ChangeLog+
else
cp $_v ChangeLog ${DESTDIR}${docdir}
fi
__exclude_go=
__exclude_scm=
if test -f module/mescc.go; then
__exclude_go=--exclude='*.go'
__exclude_scm=--exclude='*.scm'
fi
mkdir -p $DESTDIR$includedir
mkdir -p $DESTDIR$libdir
mkdir -p $DESTDIR$pkgdatadir
tar -cf- -C ${srcdir}/include . | tar -${v}xf- -C $DESTDIR$includedir
tar -cf- -C ${srcdir}/lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
tar -cf- -C ${srcdir}/lib $mes_kernel/$mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
if test -z "$srcdest"; then
tar -cf- $__exclude_go module | tar -${v}xf- -C $DESTDIR$pkgdatadir
else
tar -cf- -C ${srcdest} module | tar -${v}xf- -C $DESTDIR$pkgdatadir
fi
tar -cf- -C ${srcdest}mes module | tar -${v}xf- -C $DESTDIR$pkgdatadir
if test -d gcc-lib/$mes_cpu-mes; then
tar -cf- -C gcc-lib/$mes_cpu-mes . | tar -${v}xf- -C $DESTDIR$libdir
fi
if test -d mescc-lib/$mes_cpu-mes; then
tar -cf- -C mescc-lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
fi
mkdir -p ${DESTDIR}${guile_site_dir}
mkdir -p ${DESTDIR}${guile_site_ccache_dir}
tar -cf- -C ${srcdest}module $__exclude_go . | tar -${v}xf- -C ${DESTDIR}${guile_site_dir}
tar -cf- -C module $__exclude_scm . | tar -${v}xf- -C ${DESTDIR}${guile_site_ccache_dir}
if test -f doc/mes.info; then
mkdir -p ${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
fi
if test -f doc/mes.1; then
mkdir -p ${DESTDIR}${mandir}/man1
cp $_v doc/mes.1 ${DESTDIR}${mandir}/man1/
fi
if test -f doc/mescc.1; then
mkdir -p ${DESTDIR}${mandir}/man1
cp $_v doc/mescc.1 ${DESTDIR}${mandir}/man1/
fi

View file

@ -0,0 +1,23 @@
;;; 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/>.
(use-modules (guix packages))
(define %source-dir (dirname (dirname (current-filename))))
(add-to-load-path (string-append %source-dir "/guix"))
(use-modules (git mes))
(packages->manifest (map cadr (package-direct-inputs mes)))

View file

@ -0,0 +1,205 @@
#! /bin/sh
# -*-scheme-*-
exec ${GUILE-guile} --no-auto-compile -L $(dirname $0) -C $(dirname $0) -e '(mes-snarf)' -s "$0" "$@"
!#
;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; mes-snarf.scm: 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/>.
(define-module (mes-snarf)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-8)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-26)
#:use-module (ice-9 rdelim)
#:export (main))
(cond-expand
(mes
(define %scheme "mes"))
(guile-2
(define %scheme "guile")
(define-macro (mes-use-module . rest) #t))
(guile
(use-modules (ice-9 syncase))
(define %scheme "guile")
(define-macro (mes-use-module . rest) #t)))
(mes-use-module (mes guile))
(mes-use-module (srfi srfi-1))
(mes-use-module (srfi srfi-8))
(mes-use-module (srfi srfi-9))
(mes-use-module (srfi srfi-26))
(when (and=> (getenv "V") (lambda (v) (> (string->number v) 1)))
(format (current-error-port) "mes-snarf[~a]...\n" %scheme))
(define (char->char from to char)
(if (eq? char from) to char))
(define (string-replace-char string from to)
(string-map (cut char->char from to <>) string))
(define (string-replace-suffix string from to)
(if (string-suffix? from string)
(string-replace string to (- (string-length string) (string-length from)))
string))
(define (string-replace-string string from to)
(cond ((string-contains string from) => (lambda (i) (string-replace string to i (+ i (string-length from)))))
(else string)))
(define %gcc? #t)
(define-record-type <file> (make-file name content)
file?
(name file.name)
(content file.content))
(define-record-type <function> (make-function name formals annotation)
function?
(name function.name)
(formals function.formals)
(annotation function.annotation))
(define (function-scm-name f)
(or (assoc-ref (function.annotation f) 'name)
(let ((name ((compose
identity
(cut string-replace-char <> #\_ #\-)
(cut string-replace-string <> "_to_" "->")
(cut string-replace-suffix <> "_x" "!")
(cut string-replace-suffix <> "_x_" "!-")
(cut string-replace-suffix <> "_p" "?")
)
(function.name f))))
(if (not (string-suffix? "-" name)) name
(string-append "core:" (string-drop-right name 1))))))
(define %builtin-prefix% "scm_")
(define (function-builtin-name f)
(string-append %builtin-prefix% (function.name f)))
(define %cell-prefix% "cell_")
(define (function-cell-name f)
(string-append %cell-prefix% (function.name f)))
(define %start 1)
(define (symbol->header s i)
(string-append
(format #f "// CONSTANT ~a ~a\n" s i)
(format #f "#define ~a ~a\n" s i)))
(define (function->header f i)
(let* ((arity (or (assoc-ref (function.annotation f) 'arity)
(if (string-null? (function.formals f)) 0
(length (string-split (function.formals f) #\,)))))
(n (if (eq? arity 'n) -1 arity)))
(format #f "SCM ~a (~a);\n" (function.name f) (function.formals f))))
(define (function->source f i)
(let* ((arity (or (assoc-ref (function.annotation f) 'arity)
(if (string-null? (function.formals f)) 0
(length (string-split (function.formals f) #\,)))))
(n (if (eq? arity 'n) -1 arity)))
(format #f " a = init_builtin (builtin_type, ~s, ~a, &~a, a);\n" (function.name f) n (function.name f))))
(define (disjoin . predicates)
(lambda (. arguments)
(any (cut apply <> arguments) predicates)))
(define (snarf-symbols string)
(let* ((lines (string-split string #\newline))
(symbols (filter (cut string-prefix? " init_symbol (" <>) lines)))
(define (line->symbol line)
((compose
(lambda (s) (string-take s (string-index s #\,)))
(cut string-drop <> (string-length " init_symbol (")))
line))
(map line->symbol symbols)))
(define (string-split-string string sep)
(cond ((string-contains string sep) => (lambda (i) (list (string-take string i) (string-drop string (+ i (string-length sep))))))
(else (list string #f))))
(define (snarf-functions string)
(let ((lines (string-split string #\newline)))
(filter-map
(lambda (line previous)
(receive (function rest)
(apply values (string-split-string line " "))
(and function
(equal? (string-trim previous) "SCM")
(not (string-null? function))
(not (string-prefix? "#" function))
(not (string-prefix? "/" function))
rest
(receive (parameter-list annotation)
(apply values (string-split-string rest " ///"))
(let* ((parameters (string-drop parameter-list 1))
(parameters (string-drop-right parameters 1))
(formals (if (string-null? parameters) '()
(string-split parameters #\,)))
(formals (map string-trim formals)))
(and parameters
(let* ((non-SCM (filter (negate (cut string-prefix? "SCM" <>)) formals)))
(and (null? non-SCM)
(let ((annotation (and annotation (with-input-from-string annotation read))))
(make-function function parameters annotation))))))))))
lines (cons "\n" lines))))
(define (content? f)
((compose not string-null? file.content) f))
(define (internal? f)
((compose (cut assoc-ref <> 'internal) function.annotation) f))
(define (no-environment? f)
((compose (cut assoc-ref <> 'no-environment) function.annotation) f))
(define (generate-includes file-name)
(let* ((srcdest (or (getenv "srcdest") ""))
(string (with-input-from-file (string-append srcdest file-name) read-string))
(functions (snarf-functions string))
(functions (delete-duplicates functions (lambda (a b) (equal? (function.name a) (function.name b)))))
(functions (filter (negate internal?) functions))
(symbols (snarf-symbols string))
(base-name (basename file-name ".c"))
(dir (string-append (dirname file-name)))
(base-name (string-append dir "/" base-name))
(base-name (if %gcc? base-name
(string-append base-name ".mes")))
(header (make-file
(string-append base-name ".h")
(string-join (map function->header functions (iota (length functions) (+ %start (length symbols)))) "")))
(source (make-file
(string-append base-name ".i")
(string-join (map function->source (filter (negate no-environment?) functions) (iota (length functions) (+ (length symbols) %start))) "")))
(symbols.h (make-file
(string-append base-name ".symbols.h")
(string-join (map symbol->header symbols (iota (length symbols) %start)) ""))))
(list header source symbols.h)))
(define (file-write file)
(system* "mkdir" "-p" (dirname (file.name file)))
(with-output-to-file (file.name file) (lambda () (display (file.content file)))))
(define (main args)
(let* ((files (cdr args))
(files (append-map generate-includes files)))
(for-each file-write (filter content? files))))

View file

@ -0,0 +1,54 @@
#! @BASH@
# 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/>.
abs_top_srcdir="@abs_top_srcdir@"
export abs_top_srcdir
abs_top_builddir="@abs_top_builddir@"
export abs_top_builddir
prefix=${prefix-@prefix@}
export prefix
program_prefix=${program_prefix-@program_prefix@}
MES_PREFIX=${MES_PREFIX-${abs_top_srcdir}}
export MES_PREFIX
GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/scripts:$abs_top_builddir/module${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
GUILE_LOAD_PATH="$abs_top_srcdir/module:$abs_top_srcdir/mes:$abs_top_srcdir/guix${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
if [ -n "$srcdest" ]; then
GUILE_LOAD_PATH="${srcdest}module:${srcdest}mes:$GUILE_LOAD_PATH"
fi
export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
PATH="$abs_top_builddir/scripts:$abs_top_builddir/scripts:$abs_top_builddir/bin:$abs_top_builddir/build-aux:$PATH"
export PATH
MES=${MES-${abs_top_builddir}/bin/${program_prefix}mes}
export MES
bindir=${abs_top_builddir}/scripts
export bindir
GUIX_PACKAGE_PATH="$abs_top_srcdir/guix${GUIX_PACKAGE_PATH:+:}$GUIX_PACKAGE_PATH"
export GUIX_PACKAGE_PATH
LANG=
LC_ALL=
exec "$@"

View file

@ -0,0 +1,90 @@
#! /bin/sh
# 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/>.
set -e
if [ -n "$BUILD_DEBUG" ]; then
set -x
fi
mkdir -p src
cd src
for GUILE_EFFECTIVE_VERSION in 2.2 2.0; do
if sudo apt-get install --no-install-recommends guile-$GUILE_EFFECTIVE_VERSION-dev; then
break
fi
done
guile_site_dir=/usr/local/share/guile/site/$GUILE_EFFECTIVE_VERSION
guile_site_ccache_dir=/usr/local/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache
GUILE_LOAD_PATH=$guile_site_dir
GUILE_LOAD_COMPILED_PATH=$guile_site_ccache_dir
export GUILE_LOAD_PATH
export GUILE_LOAD_COMPILED_PATH
sudo apt-get install --no-install-recommends build-essential ca-certificates help2man texinfo
# Nice to have
sudo apt-get install --no-install-recommends gcc-i686-linux-gnu || true
echo checking for M1
if ! command -v M1; then
if sudo apt-get install mescc-tools; then
echo yay
else
wget -O mescc-tools-Release_0.5.1.tar.gz https://github.com/oriansj/mescc-tools/archive/Release_0.5.1.tar.gz
tar xf mescc-tools-Release_0.5.1.tar.gz
cd mescc-tools-Release_0.5.1
make
make check
sudo make install
cd ..
fi
fi
echo checking for Nyacc
if ! guile -c '(use-modules (nyacc lalr)) (display *nyacc-version*) (newline)'; then
if sudo apt-get install --no-install-recommends nyacc; then
echo yay
else
wget -O nyacc-v0.80.43.tar.gz https://gitlab.com/janneke/nyacc/-/archive/v0.80.43/nyacc-v0.80.43.tar.gz
tar xf nyacc-v0.80.43.tar.gz
cd nyacc-v0.80.43
./configure --prefix=/usr/local
make
make check
sudo make install
cd ..
fi
fi
echo checking for mes
if ! command -v mes; then
sudo apt-get install --no-install-recommends git
git clone git://git.savannah.gnu.org/mes.git
cd mes
git checkout wip-gnu
./configure
make
make check
make install
fi

View file

@ -0,0 +1,36 @@
#! /bin/sh
# 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/>.
set -e
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
trace "SNARF$snarf gc.c" ${srcdest}build-aux/mes-snarf.scm src/gc.c
trace "SNARF$snarf hash.c" ${srcdest}build-aux/mes-snarf.scm src/hash.c
trace "SNARF$snarf lib.c" ${srcdest}build-aux/mes-snarf.scm src/lib.c
trace "SNARF$snarf math.c" ${srcdest}build-aux/mes-snarf.scm src/math.c
trace "SNARF$snarf mes.c" ${srcdest}build-aux/mes-snarf.scm src/mes.c
trace "SNARF$snarf module.c" ${srcdest}build-aux/mes-snarf.scm src/module.c
trace "SNARF$snarf posix.c" ${srcdest}build-aux/mes-snarf.scm src/posix.c
trace "SNARF$snarf reader.c" ${srcdest}build-aux/mes-snarf.scm src/reader.c
trace "SNARF$snarf strings.c" ${srcdest}build-aux/mes-snarf.scm src/string.c
trace "SNARF$snarf struct.c" ${srcdest}build-aux/mes-snarf.scm src/struct.c
trace "SNARF$snarf vector.c" ${srcdest}build-aux/mes-snarf.scm src/vector.c

View file

@ -0,0 +1,38 @@
#! /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-scaffold/boot/00-zero.scm}
b=$(basename "$t" .scm)
if [ "$(basename $MES)" = guile ]; then
$MES -L ${srcdest}module -C module -L . -c '(begin (use-modules (mes guile)) (include-from-path "'"$t"'"))'
elif [ -z "${b/5[0-9]-*/}" ]; then
cat "$t" | MES_BOOT=boot-00.scm $MES
elif [ -z "${b/6[0-9]-*/}" ]; then
cat "$t" | MES_BOOT=boot-01.scm $MES
else
MES_BOOT=$t $MES;
fi

View file

@ -0,0 +1,85 @@
#! /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 test -z "$config_sh"; then
. ./config.sh
fi
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_kernel = gnu\
&& test -z "$LIBS"; then
LIBS="-l c-mini"
fi
if test $mes_libc = system; then
crt1=
LIBS='-l mes'
else
crt1=crt1.o
fi
$CC -g -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o "$o".o "$t"
$CC -g $AM_CFLAGS $CFLAGS $AM_LDFLAGS $LDFLAGS -L . -o "$o" $crt1 "$o".o $LIBS
set +e
timeout 10 "$o" -s --long file0 file1 > "$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

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:

View file

@ -0,0 +1,143 @@
#! /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)
TEST_LOGS="$TEST_LOGS $b.log"
if test -e $b.log \
&& test -e $b.trs\
&& ! $recheck; then
echo `grep :test-result $b.trs | cut -d' ' -f 2`: $b
continue
fi
d=$(dirname $t)
case " `echo $XFAIL_TESTS` " in
*[\ \ ]$t[\ \ ]*)
fail=yes;;
*)
fail=no;;
esac
mkdir -p $d
${SHELL} ${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
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

@ -0,0 +1,49 @@
# 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/>.
LOG=
if [ -z "$V" -o "$V" = 0 ]; then
trace () {
echo " $1"
shift
echo "$@" >> build.log
eval "$@ $LOG"
cat .log 1>&2
cat .log >> build.log
}
LOG=" >.log 2>&1"
fi
if [ "$V" = 1 ]; then
trace () {
shift
echo "$@"
echo "$@" >> build.log
eval "$@ $LOG"
cat .log 1>&2
cat .log >> build.log
}
LOG=" >.log 2>&1"
fi
if [ "$V" = 2 ]; then
set -x
trace () {
shift
echo "$@" >> build.log
eval "$@"
}
fi

View file

@ -0,0 +1,96 @@
#! /bin/sh
# 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/>.
#set -e
. ./config.sh
v=
_v=
if test "$V" = 2; then
set -x
fi
if test "$V" -gt 0; then
v=v
_v=-v
fi
set -u
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 -r ${DESTDIR}${libdir}/$mes_cpu-mes
rm ${DESTDIR}${libdir}/libc-mini.a
rm ${DESTDIR}${libdir}/libmes.a
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\
AUTHORS\
BOOTSTRAP\
COPYING\
ChangeLog\
HACKING\
INSTALL\
NEWS\
README\
;do
rm ${DESTDIR}${docdir}/$i || :;
done
rm -r ${DESTDIR}${pkgdatadir}
rm -r ${DESTDIR}${guile_site_ccache_dir}/mes
rm -r ${DESTDIR}${guile_site_ccache_dir}/mescc
rm -r ${DESTDIR}${guile_site_dir}/mes
rm ${DESTDIR}${guile_site_dir}/mescc.scm
rm -r ${DESTDIR}${guile_site_dir}/mescc
rm ${DESTDIR}${infodir}/dir
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
rmdir -p ${DESTDIR}${docdir}
rmdir -p ${DESTDIR}${infodir}/images
rmdir -p ${DESTDIR}${guile_site_dir}
rmdir -p ${DESTDIR}${guile_site_ccache_dir}
rmdir -p ${DESTDIR}${mandir}/man1
true