build: Support --srcdir build.
* build-aux/config.sh: New file. * build-aux/trace.sh: New file. * build-aux/GNUmakefile.in: New file. * configure: Support srcdir configure. * GNUmakefile: Support srcdir build. * build-aux/build-cc.sh: Likewise. * build-aux/build-cc32.sh: Likewise. * build-aux/build-guile.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/cc-mes.sh: Likewise. * build-aux/cc.sh: Likewise. * build-aux/cc32-mes.sh: Likewise. * build-aux/check-mes.sh: Likewise. * build-aux/check-mescc.sh: Likewise. * build-aux/export.make: Likewise. * build-aux/mes-snarf.scm: Likewise. * build-aux/pre-inst-env.in: Likewise. * build-aux/test.sh: Likewise. * build.sh: Likewise. * check.sh: Likewise. * install.sh: Likewise. * module/mescc/mescc.scm: Likewise. * scripts/mescc.in: Likewise. * src/mes.c: Likewise.
This commit is contained in:
parent
573896cc1c
commit
4203a427d0
3
AUTHORS
3
AUTHORS
|
@ -52,8 +52,5 @@ mes/module/srfi/srfi-16.scm
|
||||||
Srfi-26 from Guile
|
Srfi-26 from Guile
|
||||||
mes/module/srfi/srfi-26.scm
|
mes/module/srfi/srfi-26.scm
|
||||||
|
|
||||||
Sxml bits from Guile
|
|
||||||
mes/module/sxml/xpath.scm
|
|
||||||
|
|
||||||
GNU FDL in texinfo from GNU
|
GNU FDL in texinfo from GNU
|
||||||
doc/fdl-1.3.texi
|
doc/fdl-1.3.texi
|
||||||
|
|
90
GNUmakefile
90
GNUmakefile
|
@ -18,13 +18,19 @@
|
||||||
|
|
||||||
GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module
|
GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module
|
||||||
|
|
||||||
include .config.make
|
cleaning_p:=$(filter clean%, $(MAKECMDGOALS))
|
||||||
|
|
||||||
.config.make:
|
ifndef cleaning_p
|
||||||
|
ifndef config.make
|
||||||
|
config.make:=.config.make
|
||||||
|
include $(config.make)
|
||||||
|
$(config.make):
|
||||||
./configure --prefix=$(prefix)
|
./configure --prefix=$(prefix)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
PHONY_TARGETS:= all all-go build check clean clean-go default doc help install install-info man\
|
PHONY_TARGETS:= all all-go build check clean clean-go default dist doc help install\
|
||||||
gcc mes src/mes mes-gcc mes-tcc
|
install-info man gcc mes ${top_builddest}src/mes mes-gcc mes-tcc generate-ChangeLog
|
||||||
|
|
||||||
.PHONY: $(PHONY_TARGETS)
|
.PHONY: $(PHONY_TARGETS)
|
||||||
|
|
||||||
|
@ -64,10 +70,10 @@ clean-go:
|
||||||
check:
|
check:
|
||||||
./check.sh
|
./check.sh
|
||||||
|
|
||||||
install: src/mes
|
install: ${top_builddest}src/mes
|
||||||
./install.sh
|
./install.sh
|
||||||
|
|
||||||
.config.make: ./configure
|
$(config.make): configure
|
||||||
|
|
||||||
seed: all-go mes-gcc mes-tcc
|
seed: all-go mes-gcc mes-tcc
|
||||||
ifdef TCC
|
ifdef TCC
|
||||||
|
@ -86,14 +92,15 @@ endif
|
||||||
$(MESCC_TOOLS_SEED)/libs
|
$(MESCC_TOOLS_SEED)/libs
|
||||||
cd $(MESCC_TOOLS_SEED) && MES_PREFIX=$(PWD) ./bootstrap.sh
|
cd $(MESCC_TOOLS_SEED) && MES_PREFIX=$(PWD) ./bootstrap.sh
|
||||||
|
|
||||||
doc/version.texi: doc/mes.texi GNUmakefile
|
${top_builddest}doc/version.texi: doc/mes.texi GNUmakefile
|
||||||
|
@mkdir -p $(@D)
|
||||||
(set `LANG= date -r $< +'%d %B %Y'`;\
|
(set `LANG= date -r $< +'%d %B %Y'`;\
|
||||||
echo "@set UPDATED $$1 $$2 $$3"; \
|
echo "@set UPDATED $$1 $$2 $$3"; \
|
||||||
echo "@set UPDATED-MONTH $$2 $$3"; \
|
echo "@set UPDATED-MONTH $$2 $$3"; \
|
||||||
echo "@set EDITION $(VERSION)"; \
|
echo "@set EDITION $(VERSION)"; \
|
||||||
echo "@set VERSION $(VERSION)") > $@
|
echo "@set VERSION $(VERSION)") > $@
|
||||||
|
|
||||||
doc: doc/version.texi
|
doc: ${top_builddest}doc/version.texi
|
||||||
ifdef MAKEINFO
|
ifdef MAKEINFO
|
||||||
doc: info
|
doc: info
|
||||||
else
|
else
|
||||||
|
@ -106,32 +113,66 @@ else
|
||||||
$(warning skipping man: no help2man)
|
$(warning skipping man: no help2man)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
info: doc/mes.info
|
info: ${top_builddest}doc/mes.info
|
||||||
|
|
||||||
doc/mes.info: doc/mes.texi doc/version.texi GNUmakefile
|
${top_builddest}doc/mes.info: doc/mes.texi ${top_builddest}doc/version.texi GNUmakefile
|
||||||
$(MAKEINFO) -o $@ -I doc $<
|
$(MAKEINFO) -o $@ -I ${top_builddest}doc -I doc $<
|
||||||
|
|
||||||
install-info: info
|
install-info: info
|
||||||
|
|
||||||
man: doc/mes.1 doc/mescc.1
|
man: ${top_builddest}doc/mes.1 ${top_builddest}doc/mescc.1
|
||||||
|
|
||||||
src/mes: build
|
${top_builddest}src/mes: build
|
||||||
|
|
||||||
doc/mes.1: src/mes
|
${top_builddest}doc/mes.1: ${top_builddest}src/mes
|
||||||
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $< > $@
|
MES_ARENA=10000000 ${top_builddir}/pre-inst-env $(HELP2MAN) $(<F) > $@
|
||||||
|
|
||||||
doc/mescc.1: src/mes scripts/mescc
|
${top_builddest}doc/mescc.1: ${top_builddest}src/mes ${top_builddest}scripts/mescc
|
||||||
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $< > $@
|
MES_ARENA=10000000 ${top_builddir}/pre-inst-env $(HELP2MAN) $(<F) > $@
|
||||||
|
|
||||||
html: mes/index.html
|
html: ${top_builddest}mes/index.html
|
||||||
|
|
||||||
mes/index.html: doc/mes.texi
|
${top_builddest}mes/index.html: doc/mes.texi
|
||||||
$(MAKEINFO) --html -o doc/mes $<
|
$(MAKEINFO) --html -o ${top_builddest}doc/mes $<
|
||||||
|
|
||||||
pdf: doc/mes.pdf
|
pdf: ${top_builddest}doc/mes.pdf
|
||||||
|
|
||||||
doc/mes.pdf: doc/mes.texi
|
${top_builddest}doc/mes.pdf: doc/mes.texi
|
||||||
$(MAKEINFO) --pdf -o doc/mes.pdf $<
|
$(MAKEINFO) --pdf -I ${top_builddest}/doc -o doc/mes.pdf $<
|
||||||
|
|
||||||
|
### dist
|
||||||
|
COMMIT=$(shell test -d .git && (git describe --dirty 2>/dev/null) || cat .tarball-version)
|
||||||
|
TARBALL_VERSION=$(COMMIT:v%=%)
|
||||||
|
TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION)
|
||||||
|
TARBALL:=${top_builddest}$(TARBALL_DIR).tar.gz
|
||||||
|
|
||||||
|
${top_builddest}.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
|
||||||
|
endif
|
||||||
|
|
||||||
|
dist: $(TARBALL)
|
||||||
|
|
||||||
|
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) build-aux/gitlog-to-changelog --srcdir=${srcdir} > ChangeLog
|
||||||
|
|
||||||
|
$(TARBALL): ${top_builddest}.tarball-version | generate-ChangeLog
|
||||||
|
($(GIT_LS_FILES)\
|
||||||
|
--exclude=$(TARBALL_DIR);\
|
||||||
|
echo $^ | tr ' ' '\n')\
|
||||||
|
| GZIP=-n tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner\
|
||||||
|
--transform=s,^,$(TARBALL_DIR)/,S -T- -czf $@
|
||||||
|
git checkout ChangeLog
|
||||||
|
|
||||||
define HELP_TOP
|
define HELP_TOP
|
||||||
Usage: make [OPTION]... [TARGET]...
|
Usage: make [OPTION]... [TARGET]...
|
||||||
|
@ -139,7 +180,8 @@ Usage: make [OPTION]... [TARGET]...
|
||||||
Targets:
|
Targets:
|
||||||
all update everything
|
all update everything
|
||||||
all-go update .go files
|
all-go update .go files
|
||||||
cc update src/mes.gcc-out
|
gcc update src/mes.gcc-out
|
||||||
|
dist update $(TARBALL)
|
||||||
doc update documentation
|
doc update documentation
|
||||||
mes-gcc update src/mes.mes-gcc-out
|
mes-gcc update src/mes.mes-gcc-out
|
||||||
mes-tcc update src/mes.mes-tcc-out
|
mes-tcc update src/mes.mes-tcc-out
|
||||||
|
|
30
build-aux/GNUmakefile.in
Normal file
30
build-aux/GNUmakefile.in
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Mes --- Maxwell Equations of Software
|
||||||
|
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
#
|
||||||
|
# This file is part of Mes.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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 Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
PHONY_TARGETS:= all all-go build check clean clean-go default dist doc help install\
|
||||||
|
install-info man gcc mes src/mes mes-gcc mes-tcc
|
||||||
|
.PHONY: $(PHONY_TARGETS)
|
||||||
|
|
||||||
|
default: all
|
||||||
|
|
||||||
|
$(PHONY_TARGETS):
|
||||||
|
$(MAKE) -C $(srcdir) $@
|
||||||
|
|
||||||
|
include .config.make
|
||||||
|
config.make:=$(PWD)/.config.make
|
||||||
|
include $(srcdir)/build-aux/export.make
|
|
@ -20,36 +20,16 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
. build-aux/config.sh
|
||||||
set -x
|
. build-aux/trace.sh
|
||||||
fi
|
|
||||||
|
|
||||||
export CC CFLAGS CPPFLAGS
|
trace "SNARF gc.c" build-aux/mes-snarf.scm src/gc.c
|
||||||
export CC_CFLAGS CC_CPPFLAGS
|
trace "SNARF lib.c" build-aux/mes-snarf.scm src/lib.c
|
||||||
|
trace "SNARF math.c" build-aux/mes-snarf.scm src/math.c
|
||||||
CC=${CC-gcc}
|
trace "SNARF mes.c" build-aux/mes-snarf.scm src/mes.c
|
||||||
CC_CFLAGS=${CC_CFLAGS-"
|
trace "SNARF posix.c" build-aux/mes-snarf.scm src/posix.c
|
||||||
--std=gnu99
|
trace "SNARF reader.c" build-aux/mes-snarf.scm src/reader.c
|
||||||
-O0
|
trace "SNARF vector.c" build-aux/mes-snarf.scm src/vector.c
|
||||||
-g
|
|
||||||
"}
|
|
||||||
|
|
||||||
CC_CPPFLAGS=${CC_CPPFLAGS-"
|
|
||||||
-D VERSION=\"$VERSION\"
|
|
||||||
-D MODULEDIR=\"$moduledir\"
|
|
||||||
-D PREFIX=\"$prefix\"
|
|
||||||
-I src
|
|
||||||
-I lib
|
|
||||||
-I include
|
|
||||||
"}
|
|
||||||
|
|
||||||
build-aux/mes-snarf.scm src/gc.c
|
|
||||||
build-aux/mes-snarf.scm src/lib.c
|
|
||||||
build-aux/mes-snarf.scm src/math.c
|
|
||||||
build-aux/mes-snarf.scm src/mes.c
|
|
||||||
build-aux/mes-snarf.scm src/posix.c
|
|
||||||
build-aux/mes-snarf.scm src/reader.c
|
|
||||||
build-aux/mes-snarf.scm src/vector.c
|
|
||||||
|
|
||||||
ARCHDIR=1 NOLINK=1 sh build-aux/cc.sh lib/libmes
|
ARCHDIR=1 NOLINK=1 sh build-aux/cc.sh lib/libmes
|
||||||
sh build-aux/cc.sh src/mes
|
sh build-aux/cc.sh src/mes
|
||||||
|
|
|
@ -20,56 +20,28 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
. build-aux/config.sh
|
||||||
set -x
|
. build-aux/trace.sh
|
||||||
fi
|
|
||||||
|
|
||||||
moduledir=${moduledir-${datadir}${datadir:+/}module}
|
LIBC=${LIBC-c}
|
||||||
export CC32 TCC CPPFLAGS
|
|
||||||
export CC32 TCC CC32_CPPFLAGS CC32_CFLAGS
|
|
||||||
|
|
||||||
CC32=${CC32-$(command -v i686-unknown-linux-gnu-gcc)}
|
##moduledir=${moduledir-${datadir}${datadir:+/}module}
|
||||||
build-aux/mes-snarf.scm --mes src/gc.c
|
|
||||||
build-aux/mes-snarf.scm --mes src/lib.c
|
|
||||||
build-aux/mes-snarf.scm --mes src/math.c
|
|
||||||
build-aux/mes-snarf.scm --mes src/mes.c
|
|
||||||
build-aux/mes-snarf.scm --mes src/posix.c
|
|
||||||
build-aux/mes-snarf.scm --mes src/reader.c
|
|
||||||
build-aux/mes-snarf.scm --mes src/vector.c
|
|
||||||
|
|
||||||
build-aux/mes-snarf.scm src/gc.c
|
# trace "SNARF gc.c" build-aux/mes-snarf.scm src/gc.c
|
||||||
build-aux/mes-snarf.scm src/lib.c
|
# trace "SNARF lib.c" build-aux/mes-snarf.scm src/lib.c
|
||||||
build-aux/mes-snarf.scm src/math.c
|
# trace "SNARF math.c" build-aux/mes-snarf.scm src/math.c
|
||||||
build-aux/mes-snarf.scm src/mes.c
|
# trace "SNARF mes.c" build-aux/mes-snarf.scm src/mes.c
|
||||||
build-aux/mes-snarf.scm src/posix.c
|
# trace "SNARF posix.c" build-aux/mes-snarf.scm src/posix.c
|
||||||
build-aux/mes-snarf.scm src/reader.c
|
# trace "SNARF reader.c" build-aux/mes-snarf.scm src/reader.c
|
||||||
build-aux/mes-snarf.scm src/vector.c
|
# trace "SNARF vector.c" build-aux/mes-snarf.scm src/vector.c
|
||||||
|
|
||||||
CC32_CPPFLAGS=${CC32_CPPFLAGS-"
|
trace "MSNARF gc.c" build-aux/mes-snarf.scm --mes src/gc.c
|
||||||
-D VERSION=\"$VERSION\"
|
trace "MSNARF lib.c" build-aux/mes-snarf.scm --mes src/lib.c
|
||||||
-D MODULEDIR=\"$moduledir\"
|
trace "MSNARF math.c" build-aux/mes-snarf.scm --mes src/math.c
|
||||||
-D PREFIX=\"$prefix\"
|
trace "MSNARF mes.c" build-aux/mes-snarf.scm --mes src/mes.c
|
||||||
-I src
|
trace "MSNARF posix.c" build-aux/mes-snarf.scm --mes src/posix.c
|
||||||
-I lib
|
trace "MSNARF reader.c" build-aux/mes-snarf.scm --mes src/reader.c
|
||||||
-I include
|
trace "MSNARF vector.c" build-aux/mes-snarf.scm --mes src/vector.c
|
||||||
"}
|
|
||||||
|
|
||||||
CC32_CFLAGS=${CC32_CFLAGS-"
|
|
||||||
-std=gnu99
|
|
||||||
-O0
|
|
||||||
-fno-builtin
|
|
||||||
-fno-stack-protector
|
|
||||||
-g
|
|
||||||
-m32
|
|
||||||
-nostdinc
|
|
||||||
-nostdlib
|
|
||||||
-Wno-discarded-qualifiers
|
|
||||||
-Wno-int-to-pointer-cast
|
|
||||||
-Wno-pointer-to-int-cast
|
|
||||||
-Wno-pointer-sign
|
|
||||||
-Wno-int-conversion
|
|
||||||
-Wno-incompatible-pointer-types
|
|
||||||
"}
|
|
||||||
|
|
||||||
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/linux/crt0
|
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/linux/crt0
|
||||||
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/linux/crt1
|
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/linux/crt1
|
||||||
|
@ -83,12 +55,12 @@ ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libtcc1
|
||||||
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libc+gnu
|
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libc+gnu
|
||||||
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libg
|
ARCHDIR=1 NOLINK=1 sh build-aux/cc32-mes.sh lib/libg
|
||||||
|
|
||||||
sh build-aux/cc32-mes.sh scaffold/main
|
# sh build-aux/cc32-mes.sh scaffold/main
|
||||||
sh build-aux/cc32-mes.sh scaffold/hello
|
# sh build-aux/cc32-mes.sh scaffold/hello
|
||||||
sh build-aux/cc32-mes.sh scaffold/argv
|
# sh build-aux/cc32-mes.sh scaffold/argv
|
||||||
sh build-aux/cc32-mes.sh scaffold/malloc
|
# sh build-aux/cc32-mes.sh scaffold/malloc
|
||||||
sh build-aux/cc32-mes.sh scaffold/micro-mes
|
# sh build-aux/cc32-mes.sh scaffold/micro-mes
|
||||||
sh build-aux/cc32-mes.sh scaffold/tiny-mes
|
# sh build-aux/cc32-mes.sh scaffold/tiny-mes
|
||||||
sh build-aux/cc32-mes.sh scaffold/mini-mes
|
# sh build-aux/cc32-mes.sh scaffold/mini-mes
|
||||||
|
|
||||||
sh build-aux/cc32-mes.sh src/mes
|
sh build-aux/cc32-mes.sh src/mes
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if [ "$V" = 2 ]; then
|
. build-aux/trace.sh
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
|
|
||||||
export GUILE
|
export GUILE
|
||||||
export GUILE_AUTO_COMPILE
|
export GUILE_AUTO_COMPILE
|
||||||
|
@ -58,14 +56,10 @@ if [ "$GUILE_EFFECTIVE_VERSION" = "2.0" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GUILE_AUTO_COMPILE=0
|
GUILE_AUTO_COMPILE=0
|
||||||
[ -z "$V" -o "$V" = 1 ] && LOG='build.log' || LOG=/dev/stdout
|
|
||||||
|
|
||||||
for i in $SCM_FILES $SCRIPTS; do
|
for i in $SCM_FILES $SCRIPTS; do
|
||||||
go=${i%%.scm}.go
|
go=${top_builddest}${i%%.scm}.go
|
||||||
if [ $i -nt $go ]; then
|
if [ $i -nt $go ]; then
|
||||||
[ -z "$V" -o "$V" = 1 ] && echo " GUILEC $i" || true
|
trace "GUILEC $i" $GUILE_TOOLS compile -L ${abs}module -L ${abs}/build-aux -L ${abs}scripts -o $go $i
|
||||||
[ "$V" = 1 ] && set -x
|
|
||||||
$GUILE_TOOLS compile -L ${abs}module -L ${abs}/build-aux -L ${abs}scripts -o $go $i >>$LOG
|
|
||||||
{ [ "$V" = 1 ] && set +x || true; } > /dev/null 2>&1
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -18,82 +18,62 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
. build-aux/config.sh
|
||||||
set -x
|
. build-aux/trace.sh
|
||||||
fi
|
|
||||||
|
|
||||||
export BLOOD_ELF GUILE HEX2 M1 MES MESCC
|
|
||||||
export M1FLAGS HEX2FLAGS PREPROCESS
|
|
||||||
export MES_SEED MES_ARENA
|
|
||||||
|
|
||||||
GUILE=${GUILE-guile}
|
GUILE=${GUILE-guile}
|
||||||
if [ -z "$GUILE" -o "$GUILE" = "true" ] || ! command -v $GUILE > /dev/null; then
|
if [ -z "$GUILE" -o "$GUILE" = "true" ] || ! command -v $GUILE > /dev/null; then
|
||||||
GUILE=src/mes
|
GUILE=src/mes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HEX2=${HEX2-hex2}
|
[ -z "$MESCC" ] && MESCC=${top_builddest}scripts/mescc
|
||||||
M1=${M1-M1}
|
|
||||||
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
|
||||||
MES_SEED=${MES_SEED-../mes-seed}
|
|
||||||
MESCC=${MESCC-$(command -v mescc)}
|
|
||||||
[ -z "$MESCC" ] && MESCC=scripts/mescc
|
|
||||||
MES=${MES-$(command -v mes)}
|
MES=${MES-$(command -v mes)}
|
||||||
[ -z "$MES" ] && MES=src/mes
|
[ -z "$MES" ] && MES=${top_builddest}src/mes
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
M1FLAGS=${M1FLAGS-"
|
|
||||||
--LittleEndian
|
|
||||||
--Architecture 1
|
|
||||||
"}
|
|
||||||
HEX2FLAGS=${HEX2FLAGS-"
|
|
||||||
--LittleEndian
|
|
||||||
--Architecture 1
|
|
||||||
--BaseAddress 0x1000000
|
|
||||||
"}
|
|
||||||
|
|
||||||
if [ -d "$MES_SEED" ]; then
|
if [ -d "$MES_SEED" ]; then
|
||||||
$M1\
|
trace "M1 crt1.S" $M1\
|
||||||
$M1FLAGS\
|
$M1FLAGS\
|
||||||
-f lib/x86-mes/x86.M1\
|
-f lib/x86-mes/x86.M1\
|
||||||
-f $MES_SEED/x86-mes/crt1.S\
|
-f $MES_SEED/x86-mes/crt1.S\
|
||||||
-o lib/x86-mes/crt1.o
|
-o ${top_builddest}lib/x86-mes/crt1.o
|
||||||
$M1\
|
trace "M1 libc.S" $M1\
|
||||||
$M1FLAGS\
|
$M1FLAGS\
|
||||||
-f lib/x86-mes/x86.M1\
|
-f lib/x86-mes/x86.M1\
|
||||||
-f $MES_SEED/x86-mes/libc.S\
|
-f $MES_SEED/x86-mes/libc.S\
|
||||||
-o lib/x86-mes/libc.o
|
-o ${top_builddest}lib/x86-mes/libc.o
|
||||||
$M1\
|
trace "M1 mes.S" $M1\
|
||||||
--LittleEndian\
|
--LittleEndian\
|
||||||
--Architecture 1\
|
--Architecture 1\
|
||||||
-f lib/x86-mes/x86.M1\
|
-f lib/x86-mes/x86.M1\
|
||||||
-f $MES_SEED/x86-mes/mes.S\
|
-f $MES_SEED/x86-mes/mes.S\
|
||||||
-o src/mes.o
|
-o ${top_builddest}src/mes.o
|
||||||
$BLOOD_ELF\
|
trace "BLOOD_ELF mes.S" $BLOOD_ELF\
|
||||||
-f lib/x86-mes/x86.M1\
|
-f lib/x86-mes/x86.M1\
|
||||||
-f $MES_SEED/x86-mes/mes.S\
|
-f $MES_SEED/x86-mes/mes.S\
|
||||||
-f $MES_SEED/x86-mes/libc.S\
|
-f $MES_SEED/x86-mes/libc.S\
|
||||||
-o src/mes.S.blood-elf
|
-o ${top_builddest}src/mes.S.blood-elf
|
||||||
$M1\
|
trace "M1 mes.blood-elf" $M1\
|
||||||
--LittleEndian\
|
--LittleEndian\
|
||||||
--Architecture 1\
|
--Architecture 1\
|
||||||
-f src/mes.S.blood-elf\
|
-f ${top_builddest}src/mes.S.blood-elf\
|
||||||
-o src/mes.o.blood-elf
|
-o ${top_builddest}src/mes.o.blood-elf
|
||||||
$HEX2\
|
trace "HEX2 mes.o" $HEX2\
|
||||||
$HEX2FLAGS\
|
$HEX2FLAGS\
|
||||||
-f lib/x86-mes/elf32-header.hex2\
|
-f lib/x86-mes/elf32-header.hex2\
|
||||||
-f lib/x86-mes/crt1.o\
|
-f ${top_builddest}lib/x86-mes/crt1.o\
|
||||||
-f lib/x86-mes/libc.o\
|
-f ${top_builddest}lib/x86-mes/libc.o\
|
||||||
-f src/mes.o\
|
-f ${top_builddest}src/mes.o\
|
||||||
-f src/mes.o.blood-elf\
|
-f ${top_builddest}src/mes.o.blood-elf\
|
||||||
--exec_enable\
|
--exec_enable\
|
||||||
-o src/mes.seed-out
|
-o ${top_builddest}src/mes.seed-out
|
||||||
cp src/mes.seed-out src/mes
|
cp ${top_builddest}src/mes.seed-out ${top_builddest}src/mes
|
||||||
$M1\
|
trace "M1 libc+tcc.S" $M1\
|
||||||
$M1FLAGS\
|
$M1FLAGS\
|
||||||
-f lib/x86-mes/x86.M1\
|
-f lib/x86-mes/x86.M1\
|
||||||
-f $MES_SEED/x86-mes/libc+tcc.S\
|
-f $MES_SEED/x86-mes/libc+tcc.S\
|
||||||
-o lib/x86-mes/libc+tcc.o
|
-o ${top_builddest}lib/x86-mes/libc+tcc.o
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PREPROCESS=1
|
PREPROCESS=1
|
||||||
|
@ -118,13 +98,13 @@ ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/libc+gnu
|
||||||
[ -n "$SEED" ] && exit 0
|
[ -n "$SEED" ] && exit 0
|
||||||
|
|
||||||
MES_ARENA=${MES_ARENA-100000000}
|
MES_ARENA=${MES_ARENA-100000000}
|
||||||
bash build-aux/mes-snarf.scm --mes src/gc.c
|
trace "MSNARF gc.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/gc.c
|
||||||
bash build-aux/mes-snarf.scm --mes src/lib.c
|
trace "MSNARF lib.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/lib.c
|
||||||
bash build-aux/mes-snarf.scm --mes src/math.c
|
trace "MSNARF math.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/math.c
|
||||||
bash build-aux/mes-snarf.scm --mes src/mes.c
|
trace "MSNARF mes.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/mes.c
|
||||||
bash build-aux/mes-snarf.scm --mes src/posix.c
|
trace "MSNARF posix.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/posix.c
|
||||||
bash build-aux/mes-snarf.scm --mes src/reader.c
|
trace "MSNARF reader.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/reader.c
|
||||||
bash build-aux/mes-snarf.scm --mes src/vector.c
|
trace "MSNARF vector.c" ${top_builddir}/pre-inst-env bash build-aux/mes-snarf.scm --mes src/vector.c
|
||||||
|
|
||||||
echo MES_ARENA=$MES_ARENA
|
echo MES_ARENA=$MES_ARENA
|
||||||
bash build-aux/cc-mes.sh scaffold/main
|
bash build-aux/cc-mes.sh scaffold/main
|
||||||
|
@ -137,4 +117,4 @@ bash build-aux/cc-mes.sh scaffold/malloc
|
||||||
##sh build-aux/cc-mes.sh scaffold/tiny-mes
|
##sh build-aux/cc-mes.sh scaffold/tiny-mes
|
||||||
# bash build-aux/cc-mes.sh scaffold/mini-mes
|
# bash build-aux/cc-mes.sh scaffold/mini-mes
|
||||||
bash build-aux/cc-mes.sh src/mes
|
bash build-aux/cc-mes.sh src/mes
|
||||||
cp src/mes.mes-out src/mes
|
cp ${top_builddest}src/mes.mes-out ${top_builddest}src/mes
|
||||||
|
|
|
@ -18,33 +18,17 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
set -e
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
|
|
||||||
export BLOOD_ELF GUILE HEX2 M1 MES MESCC
|
. build-aux/config.sh
|
||||||
export M1FLAGS HEX2FLAGS PREPROCESS
|
. build-aux/trace.sh
|
||||||
|
|
||||||
HEX2=${HEX2-hex2}
|
|
||||||
M1=${M1-M1}
|
|
||||||
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
|
||||||
MESCC=${MESCC-$(command -v mescc)}
|
MESCC=${MESCC-$(command -v mescc)}
|
||||||
[ -z "$MESCC" ] && MESCC=scripts/mescc
|
[ -z "$MESCC" ] && MESCC=scripts/mescc
|
||||||
MES=${MES-$(command -v mes)}
|
MES=${MES-$(command -v mes)}
|
||||||
[ -z "$MES" ] && MES=src/mes
|
[ -z "$MES" ] && MES=${top_builddest}src/mes
|
||||||
|
|
||||||
MES_CPPFLAGS=${MES_CPPFLAGS-"
|
if [ "$V" = 2 ]; then
|
||||||
-D VERSION=\"$VERSION\"
|
|
||||||
-D MODULEDIR=\"$moduledir\"
|
|
||||||
-D PREFIX=\"$prefix\"
|
|
||||||
-I src
|
|
||||||
-I lib
|
|
||||||
-I include
|
|
||||||
"}
|
|
||||||
MES_CCFLAGS=${MES_CCFLAGS-"
|
|
||||||
"}
|
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
|
||||||
MES_CFLAGS="$MES_CFLAGS -v"
|
MES_CFLAGS="$MES_CFLAGS -v"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -53,30 +37,31 @@ c=$1
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -z "$ARCHDIR" ]; then
|
if [ -z "$ARCHDIR" ]; then
|
||||||
o="$c"
|
o="${top_builddest}$c"
|
||||||
|
d=${top_builddest}${c%%/*}
|
||||||
p="mes-"
|
p="mes-"
|
||||||
else
|
else
|
||||||
b=${c##*/}
|
b=${c##*/}
|
||||||
d=${c%%/*}
|
d=${top_builddest}${c%%/*}/x86-mes
|
||||||
o="$d/x86-mes/$b"
|
o="$d/$b"
|
||||||
mkdir -p $d/x86-mes
|
|
||||||
fi
|
fi
|
||||||
|
mkdir -p $d
|
||||||
|
|
||||||
if [ -n "$PREPROCESS" ]; then
|
if [ -n "$PREPROCESS" ]; then
|
||||||
./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -E -o "$o.E" "$c".c
|
trace "MESCPP $c.c" ${top_builddir}/pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -E -o "$o.E" "$c".c
|
||||||
./pre-inst-env bash $MESCC $MES_CFLAGS -S "$o".E
|
trace "MESCC $c.E" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -S "$o".E
|
||||||
./pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
|
trace "MESAS $c.S" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
|
||||||
if [ -z "$NOLINK" ]; then
|
if [ -z "$NOLINK" ]; then
|
||||||
./pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
|
trace "MESLD $c.o" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
|
||||||
fi
|
fi
|
||||||
elif [ -n "$COMPILE" ]; then
|
elif [ -n "$COMPILE" ]; then
|
||||||
./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -S -o "$o.S" "$c".c
|
trace "MESCC $c.c" trace "MESCC $c.c" ${top_builddir}/pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -S -o "$o.S" "$c".c
|
||||||
./pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
|
trace "MESAS $c.S" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
|
||||||
if [ -z "$NOLINK" ]; then
|
if [ -z "$NOLINK" ]; then
|
||||||
./pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
|
trace "MESLD $c.o" ${top_builddir}/pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
|
||||||
fi
|
fi
|
||||||
elif [ -z "$NOLINK" ]; then
|
elif [ -z "$NOLINK" ]; then
|
||||||
./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -o "$o".${p}out "$c".c $MES_LIBS
|
trace "MESLD $c.c" ${top_builddir}/pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -o "$o".${p}out "$c".c $MES_LIBS
|
||||||
else
|
else
|
||||||
./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -c -o "$o".${p}o "$c".c
|
trace "MESCC $c.c" ${top_builddir}/pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -c -o "$o".${p}o "$c".c
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -20,38 +20,23 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
. build-aux/trace.sh
|
||||||
set -x
|
. build-aux/config.sh
|
||||||
fi
|
|
||||||
|
|
||||||
CC_CPPFLAGS=${CC_CPPFLAGS-"
|
|
||||||
-D VERSION=\"$VERSION\"
|
|
||||||
-D MODULEDIR=\"$moduledir\"
|
|
||||||
-D PREFIX=\"$prefix\"
|
|
||||||
-I src
|
|
||||||
-I lib
|
|
||||||
-I include
|
|
||||||
"}
|
|
||||||
|
|
||||||
CC_CFLAGS=${CC_CFLAGS-"
|
|
||||||
--std=gnu99
|
|
||||||
-O0
|
|
||||||
-g
|
|
||||||
"}
|
|
||||||
|
|
||||||
c=$1
|
c=$1
|
||||||
|
|
||||||
if [ -z "$ARCHDIR" ]; then
|
if [ -z "$ARCHDIR" ]; then
|
||||||
o="$c"
|
o="${top_builddest}$c"
|
||||||
|
d=${top_builddest}${c%%/*}
|
||||||
p="gcc-"
|
p="gcc-"
|
||||||
else
|
else
|
||||||
b=${c##*/}
|
b=${c##*/}
|
||||||
d=${c%/*}
|
d=${top_builddest}${c%/*}/gcc
|
||||||
o="$d/gcc/$b"
|
o="$d/$b"
|
||||||
mkdir -p $d/gcc
|
|
||||||
fi
|
fi
|
||||||
|
mkdir -p $d
|
||||||
|
|
||||||
$CC\
|
trace "CC $c.c" $CC\
|
||||||
-c\
|
-c\
|
||||||
$CC_CPPFLAGS\
|
$CC_CPPFLAGS\
|
||||||
$CPPFLAGS\
|
$CPPFLAGS\
|
||||||
|
@ -63,12 +48,12 @@ $CC\
|
||||||
"$c".c
|
"$c".c
|
||||||
|
|
||||||
if [ -z "$NOLINK" ]; then
|
if [ -z "$NOLINK" ]; then
|
||||||
$CC\
|
trace "CCLD "$o".${p}out" $CC\
|
||||||
$CC_CPPFLAGS\
|
$CC_CPPFLAGS\
|
||||||
$CPPFLAGS\
|
$CPPFLAGS\
|
||||||
$CC_CFLAGS\
|
$CC_CFLAGS\
|
||||||
$CFLAGS\
|
$CFLAGS\
|
||||||
-o "$o".${p}out\
|
-o "$o".${p}out\
|
||||||
"$o".${p}o\
|
"$o".${p}o\
|
||||||
lib/gcc/libmes.o
|
${top_builddest}lib/gcc/libmes.o
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -20,30 +20,8 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
. build-aux/config.sh
|
||||||
set -x
|
. build-aux/trace.sh
|
||||||
fi
|
|
||||||
|
|
||||||
CC32_CPPFLAGS=${CC32_CPPFLAGS-"
|
|
||||||
-D VERSION=\"$VERSION\"
|
|
||||||
-D MODULEDIR=\"$moduledir\"
|
|
||||||
-D PREFIX=\"$prefix\"
|
|
||||||
-I src
|
|
||||||
-I lib
|
|
||||||
-I include
|
|
||||||
"}
|
|
||||||
|
|
||||||
CC32_CFLAGS=${CC32_CFLAGS-"
|
|
||||||
-std=gnu99
|
|
||||||
-O0
|
|
||||||
-fno-builtin
|
|
||||||
-fno-stack-protector
|
|
||||||
-g
|
|
||||||
-m32
|
|
||||||
-nostdinc
|
|
||||||
-nostdlib
|
|
||||||
"}
|
|
||||||
LIBC=${LIBC-c}
|
|
||||||
|
|
||||||
a=mes-gcc
|
a=mes-gcc
|
||||||
if [ "$CC32" = "$TCC" ]; then
|
if [ "$CC32" = "$TCC" ]; then
|
||||||
|
@ -53,22 +31,23 @@ fi
|
||||||
arch=x86-$a
|
arch=x86-$a
|
||||||
|
|
||||||
if [ -n "$LIBC" ]; then
|
if [ -n "$LIBC" ]; then
|
||||||
CC32LIBS="lib/$arch/lib$LIBC.o"
|
CC32LIBS="${top_builddest}lib/$arch/lib$LIBC.o"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
c=$1
|
c=$1
|
||||||
|
|
||||||
if [ -z "$ARCHDIR" ]; then
|
if [ -z "$ARCHDIR" ]; then
|
||||||
o="$c"
|
o="${top_builddest}$c"
|
||||||
|
d=${top_builddest}${c%%/*}
|
||||||
p="$a-"
|
p="$a-"
|
||||||
else
|
else
|
||||||
b=${c##*/}
|
b=${c##*/}
|
||||||
d=${c%%/*}
|
d=${top_builddest}${c%%/*}/$arch
|
||||||
o="$d/$arch/$b"
|
o="$d/$b"
|
||||||
mkdir -p $d/$arch
|
|
||||||
fi
|
fi
|
||||||
|
mkdir -p $d
|
||||||
|
|
||||||
$CC32\
|
trace "CC32 $c.c" $CC32\
|
||||||
-c\
|
-c\
|
||||||
$CC32_CPPFLAGS\
|
$CC32_CPPFLAGS\
|
||||||
$CC32_CFLAGS\
|
$CC32_CFLAGS\
|
||||||
|
@ -76,11 +55,11 @@ $CC32\
|
||||||
"$c".c
|
"$c".c
|
||||||
|
|
||||||
if [ -z "$NOLINK" ]; then
|
if [ -z "$NOLINK" ]; then
|
||||||
$CC32\
|
trace "CCLD32 $c.c" $CC32\
|
||||||
$CC32_CPPFLAGS\
|
$CC32_CPPFLAGS\
|
||||||
$CC32_CFLAGS\
|
$CC32_CFLAGS\
|
||||||
-o "$o".${p}out\
|
-o "$o".${p}out\
|
||||||
lib/$arch/crt1.o\
|
${top_builddest}lib/$arch/crt1.o\
|
||||||
"$o".${p}o\
|
"$o".${p}o\
|
||||||
$CC32LIBS
|
$CC32LIBS
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
. build-aux/config.sh
|
||||||
|
. build-aux/trace.sh
|
||||||
|
|
||||||
export GUILE MES
|
export GUILE MES
|
||||||
MES=${MES-./src/mes}
|
MES=${MES-./src/mes}
|
||||||
|
@ -27,8 +31,6 @@ if ! command -v $GUILE > /dev/null; then
|
||||||
GUILE=true
|
GUILE=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
tests="
|
tests="
|
||||||
|
|
||||||
00-zero.scm
|
00-zero.scm
|
||||||
|
@ -116,16 +118,18 @@ for i in $tests; do
|
||||||
echo ' [SKIP]'
|
echo ' [SKIP]'
|
||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
$GUILE -L module -C module -L . <(echo '(use-modules (mes guile))'; cat scaffold/boot/$i) >& /dev/null
|
trace "TEST $i.guile" $GUILE -L module -C ${builddest}/module -L . <(echo '(use-modules (mes guile))'; cat scaffold/boot/$i)
|
||||||
x=$(
|
x=$(
|
||||||
if [ -z "${i/5[0-9]-*/}" ]; then
|
if [ "$MES" = guile ]; then
|
||||||
cat scaffold/boot/$i | MES_BOOT=boot-00.scm $MES 2>&1;
|
true
|
||||||
|
elif [ -z "${i/5[0-9]-*/}" ]; then
|
||||||
|
cat scaffold/boot/$i | MES_BOOT=${srcdir}/boot-00.scm $MES 2>&1;
|
||||||
elif [ -z "${i/6[0-9]-*/}" ]; then
|
elif [ -z "${i/6[0-9]-*/}" ]; then
|
||||||
cat scaffold/boot/$i | MES_BOOT=boot-01.scm $MES 2>&1;
|
cat scaffold/boot/$i | MES_BOOT=${srcdir}/boot-01.scm $MES 2>&1;
|
||||||
else
|
else
|
||||||
MES_BOOT=scaffold/boot/$i $MES 2>&1;
|
MES_BOOT=${srcdir}/scaffold/boot/$i $MES 2>&1;
|
||||||
fi
|
fi
|
||||||
) \
|
) \
|
||||||
&& echo ' [PASS]' \
|
&& echo ' [PASS]' \
|
||||||
|| (r=$?; echo ' [FAIL]'; echo -e "$x"; echo scaffold/boot/$i; exit $r)
|
|| (r=$?; echo ' [FAIL]'; echo -e "$x"; echo ${top_builddest}scaffold/boot/$i; exit $r)
|
||||||
done
|
done
|
||||||
|
|
|
@ -18,9 +18,10 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
export BASH
|
set -e
|
||||||
export GUILE MES MES_ARENA
|
|
||||||
export BUILD_DEBUG
|
. build-aux/config.sh
|
||||||
|
. build-aux/trace.sh
|
||||||
|
|
||||||
if [ "$MES" = guile ]; then
|
if [ "$MES" = guile ]; then
|
||||||
mes=guile-
|
mes=guile-
|
||||||
|
@ -30,8 +31,6 @@ GUILE=${GUILE-guile}
|
||||||
MES=${MES-src/mes}
|
MES=${MES-src/mes}
|
||||||
MES_ARENA=${MES_ARENA-100000000}
|
MES_ARENA=${MES_ARENA-100000000}
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
tests="
|
tests="
|
||||||
tests/boot.test
|
tests/boot.test
|
||||||
tests/read.test
|
tests/read.test
|
||||||
|
@ -61,10 +60,7 @@ tests/match.test
|
||||||
tests/psyntax.test
|
tests/psyntax.test
|
||||||
"
|
"
|
||||||
|
|
||||||
slow_or_broken="
|
mkdir -p ${top_builddest}tests
|
||||||
tests/peg.test
|
|
||||||
"
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
fail=0
|
fail=0
|
||||||
total=0
|
total=0
|
||||||
|
@ -73,7 +69,7 @@ for t in $tests; do
|
||||||
echo $t: [SKIP];
|
echo $t: [SKIP];
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
./pre-inst-env sh "$t" &> $t.${mes}log
|
${top_builddir}/pre-inst-env sh "$t" &> ${top_builddest}$t.${mes}log
|
||||||
r=$?
|
r=$?
|
||||||
total=$((total+1))
|
total=$((total+1))
|
||||||
if [ $r = 0 ]; then
|
if [ $r = 0 ]; then
|
||||||
|
|
|
@ -18,18 +18,12 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
set -e
|
||||||
set -x
|
. build-aux/config.sh
|
||||||
fi
|
. build-aux/trace.sh
|
||||||
|
|
||||||
export BLOOD_ELF GUILE HEX2 M1 MES MESCC
|
|
||||||
export M1FLAGS HEX2FLAGS PREPROCESS
|
|
||||||
export MES_ARENA MES_PREFIX MES_SEED
|
|
||||||
export BUILD_DEBUG
|
|
||||||
export LIBC CC32LIBS MES_LIBS
|
|
||||||
|
|
||||||
MES=${MES-src/mes}
|
MES=${MES-src/mes}
|
||||||
MESCC=${MESCC-scripts/mescc}
|
[ -z "$MESCC" ] && MESCC=${top_builddest}scripts/mescc
|
||||||
GUILE=${GUILE-guile}
|
GUILE=${GUILE-guile}
|
||||||
MES_PREFIX=${MES_PREFIX-mes}
|
MES_PREFIX=${MES_PREFIX-mes}
|
||||||
|
|
||||||
|
@ -38,9 +32,9 @@ M1=${M1-M1}
|
||||||
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
||||||
MES_SEED=${MES_SEED-../mes-seed}
|
MES_SEED=${MES_SEED-../mes-seed}
|
||||||
MESCC=${MESCC-$(command -v mescc)}
|
MESCC=${MESCC-$(command -v mescc)}
|
||||||
[ -z "$MESCC" ] && MESCC=scripts/mescc
|
[ -z "$MESCC" ] && MESCC=${top_builddest}scripts/mescc
|
||||||
MES=${MES-$(command -v mes)}
|
MES=${MES-$(command -v mes)}
|
||||||
[ -z "$MES" ] && MES=src/mes
|
[ -z "$MES" ] && MES=${top_builddest}src/mes
|
||||||
|
|
||||||
if ! command -v $GUILE > /dev/null; then
|
if ! command -v $GUILE > /dev/null; then
|
||||||
GUILE=true
|
GUILE=true
|
||||||
|
@ -158,6 +152,7 @@ expect=$(echo $broken | wc -w)
|
||||||
pass=0
|
pass=0
|
||||||
fail=0
|
fail=0
|
||||||
total=0
|
total=0
|
||||||
|
mkdir -p ${top_builddest}scaffold/tests
|
||||||
for t in $tests; do
|
for t in $tests; do
|
||||||
if [ -z "${t/[012][0-9]-*/}" ]; then
|
if [ -z "${t/[012][0-9]-*/}" ]; then
|
||||||
LIBC=c-mini
|
LIBC=c-mini
|
||||||
|
@ -172,7 +167,7 @@ for t in $tests; do
|
||||||
LIBC=c
|
LIBC=c
|
||||||
MES_LIBS=
|
MES_LIBS=
|
||||||
fi
|
fi
|
||||||
sh build-aux/test.sh "scaffold/tests/$t" &> scaffold/tests/"$t".log
|
sh build-aux/test.sh "scaffold/tests/$t" &> ${top_builddest}scaffold/tests/"$t".log
|
||||||
r=$?
|
r=$?
|
||||||
total=$((total+1))
|
total=$((total+1))
|
||||||
if [ $r = 0 ]; then
|
if [ $r = 0 ]; then
|
||||||
|
@ -278,18 +273,20 @@ broken="$broken
|
||||||
#42_function_pointer ; f* functions
|
#42_function_pointer ; f* functions
|
||||||
#49_bracket_evaluation ; float
|
#49_bracket_evaluation ; float
|
||||||
|
|
||||||
|
|
||||||
LIBC=c+gnu
|
LIBC=c+gnu
|
||||||
MES_LIBS="-l c+gnu"
|
MES_LIBS="-l c+gnu"
|
||||||
|
|
||||||
expect=$(echo $broken | wc -w)
|
expect=$(echo $broken | wc -w)
|
||||||
ARGS="arg1 arg2 arg3 arg4 arg5"
|
ARGS="arg1 arg2 arg3 arg4 arg5"
|
||||||
export ARGS
|
export ARGS
|
||||||
|
mkdir -p ${top_builddest}scaffold/tinycc
|
||||||
for t in $tests; do
|
for t in $tests; do
|
||||||
if [ ! -f scaffold/tinycc/"$t.c" ]; then
|
if [ ! -f scaffold/tinycc/"$t.c" ]; then
|
||||||
echo ' [SKIP]'
|
echo ' [SKIP]'
|
||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
sh build-aux/test.sh "scaffold/tinycc/$t" &> scaffold/tinycc/"$t".log
|
sh build-aux/test.sh "scaffold/tinycc/$t" &> ${top_builddest}scaffold/tinycc/"$t".log
|
||||||
r=$?
|
r=$?
|
||||||
total=$((total+1))
|
total=$((total+1))
|
||||||
if [ $r = 0 ]; then
|
if [ $r = 0 ]; then
|
||||||
|
|
138
build-aux/config.sh
Normal file
138
build-aux/config.sh
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
top_builddir=${top_builddir-.}
|
||||||
|
|
||||||
|
if [ "$V" = 2 ]; then
|
||||||
|
echo $0
|
||||||
|
echo top_builddest=${top_builddest}
|
||||||
|
echo top_builddir=${top_builddir}
|
||||||
|
fi
|
||||||
|
|
||||||
|
export CC
|
||||||
|
export CC CFLAGS
|
||||||
|
export CC32
|
||||||
|
export CC_CFLAGS
|
||||||
|
export CC_CFLAGS
|
||||||
|
export CC_CPPFLAGS
|
||||||
|
export CC_CPPFLAGS
|
||||||
|
export CFLAGS
|
||||||
|
export CPPFLAGS
|
||||||
|
export CPPFLAGS
|
||||||
|
export GUILE
|
||||||
|
export HEX2
|
||||||
|
export HEX2FLAGS
|
||||||
|
export LIBC
|
||||||
|
export M1
|
||||||
|
export M1FLAGS
|
||||||
|
export MES
|
||||||
|
export MES_CFLAGS
|
||||||
|
export MES_LIBS
|
||||||
|
export TCC
|
||||||
|
|
||||||
|
export MES_DEBUG
|
||||||
|
export MES_SEED
|
||||||
|
export MES_ARENA
|
||||||
|
export COMPILE
|
||||||
|
export PREPROCESS
|
||||||
|
export V
|
||||||
|
|
||||||
|
export abs_top_builddir
|
||||||
|
export abs_top_srcdir
|
||||||
|
export datadir
|
||||||
|
export moduledir
|
||||||
|
export prefix
|
||||||
|
export srcdir
|
||||||
|
export top_builddest
|
||||||
|
export top_builddir
|
||||||
|
|
||||||
|
MESCC=${MESCC-mescc}
|
||||||
|
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
||||||
|
HEX2=${HEX2-hex2}
|
||||||
|
M1=${M1-M1}
|
||||||
|
|
||||||
|
CC_CPPFLAGS=${CC_CPPFLAGS-"
|
||||||
|
-D 'VERSION=\"$VERSION\"'
|
||||||
|
-D 'MODULEDIR=\"$moduledir\"'
|
||||||
|
-D 'PREFIX=\"$prefix\"'
|
||||||
|
-D boo
|
||||||
|
-I ${top_builddest}src
|
||||||
|
-I src
|
||||||
|
-I lib
|
||||||
|
-I include
|
||||||
|
"}
|
||||||
|
|
||||||
|
CC_CFLAGS=${CC_CFLAGS-"
|
||||||
|
--std=gnu99
|
||||||
|
-O0
|
||||||
|
-g
|
||||||
|
"}
|
||||||
|
|
||||||
|
CC32_CPPFLAGS=${CC32_CPPFLAGS-"
|
||||||
|
-D 'VERSION=\"$VERSION\"'
|
||||||
|
-D 'MODULEDIR=\"$moduledir\"'
|
||||||
|
-D 'PREFIX=\"$prefix\"'
|
||||||
|
-I ${top_builddest}src
|
||||||
|
-I src
|
||||||
|
-I lib
|
||||||
|
-I include
|
||||||
|
"}
|
||||||
|
|
||||||
|
CC32_CFLAGS=${CC32_CFLAGS-"
|
||||||
|
-std=gnu99
|
||||||
|
-O0
|
||||||
|
-fno-builtin
|
||||||
|
-fno-stack-protector
|
||||||
|
-g
|
||||||
|
-m32
|
||||||
|
-nostdinc
|
||||||
|
-nostdlib
|
||||||
|
-Wno-discarded-qualifiers
|
||||||
|
-Wno-int-to-pointer-cast
|
||||||
|
-Wno-pointer-to-int-cast
|
||||||
|
-Wno-pointer-sign
|
||||||
|
-Wno-int-conversion
|
||||||
|
-Wno-incompatible-pointer-types
|
||||||
|
"}
|
||||||
|
|
||||||
|
MES_CPPFLAGS=${MES_CPPFLAGS-"
|
||||||
|
-D 'VERSION=\"$VERSION\"'
|
||||||
|
-D 'MODULEDIR=\"$moduledir\"'
|
||||||
|
-D 'PREFIX=\"$prefix\"'
|
||||||
|
-I ${top_builddest}src
|
||||||
|
-I src
|
||||||
|
-I lib
|
||||||
|
-I include
|
||||||
|
"}
|
||||||
|
|
||||||
|
MES_CFLAGS=${MES_CFLAGS-"
|
||||||
|
"}
|
||||||
|
|
||||||
|
MES_CFLAGS=${MES_CFLAGS-"
|
||||||
|
"}
|
||||||
|
|
||||||
|
M1FLAGS=${M1FLAGS-"
|
||||||
|
--LittleEndian
|
||||||
|
--Architecture 1
|
||||||
|
"}
|
||||||
|
|
||||||
|
HEX2FLAGS=${HEX2FLAGS-"
|
||||||
|
--LittleEndian
|
||||||
|
--Architecture 1
|
||||||
|
--BaseAddress 0x1000000
|
||||||
|
"}
|
|
@ -1,5 +1,16 @@
|
||||||
ifdef BUILD_DEBUG
|
export PACKAGE
|
||||||
export BUILD_DEBUG
|
export VERSION
|
||||||
|
|
||||||
|
export abs_top_builddir
|
||||||
|
export abs_top_srcdir
|
||||||
|
export top_builddest
|
||||||
|
export top_builddir
|
||||||
|
export config.make
|
||||||
|
export srcdir
|
||||||
|
|
||||||
|
|
||||||
|
ifdef V
|
||||||
|
export V
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef DESTDIR
|
ifdef DESTDIR
|
||||||
|
@ -18,10 +29,6 @@ ifdef mandir
|
||||||
export mandir
|
export mandir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef VERSION
|
|
||||||
export VERSION
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef ARCH
|
ifdef ARCH
|
||||||
export ARCH
|
export ARCH
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -46,7 +46,8 @@ exec ${GUILE-guile} --no-auto-compile -L $(dirname $0) -C $(dirname $0) -e '(mes
|
||||||
(mes-use-module (srfi srfi-9))
|
(mes-use-module (srfi srfi-9))
|
||||||
(mes-use-module (srfi srfi-26))
|
(mes-use-module (srfi srfi-26))
|
||||||
|
|
||||||
(format (current-error-port) "mes-snarf[~a]...\n" %scheme)
|
(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)
|
(define (char->char from to char)
|
||||||
(if (eq? char from) to char))
|
(if (eq? char from) to char))
|
||||||
|
@ -209,7 +210,7 @@ exec ${GUILE-guile} --no-auto-compile -L $(dirname $0) -C $(dirname $0) -e '(mes
|
||||||
(functions (filter (negate internal?) functions))
|
(functions (filter (negate internal?) functions))
|
||||||
(symbols (snarf-symbols string))
|
(symbols (snarf-symbols string))
|
||||||
(base-name (basename file-name ".c"))
|
(base-name (basename file-name ".c"))
|
||||||
(dir (or (getenv "OUT") (dirname file-name)))
|
(dir (string-append (or (getenv "top_builddest") "") (dirname file-name)))
|
||||||
(base-name (string-append dir "/" base-name))
|
(base-name (string-append dir "/" base-name))
|
||||||
(base-name (if %gcc? base-name
|
(base-name (if %gcc? base-name
|
||||||
(string-append base-name ".mes")))
|
(string-append base-name ".mes")))
|
||||||
|
@ -234,6 +235,7 @@ exec ${GUILE-guile} --no-auto-compile -L $(dirname $0) -C $(dirname $0) -e '(mes
|
||||||
(list header source environment symbols.h symbols.i symbol-names.i)))
|
(list header source environment symbols.h symbols.i symbol-names.i)))
|
||||||
|
|
||||||
(define (file-write file)
|
(define (file-write file)
|
||||||
|
(system* "mkdir" "-p" (dirname (file.name file)))
|
||||||
(with-output-to-file (file.name file) (lambda () (display (file.content file)))))
|
(with-output-to-file (file.name file) (lambda () (display (file.content file)))))
|
||||||
|
|
||||||
(define (main args)
|
(define (main args)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#! @BASH@
|
||||||
|
|
||||||
# Mes --- Maxwell Equations of Software
|
# Mes --- Maxwell Equations of Software
|
||||||
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
@ -18,19 +18,29 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
abs_top_srcdir="$(cd "@abs_top_srcdir@" > /dev/null; pwd -P)"
|
top_builddest="@top_builddest@"
|
||||||
abs_top_builddir="$(cd "@abs_top_builddir@" > /dev/null; pwd -P)"
|
abs_top_srcdir="@abs_top_srcdir@"
|
||||||
|
abs_top_builddir="@abs_top_builddir@"
|
||||||
|
|
||||||
MES_PREFIX=mes
|
MES_PREFIX=mes
|
||||||
export MES_PREFIX
|
export MES_PREFIX
|
||||||
|
|
||||||
GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/module${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
|
GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/module${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
|
||||||
GUILE_LOAD_PATH="$abs_top_srcdir/module${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
|
GUILE_LOAD_PATH="$abs_top_srcdir/module${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
|
||||||
|
if [ -n "$top_builddest" ]; then
|
||||||
|
GUILE_LOAD_PATH="$abs_top_buildir/module:$GUILE_LOAD_PATH"
|
||||||
|
fi
|
||||||
export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
|
export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
|
||||||
|
|
||||||
PATH="$abs_top_builddir/scripts:$PATH"
|
PATH="$abs_top_builddir/scripts:$abs_top_builddir/src:$abs_top_builddir/build-aux:$PATH"
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
|
MES=${MES-${top_builddest}src/mes}
|
||||||
|
export MES
|
||||||
|
|
||||||
|
GUIX_PACKAGE_PATH="$abs_top_srcdir/guix${GUIX_PACKAGE_PATH:+:}$GUIX_PACKAGE_PATH"
|
||||||
|
export GUIX_PACKAGE_PATH
|
||||||
|
|
||||||
LANG=
|
LANG=
|
||||||
LC_ALL=
|
LC_ALL=
|
||||||
|
|
||||||
|
|
|
@ -18,39 +18,38 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
set -e
|
||||||
set -x
|
. build-aux/config.sh
|
||||||
fi
|
. build-aux/trace.sh
|
||||||
|
|
||||||
MES_ARENA=100000000
|
MES_ARENA=100000000
|
||||||
|
|
||||||
export LIBC MES_LIBS
|
|
||||||
|
|
||||||
GUILE=${GUILE-$MES}
|
GUILE=${GUILE-$MES}
|
||||||
DIFF=${DIFF-$(command -v diff)}
|
DIFF=${DIFF-$(command -v diff)}
|
||||||
[ -z "$DIFF" ] && DIFF="sh scripts/diff.scm"
|
[ -z "$DIFF" ] && DIFF="sh ${top_builddest}scripts/diff.scm"
|
||||||
|
|
||||||
t=${1-scaffold/tests/t}
|
t=${1-scaffold/tests/t}
|
||||||
rm -f "$t".mes-out
|
o="${top_builddest}$t"
|
||||||
|
rm -f "$o".mes-out
|
||||||
shift
|
shift
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm -f "$t".gcc-out
|
rm -f "$o".gcc-out
|
||||||
if [ -n "$CC" ]; then
|
if [ -n "$CC" ]; then
|
||||||
sh build-aux/cc.sh "$t"
|
sh build-aux/cc.sh "$t"
|
||||||
|
|
||||||
r=0
|
r=0
|
||||||
[ -f "$t".exit ] && r=$(cat "$t".exit)
|
[ -f "$t".exit ] && r=$(cat "$t".exit)
|
||||||
set +e
|
set +e
|
||||||
"$t".gcc-out $ARGS > "$t".gcc-stdout
|
"$o".gcc-out $ARGS > "$o".gcc-stdout
|
||||||
m=$?
|
m=$?
|
||||||
cat "$t".gcc-stdout
|
cat "$o".gcc-stdout
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ $m = $r ]
|
[ $m = $r ]
|
||||||
if [ -f "$t".expect ]; then
|
if [ -f "$t".expect ]; then
|
||||||
$DIFF -ub "$t".expect "$t".gcc-stdout;
|
$DIFF -ub "$t".expect "$o".gcc-stdout;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -61,29 +60,29 @@ if [ -n "$CC32" ]; then
|
||||||
r=0
|
r=0
|
||||||
[ -f "$t".exit ] && r=$(cat "$t".exit)
|
[ -f "$t".exit ] && r=$(cat "$t".exit)
|
||||||
set +e
|
set +e
|
||||||
"$t".mes-gcc-out $ARGS > "$t".mes-gcc-stdout
|
"$o".mes-gcc-out $ARGS > "$o".mes-gcc-stdout
|
||||||
m=$?
|
m=$?
|
||||||
cat "$t".mes-gcc-stdout
|
cat "$t".mes-gcc-stdout
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ $m = $r ]
|
[ $m = $r ]
|
||||||
if [ -f "$t".expect ]; then
|
if [ -f "$t".expect ]; then
|
||||||
$DIFF -ub "$t".expect "$t".mes-gcc-stdout;
|
$DIFF -ub "$t".expect "$o".mes-gcc-stdout;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$t".mes-out
|
rm -f "$o".mes-out
|
||||||
sh build-aux/cc-mes.sh "$t"
|
sh build-aux/cc-mes.sh "$t"
|
||||||
|
|
||||||
r=0
|
r=0
|
||||||
[ -f "$t".exit ] && r=$(cat "$t".exit)
|
[ -f "$t".exit ] && r=$(cat "$t".exit)
|
||||||
set +e
|
set +e
|
||||||
"$t".mes-out $ARGS > "$t".mes-stdout
|
"$o".mes-out $ARGS > "$o".mes-stdout
|
||||||
m=$?
|
m=$?
|
||||||
cat "$t".mes-stdout
|
cat "$o".mes-stdout
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ $m = $r ]
|
[ $m = $r ]
|
||||||
if [ -f "$t".expect ]; then
|
if [ -f "$t".expect ]; then
|
||||||
$DIFF -ub "$t".expect "$t".mes-stdout;
|
$DIFF -ub "$t".expect "$o".mes-stdout;
|
||||||
fi
|
fi
|
||||||
|
|
41
build-aux/trace.sh
Normal file
41
build-aux/trace.sh
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
if [ -z "$V" -o "$V0" = 0 ]; then
|
||||||
|
function trace () {
|
||||||
|
echo " $1"
|
||||||
|
shift
|
||||||
|
eval "$@" $LOG
|
||||||
|
}
|
||||||
|
LOG=" >>${top_builddest}build.log 2>&1"
|
||||||
|
fi
|
||||||
|
if [ "$V" = 1 ]; then
|
||||||
|
function trace () {
|
||||||
|
shift
|
||||||
|
echo "$@"
|
||||||
|
eval "$@ $LOG"
|
||||||
|
}
|
||||||
|
LOG=" >>${top_builddest}build.log 2>&1"
|
||||||
|
fi
|
||||||
|
if [ "$V" = 2 ]; then
|
||||||
|
set -x
|
||||||
|
function trace () {
|
||||||
|
shift
|
||||||
|
eval "$@"
|
||||||
|
}
|
||||||
|
fi
|
64
build.sh
64
build.sh
|
@ -18,82 +18,30 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
. build-aux/config.sh
|
||||||
set -x
|
. build-aux/trace.sh
|
||||||
fi
|
|
||||||
|
|
||||||
# dash does not export foo=${foo-bar} for some values
|
|
||||||
export prefix datadir moduledir
|
|
||||||
export CC CC32 TCC GUILE MESCC MES_SEED
|
|
||||||
export MES_ARENA MES_DEBUG
|
|
||||||
export CPPFLAGS CFLAGS C32FLAGS MESCCFLAGS
|
|
||||||
export BUILD_DEBUG
|
|
||||||
|
|
||||||
CC=${CC-$(command -v gcc)}
|
|
||||||
CC32=${CC32-$(command -v i686-unknown-linux-gnu-gcc)}
|
|
||||||
MESCC=${MESCC-$(command -v mescc)}
|
|
||||||
MES_SEED=${MES_SEED-../mes-seed}
|
MES_SEED=${MES_SEED-../mes-seed}
|
||||||
GUILE=${GUILE-$(command -v guile)}
|
GUILE=${GUILE-$(command -v guile)}
|
||||||
MES_ARENA=${MES_ARENA-100000000}
|
MES_ARENA=${MES_ARENA-100000000}
|
||||||
MES_DEBUG=${MES_DEBUG-1}
|
|
||||||
|
|
||||||
prefix=${prefix-/usr/local}
|
if [ -n "$GUILE" -a "$GUILE" != true ]; then
|
||||||
datadir=${datadir-$prefix/share/mes}
|
|
||||||
moduledir=${moduledir-${datadir}${datadir:+/}module}
|
|
||||||
set -e
|
|
||||||
|
|
||||||
CC_CPPFLAGS=${CC_CPPFLAGS-"
|
|
||||||
-D VERSION=\"$VERSION\"
|
|
||||||
-D MODULEDIR=\"$moduledir\"
|
|
||||||
-D PREFIX=\"$prefix\"
|
|
||||||
-I src
|
|
||||||
-I lib
|
|
||||||
-I include
|
|
||||||
"}
|
|
||||||
CC32_CPPFLAGS=${CC_CPPFLAGS-CC32_CPPFLAGS}
|
|
||||||
CC_CFLAGS=${CC_CFLAGS-"
|
|
||||||
--std=gnu99
|
|
||||||
-O0
|
|
||||||
-g
|
|
||||||
"}
|
|
||||||
CC32_FLAGS=${CC32_FLAGS-"
|
|
||||||
--std=gnu99
|
|
||||||
-O0
|
|
||||||
-fno-stack-protector
|
|
||||||
-g
|
|
||||||
-m32
|
|
||||||
-nostdinc
|
|
||||||
-nostdlib
|
|
||||||
"}
|
|
||||||
MES_CFLAGS=${MES_CFLAGS-"
|
|
||||||
"}
|
|
||||||
M1FLAGS=${M1FLAGS-"
|
|
||||||
--LittleEndian
|
|
||||||
--Architecture 1
|
|
||||||
"}
|
|
||||||
HEX2FLAGS=${HEX2FLAGS-"
|
|
||||||
--LittleEndian
|
|
||||||
--Architecture 1
|
|
||||||
--BaseAddress 0x1000000
|
|
||||||
"}
|
|
||||||
|
|
||||||
if [ -n "$GUILE" ]; then
|
|
||||||
sh build-aux/build-guile.sh
|
sh build-aux/build-guile.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$CC" ]; then
|
if [ -n "$CC" ]; then
|
||||||
sh build-aux/build-cc.sh
|
sh build-aux/build-cc.sh
|
||||||
cp src/mes.gcc-out src/mes
|
cp ${top_builddest}src/mes.gcc-out ${top_builddest}src/mes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$CC32" ]; then
|
if [ -n "$CC32" ]; then
|
||||||
sh build-aux/build-cc32.sh
|
sh build-aux/build-cc32.sh
|
||||||
cp src/mes.mes-gcc-out src/mes
|
cp ${top_builddest}src/mes.mes-gcc-out ${top_builddest}src/mes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$TCC" ]; then
|
if [ -n "$TCC" ]; then
|
||||||
CC32=$TCC sh build-aux/build-cc32.sh
|
CC32=$TCC sh build-aux/build-cc32.sh
|
||||||
cp src/mes.mes-tcc-out src/mes
|
cp ${top_builddest}src/mes.mes-tcc-out ${top_builddest}src/mes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sh build-aux/build-mes.sh
|
sh build-aux/build-mes.sh
|
||||||
|
|
9
check.sh
9
check.sh
|
@ -18,9 +18,10 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
export CC32
|
set -e
|
||||||
export GUILE MES MES_ARENA
|
|
||||||
export BUILD_DEBUG
|
. build-aux/config.sh
|
||||||
|
. build-aux/trace.sh
|
||||||
|
|
||||||
GUILE=${GUILE-guile}
|
GUILE=${GUILE-guile}
|
||||||
MES=${MES-src/mes}
|
MES=${MES-src/mes}
|
||||||
|
@ -33,6 +34,6 @@ fi
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ "$GUILE" != true ] && MES=guile bash build-aux/check-mes.sh
|
[ "$GUILE" != true ] && MES=guile bash build-aux/check-mes.sh
|
||||||
bash build-aux/check-mes.sh
|
[ "$MES" != guile ] && bash build-aux/check-mes.sh
|
||||||
bash build-aux/check-boot.sh
|
bash build-aux/check-boot.sh
|
||||||
bash build-aux/check-mescc.sh
|
bash build-aux/check-mescc.sh
|
||||||
|
|
93
configure
vendored
93
configure
vendored
|
@ -2,7 +2,8 @@
|
||||||
# -*- scheme -*-
|
# -*- scheme -*-
|
||||||
unset LANG LC_ALL
|
unset LANG LC_ALL
|
||||||
guile=$(command -v ${GUILE-guile})
|
guile=$(command -v ${GUILE-guile})
|
||||||
if $(command -v ${GUIX-guix}); then
|
guix=$(command -v ${GUIX-guix})
|
||||||
|
if [ -n "$guix" ] ; then
|
||||||
install="guix environment -l guix.scm"
|
install="guix environment -l guix.scm"
|
||||||
else
|
else
|
||||||
install="sudo apt-get install guile-2.2-dev"
|
install="sudo apt-get install guile-2.2-dev"
|
||||||
|
@ -134,7 +135,9 @@ exec ${guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
|
||||||
|
|
||||||
(define* (make-dep name #:optional (version '(0))
|
(define* (make-dep name #:optional (version '(0))
|
||||||
#:key optional? (version-option "--version") (commands (list name)) file-name)
|
#:key optional? (version-option "--version") (commands (list name)) file-name)
|
||||||
(make-depedency name version optional? version-option commands file-name))
|
(let* ((env-var (getenv (name->shell-name name)))
|
||||||
|
(commands (if env-var (cons env-var commands) commands)))
|
||||||
|
(make-depedency name version optional? version-option commands file-name)))
|
||||||
|
|
||||||
(define (find-dep name deps)
|
(define (find-dep name deps)
|
||||||
(find (compose (cut equal? <> name) dependency-name) deps))
|
(find (compose (cut equal? <> name) dependency-name) deps))
|
||||||
|
@ -145,7 +148,10 @@ exec ${guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
|
||||||
(define (variable-name dependency)
|
(define (variable-name dependency)
|
||||||
(and=>
|
(and=>
|
||||||
(dependency-name dependency)
|
(dependency-name dependency)
|
||||||
(compose string-upcase (cut string-replace-char <> #\- #\_))))
|
name->shell-name))
|
||||||
|
|
||||||
|
(define (name->shell-name name)
|
||||||
|
(string-upcase (string-replace-char name #\- #\_)))
|
||||||
|
|
||||||
(define (version->string version)
|
(define (version->string version)
|
||||||
((->string '.) version))
|
((->string '.) version))
|
||||||
|
@ -278,16 +284,6 @@ Some influential environment variables:
|
||||||
TINYCC_SEED location of tinycc-seed
|
TINYCC_SEED location of tinycc-seed
|
||||||
" PACKAGE VERSION (getenv "prefix")))
|
" PACKAGE VERSION (getenv "prefix")))
|
||||||
|
|
||||||
(define* (substitute file-name pairs
|
|
||||||
#:key (target (if (string-suffix? ".in" file-name)
|
|
||||||
(string-drop-right file-name 3) target)))
|
|
||||||
(with-output-to-file target
|
|
||||||
(lambda _
|
|
||||||
(display
|
|
||||||
(fold (lambda (o result)
|
|
||||||
(regexp-substitute/global #f (car o) result 'pre (cdr o) 'post))
|
|
||||||
(with-input-from-file file-name read-string) pairs)))))
|
|
||||||
|
|
||||||
(define (main args)
|
(define (main args)
|
||||||
(let* ((prefix "/usr/local")
|
(let* ((prefix "/usr/local")
|
||||||
(infodir "${prefix}/share/info")
|
(infodir "${prefix}/share/info")
|
||||||
|
@ -296,9 +292,11 @@ Some influential environment variables:
|
||||||
|
|
||||||
(srcdir (dirname (car (command-line))))
|
(srcdir (dirname (car (command-line))))
|
||||||
(abs-top-srcdir (canonicalize-path srcdir))
|
(abs-top-srcdir (canonicalize-path srcdir))
|
||||||
(builddir (getcwd))
|
(abs-top-builddir (canonicalize-path (getcwd)))
|
||||||
(abs-top-builddir (canonicalize-path builddir))
|
(top-builddir (if (equal? srcdir ".") "."
|
||||||
|
abs-top-builddir))
|
||||||
|
(top-builddest (if (equal? srcdir ".") ""
|
||||||
|
(string-append abs-top-builddir "/")))
|
||||||
|
|
||||||
(options (parse-opts args))
|
(options (parse-opts args))
|
||||||
|
|
||||||
|
@ -320,14 +318,20 @@ Some influential environment variables:
|
||||||
(disable-silent-rules? (option-ref options 'disable-silent-rules #f))
|
(disable-silent-rules? (option-ref options 'disable-silent-rules #f))
|
||||||
(vars (filter (cut string-index <> #\=) (option-ref options '() '())))
|
(vars (filter (cut string-index <> #\=) (option-ref options '() '())))
|
||||||
(help? (option-ref options 'help #f)))
|
(help? (option-ref options 'help #f)))
|
||||||
|
(define (srcdir-relative file-name)
|
||||||
|
(if (equal? srcdir ".") file-name
|
||||||
|
(string-append srcdir "/" file-name)))
|
||||||
(when help?
|
(when help?
|
||||||
(print-help)
|
(print-help)
|
||||||
(exit 0))
|
(exit 0))
|
||||||
(set! %verbose? (option-ref options 'verbose #f))
|
(set! %verbose? (option-ref options 'verbose #f))
|
||||||
(for-each (lambda (v) (apply setenv (string-split v #\=))) vars)
|
(for-each (lambda (v) (apply setenv (string-split v #\=))) vars)
|
||||||
(let* ((mes-seed (or (getenv "MES_SEED") "../mes-seed"))
|
(let* ((mes-seed (or (getenv "MES_SEED")
|
||||||
(tinycc-seed (or (getenv "TINYCC_SEED") "../tinycc-seed"))
|
(srcdir-relative "../mes-seed")))
|
||||||
(mescc-tools-seed (or (getenv "MESCC_TOOLS_SEED") "../mescc-tools-seed"))
|
(tinycc-seed (or (getenv "TINYCC_SEED")
|
||||||
|
(srcdir-relative "../tinycc-seed")))
|
||||||
|
(mescc-tools-seed (or (getenv "MESCC_TOOLS_SEED")
|
||||||
|
(srcdir-relative "../mescc-tools-seed")))
|
||||||
(deps (fold (lambda (program results)
|
(deps (fold (lambda (program results)
|
||||||
(cons (check-program-version program) results))
|
(cons (check-program-version program) results))
|
||||||
'()
|
'()
|
||||||
|
@ -348,7 +352,7 @@ Some influential environment variables:
|
||||||
(make-dep "M1" '(0 3))
|
(make-dep "M1" '(0 3))
|
||||||
(make-dep "blood-elf" '(0 1))
|
(make-dep "blood-elf" '(0 1))
|
||||||
(make-dep "hex2" '(0 3))
|
(make-dep "hex2" '(0 3))
|
||||||
(make-dep "tcc" '(0 9 26) #:optional? #t)
|
(make-dep "tcc" '(0 9 26) #:optional? #t #:version-option "-v")
|
||||||
(make-dep "makeinfo" '(5) #:optional? #t)
|
(make-dep "makeinfo" '(5) #:optional? #t)
|
||||||
(make-dep "help2man" '(1 47) #:optional? #t)
|
(make-dep "help2man" '(1 47) #:optional? #t)
|
||||||
(make-dep "perl" '(5) #:optional? #t)
|
(make-dep "perl" '(5) #:optional? #t)
|
||||||
|
@ -365,6 +369,18 @@ Some influential environment variables:
|
||||||
deps))
|
deps))
|
||||||
(missing (filter (conjoin (negate dependency-file-name)
|
(missing (filter (conjoin (negate dependency-file-name)
|
||||||
(negate dependency-optional?)) deps)))
|
(negate dependency-optional?)) deps)))
|
||||||
|
|
||||||
|
(define* (substitute file-name pairs
|
||||||
|
#:key (target (if (string-suffix? ".in" file-name)
|
||||||
|
(string-drop-right file-name 3) file-name)))
|
||||||
|
(system* "mkdir" "-p" (dirname target))
|
||||||
|
(with-output-to-file target
|
||||||
|
(lambda _
|
||||||
|
(display
|
||||||
|
(fold (lambda (o result)
|
||||||
|
(regexp-substitute/global #f (car o) result 'pre (cdr o) 'post))
|
||||||
|
(with-input-from-file file-name read-string) pairs)))))
|
||||||
|
|
||||||
(when (and (not (member arch '("i686" "x86_64"))) (not with-courage?))
|
(when (and (not (member arch '("i686" "x86_64"))) (not with-courage?))
|
||||||
(stderr "platform not supported: ~a, try --with-courage\n" arch)
|
(stderr "platform not supported: ~a, try --with-courage\n" arch)
|
||||||
(exit 1))
|
(exit 1))
|
||||||
|
@ -377,7 +393,7 @@ Some influential environment variables:
|
||||||
;; Debian wants to run `make clean' from a tarball
|
;; Debian wants to run `make clean' from a tarball
|
||||||
(and (zero? (system* "git" "init"))
|
(and (zero? (system* "git" "init"))
|
||||||
(zero? (system* "git" "add" "."))
|
(zero? (system* "git" "add" "."))
|
||||||
(zero? (system* "git" "commit" "-m" "Import mes")))))
|
(zero? (system* "git" "commit" "--allow-empty" "-m" "Import mes")))))
|
||||||
(with-output-to-file ".config.make"
|
(with-output-to-file ".config.make"
|
||||||
(lambda _
|
(lambda _
|
||||||
(stdout "PACKAGE:=~a\n" PACKAGE)
|
(stdout "PACKAGE:=~a\n" PACKAGE)
|
||||||
|
@ -385,7 +401,12 @@ Some influential environment variables:
|
||||||
|
|
||||||
(stdout "build:=~a\n" build-type)
|
(stdout "build:=~a\n" build-type)
|
||||||
(stdout "host:=~a\n" host-type)
|
(stdout "host:=~a\n" host-type)
|
||||||
(stdout "srcdir:=.\n")
|
(stdout "srcdir:=~a\n" srcdir)
|
||||||
|
(stdout "top_builddest:=~a\n" top-builddest)
|
||||||
|
(stdout "top_builddir:=~a\n" top-builddir)
|
||||||
|
(stdout "abs_top_builddir:=~a\n" abs-top-builddir)
|
||||||
|
(stdout "abs_top_srcdir:=~a\n" abs-top-srcdir)
|
||||||
|
(stdout "srcdir:=~a\n" srcdir)
|
||||||
(stdout "prefix:=~a\n" (gulp-pipe (string-append "echo " prefix)))
|
(stdout "prefix:=~a\n" (gulp-pipe (string-append "echo " prefix)))
|
||||||
(stdout "infodir:=~a\n" infodir)
|
(stdout "infodir:=~a\n" infodir)
|
||||||
(stdout "mandir:=~a\n" mandir)
|
(stdout "mandir:=~a\n" mandir)
|
||||||
|
@ -417,8 +438,11 @@ Some influential environment variables:
|
||||||
"MES_CFLAGS"
|
"MES_CFLAGS"
|
||||||
))))
|
))))
|
||||||
|
|
||||||
(let ((pairs `(("@abs_top_srcdir@" . ,abs-top-srcdir)
|
(let ((pairs `(("@srcdir@" . ,abs-top-srcdir)
|
||||||
|
("@abs_top_srcdir@" . ,abs-top-srcdir)
|
||||||
("@abs_top_builddir@" . ,abs-top-builddir)
|
("@abs_top_builddir@" . ,abs-top-builddir)
|
||||||
|
("@top_builddir@" . ,top-builddir)
|
||||||
|
("@top_builddest@" . ,top-builddest)
|
||||||
("@BASH@" . ,(file-name "bash" deps))
|
("@BASH@" . ,(file-name "bash" deps))
|
||||||
("@GUILE@" . ,(file-name "guile" deps))
|
("@GUILE@" . ,(file-name "guile" deps))
|
||||||
("@guile_site_dir@" . ,guile-site-dir)
|
("@guile_site_dir@" . ,guile-site-dir)
|
||||||
|
@ -426,20 +450,27 @@ Some influential environment variables:
|
||||||
("@VERSION@" . ,VERSION)
|
("@VERSION@" . ,VERSION)
|
||||||
("mes/module/" . ,(string-append moduledir "/")))))
|
("mes/module/" . ,(string-append moduledir "/")))))
|
||||||
(for-each (lambda (o)
|
(for-each (lambda (o)
|
||||||
(substitute o pairs)
|
(let* ((src (srcdir-relative o))
|
||||||
(chmod (string-drop-right o 3) #o755))
|
(target (string-drop-right o 3))
|
||||||
|
(target (if (not (string-prefix? "build-aux/" target)) target
|
||||||
|
(string-drop target (string-length "build-aux/")))))
|
||||||
|
(substitute src pairs #:target target)))
|
||||||
'(
|
'(
|
||||||
"build-aux/pre-inst-env.in"
|
"build-aux/pre-inst-env.in"
|
||||||
"mes/module/mes/boot-0.scm.in"
|
"mes/module/mes/boot-0.scm.in"
|
||||||
"scripts/mescc.in"
|
"scripts/mescc.in"
|
||||||
)))
|
))
|
||||||
(chmod "build-aux/pre-inst-env" #o755)
|
(when (not (equal? srcdir "."))
|
||||||
(rename-file "build-aux/pre-inst-env" "pre-inst-env")
|
(substitute (string-append srcdir "/build-aux/GNUmakefile.in")
|
||||||
|
pairs
|
||||||
|
#:target "GNUmakefile")
|
||||||
|
(system (string-append "cd mes/module/mes && ln -sf " abs-top-srcdir "/mes/module/mes/*.mes ."))))
|
||||||
|
(chmod "pre-inst-env" #o755)
|
||||||
(chmod "scripts/mescc" #o755)
|
(chmod "scripts/mescc" #o755)
|
||||||
(let ((make (and=> (file-name "make" deps) basename)))
|
(let ((make (and=> (file-name "make" deps) basename)))
|
||||||
(format (current-output-port)
|
(format (current-output-port)
|
||||||
"\nRun:
|
"\nRun:
|
||||||
~a to build mes
|
~a to build mes
|
||||||
~a help for help on other targets\n"
|
~a help for help on other targets\n"
|
||||||
(or make "./build.sh")
|
(or make "./build.sh")
|
||||||
(or make "./build.sh"))))))
|
(or make "./build.sh"))))))
|
||||||
|
|
100
configure.sh
Executable file
100
configure.sh
Executable file
|
@ -0,0 +1,100 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VERSION=0.17
|
||||||
|
|
||||||
|
# parse --prefix=prefix
|
||||||
|
cmdline=$(echo "$@")
|
||||||
|
p=${cmdline##*--prefix=}
|
||||||
|
p=${p% *}
|
||||||
|
p=${p% -*}
|
||||||
|
prefix=${p-${prefix}}
|
||||||
|
if [ -z "$prefix" ]; then
|
||||||
|
prefix=/usr/local
|
||||||
|
fi
|
||||||
|
|
||||||
|
. build-aux/trace.sh
|
||||||
|
|
||||||
|
BASH=${BASH-$(command -v bash)}
|
||||||
|
GUILE=${GUILE-$(command -v guile)} || true
|
||||||
|
|
||||||
|
srcdir=${srcdir-.}
|
||||||
|
top_builddest=${top_builddest-}
|
||||||
|
top_builddir=${top_builddest-.}
|
||||||
|
abs_top_srcdir=${abs_top_srcdir-$PWD}
|
||||||
|
abs_top_builddir=${abs_top_srcdir-$abs_top_builddir}
|
||||||
|
|
||||||
|
if [ -z "$GUILE" -o "$GUILE" = true ]; then
|
||||||
|
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2}
|
||||||
|
else
|
||||||
|
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
|
||||||
|
fi
|
||||||
|
datadir=${datadir-$prefix/share}
|
||||||
|
docdir=${docdir-$datadir/doc/mes-$VERSION}
|
||||||
|
infodir=${infodir-$datadir/info}
|
||||||
|
mandir=${mandir-$datadir/man}
|
||||||
|
moduledir=${moduledir-$datadir/mes/module}
|
||||||
|
guile_site_dir=${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION}
|
||||||
|
guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
|
||||||
|
|
||||||
|
sed \
|
||||||
|
-e s,"@srcdir@,$srcdir,"\
|
||||||
|
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
|
||||||
|
-e s,"@abs_top_builddir@,$abs_top_builddir,"\
|
||||||
|
-e s,"@top_builddir@,$top_builddir,"\
|
||||||
|
-e s,"@top_builddest@,$top_builddest,"\
|
||||||
|
-e s,"@BASH@,$BASH,"\
|
||||||
|
-e s,"@GUILE@,$GUILE,"\
|
||||||
|
-e s,"@guile_site_dir@,$guile_site_dir,"\
|
||||||
|
-e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\
|
||||||
|
-e s,"@VERSION@,$VERSION,"\
|
||||||
|
-e s,"mes/module/,$moduledir,"\
|
||||||
|
build-aux/pre-inst-env.in\
|
||||||
|
> pre-inst-env
|
||||||
|
|
||||||
|
chmod +x pre-inst-env
|
||||||
|
|
||||||
|
sed \
|
||||||
|
-e s,"@srcdir@,$srcdir,"\
|
||||||
|
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
|
||||||
|
-e s,"@abs_top_builddir@,$abs_top_builddir,"\
|
||||||
|
-e s,"@top_builddir@,$top_builddir,"\
|
||||||
|
-e s,"@top_builddest@,$top_builddest,"\
|
||||||
|
-e s,"@BASH@,$BASH,"\
|
||||||
|
-e s,"@GUILE@,$GUILE,"\
|
||||||
|
-e s,"@guile_site_dir@,$guile_site_dir,"\
|
||||||
|
-e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\
|
||||||
|
-e s,"@VERSION@,$VERSION,"\
|
||||||
|
-e s,"mes/module/,$moduledir,"\
|
||||||
|
mes/module/mes/boot-0.scm.in\
|
||||||
|
> mes/module/mes/boot-0.scm
|
||||||
|
|
||||||
|
sed \
|
||||||
|
-e s,"@srcdir@,$srcdir,"\
|
||||||
|
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
|
||||||
|
-e s,"@abs_top_builddir@,$abs_top_builddir,"\
|
||||||
|
-e s,"@top_builddir@,$top_builddir,"\
|
||||||
|
-e s,"@top_builddest@,$top_builddest,"\
|
||||||
|
-e s,"@BASH@,$BASH,"\
|
||||||
|
-e s,"@GUILE@,$GUILE,"\
|
||||||
|
-e s,"@guile_site_dir@,$guile_site_dir,"\
|
||||||
|
-e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\
|
||||||
|
-e s,"@VERSION@,$VERSION,"\
|
||||||
|
-e s,"mes/module/,$moduledir,"\
|
||||||
|
scripts/mescc.in\
|
||||||
|
> scripts/mescc
|
||||||
|
|
||||||
|
chmod +x scripts/mescc
|
||||||
|
|
||||||
|
if [ "$srcdir" != . ]; then
|
||||||
|
mkdir -p mes/module/mes
|
||||||
|
{ cd mes/module/mes; ln -sf $abs_top_srcdir/mes/module/mes/*.mes .; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
Run:
|
||||||
|
prefix=$prefix ./build.sh to build mes
|
||||||
|
prefix=$prefix ./check.sh to check mes
|
||||||
|
prefix=$prefix ./install.sh to install mes
|
||||||
|
EOF
|
50
install.sh
50
install.sh
|
@ -1,21 +1,29 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
|
||||||
set -x
|
. build-aux/trace.sh
|
||||||
fi
|
|
||||||
|
|
||||||
# use bash or lose if pipes fail
|
# use bash or lose if pipes fail
|
||||||
[ -n "$BASH" ] && set -o pipefail
|
[ -n "$BASH" ] && set -o pipefail
|
||||||
|
|
||||||
SHELL=${SHELL-$(command -v sh)}
|
SHELL=${SHELL-$(command -v sh)}
|
||||||
prefix=${prefix-/usr/local}
|
prefix=${prefix-/usr/local}
|
||||||
|
top_builddest=${top_builddest-}
|
||||||
|
top_builddir=${top_buildir-.}
|
||||||
|
abs_top_srcdir=${abs_top_srcdir-$PWD}
|
||||||
|
abs_top_builddir=${abs_top_builddir-$PWD}
|
||||||
|
|
||||||
MES_PREFIX=${MES_PREFIX-$prefix/share/mes}
|
MES_PREFIX=${MES_PREFIX-$prefix/share/mes}
|
||||||
MES_SEED=${MES_SEED-../MES-SEED}
|
MES_SEED=${MES_SEED-../MES-SEED}
|
||||||
TINYCC_SEED=${TINYCC_SEED-../TINYCC-SEED}
|
TINYCC_SEED=${TINYCC_SEED-../TINYCC-SEED}
|
||||||
|
|
||||||
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
|
GUILE=${GUILE-$(command -v guile)} || true
|
||||||
|
if [ -z "$GUILE" -o "$GUILE" = true ]; then
|
||||||
|
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2}
|
||||||
|
else
|
||||||
|
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
|
||||||
|
fi
|
||||||
bindir=${bindir-$prefix/bin}
|
bindir=${bindir-$prefix/bin}
|
||||||
datadir=${datadir-$prefix/share/mes}
|
datadir=${datadir-$prefix/share/mes}
|
||||||
docdir=${docdir-$prefix/share/doc/mes}
|
docdir=${docdir-$prefix/share/doc/mes}
|
||||||
|
@ -26,28 +34,26 @@ guile_site_dir=${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSIO
|
||||||
guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
|
guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
|
||||||
|
|
||||||
mkdir -p $DESTDIR$bindir
|
mkdir -p $DESTDIR$bindir
|
||||||
cp src/mes $DESTDIR$bindir/mes
|
cp ${top_builddest}src/mes $DESTDIR$bindir/mes
|
||||||
cp scripts/mescc $DESTDIR$bindir/mescc
|
cp ${top_builddest}scripts/mescc $DESTDIR$bindir/mescc
|
||||||
|
|
||||||
sed \
|
sed \
|
||||||
-e "s,^#! /bin/sh,#! $SHELL," \
|
-e "s,^#! /bin/sh,#! $SHELL," \
|
||||||
scripts/diff.scm > $DESTDIR$bindir/diff.scm
|
scripts/diff.scm > $DESTDIR$bindir/diff.scm
|
||||||
chmod -w+x $DESTDIR$bindir/diff.scm
|
chmod -w+x $DESTDIR$bindir/diff.scm
|
||||||
|
|
||||||
|
|
||||||
mkdir -p $docdir
|
mkdir -p $docdir
|
||||||
|
|
||||||
if [ -n "$PERL" -a -n "$GIT" ]\
|
if [ -n "$PERL" -a -n "$GIT" ]\
|
||||||
&& $PERL -v > /dev/null\
|
&& $PERL -v > /dev/null\
|
||||||
&& $GIT --status > /dev/null; then
|
&& $GIT --status > /dev/null; then
|
||||||
$PERL build-aux/gitlog-to-changelog --srcdir=. > ChangeLog
|
$PERL build-aux/gitlog-to-changelog --srcdir=. > ${top_builddest}ChangeLog
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp\
|
cp\
|
||||||
AUTHORS\
|
AUTHORS\
|
||||||
BOOTSTRAP\
|
BOOTSTRAP\
|
||||||
COPYING\
|
COPYING\
|
||||||
ChangeLog\
|
|
||||||
HACKING\
|
HACKING\
|
||||||
INSTALL\
|
INSTALL\
|
||||||
NEWS\
|
NEWS\
|
||||||
|
@ -60,28 +66,36 @@ else
|
||||||
cp ChangeLog $DESTDIR$docdir
|
cp ChangeLog $DESTDIR$docdir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f ${top_builddest}ChangeLog ]; then
|
||||||
|
cp ${top_builddest}ChangeLog $docdir
|
||||||
|
else
|
||||||
|
cp ChangeLog $docdir
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $DESTDIR$MES_PREFIX
|
||||||
tar -cf- include lib | tar -xf- -C $DESTDIR$MES_PREFIX
|
tar -cf- include lib | tar -xf- -C $DESTDIR$MES_PREFIX
|
||||||
tar -cf- scaffold --exclude='*.gcc*' --exclude='*.mes*' | tar -xf- -C $DESTDIR$MES_PREFIX
|
tar -cf- scaffold --exclude='*.gcc*' --exclude='*.mes*' | tar -xf- -C $DESTDIR$MES_PREFIX
|
||||||
|
tar -cf- ${top_builddest}lib | tar -xf- -C $DESTDIR$MES_PREFIX
|
||||||
tar -cf- --exclude='*.go' module | tar -xf- -C $DESTDIR$MES_PREFIX
|
tar -cf- --exclude='*.go' module | tar -xf- -C $DESTDIR$MES_PREFIX
|
||||||
tar -cf- -C mes module | tar -xf- -C $DESTDIR$MES_PREFIX
|
tar -cf- -C mes module | tar -xf- -C $DESTDIR$MES_PREFIX
|
||||||
|
|
||||||
mkdir -p $DESTDIR$guile_site_dir
|
mkdir -p $DESTDIR$guile_site_dir
|
||||||
mkdir -p $DESTDIR$guile_site_ccache_dir
|
mkdir -p $DESTDIR$guile_site_ccache_dir
|
||||||
tar -cf- -C module --exclude='*.go' . | tar -xf- -C $DESTDIR$guile_site_dir
|
tar -cf- -C module --exclude='*.go' . | tar -xf- -C $DESTDIR$guile_site_dir
|
||||||
tar -cf- -C module --exclude='*.scm' . | tar -xf- -C $DESTDIR$guile_site_ccache_dir
|
tar -cf- -C ${top_builddest}module --exclude='*.scm' . | tar -xf- -C $DESTDIR$guile_site_ccache_dir
|
||||||
|
|
||||||
if [ -f doc/mes.info ]; then
|
if [ -f ${top_builddest}doc/mes.info ]; then
|
||||||
mkdir -p $DESTDIR$prefix/share/info
|
mkdir -p $DESTDIR$infodir
|
||||||
tar -cf- doc/mes.info* doc/images | tar -xf- --strip-components=1 -C $DESTDIR$infodir
|
tar -cf- ${top_builddest}doc/mes.info* doc/images | tar -xf- --strip-components=1 -C $DESTDIR$infodir
|
||||||
install-info --info-dir=$DESTDIR$prefix/share/info doc/mes.info
|
install-info --info-dir=$DESTDIR$infodir ${top_builddest}doc/mes.info
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f doc/mes.1 ]; then
|
if [ -f ${top_builddest}doc/mes.1 ]; then
|
||||||
mkdir -p $DESTDIR$mandir/man1
|
mkdir -p $DESTDIR$mandir/man1
|
||||||
cp doc/mes.1 $DESTDIR$mandir/man1/
|
cp ${top_builddest}doc/mes.1 $DESTDIR$mandir/man1/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f doc/mescc.1 ]; then
|
if [ -f ${top_builddest}doc/mescc.1 ]; then
|
||||||
mkdir -p $DESTDIR$mandir/man1
|
mkdir -p $DESTDIR$mandir/man1
|
||||||
cp doc/mescc.1 $DESTDIR$mandir/man1/
|
cp ${top_builddest}doc/mescc.1 $DESTDIR$mandir/man1/
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -219,7 +219,7 @@
|
||||||
(mes-use-module (mes posix))
|
(mes-use-module (mes posix))
|
||||||
|
|
||||||
(define-macro (include-from-path file)
|
(define-macro (include-from-path file)
|
||||||
(let loop ((path (cons* %moduledir "module" (string-split (or (getenv "GUILE_LOAD_PATH")) #\:))))
|
(let loop ((path (cons* %moduledir "@srcdir@/module" (string-split (or (getenv "GUILE_LOAD_PATH")) #\:))))
|
||||||
(cond ((and=> (getenv "MES_DEBUG") (compose (lambda (o) (> o 2)) string->number))
|
(cond ((and=> (getenv "MES_DEBUG") (compose (lambda (o) (> o 2)) string->number))
|
||||||
(core:display-error (string-append "include-from-path: " file " [PATH:" (string-join path ":") "]\n")))
|
(core:display-error (string-append "include-from-path: " file " [PATH:" (string-join path ":") "]\n")))
|
||||||
((and=> (getenv "MES_DEBUG") (compose (lambda (o) (> o 1)) string->number))
|
((and=> (getenv "MES_DEBUG") (compose (lambda (o) (> o 1)) string->number))
|
||||||
|
|
|
@ -212,8 +212,11 @@
|
||||||
(arch-find options (string-append "lib" o ext)))
|
(arch-find options (string-append "lib" o ext)))
|
||||||
|
|
||||||
(define* (arch-find options file-name)
|
(define* (arch-find options file-name)
|
||||||
(let* ((path (cons (prefix-file options "lib")
|
(let* ((top-builddest (or (getenv "top_builddest") ""))
|
||||||
(filter-map (multi-opt 'library-dir) options)))
|
(builddir-lib (string-append top-builddest "lib"))
|
||||||
|
(path (cons* builddir-lib
|
||||||
|
(prefix-file options "lib")
|
||||||
|
(filter-map (multi-opt 'library-dir) options)))
|
||||||
(arch-file-name (string-append "x86-mes/" file-name))
|
(arch-file-name (string-append "x86-mes/" file-name))
|
||||||
(verbose? (option-ref options 'verbose #f)))
|
(verbose? (option-ref options 'verbose #f)))
|
||||||
(when verbose?
|
(when verbose?
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#! @BASH@
|
#! @BASH@
|
||||||
# -*-scheme-*-
|
# -*-scheme-*-
|
||||||
if [ -n "$BUILD_DEBUG" ]; then
|
if [ "$V" = 2 ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
prefix=${prefix-@prefix@}
|
prefix=${prefix-@prefix@}
|
||||||
MES_PREFIX=${MES_PREFIX-$prefix/share/mes}
|
MES_PREFIX=${MES_PREFIX-$prefix/share/mes}
|
||||||
export MES_PREFIX
|
export MES_PREFIX
|
||||||
mes_p=$(command -v mes)
|
mes_p=$(command -v mes)
|
||||||
|
mescc=$(command -v $0)
|
||||||
|
|
||||||
guile_site_dir=${guile_site_dir-@guile_site_dir@}
|
guile_site_dir=${guile_site_dir-@guile_site_dir@}
|
||||||
GUILE_LOAD_PATH=$guile_site_dir:$GUILE_LOAD_PATH
|
GUILE_LOAD_PATH=$guile_site_dir:$GUILE_LOAD_PATH
|
||||||
|
@ -16,10 +17,10 @@ if [ '(' -z "$mes_p" -a -z "$MES" ')' -o "$MES" = "guile" -o "$MES" = "mes.guile
|
||||||
GUILE_LOAD_COMPILED_PATH=$guile_site_ccache_dir:$GUILE_LOAD_COMPILED_PATH
|
GUILE_LOAD_COMPILED_PATH=$guile_site_ccache_dir:$GUILE_LOAD_COMPILED_PATH
|
||||||
GUILE_AUTO_COMPILE=${GUILE_AUTO_COMPILE-0}
|
GUILE_AUTO_COMPILE=${GUILE_AUTO_COMPILE-0}
|
||||||
export GUILE_AUTO_COMPILE
|
export GUILE_AUTO_COMPILE
|
||||||
exec ${GUILE-guile} -L $guile_site_dir -e '(mescc)' -s "$0" "$@"
|
exec ${GUILE-guile} -L $guile_site_dir -e '(mescc)' -s "$mescc" "$@"
|
||||||
else
|
else
|
||||||
MES=${MES-$(dirname $0)/mes}
|
MES=${MES-$(dirname $0)/mes}
|
||||||
exec ${MES-mes} -e '(mescc)' -s $0 "$@"
|
exec ${MES-${top_builddest}mes} -e '(mescc)' -s "$mescc" "$@"
|
||||||
fi
|
fi
|
||||||
!#
|
!#
|
||||||
|
|
||||||
|
@ -66,7 +67,8 @@ fi
|
||||||
(guile
|
(guile
|
||||||
(define-macro (mes-use-module . rest) #t)))
|
(define-macro (mes-use-module . rest) #t)))
|
||||||
|
|
||||||
(format (current-error-port) "mescc[~a]...\n" %scheme)
|
(when (and=> (getenv "V") (lambda (v) (> (string->number v) 1)))
|
||||||
|
(format (current-error-port) "mescc[~a]...\n" %scheme))
|
||||||
|
|
||||||
(define (parse-opts args)
|
(define (parse-opts args)
|
||||||
(let* ((option-spec
|
(let* ((option-spec
|
||||||
|
|
|
@ -2268,9 +2268,10 @@ load_env (SCM a) ///((internal))
|
||||||
strcpy (prefix, p);
|
strcpy (prefix, p);
|
||||||
g_stdin = load_boot (prefix, boot, "MODULEDIR");
|
g_stdin = load_boot (prefix, boot, "MODULEDIR");
|
||||||
}
|
}
|
||||||
if (g_stdin < 0)
|
if (g_stdin < 0 && getenv ("top_builddest"))
|
||||||
{
|
{
|
||||||
strcpy (prefix, "mes/module/mes/");
|
strcpy (prefix, getenv ("top_builddest"));
|
||||||
|
strcpy (prefix + strlen (prefix), "mes/module/mes/");
|
||||||
g_stdin = load_boot (prefix, boot, ".");
|
g_stdin = load_boot (prefix, boot, ".");
|
||||||
}
|
}
|
||||||
if (g_stdin < 0)
|
if (g_stdin < 0)
|
||||||
|
|
Loading…
Reference in a new issue