@@ -2,6 +2,8 @@ using Clang.Generators
22using Clang. JLLEnvs
33using JLLPrefixes
44import aws_c_common_jll, aws_c_io_jll, aws_c_cal_jll
5+ using LibAwsCommon
6+ using LibAwsCal
57
68cd (@__DIR__ )
79
@@ -27,6 +29,21 @@ function should_skip_target(target)
2729 return target == " i686-w64-mingw32"
2830end
2931
32+ const deps_jlls = [aws_c_common_jll, aws_c_cal_jll]
33+ const deps = [LibAwsCommon, LibAwsCal]
34+ const deps_names = sort (collect (Iterators. flatten (names .(deps))))
35+
36+ # clang can emit code for forward declarations of structs defined in our dependencies. we need to skip those, otherwise
37+ # we'll have duplicate struct definitions.
38+ function skip_nodes_in_dependencies! (dag:: ExprDAG )
39+ replace! (get_nodes (dag)) do node
40+ if insorted (node. id, deps_names)
41+ return ExprNode (node. id, Generators. Skip (), node. cursor, Expr[], node. adj)
42+ end
43+ return node
44+ end
45+ end
46+
3047# download toolchains in parallel
3148Threads. @threads for target in JLLEnvs. JLL_ENV_TRIPLES
3249 if should_skip_target (target)
@@ -44,11 +61,10 @@ for target in JLLEnvs.JLL_ENV_TRIPLES
4461 options[" general" ][" callback_documentation" ] = get_docs
4562
4663 args = get_default_args (target)
47- inc = JLLEnvs. get_pkg_include_dir (aws_c_common_jll, target)
48- push! (args, " -isystem$inc " )
49-
50- inc = JLLEnvs. get_pkg_include_dir (aws_c_cal_jll, target)
51- push! (args, " -isystem$inc " )
64+ for dep in deps_jlls
65+ inc = JLLEnvs. get_pkg_include_dir (dep, target)
66+ push! (args, " -isystem$inc " )
67+ end
5268
5369 header_dirs = []
5470 inc = JLLEnvs. get_pkg_include_dir (aws_c_io_jll, target)
@@ -68,5 +84,7 @@ for target in JLLEnvs.JLL_ENV_TRIPLES
6884 unique! (headers)
6985
7086 ctx = create_context (headers, args, options)
71- build! (ctx)
87+ build! (ctx, BUILDSTAGE_NO_PRINTING)
88+ skip_nodes_in_dependencies! (ctx. dag)
89+ build! (ctx, BUILDSTAGE_PRINTING_ONLY)
7290end
0 commit comments