Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ endif
@printf "%s\n" "const PRIVATE_LIBDIR = "$(call shell_escape,$(call julia_escape,$(call normalize_path,$(private_libdir_rel)))) >> $@
@printf "%s\n" "const PRIVATE_LIBEXECDIR = "$(call shell_escape,$(call julia_escape,$(call normalize_path,$(private_libexecdir_rel)))) >> $@
@printf "%s\n" "const INCLUDEDIR = "$(call shell_escape,$(call julia_escape,$(call normalize_path,$(includedir_rel)))) >> $@
@printf "%s\n" "const SOURCEDIR = "$(call shell_escape,$(call julia_escape,$(call normalize_path,$(shell echo $(call cygpath_w,$(JULIAHOME)))))) >> $@
ifeq ($(DARWIN_FRAMEWORK), 1)
@printf "%s\n" "const DARWIN_FRAMEWORK = true" >> $@
@printf "%s\n" "const DARWIN_FRAMEWORK_NAME = \"$(FRAMEWORK_NAME)\"" >> $@
Expand Down
8 changes: 3 additions & 5 deletions base/sysinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export BINDIR,
which,
detectwsl

import ..Base: show
import ..Base: DATAROOTDIR, show

"""
Sys.BINDIR::String
Expand All @@ -56,12 +56,10 @@ global BINDIR::String = ccall(:jl_get_julia_bindir, Any, ())::String

A string containing the full path to the directory containing the `stdlib` packages.
"""
global STDLIB::String = "$BINDIR/../share/julia/stdlib/v$(VERSION.major).$(VERSION.minor)" # for bootstrap
global STDLIB::String = "$BINDIR/$DATAROOTDIR/julia/stdlib/v$(VERSION.major).$(VERSION.minor)" # for bootstrap
# In case STDLIB change after julia is built, the variable below can be used
# to update cached method locations to updated ones.
const BUILD_STDLIB_PATH = STDLIB
# Similarly, this is the root of the julia repo directory that julia was built from
const BUILD_ROOT_PATH = "$BINDIR/../.."

# helper to avoid triggering precompile warnings

Expand Down Expand Up @@ -200,7 +198,7 @@ end
function __init_build()
global BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
vers = "v$(string(VERSION.major)).$(string(VERSION.minor))"
global STDLIB = abspath(BINDIR, "..", "share", "julia", "stdlib", vers)
global STDLIB = abspath(BINDIR, DATAROOTDIR, "julia", "stdlib", vers)
nothing
end

Expand Down
17 changes: 8 additions & 9 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,7 @@ function flatten(data::Vector, lidict::LineInfoDict)
return (newdata, newdict)
end

const SRC_DIR = normpath(joinpath(Sys.BUILD_ROOT_PATH, "src"))
const COMPILER_DIR = "../usr/share/julia/Compiler/"
const SRC_DIR = normpath(Base.SOURCEDIR, "src")

# Take a file-system path and try to form a concise representation of it
# based on the package ecosystem
Expand All @@ -548,17 +547,18 @@ function short_path(spath::Symbol, filenamecache::Dict{Symbol, Tuple{String,Stri
return get!(filenamecache, spath) do
path = Base.fixup_stdlib_path(string(spath))
path_norm = normpath(path)
possible_base_path = normpath(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "base", path))
possible_base_path = normpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "base", path)
lib_dir = abspath(Sys.BINDIR, Base.LIBDIR)
compiler_dir = normpath(Base.DATAROOT, "julia", "Compiler/")
if startswith(path_norm, SRC_DIR)
remainder = only(split(path_norm, SRC_DIR, keepempty=false))
return (isfile(path_norm) ? path_norm : ""), "@juliasrc", remainder
elseif startswith(path_norm, lib_dir)
remainder = only(split(path_norm, lib_dir, keepempty=false))
return (isfile(path_norm) ? path_norm : ""), "@julialib", remainder
elseif contains(path, COMPILER_DIR)
remainder = split(path, COMPILER_DIR, keepempty=false)[end]
possible_compiler_path = normpath(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "Compiler", remainder))
elseif startswith(path_norm, compiler_dir)
remainder = split(path_norm, compiler_dir, keepempty=false)[end]
possible_compiler_path = normpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "Compiler", remainder)
return (isfile(possible_compiler_path) ? possible_compiler_path : ""), "@Compiler", remainder
elseif isabspath(path)
if ispath(path)
Expand Down Expand Up @@ -586,11 +586,10 @@ function short_path(spath::Symbol, filenamecache::Dict{Symbol, Tuple{String,Stri
elseif isfile(possible_base_path)
# do the same mechanic for Base (or Core/Compiler) files as above,
# but they start from a relative path
return possible_base_path, "@Base", normpath(path)
return possible_base_path, "@Base", path_norm
else
# for non-existent relative paths (such as "REPL[1]"), just consider simplifying them
path = normpath(path)
return "", "", path # drop leading "./"
return "", "", path_norm # drop leading "./"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/buildkitetestjson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ end
# to be able to identify the file. Also convert Windows-style paths to Unix-style paths so tests can
# be grouped by file.
const generalize_file_paths_cache = Dict{AbstractString,AbstractString}()
const norm_build_root_path = normpath(Sys.BUILD_ROOT_PATH)
const norm_sourcedir = normpath(Base.SOURCEDIR)
const bindir_dir = dirname(Sys.BINDIR)
const pathsep = Sys.iswindows() ? '\\' : '/'
function generalize_file_paths(path::AbstractString)
return get!(generalize_file_paths_cache, path) do
path = replace(path,
Sys.STDLIB => "stdlib",
string(norm_build_root_path, pathsep) => "",
string(norm_sourcedir, pathsep) => "",
string(bindir_dir, pathsep) => ""
)
@static if Sys.iswindows()
Expand Down