Skip to content

Commit

Permalink
Merge pull request #24 from JuliaPackaging/mg/dont-dlopen
Browse files Browse the repository at this point in the history
Allow `dlopen_flags=nothing` to not dlopen libraries
  • Loading branch information
giordano authored Dec 30, 2020
2 parents b1b8118 + 49039c6 commit 4eaa196
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JLLWrappers"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
authors = ["Mosè Giordano", "Elliot Saba"]
version = "1.1.4"
version = "1.2.0"

[compat]
julia = "1.0.0"
Expand Down
7 changes: 5 additions & 2 deletions src/products/library_generators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ macro init_library_product(product_name, product_path, dlopen_flags)
global $(path_name) = joinpath(artifact_dir, $(product_path))
# Manually `dlopen()` this right now so that future invocations
# of `ccall` with its path/SONAME will find this path immediately.
global $(handle_name) = dlopen($(path_name), $(dlopen_flags))
push!(LIBPATH_list, joinpath(artifact_dir, $(dirname(product_path))))
# dlopen_flags === nothing means to not dlopen the library.
if $(dlopen_flags) !== nothing
global $(handle_name) = dlopen($(path_name), $(dlopen_flags))
push!(LIBPATH_list, joinpath(artifact_dir, $(dirname(product_path))))
end
end,
init_new_library_product(product_name),
)
Expand Down
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/aarch64-linux-gnu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/aarch64-linux-musl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/armv7l-linux-gnueabihf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/armv7l-linux-musleabihf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/i686-linux-gnu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/i686-linux-musl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/i686-w64-mingw32.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.dll")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.dll")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"bin/libopenlibm.dll",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"bin/libnonexisting.dll",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/powerpc64le-linux-gnu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/x86_64-apple-darwin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "@rpath/libopenlibm.3.dylib")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.0.dylib")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.3.0.dylib",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.0.0.dylib",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/x86_64-linux-gnu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/x86_64-linux-musl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/x86_64-unknown-freebsd11.1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.so.3")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.so.0")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"lib/libopenlibm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"lib/libnonexisting.so",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
6 changes: 6 additions & 0 deletions test/OpenLibm_jll/src/wrappers/x86_64-w64-mingw32.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ export libopenlibm

JLLWrappers.@generate_wrapper_header("OpenLibm")
JLLWrappers.@declare_library_product(libopenlibm, "libopenlibm.dll")
JLLWrappers.@declare_library_product(libnonexisting, "libnonexisting.dll")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libopenlibm,
"bin/libopenlibm.dll",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnonexisting,
"bin/libnonexisting.dll",
nothing,
)

JLLWrappers.@generate_init_footer()
end # __init__()
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module TestJLL end
@test isdir(@eval TestJLL OpenLibm_jll.artifact_dir)
@test isempty(@eval TestJLL OpenLibm_jll.PATH[])
@test occursin(Sys.BINDIR, @eval TestJLL OpenLibm_jll.LIBPATH[])
@test C_NULL == @eval TestJLL OpenLibm_jll.libnonexisting_handle

# Issue #20
if Sys.iswindows()
Expand Down

2 comments on commit 4eaa196

@giordano
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/27544

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.0 -m "<description of version>" 4eaa19641aa8a36915c2c5f11337ebf324981397
git push origin v1.2.0

Please sign in to comment.