build: Support mescc-tools 0.5.2.
* configure: Remove version check for mescc-tools. Check for stage0 architecture flag type. * configure.sh: Likewise. * build-aux/build-scaffold.sh: Add stage0 flag type indirection. * module/mescc/mescc.scm (arch-get-architecture): Likewise.
This commit is contained in:
parent
778fbd4f48
commit
82c85c24da
|
@ -44,13 +44,21 @@ fi
|
||||||
|
|
||||||
case "$mes_cpu" in
|
case "$mes_cpu" in
|
||||||
arm)
|
arm)
|
||||||
stage0_cpu=armv7l;;
|
stage0_arch=40
|
||||||
|
stage0_cpu=armv7l
|
||||||
|
;;
|
||||||
x86_64)
|
x86_64)
|
||||||
stage0_cpu=amd64;;
|
stage0_arch=2
|
||||||
|
stage0_cpu=amd64
|
||||||
|
;;
|
||||||
x86)
|
x86)
|
||||||
stage0_cpu=x86;;
|
stage0_arch=1
|
||||||
|
stage0_cpu=x86
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
stage0_cpu=$mes_cpu;;
|
stage0_arch=1
|
||||||
|
stage0_cpu=$mes_cpu
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
trace "CCLD ${srcdest}lib/$mes_cpu-mes-$compiler/exit-42.S" $CC\
|
trace "CCLD ${srcdest}lib/$mes_cpu-mes-$compiler/exit-42.S" $CC\
|
||||||
|
@ -64,9 +72,15 @@ trace "TEST exit-42"
|
||||||
[ $r != 42 ] && echo " => $r"
|
[ $r != 42 ] && echo " => $r"
|
||||||
[ $r = 42 ]
|
[ $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_cpu-mes/elf$mes_bits-0exit-42.hex2" $HEX2\
|
trace "HEX2 ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2" $HEX2\
|
||||||
--LittleEndian\
|
--LittleEndian\
|
||||||
--architecture $stage0_cpu\
|
$stage0_cpu_flag\
|
||||||
--BaseAddress 0x1000000\
|
--BaseAddress 0x1000000\
|
||||||
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0header.hex2\
|
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0header.hex2\
|
||||||
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2\
|
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2\
|
||||||
|
@ -80,7 +94,7 @@ trace "TEST 0exit-42"
|
||||||
|
|
||||||
trace "HEX2 ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2" $HEX2\
|
trace "HEX2 ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2" $HEX2\
|
||||||
--LittleEndian\
|
--LittleEndian\
|
||||||
--architecture $stage0_cpu\
|
$stage0_cpu_flag\
|
||||||
--BaseAddress 0x1000000\
|
--BaseAddress 0x1000000\
|
||||||
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-header.hex2\
|
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-header.hex2\
|
||||||
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\
|
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\
|
||||||
|
@ -107,7 +121,7 @@ trace "TEST hello-mes"
|
||||||
|
|
||||||
trace "HEX2 ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2" $HEX2\
|
trace "HEX2 ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2" $HEX2\
|
||||||
--LittleEndian\
|
--LittleEndian\
|
||||||
--architecture $stage0_cpu\
|
$stage0_cpu_flag\
|
||||||
--BaseAddress 0x1000000\
|
--BaseAddress 0x1000000\
|
||||||
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0header.hex2\
|
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0header.hex2\
|
||||||
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2\
|
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2\
|
||||||
|
@ -121,7 +135,7 @@ trace "TEST 0hello-mes"
|
||||||
|
|
||||||
trace "HEX2 ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2" $HEX2\
|
trace "HEX2 ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2" $HEX2\
|
||||||
--LittleEndian\
|
--LittleEndian\
|
||||||
--architecture $stage0_cpu\
|
$stage0_cpu_flag\
|
||||||
--BaseAddress 0x1000000\
|
--BaseAddress 0x1000000\
|
||||||
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-header.hex2\
|
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-header.hex2\
|
||||||
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2\
|
-f ${srcdest}lib/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2\
|
||||||
|
|
|
@ -116,7 +116,7 @@ fi
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
${SHELL} ${srcdest}build-aux/build-lib.sh
|
${SHELL} ${srcdest}build-aux/build-lib.sh
|
||||||
${SHELL} ${srcdest}build-aux/build-source-lib.sh
|
${SHELL} ${srcdest}build-aux/build-source-lib.sh
|
||||||
if bootstrap; then
|
if $bootstrap; then
|
||||||
${SHELL} ${srcdest}build-aux/build-mes.sh
|
${SHELL} ${srcdest}build-aux/build-mes.sh
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
|
@ -54,6 +54,7 @@ abs_top_srcdir="@abs_top_srcdir@"
|
||||||
arch="@arch@"
|
arch="@arch@"
|
||||||
build="@build@"
|
build="@build@"
|
||||||
host="@host@"
|
host="@host@"
|
||||||
|
numbered_arch=${numbered_arch-"@numbered_arch@"}
|
||||||
|
|
||||||
bootstrap=${bootstrap-@bootstrap@}
|
bootstrap=${bootstrap-@bootstrap@}
|
||||||
compiler=${compiler-@compiler@}
|
compiler=${compiler-@compiler@}
|
||||||
|
|
16
configure
vendored
16
configure
vendored
|
@ -448,9 +448,9 @@ Some influential environment variables:
|
||||||
(deps (fold (lambda (program results)
|
(deps (fold (lambda (program results)
|
||||||
(cons (check-program-version program) results))
|
(cons (check-program-version program) results))
|
||||||
'()
|
'()
|
||||||
(list (make-dep "hex2" #:version '(0 6))
|
(list (make-dep "hex2")
|
||||||
(make-dep "M1" #:version '(0 6))
|
(make-dep "M1")
|
||||||
(make-dep "blood-elf" #:version '(0 6))
|
(make-dep "blood-elf")
|
||||||
(make-dep "diff" #:optional? #t)
|
(make-dep "diff" #:optional? #t)
|
||||||
(make-dep "guile" #:version '(2 0) #:commands '("guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t)
|
(make-dep "guile" #:version '(2 0) #:commands '("guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t)
|
||||||
(make-dep "mes" #:version '(0 20) #:optional? #t)
|
(make-dep "mes" #:version '(0 20) #:optional? #t)
|
||||||
|
@ -534,7 +534,13 @@ Some influential environment variables:
|
||||||
(file-name "bash" deps)
|
(file-name "bash" deps)
|
||||||
(and (file-exists? "/bin/sh") "/bin/sh")
|
(and (file-exists? "/bin/sh") "/bin/sh")
|
||||||
(file-name "sh" deps)
|
(file-name "sh" deps)
|
||||||
"sh")))
|
"sh"))
|
||||||
|
(hex2 (file-name "hex2" deps))
|
||||||
|
(numbered-arch? (begin
|
||||||
|
(stdout "checking for stage0 architecture flag... ")
|
||||||
|
(let ((numbered? (and hex2 (string-contains (gulp-pipe (string-append hex2 " --help 2>&1" )) "--Architecture 12345"))))
|
||||||
|
(stdout (if numbered? "numbered\n" "named\n"))
|
||||||
|
numbered?))))
|
||||||
|
|
||||||
(define* (substitute file-name pairs
|
(define* (substitute file-name pairs
|
||||||
#:key (target (if (string-suffix? ".in" file-name)
|
#:key (target (if (string-suffix? ".in" file-name)
|
||||||
|
@ -625,6 +631,7 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
|
||||||
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g"))
|
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g"))
|
||||||
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
|
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
|
||||||
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
|
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
|
||||||
|
("@numbered_arch@" . ,(if numbered-arch? "true" "false"))
|
||||||
|
|
||||||
,@(map
|
,@(map
|
||||||
(lambda (o)
|
(lambda (o)
|
||||||
|
@ -687,6 +694,7 @@ GNU Mes is configured for
|
||||||
libc: " mes-libc "
|
libc: " mes-libc "
|
||||||
kernel: " mes-kernel "
|
kernel: " mes-kernel "
|
||||||
system: " mes-system "
|
system: " mes-system "
|
||||||
|
tools: " (if numbered-arch? "numbered" "named") " arch
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
" (or make "./build.sh") " to build mes
|
" (or make "./build.sh") " to build mes
|
||||||
|
|
10
configure.sh
10
configure.sh
|
@ -99,6 +99,14 @@ if test -z "$GUILE" -o "$GUILE" = true; then
|
||||||
else
|
else
|
||||||
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
|
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
numbered_arch=false
|
||||||
|
mes_tools=named
|
||||||
|
if ( $HEX2 --help 2>&1 ) | grep -q "\-\-Architecture 12345"; then
|
||||||
|
numbered_arch=true
|
||||||
|
mes_tools=numbered
|
||||||
|
fi
|
||||||
|
|
||||||
bindir=$(eval echo ${bindir-$prefix/bin})
|
bindir=$(eval echo ${bindir-$prefix/bin})
|
||||||
datadir=$(eval echo ${datadir-$prefix/share})
|
datadir=$(eval echo ${datadir-$prefix/share})
|
||||||
docdir=$(eval echo ${docdir-$datadir/doc/mes})
|
docdir=$(eval echo ${docdir-$datadir/doc/mes})
|
||||||
|
@ -164,6 +172,7 @@ subst () {
|
||||||
-e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\
|
-e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\
|
||||||
-e s,"@MES_SEED@,$MES_SEED,"\
|
-e s,"@MES_SEED@,$MES_SEED,"\
|
||||||
-e s,"@MES_SEED@,$MES_SEED,"\
|
-e s,"@MES_SEED@,$MES_SEED,"\
|
||||||
|
-e s,"@numbered_arch@,$numbered_arch,"\
|
||||||
-e s,"@SHELL@,$SHELL,"\
|
-e s,"@SHELL@,$SHELL,"\
|
||||||
$1 > $2
|
$1 > $2
|
||||||
}
|
}
|
||||||
|
@ -259,6 +268,7 @@ GNU Mes is configured for
|
||||||
libc: $mes_libc
|
libc: $mes_libc
|
||||||
kernel: $mes_kernel
|
kernel: $mes_kernel
|
||||||
system: $mes_system
|
system: $mes_system
|
||||||
|
tools: $mes_tools arch
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
sh build.sh to build mes
|
sh build.sh to build mes
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
(define %includedir (getenv "%includedir"))
|
(define %includedir (getenv "%includedir"))
|
||||||
(define %libdir (getenv "%libdir"))
|
(define %libdir (getenv "%libdir"))
|
||||||
(define %version (getenv "%version"))
|
(define %version (getenv "%version"))
|
||||||
|
(define %numbered-arch? (and=> (getenv "%numbered_arch") (lambda (x) (equal? x "true"))))
|
||||||
|
|
||||||
(when (and=> (getenv "V") (lambda (v) (and (= (string-length v) 1) (> (string->number v) 1))))
|
(when (and=> (getenv "V") (lambda (v) (and (= (string-length v) 1) (> (string->number v) 1))))
|
||||||
(format (current-error-port) "mescc[~a]...\n" %scheme))
|
(format (current-error-port) "mescc[~a]...\n" %scheme))
|
||||||
|
@ -75,6 +76,7 @@
|
||||||
(nostartfiles)
|
(nostartfiles)
|
||||||
(nostdinc)
|
(nostdinc)
|
||||||
(nostdlib)
|
(nostdlib)
|
||||||
|
(numbered-arch?)
|
||||||
(preprocess (single-char #\E))
|
(preprocess (single-char #\E))
|
||||||
(static)
|
(static)
|
||||||
(std (value #t))
|
(std (value #t))
|
||||||
|
@ -103,6 +105,7 @@ Options:
|
||||||
-dumpmachine display the compiler's target machine
|
-dumpmachine display the compiler's target machine
|
||||||
--base-address=ADRRESS
|
--base-address=ADRRESS
|
||||||
use BaseAddress ADDRESS [0x1000000]
|
use BaseAddress ADDRESS [0x1000000]
|
||||||
|
--numbered-arch mescc-tools use numbered arch
|
||||||
-D DEFINE[=VALUE] define DEFINE [VALUE=1]
|
-D DEFINE[=VALUE] define DEFINE [VALUE=1]
|
||||||
-E preprocess only; do not compile, assemble or link
|
-E preprocess only; do not compile, assemble or link
|
||||||
-g add debug info [GDB, objdump] TODO: hex2 footer
|
-g add debug info [GDB, objdump] TODO: hex2 footer
|
||||||
|
@ -164,6 +167,8 @@ General help using GNU software: <http://gnu.org/gethelp/>
|
||||||
(options (acons 'libdir %libdir options))
|
(options (acons 'libdir %libdir options))
|
||||||
(arch (option-ref options 'arch %host-arch))
|
(arch (option-ref options 'arch %host-arch))
|
||||||
(options (if arch (acons 'arch arch options) options))
|
(options (if arch (acons 'arch arch options) options))
|
||||||
|
(numbered-arch? (option-ref options 'numbered-arch? %numbered-arch?))
|
||||||
|
(options (acons 'numbered-arch? numbered-arch? options))
|
||||||
(dumpmachine? (option-ref options 'dumpmachine #f))
|
(dumpmachine? (option-ref options 'dumpmachine #f))
|
||||||
(preprocess? (option-ref options 'preprocess #f))
|
(preprocess? (option-ref options 'preprocess #f))
|
||||||
(compile? (option-ref options 'compile #f))
|
(compile? (option-ref options 'compile #f))
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
(M1 (or (getenv "M1") "M1"))
|
(M1 (or (getenv "M1") "M1"))
|
||||||
(command `(,M1
|
(command `(,M1
|
||||||
"--LittleEndian"
|
"--LittleEndian"
|
||||||
"--architecture" ,(arch-get-architecture options)
|
,@(arch-get-architecture options)
|
||||||
"-f" ,(arch-find options (arch-get-m1-macros options))
|
"-f" ,(arch-find options (arch-get-m1-macros options))
|
||||||
,@(append-map (cut list "-f" <>) M1-files)
|
,@(append-map (cut list "-f" <>) M1-files)
|
||||||
"-o" ,hex2-file-name)))
|
"-o" ,hex2-file-name)))
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
`("-f" ,(arch-find options "crt1.o"))))
|
`("-f" ,(arch-find options "crt1.o"))))
|
||||||
(command `(,hex2
|
(command `(,hex2
|
||||||
"--LittleEndian"
|
"--LittleEndian"
|
||||||
"--architecture" ,(arch-get-architecture options)
|
,@(arch-get-architecture options)
|
||||||
"--BaseAddress" ,base-address
|
"--BaseAddress" ,base-address
|
||||||
"-f" ,(arch-find options (string-append "elf" machine "-header.hex2"))
|
"-f" ,(arch-find options (string-append "elf" machine "-header.hex2"))
|
||||||
,@start-files
|
,@start-files
|
||||||
|
@ -322,10 +322,13 @@
|
||||||
((equal? arch "x86_64") "x86_64.M1"))))
|
((equal? arch "x86_64") "x86_64.M1"))))
|
||||||
|
|
||||||
(define (arch-get-architecture options)
|
(define (arch-get-architecture options)
|
||||||
(let ((arch (arch-get options)))
|
(let* ((arch (arch-get options))
|
||||||
(cond ((equal? arch "arm") "armv7l")
|
(numbered-arch? (option-ref options 'numbered-arch? #f))
|
||||||
((equal? arch "x86") "x86")
|
(flag (if numbered-arch? "--Architecture" "--architecture")))
|
||||||
((equal? arch "x86_64") "amd64"))))
|
(list flag
|
||||||
|
(cond ((equal? arch "arm") (if numbered-arch? "40" "armv7l"))
|
||||||
|
((equal? arch "x86") (if numbered-arch? "1" "x86"))
|
||||||
|
((equal? arch "x86_64") (if numbered-arch? "2" "amd64"))))))
|
||||||
|
|
||||||
(define (multi-opt option-name) (lambda (o) (and (eq? (car o) option-name) (cdr o))))
|
(define (multi-opt option-name) (lambda (o) (and (eq? (car o) option-name) (cdr o))))
|
||||||
(define (count-opt options option-name)
|
(define (count-opt options option-name)
|
||||||
|
|
|
@ -43,6 +43,8 @@ includedir=${includedir-@includedir@}
|
||||||
export includedir
|
export includedir
|
||||||
libdir=${libdir-@libdir@}
|
libdir=${libdir-@libdir@}
|
||||||
export libdir
|
export libdir
|
||||||
|
numbered_arch=${numbered_arch=@numbered_arch@}
|
||||||
|
export numbered_arch
|
||||||
|
|
||||||
if [ ! -f $bindir/mescc.scm ]; then
|
if [ ! -f $bindir/mescc.scm ]; then
|
||||||
bindir=$(dirname $0)
|
bindir=$(dirname $0)
|
||||||
|
|
|
@ -41,11 +41,17 @@
|
||||||
(define %arch (if (string-prefix? "@mes_cpu" "@mes_cpu@") %arch
|
(define %arch (if (string-prefix? "@mes_cpu" "@mes_cpu@") %arch
|
||||||
"@mes_cpu@"))
|
"@mes_cpu@"))
|
||||||
|
|
||||||
|
(define %numbered-arch? (if (getenv "numbered_arch") (and=> (getenv "numbered_arch")
|
||||||
|
(lambda (x) (equal? x "true")))
|
||||||
|
(if (string-prefix? "@numbered_arch" "@numbered_arch@") #f
|
||||||
|
(equal? "@numbered_arch@" "true"))))
|
||||||
|
|
||||||
(setenv "%prefix" %prefix)
|
(setenv "%prefix" %prefix)
|
||||||
(setenv "%includedir" %includedir)
|
(setenv "%includedir" %includedir)
|
||||||
(setenv "%libdir" %libdir)
|
(setenv "%libdir" %libdir)
|
||||||
(setenv "%version" %version)
|
(setenv "%version" %version)
|
||||||
(setenv "%arch" %arch)
|
(setenv "%arch" %arch)
|
||||||
|
(setenv "%numbered_arch" (if %numbered-arch? "true" "false"))
|
||||||
|
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(mes
|
(mes
|
||||||
|
|
Loading…
Reference in a new issue