{ "toolchain": { "type": "export" , "flexible_config": ["ARCH", "TARGET_ARCH", "TOOLCHAIN_CONFIG", "ENV"] , "target": "gcc-4.7.4" } , "files": {"type": "install", "deps": [["TREE", null, "."]]} , "separate_sources_and_patches": { "type": "install" , "dirs": [ ["files", "gcc"] , [["@", "gmp", "", "files"], "gmp"] , [["@", "mpc", "", "files"], "mpc"] , [["@", "mpfr", "", "files"], "mpfr"] , [["@", "patches", "", "gcc-4.7.4"], "patches"] ] } , "combined_patched_sources": { "type": ["@", "rules", "CC/foreign/shell", "data"] , "project": ["separate_sources_and_patches"] , "localbase": [["@", "busybox", "", "bootstrap"]] , "cmds": [ "export PATCH=${LOCALBASE}/bin/patch" , "mv gmp mpc mpfr gcc/." , "cp -r gcc/. ${DESTDIR}/. && chmod -R +w ${DESTDIR}/*" , "cd ${DESTDIR}" , "echo '#include \nucontext_t foo;' > ${TMPDIR}/test.c" , "if \"${CC}\" -c ${TMPDIR}/test.c -o ${TMPDIR}/test.o >/dev/null 2>&1; then" , " ${PATCH} -p1 < ${WORKDIR}/patches/gcc-4.7.4/use-ucontext_t.patch >/dev/null" , "fi" , "for p in $(cat ${WORKDIR}/patches/gcc-4.7.4/various-fixes/series); do" , " ${PATCH} -p1 < ${WORKDIR}/patches/gcc-4.7.4/various-fixes/$p >/dev/null" , "done" , "for p in $(cat ${WORKDIR}/patches/gcc-4.7.4/musl-support/series); do" , " ${PATCH} -p1 < ${WORKDIR}/patches/gcc-4.7.4/musl-support/$p >/dev/null" , "done" , "for p in $(cat ${WORKDIR}/patches/gcc-4.7.4/reproducibility/series); do" , " ${PATCH} -p1 < ${WORKDIR}/patches/gcc-4.7.4/reproducibility/$p >/dev/null" , "done" ] , "out_dirs": ["."] } , "staged_sources_and_binutils": { "type": "install" , "dirs": [ ["combined_patched_sources", "src"] , [["@", "binutils", "", "toolchain"], "binutils"] ] } , "gcc-4.7.4 (real)": { "type": ["@", "rules", "CC/foreign/shell", "data"] , "arguments_config": ["TOOLCHAIN_CONFIG"] , "project": ["staged_sources_and_binutils"] , "localbase": [["@", "busybox", "", "bootstrap"], ["@", "make", "", "bootstrap"]] , "cmds": { "type": "++" , "$1": [ [ { "type": "join" , "$1": [ "HOST_SYSTEM_HDR_DIR='" , { "type": "lookup" , "key": "HOST_SYSTEM_HDR_DIR" , "map": { "type": "var" , "name": "TOOLCHAIN_CONFIG" , "default": {"type": "empty_map"} } , "default": "" } , "'" ] } , { "type": "join" , "$1": [ "HOST_SYSTEM_LIB_DIR='" , { "type": "lookup" , "key": "HOST_SYSTEM_LIB_DIR" , "map": { "type": "var" , "name": "TOOLCHAIN_CONFIG" , "default": {"type": "empty_map"} } , "default": "" } , "'" ] } , { "type": "join" , "$1": [ "HOST_DYNAMIC_LINKER='" , { "type": "lookup" , "key": "HOST_DYNAMIC_LINKER" , "map": { "type": "var" , "name": "TOOLCHAIN_CONFIG" , "default": {"type": "empty_map"} } , "default": "" } , "'" ] } , "export NJOBS=$(nproc --all 2>/dev/null || echo 1)" , "export MAKEINFO=missing" , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=$(pwd)/binutils/bin:${LOCALBASE}/bin:$PATH" , "export BUILD_ROOT_DIR=${ACTION_DIR}" , "export SHELL=${LOCALBASE}/bin/sh" , "export CONFIG_SHELL=${LOCALBASE}/bin/sh" , "export CXX=no" , "unset LDFLAGS" , "CONF_ARGS=" , "if [ -n \"$HOST_SYSTEM_HDR_DIR\" ]; then" , " CONF_ARGS=\"$CONF_ARGS --with-sysroot=/ --with-native-system-header-dir=$HOST_SYSTEM_HDR_DIR\"" , "fi" , "LINK_ARGS=" , "if [ -n \"$HOST_SYSTEM_LIB_DIR\" ]; then" , " export LIBRARY_PATH=\"$HOST_SYSTEM_LIB_DIR\"" , " LINK_ARGS=\"$LINK_ARGS -B$HOST_SYSTEM_LIB_DIR -L$HOST_SYSTEM_LIB_DIR\"" , " LINK_ARGS=\"$LINK_ARGS -Xlinker -rpath -Xlinker $HOST_SYSTEM_LIB_DIR\"" , "fi" , "if [ -n \"$HOST_DYNAMIC_LINKER\" ]; then" , " mv src/gcc/config src/gcc/config.orig" , " cp -r src/gcc/config.orig src/gcc/config" , " chmod -R +w src/gcc/config" , " for h in src/gcc/config/*/*.h; do" , " grep -q _DYNAMIC_LINKER \"$h\" || continue" , " sed -i 's|\\(^#define [A-Z]*_DYNAMIC_LINKER[A-Z0-9]* *\"\\).*\"|\\1'$HOST_DYNAMIC_LINKER'\"|g' \"$h\"" , " done" , "fi" , "export LDFLAGS_FOR_TARGET=\"${LINK_ARGS}\"" , "if [ -f /lib/ld-musl-$(uname -m).so.1 ]; then" , " ln -s /lib/ld-musl-$(uname -m).so.1 ${TMPDIR}/ldd" , " export PATH=$PATH:${TMPDIR}" , "fi" , "cp -r binutils/. ${DESTDIR}/." , "chmod -R +w ${DESTDIR}/*" ] , { "type": "if" , "cond": { "type": "lookup" , "key": "BOOTSTRAP_WRAP_CC" , "map": { "type": "var" , "name": "TOOLCHAIN_CONFIG" , "default": {"type": "empty_map"} } } , "then": [ "echo \"#!${SHELL}\" > wrapped-cc" , { "type": "join" , "separator": " " , "$1": [ "echo" , { "type": "join_cmd" , "$1": [ "exec" , { "type": "join_cmd" , "$1": { "type": "++" , "$1": [ [ { "type": "lookup" , "key": "BOOTSTRAP_CC" , "map": { "type": "var" , "name": "TOOLCHAIN_CONFIG" , "default": {"type": "empty_map"} } , "default": "cc" } ] , { "type": "lookup" , "key": "BOOTSTRAP_CFLAGS" , "map": { "type": "var" , "name": "TOOLCHAIN_CONFIG" , "default": {"type": "empty_map"} } , "default": [] } ] } } , "\"$@\"" ] } , ">> wrapped-cc" ] } , "chmod 755 wrapped-cc" , "export CC=$(pwd)/wrapped-cc" ] } , [ "cd src" , "for f in $(find . -type f -exec grep -q '#! */bin/sh' {} \\; -print)" , "do" , " cp $f $f.__work" , " rm $f" , " chmod 755 $f.__work" , " sed -i 's|#! */bin/sh|#!'\"${SHELL}\"'|g' $f.__work" , " mv $f.__work $f" , "done" , "for f in mpfr/get_patches.c # Source modified in place" , "do" , " cp $f $f.__work" , " rm $f" , " chmod 755 $f.__work" , " mv $f.__work $f" , "done" , "export check_msgfmt=no # do not use system's msgfmt, if available" , "${SHELL} ./configure --prefix=/ --enable-languages=c,c++ --disable-multilib --disable-shared --disable-lto --disable-gcov --disable-libmudflap --disable-libgomp --disable-libssp --disable-nls --disable-libitm ${CONF_ARGS} >configure.log 2>&1 || (cat configure.log && exit 1)" , "${MAKE} -j${NJOBS} >build.log 2>&1 || (cat configure.log build.log && exit 1)" , "${MAKE} -j${NJOBS} DESTDIR=${DESTDIR} install-strip >>build.log 2>&1 || (cat configure.log build.log && exit 1)" , "cd ${DESTDIR}" , "for f in $(find . -type f | grep '\\.o$'); do strip -g $f; done" , "for f in $(find . -type f | grep '\\.a$'); do strip -g $f; done" , "GCC_LIBDIR=\"lib/gcc/$(./bin/gcc -dumpmachine)/$(./bin/gcc -dumpfullversion -dumpversion)\"" , "mv ${GCC_LIBDIR}/include-fixed ${TMPDIR}/" , "cp -rL ${TMPDIR}/include-fixed ${GCC_LIBDIR}/. # resolve symlinks" , "cd ${DESTDIR}/bin" ] ] } , "out_dirs": ["."] } , "link_args.h": { "type": "file_gen" , "arguments_config": ["TOOLCHAIN_CONFIG", "USE_LINK_ARGS"] , "name": "link_args.h" , "data": { "type": "let*" , "bindings": [ [ "system_lib_dir" , { "type": "lookup" , "key": "HOST_SYSTEM_LIB_DIR" , "map": { "type": "var" , "name": "TOOLCHAIN_CONFIG" , "default": {"type": "empty_map"} } } ] , [ "link_args" , { "type": "if" , "cond": { "type": "and" , "$1": [ {"type": "var", "name": "system_lib_dir"} , {"type": "var", "name": "USE_LINK_ARGS"} ] } , "then": [ { "type": "join" , "$1": ["-B", {"type": "var", "name": "system_lib_dir"}] } , { "type": "join" , "$1": ["-L", {"type": "var", "name": "system_lib_dir"}] } , "-Xlinker" , "-rpath" , "-Xlinker" , {"type": "var", "name": "system_lib_dir"} ] } ] , [ "link_args_c" , { "type": "json_encode" , "$1": {"type": "length", "$1": {"type": "var", "name": "link_args"}} } ] , [ "args_array" , { "type": "join" , "separator": ", " , "$1": { "type": "++" , "$1": [ { "type": "foreach" , "range": {"type": "var", "name": "link_args"} , "body": {"type": "json_encode", "$1": {"type": "var", "name": "_"}} } , ["NULL"] ] } } ] ] , "body": { "type": "join" , "$1": [ "char* link_args[]" , " = {" , {"type": "var", "name": "args_array"} , "};\n" , "size_t link_args_c = (size_t) " , {"type": "var", "name": "link_args_c"} , ";\n" ] } } } , "toolname.h": { "type": "file_gen" , "arguments_config": ["TOOL"] , "name": "toolname.h" , "data": { "type": "join" , "$1": [ "char *toolname = " , {"type": "json_encode", "$1": {"type": "var", "name": "TOOL"}} , ";\n" , "char *dir_offset = \"../__real/bin\";\n" ] } } , "wrapper (real)": { "type": ["@", "rules", "CC", "binary"] , "arguments_config": ["TOOL"] , "pure C": [""] , "name": [{"type": "var", "name": "TOOL"}] , "private-hdrs": ["toolname.h", "link_args.h"] , "srcs": [["@", "patches", "", "wrapper.c"]] } , "gcc": { "type": "configure" , "target": "wrapper (real)" , "config": { "type": "let*" , "bindings": [["TOOL", "gcc"], ["USE_LINK_ARGS", true]] , "body": {"type": "env", "vars": ["TOOL", "USE_LINK_ARGS"]} } } , "g++": { "type": "configure" , "target": "wrapper (real)" , "config": { "type": "let*" , "bindings": [["TOOL", "g++"], ["USE_LINK_ARGS", true]] , "body": {"type": "env", "vars": ["TOOL", "USE_LINK_ARGS"]} } } , "ar": { "type": "configure" , "target": "wrapper (real)" , "config": { "type": "let*" , "bindings": [["TOOL", "ar"], ["USE_LINK_ARGS", false]] , "body": {"type": "env", "vars": ["TOOL", "USE_LINK_ARGS"]} } } , "ranlib": { "type": "configure" , "target": "wrapper (real)" , "config": { "type": "let*" , "bindings": [["TOOL", "ranlib"], ["USE_LINK_ARGS", false]] , "body": {"type": "env", "vars": ["TOOL", "USE_LINK_ARGS"]} } } , "ld": { "type": "configure" , "target": "wrapper (real)" , "config": { "type": "let*" , "bindings": [["TOOL", "ld"], ["USE_LINK_ARGS", false]] , "body": {"type": "env", "vars": ["TOOL", "USE_LINK_ARGS"]} } } , "strip": { "type": "configure" , "target": "wrapper (real)" , "config": { "type": "let*" , "bindings": [["TOOL", "strip"], ["USE_LINK_ARGS", false]] , "body": {"type": "env", "vars": ["TOOL", "USE_LINK_ARGS"]} } } , "wrappers": { "type": ["@", "rules", "CC", "install-with-deps"] , "targets": ["gcc", "g++", "ar", "ranlib", "ld", "strip"] } , "gcc-4.7.4": { "type": "install" , "dirs": [["wrappers", "."], ["gcc-4.7.4 (real)", "__real"]] } }