Skip to content

Commit 94fdba2

Browse files
authored
Fix windows library filename (#655)
* Fix library name on Windows * The name was accidentally changed to sys.dll in a previous refactor * Also rename `get_sysimg_file` -> `get_library_filename`. It used to be used to get the sysimg filename for `create_app` and `create_lib`, but now it's only used by `create_lib`. * Remove extra whitespace
1 parent 22576ee commit 94fdba2

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/PackageCompiler.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ end
3838

3939
function bitflag()
4040
Sys.ARCH === :i686 ? `-m32` :
41-
Sys.ARCH === :x86_64 ? `-m64` :
41+
Sys.ARCH === :x86_64 ? `-m64` :
4242
``
4343
end
4444

@@ -151,8 +151,8 @@ function run_compiler(cmd::Cmd; cplusplus::Bool=false)
151151
break
152152
end
153153
end
154-
end
155-
found_compiler || error("could not find a compiler, looked for ",
154+
end
155+
found_compiler || error("could not find a compiler, looked for ",
156156
join(((cplusplus ? compilers_cpp : ())..., compilers_c...), ", ", " and "))
157157
end
158158
if path !== nothing
@@ -187,7 +187,7 @@ function create_fresh_base_sysimage(stdlibs::Vector{String}; cpu_target::String)
187187
tmp_sys_ji = joinpath(tmp, "sys.ji")
188188
compiler_source_path = joinpath(base_dir, "compiler", "compiler.jl")
189189

190-
spinner = TerminalSpinners.Spinner(msg = "PackageCompiler: compiling base system image (incremental=false)")
190+
spinner = TerminalSpinners.Spinner(msg = "PackageCompiler: compiling base system image (incremental=false)")
191191
TerminalSpinners.@spin spinner begin
192192
cd(base_dir) do
193193
# Create corecompiler.ji
@@ -348,11 +348,11 @@ function create_sysimg_object_file(object_file::String,
348348
outputo_file = tempname()
349349
write(outputo_file, julia_code)
350350
# Read the input via stdin to avoid hitting the maximum command line limit
351-
351+
352352
cmd = `$(get_julia_cmd()) --cpu-target=$cpu_target -O3 $sysimage_build_args
353353
--sysimage=$base_sysimage --project=$project --output-o=$(object_file) $outputo_file`
354354
@debug "running $cmd"
355-
spinner = TerminalSpinners.Spinner(msg = "PackageCompiler: compiling incremental system image")
355+
spinner = TerminalSpinners.Spinner(msg = "PackageCompiler: compiling incremental system image")
356356
TerminalSpinners.@spin spinner run(cmd)
357357
return
358358
end
@@ -453,7 +453,7 @@ function create_sysimage(packages::Union{Nothing, Symbol, Vector{String}, Vector
453453
if base_sysimage !== nothing
454454
error("cannot specify `base_sysimage` when `incremental=false`")
455455
end
456-
sysimage_stdlibs = filter_stdlibs ? gather_stdlibs_project(ctx) : stdlibs_in_sysimage()
456+
sysimage_stdlibs = filter_stdlibs ? gather_stdlibs_project(ctx) : stdlibs_in_sysimage()
457457
base_sysimage = create_fresh_base_sysimage(sysimage_stdlibs; cpu_target)
458458
else
459459
base_sysimage = something(base_sysimage, unsafe_string(Base.JLOptions().image_file))
@@ -503,7 +503,7 @@ function create_sysimage(packages::Union{Nothing, Symbol, Vector{String}, Vector
503503

504504
# Create the sysimage
505505
object_file = tempname() * ".o"
506-
506+
507507
create_sysimg_object_file(object_file, packages, packages_sysimg;
508508
project,
509509
base_sysimage,
@@ -541,7 +541,7 @@ function create_sysimg_from_object_file(object_files::Vector{String},
541541
version,
542542
compat_level::String,
543543
soname::Union{Nothing, String})
544-
544+
545545
if soname === nothing && (Sys.isunix() && !Sys.isapple())
546546
soname = basename(sysimage_path)
547547
end
@@ -860,7 +860,7 @@ function create_library(package_dir::String,
860860
sysimage_build_args::Cmd=``,
861861
include_transitive_dependencies::Bool=true)
862862

863-
863+
864864
warn_official()
865865

866866
julia_init_h_file = String(DEFAULT_JULIA_INIT_HEADER)
@@ -886,9 +886,9 @@ function create_library(package_dir::String,
886886

887887
lib_dir = Sys.iswindows() ? joinpath(dest_dir, "bin") : joinpath(dest_dir, "lib")
888888

889-
sysimg_file = get_sysimg_file(lib_name; version)
889+
sysimg_file = get_library_filename(lib_name; version)
890890
sysimg_path = joinpath(lib_dir, sysimg_file)
891-
compat_file = get_sysimg_file(lib_name; version, compat_level)
891+
compat_file = get_library_filename(lib_name; version, compat_level)
892892
soname = (Sys.isunix() && !Sys.isapple()) ? compat_file : nothing
893893

894894
create_sysimage_workaround(ctx, sysimg_path, precompile_execution_file,
@@ -898,7 +898,7 @@ function create_library(package_dir::String,
898898

899899
if version !== nothing && Sys.isunix()
900900
cd(dirname(sysimg_path)) do
901-
base_file = get_sysimg_file(lib_name)
901+
base_file = get_library_filename(lib_name)
902902
@debug "creating symlinks for $compat_file and $base_file"
903903
symlink(sysimg_file, compat_file)
904904
symlink(sysimg_file, base_file)
@@ -915,12 +915,12 @@ function get_compat_version_str(version::VersionNumber, level::String)
915915
error("Unknown level: $level")
916916
end
917917

918-
function get_sysimg_file(name::String;
919-
version::Union{VersionNumber, Nothing}=nothing,
920-
compat_level::String="patch")
918+
function get_library_filename(name::String;
919+
version::Union{VersionNumber, Nothing}=nothing,
920+
compat_level::String="patch")
921921

922922
dlext = Libdl.dlext
923-
Sys.iswindows() && return "sys.$dlext"
923+
Sys.iswindows() && return "$name.$dlext"
924924

925925
# For libraries on Unix/Apple, make sure the name starts with "lib"
926926
if !startswith(name, "lib")
@@ -930,7 +930,7 @@ function get_sysimg_file(name::String;
930930
version === nothing && return "$name.$dlext"
931931

932932
version = get_compat_version_str(version, compat_level)
933-
933+
934934
sysimg_file = (
935935
Sys.isapple() ? "$name.$version.$dlext" : # libname.1.2.3.dylib
936936
Sys.isunix() ? "$name.$dlext.$version" : # libname.so.1.2.3

0 commit comments

Comments
 (0)