fix(selfhost): stdlib path + merge all modules, not just imports
- Fix Cli_FindStdlibDir: search for lib/ instead of stdlib/ - Fix Cli_CollectStdlibImports → merge ALL lib/*.bux via bux_list_dir - Fix Cli_CollectStdlibImports path: remove Std/ subdir (now flat) - Add ../../ fallback for rt/ paths (build/selfhost depth) - Update PLAN.md with v0.3.0 structure + v1.0.0 roadmap - Remaining: 7 sema cross-module resolution bugs (pre-existing)
This commit is contained in:
+11
-10
@@ -259,9 +259,9 @@ proc collectDepDecls(lock: Lockfile, root: string, opts: GlobalOptions): seq[Dec
|
||||
|
||||
proc findStdlibDir(root: string): string =
|
||||
let searchPaths = @[
|
||||
getAppDir() / ".." / "library",
|
||||
getAppDir() / "library",
|
||||
root / "library",
|
||||
getAppDir() / ".." / "lib",
|
||||
getAppDir() / "lib",
|
||||
root / "lib",
|
||||
]
|
||||
for path in searchPaths:
|
||||
if dirExists(path):
|
||||
@@ -461,26 +461,27 @@ proc cmdBuild*(args: seq[string], opts: GlobalOptions): int =
|
||||
let cFile = buildDir / "main.c"
|
||||
writeFile(cFile, allCCode)
|
||||
|
||||
# Copy runtime and stdlib files
|
||||
# Copy runtime files (rt/ is sibling of lib/)
|
||||
let stdlibDir = pctx.stdlibDir
|
||||
let runtimeDst = buildDir / "runtime.c"
|
||||
let ioDst = buildDir / "io.c"
|
||||
if stdlibDir == "":
|
||||
printError("stdlib directory not found", useColor)
|
||||
return 1
|
||||
|
||||
let runtimeSrc = stdlibDir / "runtime" / "runtime.c"
|
||||
|
||||
let baseDir = stdlibDir.parentDir()
|
||||
let runtimeSrc = baseDir / "rt" / "runtime.c"
|
||||
if fileExists(runtimeSrc):
|
||||
copyFile(runtimeSrc, runtimeDst)
|
||||
else:
|
||||
printError("runtime.c not found in library/runtime/", useColor)
|
||||
printError("runtime.c not found in rt/", useColor)
|
||||
return 1
|
||||
|
||||
let ioSrc = stdlibDir / "runtime" / "io.c"
|
||||
|
||||
let ioSrc = baseDir / "rt" / "io.c"
|
||||
if fileExists(ioSrc):
|
||||
copyFile(ioSrc, ioDst)
|
||||
else:
|
||||
printError("io.c not found in library/runtime/", useColor)
|
||||
printError("io.c not found in rt/", useColor)
|
||||
return 1
|
||||
|
||||
# Compile with cc
|
||||
|
||||
Reference in New Issue
Block a user