2022-05-09 01:21:54 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
|
2022-07-01 06:41:44 -07:00
|
|
|
from upstream_utils import (
|
2022-08-20 07:26:34 -07:00
|
|
|
get_repo_root,
|
|
|
|
|
clone_repo,
|
2022-07-01 06:41:44 -07:00
|
|
|
comment_out_invalid_includes,
|
|
|
|
|
walk_cwd_and_copy_if,
|
2022-08-20 07:26:34 -07:00
|
|
|
git_am,
|
2022-07-01 06:41:44 -07:00
|
|
|
)
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2023-07-14 18:55:32 -07:00
|
|
|
upstream_root = clone_repo("https://github.com/libuv/libuv", "v1.46.0")
|
2022-08-20 07:26:34 -07:00
|
|
|
wpilib_root = get_repo_root()
|
|
|
|
|
wpinet = os.path.join(wpilib_root, "wpinet")
|
2022-05-09 01:21:54 -04:00
|
|
|
|
2022-08-20 07:26:34 -07:00
|
|
|
# Apply patches to upstream Git repo
|
|
|
|
|
os.chdir(upstream_root)
|
|
|
|
|
for f in [
|
2023-07-14 18:55:32 -07:00
|
|
|
"0001-Revert-win-process-write-minidumps-when-sending-SIGQ.patch",
|
|
|
|
|
"0002-Fix-missing-casts.patch",
|
|
|
|
|
"0003-Fix-warnings.patch",
|
|
|
|
|
"0004-Preprocessor-cleanup.patch",
|
|
|
|
|
"0005-Cleanup-problematic-language.patch",
|
2022-08-20 07:26:34 -07:00
|
|
|
"0006-Style-comments-cleanup.patch",
|
2023-07-14 18:55:32 -07:00
|
|
|
"0007-Fix-Win32-warning-suppression-pragma.patch",
|
|
|
|
|
"0008-Use-C-atomics.patch",
|
|
|
|
|
"0009-Remove-static-from-array-indices.patch",
|
|
|
|
|
"0010-Remove-uv_clock_gettime-and-add-pragmas-for-missing-.patch",
|
2022-08-20 07:26:34 -07:00
|
|
|
]:
|
|
|
|
|
git_am(os.path.join(wpilib_root, "upstream_utils/libuv_patches", f))
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
# Delete old install
|
|
|
|
|
for d in ["src/main/native/thirdparty/libuv"]:
|
|
|
|
|
shutil.rmtree(os.path.join(wpinet, d), ignore_errors=True)
|
|
|
|
|
|
|
|
|
|
include_ignorelist = [
|
|
|
|
|
"aix.h",
|
|
|
|
|
"os390.h",
|
|
|
|
|
"stdint-msvc2008.h",
|
|
|
|
|
"sunos.h",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
include_files = walk_cwd_and_copy_if(
|
2023-08-28 15:07:13 -07:00
|
|
|
lambda dp, f: dp.startswith("./include") and f not in include_ignorelist,
|
2022-07-01 06:41:44 -07:00
|
|
|
os.path.join(wpinet, "src/main/native/thirdparty/libuv"),
|
|
|
|
|
)
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
src_ignorelist = [
|
|
|
|
|
"aix-common.c",
|
|
|
|
|
"aix.c",
|
|
|
|
|
"bsd-proctitle.c",
|
2022-05-18 20:40:27 -07:00
|
|
|
"darwin-stub.c",
|
2022-05-09 01:21:54 -04:00
|
|
|
"haiku.c",
|
2022-05-18 20:40:27 -07:00
|
|
|
"hurd.c",
|
|
|
|
|
"os390-proctitle.c",
|
2022-05-09 01:21:54 -04:00
|
|
|
"os390-syscalls.c",
|
|
|
|
|
"os390-syscalls.h",
|
|
|
|
|
"os390.c",
|
2022-05-18 20:40:27 -07:00
|
|
|
"qnx.c",
|
2022-05-09 01:21:54 -04:00
|
|
|
"sunos.c",
|
2022-05-18 20:40:27 -07:00
|
|
|
"sysinfo-loadavg.c",
|
2022-05-09 01:21:54 -04:00
|
|
|
"sysinfo-memory.c",
|
|
|
|
|
]
|
|
|
|
|
src_files = walk_cwd_and_copy_if(
|
2023-08-28 15:07:13 -07:00
|
|
|
lambda dp, f: dp.startswith("./src") and f not in src_ignorelist,
|
2022-07-01 06:41:44 -07:00
|
|
|
os.path.join(wpinet, "src/main/native/thirdparty/libuv"),
|
|
|
|
|
)
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|