2018-11-24 06:14:07 +00:00
|
|
|
# Functions to build the moxiebox runtime.
|
|
|
|
|
|
|
|
. "${CT_LIB_DIR}/scripts/build/libc/newlib.sh"
|
|
|
|
|
|
|
|
moxiebox_get()
|
|
|
|
{
|
|
|
|
CT_Fetch NEWLIB
|
|
|
|
CT_Fetch MOXIEBOX
|
|
|
|
}
|
|
|
|
|
|
|
|
moxiebox_extract()
|
|
|
|
{
|
|
|
|
CT_ExtractPatch NEWLIB
|
|
|
|
CT_ExtractPatch MOXIEBOX
|
|
|
|
}
|
|
|
|
|
Fold libc_start_files into libc
After 557b9d4, libc_start_files and libc_main steps are performed one
after another. It doesn't make sense, especially since some of the libcs
(glibc, uClibc-ng) go to great lengths to first install start files in
the first step, libc_start_files, only to remove them immediately in the
second step, libc_main.
Current build steps also break in the xtensa newlib configurations, as
it needs to install the custom xtensa headers before building the libgcc
and after 557b9d4, the headers are not installed before libgcc is built
in pass-1.
Therefore, finish what 557b9d4 mentioned but did not do: move header
installation into a new step, libc_headers, and combine libc_start_files
and libc_main into a single step.
This also allows to combine the core pass-1/pass-2 steps, to be done in
a subsequent commit.
Signed-off-by: Alexey Neyman <stilor@att.net>
2022-02-08 23:52:48 +00:00
|
|
|
moxiebox_headers()
|
2018-11-24 06:14:07 +00:00
|
|
|
{
|
Fold libc_start_files into libc
After 557b9d4, libc_start_files and libc_main steps are performed one
after another. It doesn't make sense, especially since some of the libcs
(glibc, uClibc-ng) go to great lengths to first install start files in
the first step, libc_start_files, only to remove them immediately in the
second step, libc_main.
Current build steps also break in the xtensa newlib configurations, as
it needs to install the custom xtensa headers before building the libgcc
and after 557b9d4, the headers are not installed before libgcc is built
in pass-1.
Therefore, finish what 557b9d4 mentioned but did not do: move header
installation into a new step, libc_headers, and combine libc_start_files
and libc_main into a single step.
This also allows to combine the core pass-1/pass-2 steps, to be done in
a subsequent commit.
Signed-off-by: Alexey Neyman <stilor@att.net>
2022-02-08 23:52:48 +00:00
|
|
|
newlib_headers
|
2018-11-24 06:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
moxiebox_main()
|
|
|
|
{
|
|
|
|
newlib_main
|
2019-02-18 07:55:16 +00:00
|
|
|
}
|
2018-11-24 06:14:07 +00:00
|
|
|
|
2019-02-18 07:55:16 +00:00
|
|
|
moxiebox_post_cc()
|
|
|
|
{
|
2018-11-24 06:14:07 +00:00
|
|
|
CT_DoStep INFO "Installing moxiebox runtime and VM"
|
|
|
|
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-moxiebox"
|
|
|
|
CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/moxiebox/." .
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building SHA256-only libcrypto"
|
|
|
|
# Moxiebox needs libcrypto on the host, but it only uses SHA256 digest functions
|
|
|
|
# from it. We don't want to pull the whole OpenSSL for the host; fortunately,
|
|
|
|
# moxiebox comes with a standalone SHA256 implementation - which it only uses
|
|
|
|
# for the target library. Help it use the same implementation for the host.
|
|
|
|
CT_mkdir_pushd openssl
|
|
|
|
CT_DoExecLog ALL cp -v "${CT_LIB_DIR}/packages/moxiebox/"sha*.[ch] ./
|
|
|
|
CT_DoExecLog ALL "${CT_HOST}-gcc" -c sha256_wrap.c -O2 -Wall
|
|
|
|
CT_DoExecLog ALL "${CT_HOST}-ar" cru libcrypto.a sha256_wrap.o
|
2018-12-03 21:04:44 +00:00
|
|
|
CT_Popd
|
2018-11-24 06:14:07 +00:00
|
|
|
|
|
|
|
# Moxiebox includes a VM which we're building for the
|
|
|
|
# host machine.
|
|
|
|
CT_DoLog EXTRA "Configuring moxiebox"
|
|
|
|
|
|
|
|
CT_DoExecLog CFG ./autogen.sh
|
|
|
|
|
2019-02-18 07:55:16 +00:00
|
|
|
# moxiebox build script creates symlinks from the installation location to the build
|
2018-11-24 06:14:07 +00:00
|
|
|
# directory for the moxiebox library. This seems backwards. Instead, pass the search
|
|
|
|
# as part of the MOX_GCC definition.
|
|
|
|
# moxiebox also depends on the tools being named moxiebox-{gcc,as,ar}. However, failure
|
|
|
|
# to detect such tools is non-fatal in the configure and we need to override it in
|
|
|
|
# make's command line anyway.
|
|
|
|
CT_DoExecLog CFG \
|
|
|
|
LDFLAGS="${CT_LDFLAGS_FOR_HOST} -L${CT_BUILD_DIR}/build-libc-moxiebox/openssl" \
|
|
|
|
CFLAGS="${CT_CFLAGS_FOR_HOST} -I${CT_BUILD_DIR}/build-libc-moxiebox" \
|
|
|
|
CXXFLAGS="${CT_CFLAGS_FOR_HOST} -I${CT_BUILD_DIR}/build-libc-moxiebox" \
|
|
|
|
./configure \
|
|
|
|
--host="${CT_HOST}"
|
|
|
|
CT_DoLog EXTRA "Building moxiebox"
|
|
|
|
CT_DoExecLog CFG make all \
|
|
|
|
MOX_GCC="${CT_TARGET}-gcc -B ${CT_BUILD_DIR}/build-libc-moxiebox/runtime -B ${CT_SYSROOT_DIR}/lib" \
|
|
|
|
MOX_AS="${CT_TARGET}-as" \
|
|
|
|
MOX_AR="${CT_TARGET}-ar"
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing moxiebox"
|
|
|
|
|
|
|
|
# moxiebox does not have install target. Copy the interesting stuff manually.
|
|
|
|
CT_DoExecLog ALL cp -v "${CT_BUILD_DIR}/build-libc-moxiebox/runtime/libsandboxrt.a" \
|
|
|
|
"${CT_BUILD_DIR}/build-libc-moxiebox/runtime/crt0.o" \
|
|
|
|
"${CT_SYSROOT_DIR}/lib/"
|
|
|
|
CT_DoExecLog ALL cp -v "${CT_BUILD_DIR}/build-libc-moxiebox/src/sandbox" \
|
|
|
|
"${CT_PREFIX_DIR}/bin"
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|