Skip to content

Commit 172e024

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 172e024

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-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/products/library_generators.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
if VERSION >= v"1.6.0-DEV"
2+
using Base.BinaryPlatforms
3+
end
4+
15
macro declare_library_product(product_name, product_soname)
26
handle_name = Symbol(string(product_name, "_handle"))
37
get_path_name = Symbol(string("get_", product_name, "_path"))
48
path_name = Symbol(string(product_name, "_path"))
5-
@static if VERSION < v"1.6.0-DEV"
9+
@static if VERSION < v"1.6.0-DEV" || libc(HostPlatform()) != "musl"
610
lib_declaration = quote
711
# On Julia 1.5-, this must be `const` and must be the SONAME
812
const $(product_name) = $(product_soname)
913
end
1014
else
1115
lib_declaration = quote
1216
# On Julia 1.6+, this doesn't have to be `const`! Thanks Jeff!
17+
# But this is needed only for Musl-based platforms.
1318
$(product_name) = ""
1419
end
1520
end
@@ -28,11 +33,12 @@ macro declare_library_product(product_name, product_soname)
2833
end
2934

3035
function init_new_library_product(product_name)
31-
@static if VERSION < v"1.6.0-DEV"
36+
@static if VERSION < v"1.6.0-DEV" || libc(HostPlatform()) != "musl"
3237
return nothing
3338
else
3439
return quote
3540
# Initialize non-const variable export with the path to this product
41+
# for Musl-based platforms.
3642
global $(product_name) = $(Symbol(string(product_name, "_path")))
3743
end
3844
end

0 commit comments

Comments
 (0)