From 36ef34e27dc3d03ffc3a1b9f3f437038e90f247f Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Mon, 21 Nov 2022 09:58:47 -0800 Subject: [PATCH 1/2] Limit libraries to be included in the bundle If `julia_libdir() == "/usr/lib"` then it will attempt to bundle the whole directory into the app. Fixes #16. --- src/PackageCompiler.jl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/PackageCompiler.jl b/src/PackageCompiler.jl index 9d2b1b18..047a2b05 100644 --- a/src/PackageCompiler.jl +++ b/src/PackageCompiler.jl @@ -1026,16 +1026,17 @@ end function bundle_julia_libraries(dest_dir) app_libdir = joinpath(dest_dir, Sys.isunix() ? "lib" : "bin") mkpath(app_libdir) - cp(julia_libdir(), app_libdir; force=true) + for filename in filter(startswith("libjulia"),readdir(julia_libdir())) + # Skip debug symbol libraries + if endswith(filename, "dylib.dSYM") + continue + end + cp(joinpath(julia_libdir(),filename), joinpath(app_libdir, filename); force=true) + end + cp(joinpath(julia_libdir(),"julia"), joinpath(app_libdir, "julia"); force=true) # We do not want to bundle the sysimg default_sysimg_name = "sys." * Libdl.dlext rm(joinpath(app_libdir, "julia", default_sysimg_name); force=true) - # Remove debug symbol libraries - if Sys.isapple() - v = string(VERSION.major, ".", VERSION.minor) - rm(joinpath(app_libdir, "libjulia.$v.dylib.dSYM"); force=true, recursive=true) - rm(joinpath(app_libdir, "julia", "sys.dylib.dSYM"); force=true, recursive=true) - end return end From 59b65280f4eeef49321ba4be438133d63d57c096 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Mon, 21 Nov 2022 10:39:18 -0800 Subject: [PATCH 2/2] old behavior on Windows --- src/PackageCompiler.jl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/PackageCompiler.jl b/src/PackageCompiler.jl index 047a2b05..571a6475 100644 --- a/src/PackageCompiler.jl +++ b/src/PackageCompiler.jl @@ -1026,14 +1026,19 @@ end function bundle_julia_libraries(dest_dir) app_libdir = joinpath(dest_dir, Sys.isunix() ? "lib" : "bin") mkpath(app_libdir) - for filename in filter(startswith("libjulia"),readdir(julia_libdir())) - # Skip debug symbol libraries - if endswith(filename, "dylib.dSYM") - continue + if Sys.isunix() + # only copy select files in case julia_libdir() == "/usr/lib" + for filename in filter(startswith("libjulia"),readdir(julia_libdir())) + # Skip debug symbol libraries + if endswith(filename, "dylib.dSYM") + continue + end + cp(joinpath(julia_libdir(),filename), joinpath(app_libdir, filename); force=true) end - cp(joinpath(julia_libdir(),filename), joinpath(app_libdir, filename); force=true) + cp(joinpath(julia_libdir(),"julia"), joinpath(app_libdir, "julia"); force=true) + else + cp(julia_libdir(), app_libdir; force=true) end - cp(joinpath(julia_libdir(),"julia"), joinpath(app_libdir, "julia"); force=true) # We do not want to bundle the sysimg default_sysimg_name = "sys." * Libdl.dlext rm(joinpath(app_libdir, "julia", default_sysimg_name); force=true)