diff --git a/.nanvix/config.py b/.nanvix/config.py index 61eaf1e99b5784..27a0bc0b32d95f 100644 --- a/.nanvix/config.py +++ b/.nanvix/config.py @@ -49,81 +49,6 @@ DOCKER_WORKSPACE_PATH = "/mnt/workspace" -def toolchain_paths( - toolchain: str | Path, - sysroot: str | Path, -) -> dict[str, Path]: - """Return resolved paths to toolchain binaries and libraries.""" - tc = Path(toolchain) - sr = Path(sysroot) - return { - "cc": tc / "bin" / f"{TOOLCHAIN_TRIPLET}-gcc", - "cxx": tc / "bin" / f"{TOOLCHAIN_TRIPLET}-g++", - "ld": tc / "bin" / f"{TOOLCHAIN_TRIPLET}-ld", - "ar": tc / "bin" / f"{TOOLCHAIN_TRIPLET}-ar", - "ranlib": tc / "bin" / f"{TOOLCHAIN_TRIPLET}-ranlib", - "strip": tc / "bin" / f"{TOOLCHAIN_TRIPLET}-strip", - "build_python": tc / "bin" / "python3", - "libc": tc / f"{TOOLCHAIN_TRIPLET}" / "lib" / "libc.a", - "libm": tc / f"{TOOLCHAIN_TRIPLET}" / "lib" / "libm.a", - "libposix": sr / "lib" / "libposix.a", - "libz": sr / "lib" / "libz.a", - "libsqlite3": sr / "lib" / "libsqlite3.a", - "libssl": sr / "lib" / "libssl.a", - "libcrypto": sr / "lib" / "libcrypto.a", - "liblzma": sr / "lib" / "liblzma.a", - "libnvx_crt0": sr / "lib" / "libnvx_crt0.a", - } - - -def configure_env(toolchain: str | Path, sysroot: str | Path) -> dict[str, str]: - """Return the environment dict for ./configure. - - NOTE: This helper is currently unused; the actual cpython build invokes - ``make -f Makefile.nanvix`` which has its own inline CONFIGURE_ENV. This - function is kept in sync so a future caller does not pick up stale link - flags. See ``Makefile.nanvix`` for the authoritative comment block - explaining the ``--whole-archive`` / ``--export-dynamic`` / - ``--allow-multiple-definition`` rationale. - """ - tp = toolchain_paths(toolchain, sysroot) - sr = Path(sysroot) - return { - "CC": str(tp["cc"]), - "CXX": str(tp["cxx"]), - "LD": str(tp["ld"]), - "AR": str(tp["ar"]), - "RANLIB": str(tp["ranlib"]), - "CFLAGS": ( - f"-O3 -fomit-frame-pointer -fno-unwind-tables " - f"-fno-asynchronous-unwind-tables -I{sr}/include" - ), - "CFLAGS_NODIST": "-fno-semantic-interposition", - "LDFLAGS": ( - f"-L{sr}/lib -T{sr}/lib/user.ld " - f"-Wl,--allow-multiple-definition -no-pie " - f"-Wl,--export-dynamic -Wl,--no-dynamic-linker" - ), - "LIBS": ( - f"-Wl,--whole-archive {tp['libnvx_crt0']} {tp['libposix']} " - f"{tp['libc']} {tp['libm']} " - f"-lstdc++ -lgcc -Wl,--no-whole-archive " - f"-Wl,--start-group " - f"-lsqlite3 -lz -lbz2 -llzma -Wl,--end-group" - ), - "LIBSQLITE3_LIBS": f"-L{sr}/lib -lsqlite3", - "LIBSQLITE3_CFLAGS": f"-I{sr}/include", - "ZLIB_LIBS": f"-L{sr}/lib -lz", - "ZLIB_CFLAGS": f"-I{sr}/include", - "BZIP2_LIBS": f"-L{sr}/lib -lbz2", - "BZIP2_CFLAGS": f"-I{sr}/include", - "LIBLZMA_LIBS": f"-L{sr}/lib -llzma", - "LIBLZMA_CFLAGS": f"-I{sr}/include", - "LIBFFI_LIBS": f"-L{sr}/lib -lffi", - "LIBFFI_CFLAGS": f"-I{sr}/include", - } - - def configure_opts( build_python: str | Path, libc: str | Path,