[zstd] Move zstd.module to external/

It felt clunky to have zstd.module in src/libraries/zstd by itself, and
doesn't make much sense in src/libraries as it's an external library
anyway.

Now the ./configure script will pick up .module files in the top-level
external directory as well.
This commit is contained in:
Justin C. Miller
2023-01-29 19:18:19 -08:00
parent 6f7dd7fc05
commit e2e1696b7e
2 changed files with 28 additions and 25 deletions

49
configure vendored
View File

@@ -1,7 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
def generate(output, config, manifest): def generate(output, config, manifest):
from os import makedirs, walk from os import makedirs
from glob import iglob
from pathlib import Path from pathlib import Path
from bonnibel.module import Module from bonnibel.module import Module
from bonnibel.project import Project from bonnibel.project import Project
@@ -10,33 +11,35 @@ def generate(output, config, manifest):
project = Project(root) project = Project(root)
output = root / output output = root / output
sources = root / "src"
manifest = root / manifest manifest = root / manifest
sources = [
str(root / "src/**/*.module"),
str(root / "external/*.module"),
]
modules = {} modules = {}
for base, dirs, files in walk(sources): for source in sources:
path = Path(base) for modfile in iglob(source, recursive=True):
for f in files: path = Path(modfile).parent
if f.endswith(".module"):
fullpath = path / f
def module_init(name, **kwargs):
if not "root" in kwargs:
kwargs["root"] = path
m = Module(name, fullpath, **kwargs)
modules[m.name] = m
return m
glo = { def module_init(name, **kwargs):
"module": module_init, if not "root" in kwargs:
"source_root": root, kwargs["root"] = path
"built_root": output, m = Module(name, modfile, **kwargs)
"module_root": path, modules[m.name] = m
} return m
code = compile(open(fullpath, 'r').read(), fullpath, "exec")
loc = {} glo = {
exec(code, glo, loc) "module": module_init,
"source_root": root,
"build_root": output,
"module_root": path,
}
code = compile(open(modfile, 'r').read(), modfile, "exec")
loc = {}
exec(code, glo, loc)
Module.update(modules) Module.update(modules)

View File

@@ -3,7 +3,7 @@
zstd = module("zstd", zstd = module("zstd",
root = "${source_root}/external/zstd", root = "${source_root}/external/zstd",
kind = "lib", kind = "lib",
deps = [ "libc" ], deps = [ ],
output = "libzstd.a", output = "libzstd.a",
sources = [ sources = [
"decompress/zstd_decompress.c", "decompress/zstd_decompress.c",
@@ -26,7 +26,7 @@ zstd = module("zstd",
]) ])
zstd.variables['ccflags'] = [ zstd.variables['ccflags'] = [
"${ccflags}", "${ccflags}",
"-DXXH_NAMESPACE=ZSTD_", "-DXXH_NAMESPACE=ZSTD_",
"-DDEBUGLEVEL=0", "-DDEBUGLEVEL=0",
"-DZSTD_DISABLE_ASM", "-DZSTD_DISABLE_ASM",