[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:
47
configure
vendored
47
configure
vendored
@@ -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):
|
def module_init(name, **kwargs):
|
||||||
if not "root" in kwargs:
|
if not "root" in kwargs:
|
||||||
kwargs["root"] = path
|
kwargs["root"] = path
|
||||||
m = Module(name, fullpath, **kwargs)
|
m = Module(name, modfile, **kwargs)
|
||||||
modules[m.name] = m
|
modules[m.name] = m
|
||||||
return m
|
return m
|
||||||
|
|
||||||
glo = {
|
glo = {
|
||||||
"module": module_init,
|
"module": module_init,
|
||||||
"source_root": root,
|
"source_root": root,
|
||||||
"built_root": output,
|
"build_root": output,
|
||||||
"module_root": path,
|
"module_root": path,
|
||||||
}
|
}
|
||||||
code = compile(open(fullpath, 'r').read(), fullpath, "exec")
|
code = compile(open(modfile, 'r').read(), modfile, "exec")
|
||||||
|
|
||||||
loc = {}
|
loc = {}
|
||||||
exec(code, glo, loc)
|
exec(code, glo, loc)
|
||||||
|
|
||||||
Module.update(modules)
|
Module.update(modules)
|
||||||
|
|
||||||
|
|||||||
@@ -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",
|
||||||
Reference in New Issue
Block a user