2022-07-03 11:44:38 +03:00
|
|
|
Import("env")
|
|
|
|
|
|
|
|
env.Append(
|
|
|
|
CPPPATH=[
|
2023-12-01 12:16:48 +03:00
|
|
|
# "#/lib/mbedtls",
|
2022-07-03 11:44:38 +03:00
|
|
|
"#/lib/mbedtls/include",
|
|
|
|
],
|
2022-11-02 18:15:40 +03:00
|
|
|
SDK_HEADERS=[
|
|
|
|
File("mbedtls/include/mbedtls/des.h"),
|
|
|
|
File("mbedtls/include/mbedtls/sha1.h"),
|
2023-12-01 12:16:48 +03:00
|
|
|
File("mbedtls/include/mbedtls/sha256.h"),
|
|
|
|
File("mbedtls/include/mbedtls/md5.h"),
|
|
|
|
File("mbedtls/include/mbedtls/md.h"),
|
|
|
|
File("mbedtls/include/mbedtls/ecdsa.h"),
|
|
|
|
File("mbedtls/include/mbedtls/ecdh.h"),
|
|
|
|
File("mbedtls/include/mbedtls/ecp.h"),
|
|
|
|
# File("mbedtls/include/mbedtls/sha1.h"),
|
2022-11-02 18:15:40 +03:00
|
|
|
],
|
2023-12-01 12:16:48 +03:00
|
|
|
CPPDEFINES=[("MBEDTLS_CONFIG_FILE", '\\"mbedtls_cfg.h\\"')],
|
2022-07-03 11:44:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
libenv = env.Clone(FW_LIB_NAME="mbedtls")
|
|
|
|
libenv.ApplyLibFlags()
|
|
|
|
|
2022-09-19 15:39:00 +03:00
|
|
|
libenv.AppendUnique(
|
|
|
|
CCFLAGS=[
|
|
|
|
# Required for lib to be linkable with .faps
|
|
|
|
"-mword-relocations",
|
|
|
|
"-mlong-calls",
|
2023-12-01 12:16:48 +03:00
|
|
|
# Crappy code :)
|
|
|
|
"-Wno-redundant-decls",
|
2022-09-19 15:39:00 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2023-12-01 12:16:48 +03:00
|
|
|
# If we were to build full mbedtls, we would need to use this:
|
|
|
|
# sources = libenv.GlobRecursive("*.c*", "mbedtls/library")
|
|
|
|
# Otherwise, we can just use the files we need:
|
2022-08-07 18:09:00 +03:00
|
|
|
sources = [
|
2023-12-01 12:16:48 +03:00
|
|
|
File("mbedtls/library/bignum.c"),
|
|
|
|
File("mbedtls/library/bignum_core.c"),
|
|
|
|
File("mbedtls/library/ecdsa.c"),
|
|
|
|
File("mbedtls/library/ecp.c"),
|
|
|
|
File("mbedtls/library/ecp_curves.c"),
|
|
|
|
File("mbedtls/library/md.c"),
|
|
|
|
File("mbedtls/library/md5.c"),
|
|
|
|
File("mbedtls/library/platform_util.c"),
|
|
|
|
File("mbedtls/library/ripemd160.c"),
|
|
|
|
File("mbedtls/library/sha1.c"),
|
|
|
|
File("mbedtls/library/sha256.c"),
|
|
|
|
File("mbedtls/library/des.c"),
|
2022-08-07 18:09:00 +03:00
|
|
|
]
|
2023-12-01 12:16:48 +03:00
|
|
|
Depends(sources, File("mbedtls_cfg.h"))
|
|
|
|
|
2022-07-03 11:44:38 +03:00
|
|
|
|
|
|
|
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
|
|
|
|
libenv.Install("${LIB_DIST_DIR}", lib)
|
|
|
|
Return("lib")
|