Skip to content

Commit 7f4c2d3

Browse files
author
KDr2
committed
filter libraries according to Julia version
1 parent d7faf2b commit 7f4c2d3

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

deps/build.jl

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,33 @@ function find_prev_tag(tag)
77
return get(tags, idx - 1, "NO-PREV-TAG")
88
end
99

10+
# modify build-tmp.jl to only check correct version libs
11+
function install_products_filter(build_file)
12+
prod_filter = raw"""products = filter(products) do prod
13+
endswith(prod.libnames[1], "$(VERSION.major)_$(VERSION.minor)")
14+
end
15+
"""
16+
lines = open(build_file) do io
17+
read(io, String) |> x -> split(x, "\n")
18+
end
19+
prod_in, prod_out, filter_written = false, false, false
20+
open(build_file, "w") do io
21+
for line in lines
22+
if occursin("products = [", line)
23+
prod_in = true
24+
end
25+
if prod_in && line == "]"
26+
prod_out = true
27+
end
28+
write(io, line * "\n")
29+
if prod_out && !filter_written
30+
write(io, prod_filter * "\n")
31+
filter_written = true
32+
end
33+
end
34+
end
35+
end
36+
1037
function include_build_script(version_str, try_prev=false)
1138
build_script_url = "https://github.com/TuringLang/Libtask.jl/releases/download/v$(version_str)/build_LibtaskDylib.v$(version_str).jl"
1239
build_script = joinpath(@__DIR__, "tmp-build.jl")
@@ -15,6 +42,7 @@ function include_build_script(version_str, try_prev=false)
1542
version_str = find_prev_tag("v$version_str") |> strip |> (x) -> lstrip(x, ['v'])
1643
return include_build_script(version_str, false)
1744
end
45+
install_products_filter(build_script)
1846
include(build_script)
1947
end
2048

@@ -30,20 +58,5 @@ function get_version_str()
3058
end
3159
end
3260

33-
function remove_dlopen()
34-
lines = open(joinpath(@__DIR__, "deps.jl")) do io
35-
read(io, String) |> x -> split(x, "\n")
36-
end
37-
open(joinpath(@__DIR__, "deps.jl"), "w") do io
38-
for line in lines
39-
if occursin("if Libdl.dlopen_e(", line)
40-
line = "if false"
41-
end
42-
write(io, line * "\n")
43-
end
44-
end
45-
end
46-
4761
version_str = get_version_str() |> strip |> (x) -> lstrip(x, ['v'])
4862
include_build_script(version_str, true)
49-
remove_dlopen()

deps/build_tarballs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ dependencies = [
5050
]
5151

5252
# Build the tarballs, and possibly a `build.jl` as well.
53+
# build_file = "products/build_$(name).v$(version_str).jl"
5354
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)

0 commit comments

Comments
 (0)