Skip to content

Commit 606ece4

Browse files
committed
Update config.guess and config.sub
1 parent f8ee405 commit 606ece4

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

scripts/build-codecs.py

+23-6
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,35 @@
1919
shutil.rmtree(d)
2020

2121

22+
def fetch(url, path):
23+
run(["curl", "-L", "-o", path, url])
24+
25+
2226
def mangle_path(path):
2327
if platform.system() == "Windows":
24-
return (
25-
path.replace(os.path.sep, "/").replace("C:", "/c").replace("D:", "/d")
26-
)
28+
return path.replace(os.path.sep, "/").replace("C:", "/c").replace("D:", "/d")
2729
else:
2830
return path
2931

3032

3133
def build(package, configure_args=[]):
32-
path = os.path.join(build_dir, package)
33-
os.chdir(path)
34+
package_path = os.path.join(build_dir, package)
35+
36+
# update config.guess and config.sub
37+
config_files = ("config.guess", "config.sub")
38+
for root, dirs, files in os.walk(package_path):
39+
for name in filter(lambda x: x in config_files, files):
40+
script_path = os.path.join(root, name)
41+
cache_path = os.path.join(source_dir, name)
42+
if not os.path.exists(cache_path):
43+
fetch(
44+
"https://git.savannah.gnu.org/cgit/config.git/plain/" + name,
45+
cache_path,
46+
)
47+
shutil.copy(cache_path, script_path)
48+
os.chmod(script_path, 0o755)
49+
50+
os.chdir(package_path)
3451
run(["sh", "./configure"] + configure_args + ["--prefix=" + mangle_path(dest_dir)])
3552
run(["make"])
3653
run(["make", "install"])
@@ -72,7 +89,7 @@ def extract(package, url, *, strip_components=1):
7289

7390
# download tarball
7491
if not os.path.exists(tarball):
75-
run(["curl", "-L", "-o", tarball, url])
92+
fetch(url, tarball)
7693

7794
# extract tarball
7895
os.mkdir(path)

0 commit comments

Comments
 (0)