Skip to content

Commit 415f381

Browse files
committed
Use non-const libraries only on Musl systems with Julia v1.6
The non-`const` library variable generates worse code because of the presence of a trampoline, but the non-`const` is really needed only for Musl-based systems.
1 parent dd045e0 commit 415f381

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
version: ${{ matrix.julia-version }}
3939
arch: ${{ matrix.julia-arch }}
4040
- name: Cache artifacts
41-
uses: actions/cache@v1
41+
uses: actions/cache@v2
4242
env:
4343
cache-name: cache-artifacts
4444
with:

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JLLWrappers"
22
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
33
authors = ["Mosè Giordano", "Elliot Saba"]
4-
version = "1.3.0"
4+
version = "1.4.0"
55

66
[deps]
77
Preferences = "21216c6a-2e73-6563-6e65-726566657250"

src/JLLWrappers.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ end
66

77
if VERSION >= v"1.6.0-DEV"
88
using Preferences
9+
using Base.BinaryPlatforms
910
end
1011

1112
# We need to glue expressions together a lot

src/products/library_generators.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ macro declare_library_product(product_name, product_soname)
22
handle_name = Symbol(string(product_name, "_handle"))
33
get_path_name = Symbol(string("get_", product_name, "_path"))
44
path_name = Symbol(string(product_name, "_path"))
5-
@static if VERSION < v"1.6.0-DEV"
5+
@static if VERSION < v"1.6.0-DEV" || libc(HostPlatform()) != "musl"
66
lib_declaration = quote
77
# On Julia 1.5-, this must be `const` and must be the SONAME
88
const $(product_name) = $(product_soname)
99
end
1010
else
1111
lib_declaration = quote
1212
# On Julia 1.6+, this doesn't have to be `const`! Thanks Jeff!
13+
# But this is needed only for Musl-based platforms.
1314
$(product_name) = ""
1415
end
1516
end
@@ -28,11 +29,12 @@ macro declare_library_product(product_name, product_soname)
2829
end
2930

3031
function init_new_library_product(product_name)
31-
@static if VERSION < v"1.6.0-DEV"
32+
@static if VERSION < v"1.6.0-DEV" || libc(HostPlatform()) != "musl"
3233
return nothing
3334
else
3435
return quote
3536
# Initialize non-const variable export with the path to this product
37+
# for Musl-based platforms.
3638
global $(product_name) = $(Symbol(string(product_name, "_path")))
3739
end
3840
end

0 commit comments

Comments
 (0)