minimal-bootstrap.stage0-posix: replace mkKaemDerivation with runCommand
This commit is contained in:
parent
b390cba84b
commit
c8ecd8ed57
|
@ -10,7 +10,7 @@ lib.makeScope newScope (self: with self; {
|
|||
inherit system;
|
||||
};
|
||||
|
||||
inherit (callPackage ./stage0-posix { }) kaem mkKaemDerivation m2libc mescc-tools mescc-tools-extra writeTextFile writeText;
|
||||
inherit (callPackage ./stage0-posix { }) kaem m2libc mescc-tools mescc-tools-extra writeTextFile writeText runCommand;
|
||||
|
||||
mes = callPackage ./mes { };
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ mkKaemDerivation
|
||||
{ runCommand
|
||||
, fetchurl
|
||||
, writeText
|
||||
, m2libc
|
||||
|
@ -19,279 +19,274 @@ let
|
|||
sha256 = "06rg6pn4k8smyydwls1abc9h702cri3z65ac9gvc4rxxklpynslk";
|
||||
};
|
||||
in
|
||||
(mkKaemDerivation {
|
||||
pname = "mes";
|
||||
inherit version;
|
||||
# Adapted from https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/mes-0.24.2/mes-0.24.2.kaem
|
||||
(runCommand "mes-${version}" {} ''
|
||||
# Unpack source
|
||||
ungz --file ${src} --output mes.tar
|
||||
mkdir ''${out} ''${out}/bin ''${out}/share
|
||||
cd ''${out}/share
|
||||
untar --non-strict --file ''${NIX_BUILD_TOP}/mes.tar # ignore symlinks
|
||||
|
||||
# Adapted from https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/mes-0.24.2/mes-0.24.2.kaem
|
||||
buildPhase = ''
|
||||
# Unpack source
|
||||
ungz --file ${src} --output mes.tar
|
||||
mkdir ''${out} ''${out}/bin ''${out}/share
|
||||
cd ''${out}/share
|
||||
untar --non-strict --file ''${NIX_BUILD_TOP}/mes.tar # ignore symlinks
|
||||
MES_PREFIX=''${out}/share/mes-${version}
|
||||
LIBDIR=''${MES_PREFIX}/lib
|
||||
|
||||
MES_PREFIX=''${out}/share/mes-${version}
|
||||
LIBDIR=''${MES_PREFIX}/lib
|
||||
cd ''${MES_PREFIX}
|
||||
|
||||
cd ''${MES_PREFIX}
|
||||
cp ${./config.h} include/mes/config.h
|
||||
replace --file include/mes/config.h --output include/mes/config.h --match-on @VERSION@ --replace-with ${version}
|
||||
|
||||
cp ${./config.h} include/mes/config.h
|
||||
replace --file include/mes/config.h --output include/mes/config.h --match-on @VERSION@ --replace-with ${version}
|
||||
mkdir include/arch
|
||||
cp include/linux/x86/syscall.h include/arch/syscall.h
|
||||
cp include/linux/x86/kernel-stat.h include/arch/kernel-stat.h
|
||||
|
||||
mkdir include/arch
|
||||
cp include/linux/x86/syscall.h include/arch/syscall.h
|
||||
cp include/linux/x86/kernel-stat.h include/arch/kernel-stat.h
|
||||
# Remove pregenerated files
|
||||
rm mes/module/mes/psyntax.pp mes/module/mes/psyntax.pp.header
|
||||
|
||||
# Remove pregenerated files
|
||||
rm mes/module/mes/psyntax.pp mes/module/mes/psyntax.pp.header
|
||||
# These files are symlinked in the repo
|
||||
cp mes/module/srfi/srfi-9-struct.mes mes/module/srfi/srfi-9.mes
|
||||
cp mes/module/srfi/srfi-9/gnu-struct.mes mes/module/srfi/srfi-9/gnu.mes
|
||||
|
||||
# These files are symlinked in the repo
|
||||
cp mes/module/srfi/srfi-9-struct.mes mes/module/srfi/srfi-9.mes
|
||||
cp mes/module/srfi/srfi-9/gnu-struct.mes mes/module/srfi/srfi-9/gnu.mes
|
||||
# Fixes to support newer M2-Planet
|
||||
catm x86_defs.M1 ${m2libc}/x86/x86_defs.M1 lib/m2/x86/x86_defs.M1
|
||||
cp x86_defs.M1 lib/m2/x86/x86_defs.M1
|
||||
rm x86_defs.M1
|
||||
|
||||
# Fixes to support newer M2-Planet
|
||||
catm x86_defs.M1 ${m2libc}/x86/x86_defs.M1 lib/m2/x86/x86_defs.M1
|
||||
cp x86_defs.M1 lib/m2/x86/x86_defs.M1
|
||||
rm x86_defs.M1
|
||||
# Remove environment impurities
|
||||
__GUILE_LOAD_PATH="\"''${MES_PREFIX}/mes/module:''${MES_PREFIX}/module:${nyaccModules}/module\""
|
||||
boot0_scm=mes/module/mes/boot-0.scm
|
||||
guile_mes=mes/module/mes/guile.mes
|
||||
replace --file ''${boot0_scm} --output ''${boot0_scm} --match-on "(getenv \"GUILE_LOAD_PATH\")" --replace-with ''${__GUILE_LOAD_PATH}
|
||||
replace --file ''${guile_mes} --output ''${guile_mes} --match-on "(getenv \"GUILE_LOAD_PATH\")" --replace-with ''${__GUILE_LOAD_PATH}
|
||||
|
||||
# Remove environment impurities
|
||||
__GUILE_LOAD_PATH="\"''${MES_PREFIX}/mes/module:''${MES_PREFIX}/module:${nyaccModules}/module\""
|
||||
boot0_scm=mes/module/mes/boot-0.scm
|
||||
guile_mes=mes/module/mes/guile.mes
|
||||
replace --file ''${boot0_scm} --output ''${boot0_scm} --match-on "(getenv \"GUILE_LOAD_PATH\")" --replace-with ''${__GUILE_LOAD_PATH}
|
||||
replace --file ''${guile_mes} --output ''${guile_mes} --match-on "(getenv \"GUILE_LOAD_PATH\")" --replace-with ''${__GUILE_LOAD_PATH}
|
||||
module_mescc_scm=module/mescc/mescc.scm
|
||||
replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"M1\")" --replace-with "\"${mescc-tools}/bin/M1\""
|
||||
replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"HEX2\")" --replace-with "\"${mescc-tools}/bin/hex2\""
|
||||
replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"BLOOD_ELF\")" --replace-with "\"${mescc-tools}/bin/blood-elf\""
|
||||
replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"srcdest\")" --replace-with "\"''${MES_PREFIX}\""
|
||||
|
||||
module_mescc_scm=module/mescc/mescc.scm
|
||||
replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"M1\")" --replace-with "\"${mescc-tools}/bin/M1\""
|
||||
replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"HEX2\")" --replace-with "\"${mescc-tools}/bin/hex2\""
|
||||
replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"BLOOD_ELF\")" --replace-with "\"${mescc-tools}/bin/blood-elf\""
|
||||
replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"srcdest\")" --replace-with "\"''${MES_PREFIX}\""
|
||||
mes_c=src/mes.c
|
||||
replace --file ''${mes_c} --output ''${mes_c} --match-on "getenv (\"MES_PREFIX\")" --replace-with "\"''${MES_PREFIX}\""
|
||||
replace --file ''${mes_c} --output ''${mes_c} --match-on "getenv (\"srcdest\")" --replace-with "\"''${MES_PREFIX}\""
|
||||
|
||||
mes_c=src/mes.c
|
||||
replace --file ''${mes_c} --output ''${mes_c} --match-on "getenv (\"MES_PREFIX\")" --replace-with "\"''${MES_PREFIX}\""
|
||||
replace --file ''${mes_c} --output ''${mes_c} --match-on "getenv (\"srcdest\")" --replace-with "\"''${MES_PREFIX}\""
|
||||
gc_c=src/gc.c
|
||||
replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_ARENA\")" --replace-with "\"100000000\""
|
||||
replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_MAX_ARENA\")" --replace-with "\"100000000\""
|
||||
replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_STACK\")" --replace-with "\"6000000\""
|
||||
|
||||
gc_c=src/gc.c
|
||||
replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_ARENA\")" --replace-with "\"100000000\""
|
||||
replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_MAX_ARENA\")" --replace-with "\"100000000\""
|
||||
replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_STACK\")" --replace-with "\"6000000\""
|
||||
# Create mescc.scm
|
||||
mescc_in=scripts/mescc.scm.in
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"MES_PREFIX\")" --replace-with "\"''${MES_PREFIX}\""
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"includedir\")" --replace-with "\"''${MES_PREFIX}/include\""
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"libdir\")" --replace-with "\"''${MES_PREFIX}/lib\""
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on @prefix@ --replace-with ''${MES_PREFIX}
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on @VERSION@ --replace-with ${version}
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on @mes_cpu@ --replace-with ${ARCH}
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on @mes_kernel@ --replace-with linux
|
||||
cp ''${mescc_in} ''${out}/bin/mescc.scm
|
||||
chmod 555 ''${out}/bin/mescc.scm
|
||||
|
||||
# Create mescc.scm
|
||||
mescc_in=scripts/mescc.scm.in
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"MES_PREFIX\")" --replace-with "\"''${MES_PREFIX}\""
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"includedir\")" --replace-with "\"''${MES_PREFIX}/include\""
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"libdir\")" --replace-with "\"''${MES_PREFIX}/lib\""
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on @prefix@ --replace-with ''${MES_PREFIX}
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on @VERSION@ --replace-with ${version}
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on @mes_cpu@ --replace-with ${ARCH}
|
||||
replace --file ''${mescc_in} --output ''${mescc_in} --match-on @mes_kernel@ --replace-with linux
|
||||
cp ''${mescc_in} ''${out}/bin/mescc.scm
|
||||
chmod 555 ''${out}/bin/mescc.scm
|
||||
|
||||
# Build mes-m2
|
||||
mes_cpu=${ARCH}
|
||||
stage0_cpu=${ARCH}
|
||||
kaem --verbose --strict --file kaem.run
|
||||
cp bin/mes-m2 ''${out}/bin/mes-m2
|
||||
chmod 555 ''${out}/bin/mes-m2
|
||||
# Build mes-m2
|
||||
mes_cpu=${ARCH}
|
||||
stage0_cpu=${ARCH}
|
||||
kaem --verbose --strict --file kaem.run
|
||||
cp bin/mes-m2 ''${out}/bin/mes-m2
|
||||
chmod 555 ''${out}/bin/mes-m2
|
||||
|
||||
|
||||
# Recompile Mes and Mes C library using mes-m2 bootstrapped Mes
|
||||
cd ''${NIX_BUILD_TOP}
|
||||
alias mescc="''${out}/bin/mes-m2 -e main ''${out}/bin/mescc.scm -D HAVE_CONFIG_H=1 -I ''${MES_PREFIX}/include -I ''${MES_PREFIX}/include/linux/x86 -c"
|
||||
# Recompile Mes and Mes C library using mes-m2 bootstrapped Mes
|
||||
cd ''${NIX_BUILD_TOP}
|
||||
alias mescc="''${out}/bin/mes-m2 -e main ''${out}/bin/mescc.scm -D HAVE_CONFIG_H=1 -I ''${MES_PREFIX}/include -I ''${MES_PREFIX}/include/linux/x86 -c"
|
||||
|
||||
# Start with crt1.o
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/crt1.c
|
||||
# Start with crt1.o
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/crt1.c
|
||||
|
||||
# Now for libc-mini.a
|
||||
mescc ''${MES_PREFIX}/lib/mes/eputs.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/oputs.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/globals.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/exit.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/_exit.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/_write.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/puts.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strlen.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/mini-write.c
|
||||
catm libc-mini.a eputs.o oputs.o globals.o exit.o _exit.o _write.o puts.o strlen.o mini-write.o
|
||||
catm libc-mini.s eputs.s oputs.s globals.s exit.s _exit.s _write.s puts.s strlen.s mini-write.s
|
||||
# Now for libc-mini.a
|
||||
mescc ''${MES_PREFIX}/lib/mes/eputs.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/oputs.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/globals.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/exit.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/_exit.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/_write.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/puts.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strlen.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/mini-write.c
|
||||
catm libc-mini.a eputs.o oputs.o globals.o exit.o _exit.o _write.o puts.o strlen.o mini-write.o
|
||||
catm libc-mini.s eputs.s oputs.s globals.s exit.s _exit.s _write.s puts.s strlen.s mini-write.s
|
||||
|
||||
# libmescc.a
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/syscall-internal.c
|
||||
catm libmescc.a globals.o syscall-internal.o
|
||||
catm libmescc.s globals.s syscall-internal.s
|
||||
# libmescc.a
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/syscall-internal.c
|
||||
catm libmescc.a globals.o syscall-internal.o
|
||||
catm libmescc.s globals.s syscall-internal.s
|
||||
|
||||
# libc.a
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isnumber.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/abtol.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/cast.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/eputc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/fdgetc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/fdputc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/fdputs.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/fdungetc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/itoa.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/ltoa.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/ltoab.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/mes_open.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/ntoab.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/oputc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/ultoa.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/utoa.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isdigit.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isspace.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isxdigit.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/assert_msg.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/write.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/atoi.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/lseek.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/__assert_fail.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/__buffered_read.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/__mes_debug.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/execv.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/getcwd.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/getenv.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/isatty.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/open.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/buffered-read.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/setenv.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/wait.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fgetc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fputc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fputs.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/getc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/getchar.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/putc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/putchar.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/ungetc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/free.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/realloc.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memchr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memcmp.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memcpy.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memmove.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memset.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strcmp.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strcpy.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strncmp.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/raise.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/access.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/brk.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/chmod.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/clock_gettime.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/dup.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/dup2.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/execve.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/fork.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/fsync.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/_getcwd.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/gettimeofday.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/ioctl3.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/malloc.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/_open3.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/_read.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/time.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/unlink.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/waitpid.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/syscall.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/getpid.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/kill.c
|
||||
catm libc.a eputs.o oputs.o globals.o exit.o _exit.o _write.o puts.o strlen.o isnumber.o abtol.o cast.o eputc.o fdgetc.o fdputc.o fdputs.o fdungetc.o itoa.o ltoa.o ltoab.o mes_open.o ntoab.o oputc.o ultoa.o utoa.o isdigit.o isspace.o isxdigit.o assert_msg.o write.o atoi.o lseek.o __assert_fail.o __buffered_read.o __mes_debug.o execv.o getcwd.o getenv.o isatty.o open.o buffered-read.o setenv.o wait.o fgetc.o fputc.o fputs.o getc.o getchar.o putc.o putchar.o ungetc.o free.o malloc.o realloc.o memchr.o memcmp.o memcpy.o memmove.o memset.o strcmp.o strcpy.o strncmp.o raise.o access.o brk.o chmod.o clock_gettime.o dup.o dup2.o execve.o fork.o fsync.o _getcwd.o gettimeofday.o ioctl3.o _open3.o _read.o time.o unlink.o waitpid.o syscall.o getpid.o kill.o
|
||||
catm libc.s eputs.s oputs.s globals.s exit.s _exit.s _write.s puts.s strlen.s isnumber.s abtol.s cast.s eputc.s fdgetc.s fdputc.s fdputs.s fdungetc.s itoa.s ltoa.s ltoab.s mes_open.s ntoab.s oputc.s ultoa.s utoa.s isdigit.s isspace.s isxdigit.s assert_msg.s write.s atoi.s lseek.s __assert_fail.s __buffered_read.s __mes_debug.s execv.s getcwd.s getenv.s isatty.s open.s buffered-read.s setenv.s wait.s fgetc.s fputc.s fputs.s getc.s getchar.s putc.s putchar.s ungetc.s free.s malloc.s realloc.s memchr.s memcmp.s memcpy.s memmove.s memset.s strcmp.s strcpy.s strncmp.s raise.s access.s brk.s chmod.s clock_gettime.s dup.s dup2.s execve.s fork.s fsync.s _getcwd.s gettimeofday.s ioctl3.s _open3.s _read.s time.s unlink.s waitpid.s syscall.s getpid.s kill.s
|
||||
# libc.a
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isnumber.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/abtol.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/cast.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/eputc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/fdgetc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/fdputc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/fdputs.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/fdungetc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/itoa.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/ltoa.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/ltoab.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/mes_open.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/ntoab.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/oputc.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/ultoa.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/utoa.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isdigit.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isspace.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isxdigit.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/assert_msg.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/write.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/atoi.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/lseek.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/__assert_fail.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/__buffered_read.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/__mes_debug.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/execv.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/getcwd.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/getenv.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/isatty.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/open.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/buffered-read.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/setenv.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/wait.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fgetc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fputc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fputs.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/getc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/getchar.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/putc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/putchar.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/ungetc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/free.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/realloc.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memchr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memcmp.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memcpy.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memmove.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memset.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strcmp.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strcpy.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strncmp.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/raise.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/access.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/brk.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/chmod.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/clock_gettime.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/dup.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/dup2.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/execve.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/fork.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/fsync.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/_getcwd.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/gettimeofday.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/ioctl3.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/malloc.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/_open3.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/_read.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/time.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/unlink.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/waitpid.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/x86-mes-mescc/syscall.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/getpid.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/kill.c
|
||||
catm libc.a eputs.o oputs.o globals.o exit.o _exit.o _write.o puts.o strlen.o isnumber.o abtol.o cast.o eputc.o fdgetc.o fdputc.o fdputs.o fdungetc.o itoa.o ltoa.o ltoab.o mes_open.o ntoab.o oputc.o ultoa.o utoa.o isdigit.o isspace.o isxdigit.o assert_msg.o write.o atoi.o lseek.o __assert_fail.o __buffered_read.o __mes_debug.o execv.o getcwd.o getenv.o isatty.o open.o buffered-read.o setenv.o wait.o fgetc.o fputc.o fputs.o getc.o getchar.o putc.o putchar.o ungetc.o free.o malloc.o realloc.o memchr.o memcmp.o memcpy.o memmove.o memset.o strcmp.o strcpy.o strncmp.o raise.o access.o brk.o chmod.o clock_gettime.o dup.o dup2.o execve.o fork.o fsync.o _getcwd.o gettimeofday.o ioctl3.o _open3.o _read.o time.o unlink.o waitpid.o syscall.o getpid.o kill.o
|
||||
catm libc.s eputs.s oputs.s globals.s exit.s _exit.s _write.s puts.s strlen.s isnumber.s abtol.s cast.s eputc.s fdgetc.s fdputc.s fdputs.s fdungetc.s itoa.s ltoa.s ltoab.s mes_open.s ntoab.s oputc.s ultoa.s utoa.s isdigit.s isspace.s isxdigit.s assert_msg.s write.s atoi.s lseek.s __assert_fail.s __buffered_read.s __mes_debug.s execv.s getcwd.s getenv.s isatty.s open.s buffered-read.s setenv.s wait.s fgetc.s fputc.s fputs.s getc.s getchar.s putc.s putchar.s ungetc.s free.s malloc.s realloc.s memchr.s memcmp.s memcpy.s memmove.s memset.s strcmp.s strcpy.s strncmp.s raise.s access.s brk.s chmod.s clock_gettime.s dup.s dup2.s execve.s fork.s fsync.s _getcwd.s gettimeofday.s ioctl3.s _open3.s _read.s time.s unlink.s waitpid.s syscall.s getpid.s kill.s
|
||||
|
||||
# libc+tcc.a
|
||||
mescc ''${MES_PREFIX}/lib/ctype/islower.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isupper.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/tolower.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/toupper.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/abtod.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/dtoab.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/search-path.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/execvp.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fclose.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fdopen.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/ferror.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fflush.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fopen.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fread.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fseek.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/ftell.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fwrite.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/printf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/remove.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/snprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/sprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/sscanf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vfprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vsnprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vsprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vsscanf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/calloc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/qsort.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtod.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtof.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtol.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtold.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtoll.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtoul.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtoull.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memmem.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strcat.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strchr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strlwr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strncpy.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strrchr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strstr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strupr.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/sigaction.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/ldexp.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/mprotect.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/localtime.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/sigemptyset.c
|
||||
mescc ''${MES_PREFIX}/lib/x86-mes-mescc/setjmp.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/close.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/rmdir.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/stat.c
|
||||
catm libc+tcc.a libc.a islower.o isupper.o tolower.o toupper.o abtod.o dtoab.o search-path.o execvp.o fclose.o fdopen.o ferror.o fflush.o fopen.o fprintf.o fread.o fseek.o ftell.o fwrite.o printf.o remove.o snprintf.o sprintf.o sscanf.o vfprintf.o vprintf.o vsnprintf.o vsprintf.o vsscanf.o calloc.o qsort.o strtod.o strtof.o strtol.o strtold.o strtoll.o strtoul.o strtoull.o memmem.o strcat.o strchr.o strlwr.o strncpy.o strrchr.o strstr.o strupr.o sigaction.o ldexp.o mprotect.o localtime.o sigemptyset.o setjmp.o close.o rmdir.o stat.o
|
||||
catm libc+tcc.s libc.s islower.s isupper.s tolower.s toupper.s abtod.s dtoab.s search-path.s execvp.s fclose.s fdopen.s ferror.s fflush.s fopen.s fprintf.s fread.s fseek.s ftell.s fwrite.s printf.s remove.s snprintf.s sprintf.s sscanf.s vfprintf.s vprintf.s vsnprintf.s vsprintf.s vsscanf.s calloc.s qsort.s strtod.s strtof.s strtol.s strtold.s strtoll.s strtoul.s strtoull.s memmem.s strcat.s strchr.s strlwr.s strncpy.s strrchr.s strstr.s strupr.s sigaction.s ldexp.s mprotect.s localtime.s sigemptyset.s setjmp.s close.s rmdir.s stat.s
|
||||
# libc+tcc.a
|
||||
mescc ''${MES_PREFIX}/lib/ctype/islower.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/isupper.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/tolower.c
|
||||
mescc ''${MES_PREFIX}/lib/ctype/toupper.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/abtod.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/dtoab.c
|
||||
mescc ''${MES_PREFIX}/lib/mes/search-path.c
|
||||
mescc ''${MES_PREFIX}/lib/posix/execvp.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fclose.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fdopen.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/ferror.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fflush.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fopen.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fread.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fseek.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/ftell.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/fwrite.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/printf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/remove.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/snprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/sprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/sscanf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vfprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vsnprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vsprintf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdio/vsscanf.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/calloc.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/qsort.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtod.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtof.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtol.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtold.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtoll.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtoul.c
|
||||
mescc ''${MES_PREFIX}/lib/stdlib/strtoull.c
|
||||
mescc ''${MES_PREFIX}/lib/string/memmem.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strcat.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strchr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strlwr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strncpy.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strrchr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strstr.c
|
||||
mescc ''${MES_PREFIX}/lib/string/strupr.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/sigaction.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/ldexp.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/mprotect.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/localtime.c
|
||||
mescc ''${MES_PREFIX}/lib/stub/sigemptyset.c
|
||||
mescc ''${MES_PREFIX}/lib/x86-mes-mescc/setjmp.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/close.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/rmdir.c
|
||||
mescc ''${MES_PREFIX}/lib/linux/stat.c
|
||||
catm libc+tcc.a libc.a islower.o isupper.o tolower.o toupper.o abtod.o dtoab.o search-path.o execvp.o fclose.o fdopen.o ferror.o fflush.o fopen.o fprintf.o fread.o fseek.o ftell.o fwrite.o printf.o remove.o snprintf.o sprintf.o sscanf.o vfprintf.o vprintf.o vsnprintf.o vsprintf.o vsscanf.o calloc.o qsort.o strtod.o strtof.o strtol.o strtold.o strtoll.o strtoul.o strtoull.o memmem.o strcat.o strchr.o strlwr.o strncpy.o strrchr.o strstr.o strupr.o sigaction.o ldexp.o mprotect.o localtime.o sigemptyset.o setjmp.o close.o rmdir.o stat.o
|
||||
catm libc+tcc.s libc.s islower.s isupper.s tolower.s toupper.s abtod.s dtoab.s search-path.s execvp.s fclose.s fdopen.s ferror.s fflush.s fopen.s fprintf.s fread.s fseek.s ftell.s fwrite.s printf.s remove.s snprintf.s sprintf.s sscanf.s vfprintf.s vprintf.s vsnprintf.s vsprintf.s vsscanf.s calloc.s qsort.s strtod.s strtof.s strtol.s strtold.s strtoll.s strtoul.s strtoull.s memmem.s strcat.s strchr.s strlwr.s strncpy.s strrchr.s strstr.s strupr.s sigaction.s ldexp.s mprotect.s localtime.s sigemptyset.s setjmp.s close.s rmdir.s stat.s
|
||||
|
||||
# Build mes itself
|
||||
mescc ''${MES_PREFIX}/src/builtins.c
|
||||
mescc ''${MES_PREFIX}/src/cc.c
|
||||
mescc ''${MES_PREFIX}/src/core.c
|
||||
mescc ''${MES_PREFIX}/src/display.c
|
||||
mescc ''${MES_PREFIX}/src/eval-apply.c
|
||||
mescc ''${MES_PREFIX}/src/gc.c
|
||||
mescc ''${MES_PREFIX}/src/globals.c
|
||||
mescc ''${MES_PREFIX}/src/hash.c
|
||||
mescc ''${MES_PREFIX}/src/lib.c
|
||||
mescc ''${MES_PREFIX}/src/math.c
|
||||
mescc ''${MES_PREFIX}/src/mes.c
|
||||
mescc ''${MES_PREFIX}/src/module.c
|
||||
mescc ''${MES_PREFIX}/src/posix.c
|
||||
mescc ''${MES_PREFIX}/src/reader.c
|
||||
mescc ''${MES_PREFIX}/src/stack.c
|
||||
mescc ''${MES_PREFIX}/src/string.c
|
||||
mescc ''${MES_PREFIX}/src/struct.c
|
||||
mescc ''${MES_PREFIX}/src/symbol.c
|
||||
mescc ''${MES_PREFIX}/src/vector.c
|
||||
# Build mes itself
|
||||
mescc ''${MES_PREFIX}/src/builtins.c
|
||||
mescc ''${MES_PREFIX}/src/cc.c
|
||||
mescc ''${MES_PREFIX}/src/core.c
|
||||
mescc ''${MES_PREFIX}/src/display.c
|
||||
mescc ''${MES_PREFIX}/src/eval-apply.c
|
||||
mescc ''${MES_PREFIX}/src/gc.c
|
||||
mescc ''${MES_PREFIX}/src/globals.c
|
||||
mescc ''${MES_PREFIX}/src/hash.c
|
||||
mescc ''${MES_PREFIX}/src/lib.c
|
||||
mescc ''${MES_PREFIX}/src/math.c
|
||||
mescc ''${MES_PREFIX}/src/mes.c
|
||||
mescc ''${MES_PREFIX}/src/module.c
|
||||
mescc ''${MES_PREFIX}/src/posix.c
|
||||
mescc ''${MES_PREFIX}/src/reader.c
|
||||
mescc ''${MES_PREFIX}/src/stack.c
|
||||
mescc ''${MES_PREFIX}/src/string.c
|
||||
mescc ''${MES_PREFIX}/src/struct.c
|
||||
mescc ''${MES_PREFIX}/src/symbol.c
|
||||
mescc ''${MES_PREFIX}/src/vector.c
|
||||
|
||||
# Install libraries
|
||||
cp libc.a ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libc+tcc.a ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libmescc.a ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libc.s ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libc+tcc.s ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libmescc.s ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp crt1.o ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp crt1.s ''${MES_PREFIX}/lib/x86-mes/
|
||||
# Install libraries
|
||||
cp libc.a ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libc+tcc.a ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libmescc.a ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libc.s ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libc+tcc.s ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp libmescc.s ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp crt1.o ''${MES_PREFIX}/lib/x86-mes/
|
||||
cp crt1.s ''${MES_PREFIX}/lib/x86-mes/
|
||||
|
||||
# Link everything into new mes executable
|
||||
''${out}/bin/mes-m2 -e main ''${out}/bin/mescc.scm -- --base-address 0x08048000 -L ''${MES_PREFIX}/lib -nostdlib -o ''${out}/bin/mes -L . crt1.o builtins.o cc.o core.o display.o eval-apply.o gc.o globals.o hash.o lib.o math.o mes.o module.o posix.o reader.o stack.o string.o struct.o symbol.o vector.o -lc -lmescc
|
||||
'';
|
||||
}) // {
|
||||
# Link everything into new mes executable
|
||||
''${out}/bin/mes-m2 -e main ''${out}/bin/mescc.scm -- --base-address 0x08048000 -L ''${MES_PREFIX}/lib -nostdlib -o ''${out}/bin/mes -L . crt1.o builtins.o cc.o core.o display.o eval-apply.o gc.o globals.o hash.o lib.o math.o mes.o module.o posix.o reader.o stack.o string.o struct.o symbol.o vector.o -lc -lmescc
|
||||
'') // {
|
||||
mesPrefix = "/share/mes-${version}";
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ lib.makeScope newScope (self: with self; {
|
|||
|
||||
mescc-tools-extra = callPackage ./mescc-tools-extra { };
|
||||
|
||||
inherit (callPackage ./utils.nix { }) writeTextFile writeText mkKaemDerivation;
|
||||
inherit (callPackage ./utils.nix { }) writeTextFile writeText runCommand;
|
||||
|
||||
# Now that mescc-tools-extra is available we can install kaem at /bin/kaem
|
||||
# to make it findable in environments
|
||||
|
|
|
@ -34,30 +34,18 @@ rec {
|
|||
|
||||
writeText = name: text: writeTextFile {inherit name text;};
|
||||
|
||||
mkKaemDerivation = args@{
|
||||
pname ? null,
|
||||
version ? null,
|
||||
name ? null,
|
||||
buildPhase,
|
||||
buildInputs ? [],
|
||||
...
|
||||
}:
|
||||
assert name == null -> pname != null && version != null;
|
||||
let
|
||||
rname = if name != null then name else "${pname}-${version}";
|
||||
in
|
||||
runCommand = name: env: buildCommand:
|
||||
derivation ({
|
||||
inherit system;
|
||||
name = rname;
|
||||
inherit name system;
|
||||
|
||||
builder = "${kaem}/bin/kaem";
|
||||
args = [
|
||||
"--verbose"
|
||||
"--strict"
|
||||
"--file"
|
||||
(writeText "${rname}-builder" buildPhase)
|
||||
(writeText "${name}-builder" buildCommand)
|
||||
];
|
||||
|
||||
PATH = lib.makeBinPath (buildInputs ++ [ kaem mescc-tools mescc-tools-extra ]);
|
||||
} // (builtins.removeAttrs args [ "pname" "version" "name" "buildPhase" "buildInputs" ]));
|
||||
PATH = lib.makeBinPath ((env.nativeBuildInputs or []) ++ [ kaem mescc-tools mescc-tools-extra ]);
|
||||
} // (builtins.removeAttrs env [ "nativeBuildInputs" ]));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# that can be compiled by MesCC
|
||||
|
||||
{ lib
|
||||
, mkKaemDerivation
|
||||
, runCommand
|
||||
, fetchurl
|
||||
, mes
|
||||
, buildTinyccN
|
||||
|
@ -15,72 +15,67 @@ let
|
|||
sha256 = "1xhn5qgph32dlxp3fkl4d78f21hvlb2r5dpxvh295x8spkbmbrwp";
|
||||
};
|
||||
|
||||
mes-tcc = mkKaemDerivation rec {
|
||||
pname = "mes-tcc";
|
||||
version = "0.9.27";
|
||||
mes-tcc = runCommand "mes-tcc-${version}" {} ''
|
||||
# Create config.h
|
||||
catm config.h
|
||||
|
||||
buildPhase = ''
|
||||
# Create config.h
|
||||
catm config.h
|
||||
${mes}/bin/mes --no-auto-compile -e main ${mes}/bin/mescc.scm -- \
|
||||
-S \
|
||||
-o tcc.s \
|
||||
-I . \
|
||||
-D BOOTSTRAP=1 \
|
||||
-I ${src} \
|
||||
-D TCC_TARGET_I386=1 \
|
||||
-D inline= \
|
||||
-D CONFIG_TCCDIR=\"''${out}/lib\" \
|
||||
-D CONFIG_SYSROOT=\"\" \
|
||||
-D CONFIG_TCC_CRTPREFIX=\"''${out}/lib\" \
|
||||
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
|
||||
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${mes}${mes.mesPrefix}/include\" \
|
||||
-D TCC_LIBGCC=\"${mes}${mes.mesPrefix}/lib/x86-mes/libc.a\" \
|
||||
-D CONFIG_TCC_LIBTCC1_MES=0 \
|
||||
-D CONFIG_TCCBOOT=1 \
|
||||
-D CONFIG_TCC_STATIC=1 \
|
||||
-D CONFIG_USE_LIBGCC=1 \
|
||||
-D TCC_MES_LIBC=1 \
|
||||
-D TCC_VERSION=\"${version}\" \
|
||||
-D ONE_SOURCE=1 \
|
||||
${src}/tcc.c
|
||||
|
||||
${mes}/bin/mes --no-auto-compile -e main ${mes}/bin/mescc.scm -- \
|
||||
-S \
|
||||
-o tcc.s \
|
||||
-I . \
|
||||
-D BOOTSTRAP=1 \
|
||||
-I ${src} \
|
||||
-D TCC_TARGET_I386=1 \
|
||||
-D inline= \
|
||||
-D CONFIG_TCCDIR=\"''${out}/lib\" \
|
||||
-D CONFIG_SYSROOT=\"\" \
|
||||
-D CONFIG_TCC_CRTPREFIX=\"''${out}/lib\" \
|
||||
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
|
||||
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${mes}${mes.mesPrefix}/include\" \
|
||||
-D TCC_LIBGCC=\"${mes}${mes.mesPrefix}/lib/x86-mes/libc.a\" \
|
||||
-D CONFIG_TCC_LIBTCC1_MES=0 \
|
||||
-D CONFIG_TCCBOOT=1 \
|
||||
-D CONFIG_TCC_STATIC=1 \
|
||||
-D CONFIG_USE_LIBGCC=1 \
|
||||
-D TCC_MES_LIBC=1 \
|
||||
-D TCC_VERSION=\"${version}\" \
|
||||
-D ONE_SOURCE=1 \
|
||||
${src}/tcc.c
|
||||
mkdir -p ''${out}/bin
|
||||
${mes}/bin/mes --no-auto-compile -e main ${mes}/bin/mescc.scm -- \
|
||||
-l c+tcc \
|
||||
-o ''${out}/bin/tcc \
|
||||
tcc.s
|
||||
|
||||
mkdir -p ''${out}/bin
|
||||
${mes}/bin/mes --no-auto-compile -e main ${mes}/bin/mescc.scm -- \
|
||||
-l c+tcc \
|
||||
-o ''${out}/bin/tcc \
|
||||
tcc.s
|
||||
# Quick test
|
||||
''${out}/bin/tcc -version
|
||||
|
||||
# Quick test
|
||||
''${out}/bin/tcc -version
|
||||
# Recompile the mes C library
|
||||
mkdir -p ''${out}/lib
|
||||
cd ${mes}${mes.mesPrefix}
|
||||
|
||||
# Recompile the mes C library
|
||||
mkdir -p ''${out}/lib
|
||||
cd ${mes}${mes.mesPrefix}
|
||||
# crt1.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crt1.o lib/linux/x86-mes-gcc/crt1.c
|
||||
|
||||
# crt1.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crt1.o lib/linux/x86-mes-gcc/crt1.c
|
||||
# crtn.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crtn.o lib/linux/x86-mes-gcc/crtn.c
|
||||
|
||||
# crtn.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crtn.o lib/linux/x86-mes-gcc/crtn.c
|
||||
# crti.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crti.o lib/linux/x86-mes-gcc/crti.c
|
||||
|
||||
# crti.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crti.o lib/linux/x86-mes-gcc/crti.c
|
||||
# libc+gcc.a
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/unified-libc.o ${unified-libc}
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libc.a ''${TMPDIR}/unified-libc.o
|
||||
|
||||
# libc+gcc.a
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/unified-libc.o ${unified-libc}
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libc.a ''${TMPDIR}/unified-libc.o
|
||||
# libtcc1.a
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/libtcc1.o lib/libtcc1.c
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libtcc1.a ''${TMPDIR}/libtcc1.o
|
||||
|
||||
# libtcc1.a
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/libtcc1.o lib/libtcc1.c
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libtcc1.a ''${TMPDIR}/libtcc1.o
|
||||
|
||||
# libgetopt.a
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/getopt.o lib/posix/getopt.c
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libgetopt.a ''${TMPDIR}/getopt.o
|
||||
'';
|
||||
};
|
||||
# libgetopt.a
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/getopt.o lib/posix/getopt.c
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libgetopt.a ''${TMPDIR}/getopt.o
|
||||
'';
|
||||
|
||||
boot0-tcc = buildTinyccN {
|
||||
pname = "boot0-tcc";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{ lib
|
||||
, mkKaemDerivation
|
||||
, runCommand
|
||||
, fetchurl
|
||||
, callPackage
|
||||
, mes
|
||||
|
@ -11,13 +11,10 @@ let
|
|||
sha256 = "009xvbiskg2ims2xag8w78yksnrqpm33asq5arxaph05hd59yss0";
|
||||
};
|
||||
|
||||
unified-libc = mkKaemDerivation {
|
||||
name = "mes-unified-libc.c";
|
||||
buildPhase = ''
|
||||
cd ${mes}${mes.mesPrefix}/lib
|
||||
catm ''${out} ctype/isalnum.c ctype/isalpha.c ctype/isascii.c ctype/iscntrl.c ctype/isdigit.c ctype/isgraph.c ctype/islower.c ctype/isnumber.c ctype/isprint.c ctype/ispunct.c ctype/isspace.c ctype/isupper.c ctype/isxdigit.c ctype/tolower.c ctype/toupper.c dirent/closedir.c dirent/__getdirentries.c dirent/opendir.c dirent/readdir.c linux/access.c linux/brk.c linux/chdir.c linux/chmod.c linux/clock_gettime.c linux/close.c linux/dup2.c linux/dup.c linux/execve.c linux/fcntl.c linux/fork.c linux/fsync.c linux/fstat.c linux/_getcwd.c linux/getdents.c linux/getegid.c linux/geteuid.c linux/getgid.c linux/getpid.c linux/getppid.c linux/getrusage.c linux/gettimeofday.c linux/getuid.c linux/ioctl.c linux/ioctl3.c linux/kill.c linux/link.c linux/lseek.c linux/lstat.c linux/malloc.c linux/mkdir.c linux/mknod.c linux/nanosleep.c linux/_open3.c linux/pipe.c linux/_read.c linux/readlink.c linux/rename.c linux/rmdir.c linux/setgid.c linux/settimer.c linux/setuid.c linux/signal.c linux/sigprogmask.c linux/symlink.c linux/stat.c linux/time.c linux/unlink.c linux/waitpid.c linux/x86-mes-gcc/_exit.c linux/x86-mes-gcc/syscall.c linux/x86-mes-gcc/_write.c math/ceil.c math/fabs.c math/floor.c mes/abtod.c mes/abtol.c mes/__assert_fail.c mes/assert_msg.c mes/__buffered_read.c mes/cast.c mes/dtoab.c mes/eputc.c mes/eputs.c mes/fdgetc.c mes/fdgets.c mes/fdputc.c mes/fdputs.c mes/fdungetc.c mes/globals.c mes/itoa.c mes/ltoab.c mes/ltoa.c mes/__mes_debug.c mes/mes_open.c mes/ntoab.c mes/oputc.c mes/oputs.c mes/search-path.c mes/ultoa.c mes/utoa.c posix/alarm.c posix/buffered-read.c posix/execl.c posix/execlp.c posix/execv.c posix/execvp.c posix/getcwd.c posix/getenv.c posix/isatty.c posix/mktemp.c posix/open.c posix/raise.c posix/sbrk.c posix/setenv.c posix/sleep.c posix/unsetenv.c posix/wait.c posix/write.c stdio/clearerr.c stdio/fclose.c stdio/fdopen.c stdio/feof.c stdio/ferror.c stdio/fflush.c stdio/fgetc.c stdio/fgets.c stdio/fileno.c stdio/fopen.c stdio/fprintf.c stdio/fputc.c stdio/fputs.c stdio/fread.c stdio/freopen.c stdio/fscanf.c stdio/fseek.c stdio/ftell.c stdio/fwrite.c stdio/getc.c stdio/getchar.c stdio/perror.c stdio/printf.c stdio/putc.c stdio/putchar.c stdio/remove.c stdio/snprintf.c stdio/sprintf.c stdio/sscanf.c stdio/ungetc.c stdio/vfprintf.c stdio/vfscanf.c stdio/vprintf.c stdio/vsnprintf.c stdio/vsprintf.c stdio/vsscanf.c stdlib/abort.c stdlib/abs.c stdlib/alloca.c stdlib/atexit.c stdlib/atof.c stdlib/atoi.c stdlib/atol.c stdlib/calloc.c stdlib/__exit.c stdlib/exit.c stdlib/free.c stdlib/mbstowcs.c stdlib/puts.c stdlib/qsort.c stdlib/realloc.c stdlib/strtod.c stdlib/strtof.c stdlib/strtol.c stdlib/strtold.c stdlib/strtoll.c stdlib/strtoul.c stdlib/strtoull.c string/bcmp.c string/bcopy.c string/bzero.c string/index.c string/memchr.c string/memcmp.c string/memcpy.c string/memmem.c string/memmove.c string/memset.c string/rindex.c string/strcat.c string/strchr.c string/strcmp.c string/strcpy.c string/strcspn.c string/strdup.c string/strerror.c string/strlen.c string/strlwr.c string/strncat.c string/strncmp.c string/strncpy.c string/strpbrk.c string/strrchr.c string/strspn.c string/strstr.c string/strupr.c stub/atan2.c stub/bsearch.c stub/chown.c stub/__cleanup.c stub/cos.c stub/ctime.c stub/exp.c stub/fpurge.c stub/freadahead.c stub/frexp.c stub/getgrgid.c stub/getgrnam.c stub/getlogin.c stub/getpgid.c stub/getpgrp.c stub/getpwnam.c stub/getpwuid.c stub/gmtime.c stub/ldexp.c stub/localtime.c stub/log.c stub/mktime.c stub/modf.c stub/mprotect.c stub/pclose.c stub/popen.c stub/pow.c stub/rand.c stub/rewind.c stub/setbuf.c stub/setgrent.c stub/setlocale.c stub/setvbuf.c stub/sigaction.c stub/sigaddset.c stub/sigblock.c stub/sigdelset.c stub/sigemptyset.c stub/sigsetmask.c stub/sin.c stub/sys_siglist.c stub/system.c stub/sqrt.c stub/strftime.c stub/times.c stub/ttyname.c stub/umask.c stub/utime.c x86-mes-gcc/setjmp.c
|
||||
'';
|
||||
};
|
||||
unified-libc = runCommand "mes-unified-libc.c" {} ''
|
||||
cd ${mes}${mes.mesPrefix}/lib
|
||||
catm ''${out} ctype/isalnum.c ctype/isalpha.c ctype/isascii.c ctype/iscntrl.c ctype/isdigit.c ctype/isgraph.c ctype/islower.c ctype/isnumber.c ctype/isprint.c ctype/ispunct.c ctype/isspace.c ctype/isupper.c ctype/isxdigit.c ctype/tolower.c ctype/toupper.c dirent/closedir.c dirent/__getdirentries.c dirent/opendir.c dirent/readdir.c linux/access.c linux/brk.c linux/chdir.c linux/chmod.c linux/clock_gettime.c linux/close.c linux/dup2.c linux/dup.c linux/execve.c linux/fcntl.c linux/fork.c linux/fsync.c linux/fstat.c linux/_getcwd.c linux/getdents.c linux/getegid.c linux/geteuid.c linux/getgid.c linux/getpid.c linux/getppid.c linux/getrusage.c linux/gettimeofday.c linux/getuid.c linux/ioctl.c linux/ioctl3.c linux/kill.c linux/link.c linux/lseek.c linux/lstat.c linux/malloc.c linux/mkdir.c linux/mknod.c linux/nanosleep.c linux/_open3.c linux/pipe.c linux/_read.c linux/readlink.c linux/rename.c linux/rmdir.c linux/setgid.c linux/settimer.c linux/setuid.c linux/signal.c linux/sigprogmask.c linux/symlink.c linux/stat.c linux/time.c linux/unlink.c linux/waitpid.c linux/x86-mes-gcc/_exit.c linux/x86-mes-gcc/syscall.c linux/x86-mes-gcc/_write.c math/ceil.c math/fabs.c math/floor.c mes/abtod.c mes/abtol.c mes/__assert_fail.c mes/assert_msg.c mes/__buffered_read.c mes/cast.c mes/dtoab.c mes/eputc.c mes/eputs.c mes/fdgetc.c mes/fdgets.c mes/fdputc.c mes/fdputs.c mes/fdungetc.c mes/globals.c mes/itoa.c mes/ltoab.c mes/ltoa.c mes/__mes_debug.c mes/mes_open.c mes/ntoab.c mes/oputc.c mes/oputs.c mes/search-path.c mes/ultoa.c mes/utoa.c posix/alarm.c posix/buffered-read.c posix/execl.c posix/execlp.c posix/execv.c posix/execvp.c posix/getcwd.c posix/getenv.c posix/isatty.c posix/mktemp.c posix/open.c posix/raise.c posix/sbrk.c posix/setenv.c posix/sleep.c posix/unsetenv.c posix/wait.c posix/write.c stdio/clearerr.c stdio/fclose.c stdio/fdopen.c stdio/feof.c stdio/ferror.c stdio/fflush.c stdio/fgetc.c stdio/fgets.c stdio/fileno.c stdio/fopen.c stdio/fprintf.c stdio/fputc.c stdio/fputs.c stdio/fread.c stdio/freopen.c stdio/fscanf.c stdio/fseek.c stdio/ftell.c stdio/fwrite.c stdio/getc.c stdio/getchar.c stdio/perror.c stdio/printf.c stdio/putc.c stdio/putchar.c stdio/remove.c stdio/snprintf.c stdio/sprintf.c stdio/sscanf.c stdio/ungetc.c stdio/vfprintf.c stdio/vfscanf.c stdio/vprintf.c stdio/vsnprintf.c stdio/vsprintf.c stdio/vsscanf.c stdlib/abort.c stdlib/abs.c stdlib/alloca.c stdlib/atexit.c stdlib/atof.c stdlib/atoi.c stdlib/atol.c stdlib/calloc.c stdlib/__exit.c stdlib/exit.c stdlib/free.c stdlib/mbstowcs.c stdlib/puts.c stdlib/qsort.c stdlib/realloc.c stdlib/strtod.c stdlib/strtof.c stdlib/strtol.c stdlib/strtold.c stdlib/strtoll.c stdlib/strtoul.c stdlib/strtoull.c string/bcmp.c string/bcopy.c string/bzero.c string/index.c string/memchr.c string/memcmp.c string/memcpy.c string/memmem.c string/memmove.c string/memset.c string/rindex.c string/strcat.c string/strchr.c string/strcmp.c string/strcpy.c string/strcspn.c string/strdup.c string/strerror.c string/strlen.c string/strlwr.c string/strncat.c string/strncmp.c string/strncpy.c string/strpbrk.c string/strrchr.c string/strspn.c string/strstr.c string/strupr.c stub/atan2.c stub/bsearch.c stub/chown.c stub/__cleanup.c stub/cos.c stub/ctime.c stub/exp.c stub/fpurge.c stub/freadahead.c stub/frexp.c stub/getgrgid.c stub/getgrnam.c stub/getlogin.c stub/getpgid.c stub/getpgrp.c stub/getpwnam.c stub/getpwuid.c stub/gmtime.c stub/ldexp.c stub/localtime.c stub/log.c stub/mktime.c stub/modf.c stub/mprotect.c stub/pclose.c stub/popen.c stub/pow.c stub/rand.c stub/rewind.c stub/setbuf.c stub/setgrent.c stub/setlocale.c stub/setvbuf.c stub/sigaction.c stub/sigaddset.c stub/sigblock.c stub/sigdelset.c stub/sigemptyset.c stub/sigsetmask.c stub/sin.c stub/sys_siglist.c stub/system.c stub/sqrt.c stub/strftime.c stub/times.c stub/ttyname.c stub/umask.c stub/utime.c x86-mes-gcc/setjmp.c
|
||||
'';
|
||||
|
||||
buildTinyccN = {
|
||||
pname,
|
||||
|
@ -31,64 +28,57 @@ let
|
|||
options = lib.strings.concatStringsSep " " buildOptions;
|
||||
libtccOptions = lib.strings.concatStringsSep " " libtccBuildOptions;
|
||||
in
|
||||
mkKaemDerivation {
|
||||
inherit pname version;
|
||||
buildPhase = ''
|
||||
catm config.h
|
||||
mkdir -p ''${out}/bin ''${out}/lib
|
||||
${prev}/bin/tcc \
|
||||
-g \
|
||||
-v \
|
||||
-static \
|
||||
-o ''${out}/bin/tcc \
|
||||
-D BOOTSTRAP=1 \
|
||||
${options} \
|
||||
-I . \
|
||||
-I ${src} \
|
||||
-D TCC_TARGET_I386=1 \
|
||||
-D CONFIG_TCCDIR=\"''${out}/lib\" \
|
||||
-D CONFIG_TCC_CRTPREFIX=\"''${out}/lib\" \
|
||||
-D CONFIG_TCC_ELFINTERP=\"\" \
|
||||
-D CONFIG_TCC_LIBPATHS=\"''${out}/lib\" \
|
||||
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${mes}${mes.mesPrefix}/include:${src}/include\" \
|
||||
-D TCC_LIBGCC=\"libc.a\" \
|
||||
-D TCC_LIBTCC1=\"libtcc1.a\" \
|
||||
-D CONFIG_TCCBOOT=1 \
|
||||
-D CONFIG_TCC_STATIC=1 \
|
||||
-D CONFIG_USE_LIBGCC=1 \
|
||||
-D TCC_MES_LIBC=1 \
|
||||
-D TCC_VERSION=\"${version}\" \
|
||||
-D ONE_SOURCE=1 \
|
||||
-L ${prev}/lib \
|
||||
${src}/tcc.c
|
||||
runCommand "${pname}-${version}" {} ''
|
||||
catm config.h
|
||||
mkdir -p ''${out}/bin ''${out}/lib
|
||||
${prev}/bin/tcc \
|
||||
-g \
|
||||
-v \
|
||||
-static \
|
||||
-o ''${out}/bin/tcc \
|
||||
-D BOOTSTRAP=1 \
|
||||
${options} \
|
||||
-I . \
|
||||
-I ${src} \
|
||||
-D TCC_TARGET_I386=1 \
|
||||
-D CONFIG_TCCDIR=\"''${out}/lib\" \
|
||||
-D CONFIG_TCC_CRTPREFIX=\"''${out}/lib\" \
|
||||
-D CONFIG_TCC_ELFINTERP=\"\" \
|
||||
-D CONFIG_TCC_LIBPATHS=\"''${out}/lib\" \
|
||||
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${mes}${mes.mesPrefix}/include:${src}/include\" \
|
||||
-D TCC_LIBGCC=\"libc.a\" \
|
||||
-D TCC_LIBTCC1=\"libtcc1.a\" \
|
||||
-D CONFIG_TCCBOOT=1 \
|
||||
-D CONFIG_TCC_STATIC=1 \
|
||||
-D CONFIG_USE_LIBGCC=1 \
|
||||
-D TCC_MES_LIBC=1 \
|
||||
-D TCC_VERSION=\"${version}\" \
|
||||
-D ONE_SOURCE=1 \
|
||||
-L ${prev}/lib \
|
||||
${src}/tcc.c
|
||||
|
||||
''${out}/bin/tcc -v
|
||||
''${out}/bin/tcc -v
|
||||
|
||||
cd ${mes}${mes.mesPrefix}
|
||||
# Recompile libc: crt{1,n,i}, libtcc.a, libc.a, libgetopt.a
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crt1.o lib/linux/x86-mes-gcc/crt1.c
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crtn.o lib/linux/x86-mes-gcc/crtn.c
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crti.o lib/linux/x86-mes-gcc/crti.c
|
||||
''${out}/bin/tcc -c -D TCC_TARGET_I386=1 ${libtccOptions} -o ''${TMPDIR}/libtcc1.o ${src}/lib/libtcc1.c
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libtcc1.a ''${TMPDIR}/libtcc1.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/unified-libc.o ${unified-libc}
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libc.a ''${TMPDIR}/unified-libc.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/getopt.o lib/posix/getopt.c
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libgetopt.a ''${TMPDIR}/getopt.o
|
||||
'';
|
||||
};
|
||||
cd ${mes}${mes.mesPrefix}
|
||||
# Recompile libc: crt{1,n,i}, libtcc.a, libc.a, libgetopt.a
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crt1.o lib/linux/x86-mes-gcc/crt1.c
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crtn.o lib/linux/x86-mes-gcc/crtn.c
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${out}/lib/crti.o lib/linux/x86-mes-gcc/crti.c
|
||||
''${out}/bin/tcc -c -D TCC_TARGET_I386=1 ${libtccOptions} -o ''${TMPDIR}/libtcc1.o ${src}/lib/libtcc1.c
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libtcc1.a ''${TMPDIR}/libtcc1.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/unified-libc.o ${unified-libc}
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libc.a ''${TMPDIR}/unified-libc.o
|
||||
''${out}/bin/tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ''${TMPDIR}/getopt.o lib/posix/getopt.c
|
||||
''${out}/bin/tcc -ar cr ''${out}/lib/libgetopt.a ''${TMPDIR}/getopt.o
|
||||
'';
|
||||
|
||||
boot4-tcc = callPackage ./bootstrappable.nix { inherit buildTinyccN unified-libc; };
|
||||
|
||||
tccdefs = mkKaemDerivation {
|
||||
pname = "tccdefs";
|
||||
inherit version;
|
||||
buildPhase = ''
|
||||
mkdir ''${out}
|
||||
${boot4-tcc}/bin/tcc -static -DC2STR -o c2str ${src}/conftest.c
|
||||
./c2str ${src}/include/tccdefs.h ''${out}/tccdefs_.h
|
||||
'';
|
||||
};
|
||||
tccdefs = runCommand "tccdefs-${version}" {} ''
|
||||
mkdir ''${out}
|
||||
${boot4-tcc}/bin/tcc -static -DC2STR -o c2str ${src}/conftest.c
|
||||
./c2str ${src}/include/tccdefs.h ''${out}/tccdefs_.h
|
||||
'';
|
||||
|
||||
boot5-tcc = buildTinyccN {
|
||||
pname = "boot5-tcc";
|
||||
|
|
Loading…
Reference in a new issue