|
114 | 114 | @test occursin("42", out) |
115 | 115 | end |
116 | 116 | end |
| 117 | + |
| 118 | + # https://github.com/JuliaLang/JuliaC.jl/pull/74 |
| 119 | + @testset "Library has SONAME (Linux)" begin |
| 120 | + if Sys.islinux() |
| 121 | + outdir = mktempdir() |
| 122 | + libname = "libhassonametest" |
| 123 | + libout = joinpath(outdir, libname) |
| 124 | + link = JuliaC.LinkRecipe(image_recipe=img_lib, outname=libout) |
| 125 | + JuliaC.link_products(link) |
| 126 | + bun = JuliaC.BundleRecipe(link_recipe=link, output_dir=outdir) |
| 127 | + JuliaC.bundle_products(bun) |
| 128 | + |
| 129 | + soname = libname * "." * Base.BinaryPlatforms.platform_dlext() |
| 130 | + libpath = joinpath(outdir, "lib", soname) |
| 131 | + actual_soname = readchomp(`$(Patchelf_jll.patchelf()) --print-soname $(libpath)`) |
| 132 | + @test actual_soname == soname |
| 133 | + end |
| 134 | + end |
| 135 | + |
| 136 | + # https://github.com/JuliaLang/JuliaC.jl/pull/74 |
| 137 | + @testset "Library has install_name (MacOS)" begin |
| 138 | + if Sys.isapple() |
| 139 | + outdir = mktempdir() |
| 140 | + libname = "libhasinstallnametest" |
| 141 | + libout = joinpath(outdir, libname) |
| 142 | + link = JuliaC.LinkRecipe(image_recipe=img_lib, outname=libout) |
| 143 | + JuliaC.link_products(link) |
| 144 | + bun = JuliaC.BundleRecipe(link_recipe=link, output_dir=outdir) |
| 145 | + JuliaC.bundle_products(bun) |
| 146 | + |
| 147 | + dylibname = libname * "." * Base.BinaryPlatforms.platform_dlext() |
| 148 | + libpath = joinpath(outdir, "lib", dylibname) |
| 149 | + # otool -D prints filename on first line, install_name on second |
| 150 | + install_name = split(readchomp(`otool -D $(libpath)`), '\n')[end] |
| 151 | + @test install_name == "@rpath/$(dylibname)" |
| 152 | + end |
| 153 | + end |
| 154 | + |
| 155 | + # https://github.com/JuliaLang/JuliaC.jl/pull/74 |
| 156 | + @testset "Library has import library (Windows)" begin |
| 157 | + if Sys.iswindows() |
| 158 | + outdir = mktempdir() |
| 159 | + libname = "libhasimplibtest" |
| 160 | + libout = joinpath(outdir, libname) |
| 161 | + link = JuliaC.LinkRecipe(image_recipe=img_lib, outname=libout) |
| 162 | + JuliaC.link_products(link) |
| 163 | + bun = JuliaC.BundleRecipe(link_recipe=link, output_dir=outdir) |
| 164 | + JuliaC.bundle_products(bun) |
| 165 | + |
| 166 | + implibpath = joinpath(outdir, libname * ".dll.a") |
| 167 | + @test isfile(implibpath) |
| 168 | + end |
| 169 | + end |
117 | 170 | end |
118 | 171 |
|
119 | 172 | @testset "Programmatic binary (trim)" begin |
|
0 commit comments