Skip to content

Commit 2ed0c74

Browse files
committed
Optimize for backedges
1 parent c3a82f7 commit 2ed0c74

File tree

1 file changed

+35
-47
lines changed

1 file changed

+35
-47
lines changed

src/AutoBuild.jl

Lines changed: 35 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,15 +1140,15 @@ function build_jll_package(src_name::String,
11401140
11411141
global PATH_list, LIBPATH_list
11421142
""")
1143-
if !isempty(dependencies)
1144-
print(io, """
1145-
# Initialize PATH and LIBPATH environment variable listings.
1146-
# From the list of our dependencies, generate a tuple of all the PATH and LIBPATH lists,
1147-
# then append them to our own.
1148-
foreach(p -> append!(PATH_list, p), ($(join(["$(getname(dep)).PATH_list" for dep in dependencies], ", ")),))
1149-
foreach(p -> append!(LIBPATH_list, p), ($(join(["$(getname(dep)).LIBPATH_list" for dep in dependencies], ", ")),))
1150-
""")
1151-
end
1143+
# if !isempty(dependencies)
1144+
# print(io, """
1145+
# # Initialize PATH and LIBPATH environment variable listings.
1146+
# # From the list of our dependencies, generate a tuple of all the PATH and LIBPATH lists,
1147+
# # then append them to our own.
1148+
# foreach(p -> append!(PATH_list, p), ($(join(["$(getname(dep)).PATH_list" for dep in dependencies], ", ")),))
1149+
# foreach(p -> append!(LIBPATH_list, p), ($(join(["$(getname(dep)).LIBPATH_list" for dep in dependencies], ", ")),))
1150+
# """)
1151+
# end
11521152
#println(io, " initialize_path_list!(PATH_list, $(repr(tuple(["$(getname(dep)).PATH_list" for dep in dependencies]))))")
11531153
#println(io, " initialize_path_list!(LIBPATH_list, $(repr(tuple(["$(getname(dep)).LIBPATH_list" for dep in dependencies]))))")
11541154

@@ -1287,59 +1287,47 @@ function build_jll_package(src_name::String,
12871287
const PATH_list = String[]
12881288
const LIBPATH_list = String[]
12891289
1290-
# We determine, here, at compile-time, whether our JLL package has been dev'ed and overridden
1291-
override_dir = joinpath(dirname(@__DIR__), "override")
1292-
if isdir(override_dir)
1293-
function find_artifact_dir()
1294-
return override_dir
1295-
end
1296-
else
1297-
function find_artifact_dir()
1290+
function find_artifact_dir()
1291+
# We determine at compile-time whether our JLL package has been dev'ed and overridden
1292+
@static if isdir(joinpath(dirname(@__DIR__), "override"))
1293+
return joinpath(dirname(@__DIR__), "override")
1294+
else
12981295
return artifact"$(src_name)"
12991296
end
1297+
end
13001298
1301-
\"\"\"
1302-
dev_jll()
1303-
1304-
Check this package out to the dev package directory (usually ~/.julia/dev),
1305-
copying the artifact over to a local `override` directory, allowing package
1306-
developers to experiment with a locally-built binary.
1307-
\"\"\"
1308-
function dev_jll()
1309-
# We do this in an external process to avoid having to load `Pkg`.
1310-
run(`\$(Base.julia_cmd()) $(joinpath(@__DIR__, "dev.jl"))`)
1311-
end
1299+
\"\"\"
1300+
dev_jll()
1301+
1302+
Check this package out to the dev package directory (usually ~/.julia/dev),
1303+
copying the artifact over to a local `override` directory, allowing package
1304+
developers to experiment with a locally-built binary.
1305+
\"\"\"
1306+
function dev_jll()
1307+
# We do this in an external process to avoid having to load `Pkg`.
1308+
run(`\$(Base.julia_cmd()) \$(joinpath(@__DIR__, "dev.jl"))`)
13121309
end
13131310
"""
13141311
if Set(platforms) == Set([AnyPlatform()])
13151312
# We know directly the wrapper we want to include
13161313
jll_jl *= """
1317-
include(joinpath(@__DIR__, "wrappers", "any.jl"))
1314+
Core.include(@__MODULE__, joinpath(@__DIR__, "wrappers", "any.jl"))
13181315
"""
13191316
else
13201317
jll_jl *= """
1321-
# Load Artifacts.toml file
1322-
artifacts_toml = joinpath(@__DIR__, "..", "Artifacts.toml")
1323-
1324-
# Extract all platforms
1325-
artifacts = get_artifacts(artifacts_toml, $(repr(jll_uuid("$(src_name)_jll"))))
1326-
platforms = get_platforms($(repr(src_name)), artifacts_toml, artifacts)
1327-
1328-
# Filter platforms based on what wrappers we've generated on-disk
1329-
cleanup_platforms!(@__DIR__, platforms)
1330-
1331-
# From the available options, choose the best platform
1332-
best_platform = select_best_platform(platforms)
1318+
# Load Artifacts.toml file and choose best wrapper
1319+
best_wrapper = select_best_wrapper(
1320+
joinpath(@__DIR__, "..", "Artifacts.toml"),
1321+
$(repr(jll_uuid("$(src_name)_jll"))),
1322+
$(repr(src_name)),
1323+
@__DIR__,
1324+
)
13331325
13341326
# Silently fail if there's no binaries for this platform
1335-
if best_platform === nothing
1327+
if best_wrapper === nothing
13361328
@debug("Unable to load $(src_name); unsupported platform \$(triplet(platform_key_abi()))")
13371329
else
1338-
# Load the appropriate wrapper. Note that on older Julia versions, we still
1339-
# say "arm-linux-gnueabihf" instead of the more correct "armv7l-linux-gnueabihf",
1340-
# so we manually correct for that here:
1341-
best_platform = cleanup_best_platform(best_platform)
1342-
include(joinpath(@__DIR__, "wrappers", "\$(best_platform).jl"))
1330+
Core.include($(src_name)_jll, best_wrapper)
13431331
end
13441332
"""
13451333
end

0 commit comments

Comments
 (0)