diff --git a/Makefile b/Makefile index 3b1c6f0d0bc7b..d96497ca94d2e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ default: $(JULIA_BUILD_MODE) # contains either "debug" or "release" all: debug release # sort is used to remove potential duplicates -DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_private_libdir) $(build_libexecdir) $(build_includedir) $(build_includedir)/julia $(build_sysconfdir)/julia $(build_datarootdir)/julia $(build_datarootdir)/julia/src $(build_datarootdir)/julia/stdlib $(build_man1dir)) +DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_private_libdir) $(build_libexecdir) $(build_includedir) $(build_includedir)/julia $(build_sysconfdir)/julia $(build_datarootdir)/julia $(build_datarootdir)/julia/stdlib $(build_man1dir)) ifneq ($(BUILDROOT),$(JULIAHOME)) BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src src/flisp src/support src/clangsa cli doc deps stdlib test test/clangsa test/embedding test/llvmpasses) BUILDDIRMAKE := $(addsuffix /Makefile,$(BUILDDIRS)) $(BUILDROOT)/sysimage.mk @@ -39,13 +39,13 @@ configure: endif $(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir)))) -$(eval $(call symlink_target,$(JULIAHOME)/test,$$(build_datarootdir)/julia,test)) +$(foreach link,base $(JULIAHOME)/test,$(eval $(call symlink_target,$(link),$$(build_datarootdir)/julia,$(notdir $(link))))) julia_flisp.boot.inc.phony: julia-deps @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src julia_flisp.boot.inc.phony # Build the HTML docs (skipped if already exists, notably in tarballs) -$(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUILDROOT)/doc \( -path $(BUILDROOT)/doc/_build -o -path $(BUILDROOT)/doc/deps \) -prune -o -type f -print) +$(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUILDROOT)/doc \( -path $(BUILDROOT)/doc/_build -o -path $(BUILDROOT)/doc/deps -o -name *_constants.jl -o -name *_h.jl -o -name version_git.jl \) -prune -o -type f -print) @$(MAKE) docs julia-symlink: julia-cli-$(JULIA_BUILD_MODE) @@ -58,7 +58,7 @@ ifndef JULIA_VAGRANT_BUILD endif endif -julia-deps: | $(DIRS) $(build_datarootdir)/julia/test +julia-deps: | $(DIRS) $(build_datarootdir)/julia/base $(build_datarootdir)/julia/test @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/deps # `julia-stdlib` depends on `julia-deps` so that the fake JLL stdlibs can copy in their Artifacts.toml files. @@ -86,14 +86,9 @@ julia-sysimg-ji : julia-stdlib julia-base julia-cli-$(JULIA_BUILD_MODE) julia-sr julia-sysimg-bc : julia-stdlib julia-base julia-cli-$(JULIA_BUILD_MODE) julia-src-$(JULIA_BUILD_MODE) | $(build_private_libdir) @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-bc JULIA_EXECUTABLE='$(JULIA_EXECUTABLE)' -$(JULIA_SYSIMG_release): julia-sysimg-ji julia-src-release - @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-release -$(JULIA_SYSIMG_debug) : julia-sysimg-ji julia-src-debug - @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-debug +julia-sysimg-release julia-sysimg-debug : julia-sysimg-% : julia-sysimg-ji julia-src-% + @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-$* -julia-sysimg-release : $(JULIA_SYSIMG_release) -julia-sysimg-debug : $(JULIA_SYSIMG_debug) -julia-base-cache: $(build_datarootdir)/julia/base.cache julia-debug julia-release : julia-% : julia-sysimg-% julia-src-% julia-symlink julia-libccalltest julia-libllvmcalltest julia-base-cache debug release : % : julia-% @@ -163,10 +158,10 @@ $(build_datarootdir)/julia/julia-config.jl: $(JULIAHOME)/contrib/julia-config.jl $(build_depsbindir)/stringreplace: $(JULIAHOME)/contrib/stringreplace.c | $(build_depsbindir) @$(call PRINT_CC, $(HOSTCC) -o $(build_depsbindir)/stringreplace $(JULIAHOME)/contrib/stringreplace.c) -$(build_datarootdir)/julia/base.cache: $(JULIA_SYSIMG) | $(DIRS) $(build_datarootdir)/julia +julia-base-cache: julia-sysimg-$(JULIA_BUILD_MODE) | $(DIRS) $(build_datarootdir)/julia @JULIA_BINDIR=$(call cygpath_w,$(build_bindir)) WINEPATH="$(call cygpath_w,$(build_bindir));$$WINEPATH" \ $(call spawn, $(JULIA_EXECUTABLE) --startup-file=no $(call cygpath_w,$(JULIAHOME)/etc/write_base_cache.jl) \ - $(call cygpath_w,$@)) + $(call cygpath_w,$(build_datarootdir)/julia/base.cache)) # public libraries, that are installed in $(prefix)/lib ifeq ($(JULIA_BUILD_MODE),release) @@ -319,9 +314,10 @@ else ifeq ($(JULIA_BUILD_MODE),debug) endif # Copy in all .jl sources as well - mkdir -p $(DESTDIR)$(datarootdir)/julia/src $(DESTDIR)$(datarootdir)/julia/test - cp -R -L $(build_datarootdir)/julia/* $(DESTDIR)$(datarootdir)/julia + mkdir -p $(DESTDIR)$(datarootdir)/julia/base $(DESTDIR)$(datarootdir)/julia/test + cp -R -L $(JULIAHOME)/base/* $(DESTDIR)$(datarootdir)/julia/base cp -R -L $(JULIAHOME)/test/* $(DESTDIR)$(datarootdir)/julia/test + cp -R -L $(build_datarootdir)/julia/* $(DESTDIR)$(datarootdir)/julia # Copy documentation cp -R -L $(BUILDROOT)/doc/_build/html $(DESTDIR)$(docdir)/ # Remove various files which should not be installed @@ -469,7 +465,7 @@ ifneq ($(BUILDROOT),$(JULIAHOME)) $(error make light-source-dist does not work in out-of-tree builds) endif # Save git information - -@$(MAKE) -C $(JULIAHOME)/base version_git.jl + -@$(MAKE) -C $(JULIAHOME)/base version_git.jl.phony # Create file light-source-dist.tmp to hold all the filenames that go into the tarball echo "base/version_git.jl" > light-source-dist.tmp diff --git a/base/.gitignore b/base/.gitignore index f7460230f217b..e572b8ea229d0 100644 --- a/base/.gitignore +++ b/base/.gitignore @@ -1,4 +1,10 @@ +/features_h.jl +/pcre_h.jl +/errno_h.jl +/build_h.jl /build_h.jl.phony +/file_constants.jl +/uv_constants.jl /version_git.jl /version_git.jl.phony /userimg.jl diff --git a/base/Base.jl b/base/Base.jl index aa29a6d08c943..5c84cd8b063a7 100644 --- a/base/Base.jl +++ b/base/Base.jl @@ -157,8 +157,18 @@ using .Iterators: Flatten, Filter, product # for generators include("namedtuple.jl") # For OS specific stuff -include("../build_h.jl") -include("../version_git.jl") +# We need to strcat things here, before strings are really defined +function strcat(x::String, y::String) + out = ccall(:jl_alloc_string, Ref{String}, (Csize_t,), Core.sizeof(x) + Core.sizeof(y)) + GC.@preserve x y out begin + out_ptr = unsafe_convert(Ptr{UInt8}, out) + unsafe_copyto!(out_ptr, unsafe_convert(Ptr{UInt8}, x), Core.sizeof(x)) + unsafe_copyto!(out_ptr + Core.sizeof(x), unsafe_convert(Ptr{UInt8}, y), Core.sizeof(y)) + end + return out +end +include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl) +include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl) # These used to be in build_h.jl and are retained for backwards compatibility const libblas_name = "libblastrampoline" diff --git a/base/Makefile b/base/Makefile index 1c1901e9499fb..1cc050f57fb4c 100644 --- a/base/Makefile +++ b/base/Makefile @@ -5,22 +5,7 @@ include $(JULIAHOME)/Make.inc TAGGED_RELEASE_BANNER := "" -all: - -BASE_SRCS := $(patsubst ./%,%,$(shell cd $(SRCDIR) && find . -name \*.jl -and -not -name version_git.jl -and -not -name '*.phony')) -GENERATED_SRCS := pcre_h.jl errno_h.jl build_h.jl.phony features_h.jl file_constants.jl uv_constants.jl version_git.jl.phony - -GENERATED_DSTS := $(addprefix $(build_datarootdir)/julia/src/,$(GENERATED_SRCS)) -BASE_DSTS := $(addprefix $(build_datarootdir)/julia/src/base/,$(BASE_SRCS)) $(GENERATED_DSTS) -BASE_DIRS := $(sort $(dir $(BASE_DSTS))) -$(foreach dir,$(BASE_DIRS),$(eval $(call dir_target,$(dir)))) - -# we might like to add "| $(BASE_DIRS)" here, but that causes many version of 'make' to get confused and fail to build consistently -$(build_datarootdir)/julia/src/base/%.jl: $(SRCDIR)/%.jl - @mkdir -p $(dir $@) - cp $< $@ - -all: $(BASE_DSTS) +all: $(addprefix $(BUILDDIR)/,pcre_h.jl errno_h.jl build_h.jl.phony features_h.jl file_constants.jl uv_constants.jl version_git.jl.phony) PCRE_CONST := 0x[0-9a-fA-F]+|[0-9]+|\([\-0-9]+\) ifeq ($(USE_SYSTEM_PCRE), 1) @@ -31,37 +16,29 @@ endif define parse_features @echo "# $(2) features" >> $@ -@$(call PRINT_PERL, cat $(JULIAHOME)/src/features_$(1).h | \ - perl -lne 'print "const JL_$(2)_$$1 = UInt32($$2)" if /^\s*JL_FEATURE_DEF(?:_NAME)?\(\s*(\w+)\s*,\s*([^,]+)\s*,.*\)\s*(?:\/\/.*)?$$/' >> $@) +@$(call PRINT_PERL, cat $(SRCDIR)/../src/features_$(1).h | perl -lne 'print "const JL_$(2)_$$1 = UInt32($$2)" if /^\s*JL_FEATURE_DEF(?:_NAME)?\(\s*(\w+)\s*,\s*([^,]+)\s*,.*\)\s*(?:\/\/.*)?$$/' >> $@) @echo >> $@ endef -$(build_datarootdir)/julia/src/features_h.jl: $(JULIAHOME)/src/features_x86.h $(JULIAHOME)/src/features_aarch32.h $(JULIAHOME)/src/features_aarch64.h - @mkdir -p $(dir $@) +$(BUILDDIR)/features_h.jl: $(SRCDIR)/../src/features_x86.h $(SRCDIR)/../src/features_aarch32.h $(SRCDIR)/../src/features_aarch64.h @-rm -f $@ @$(call parse_features,x86,X86) @$(call parse_features,aarch32,AArch32) @$(call parse_features,aarch64,AArch64) -$(build_datarootdir)/julia/src/pcre_h.jl: $(PCRE_INCL_PATH) - @mkdir -p $(dir $@) +$(BUILDDIR)/pcre_h.jl: $(PCRE_INCL_PATH) @$(call PRINT_PERL, $(CPP) -D PCRE2_CODE_UNIT_WIDTH=8 -dM $< | perl -nle '/^\s*#define\s+PCRE2_(\w*)\s*\(?($(PCRE_CONST))\)?u?\s*$$/ and print index($$1, "ERROR_") == 0 ? "const $$1 = Cint($$2)" : "const $$1 = UInt32($$2)"' | LC_ALL=C sort > $@) -$(build_datarootdir)/julia/src/errno_h.jl: - @mkdir -p $(dir $@) +$(BUILDDIR)/errno_h.jl: @$(call PRINT_PERL, echo '#include ' | $(CPP) -dM - | perl -nle 'print "const $$1 = Int32($$2)" if /^#define\s+(E\w+)\s+(\d+)\s*$$/' | LC_ALL=C sort > $@) -$(build_datarootdir)/julia/src/file_constants.jl: $(JULIAHOME)/src/file_constants.h - @mkdir -p $(dir $@) +$(BUILDDIR)/file_constants.jl: $(SRCDIR)/../src/file_constants.h @$(call PRINT_PERL, $(CPP_STDOUT) -DJULIA $< | perl -nle 'print "$$1 0o$$2" if /^(\s*const\s+[A-z_]+\s+=)\s+(0[0-9]*)\s*$$/; print "$$1" if /^\s*(const\s+[A-z_]+\s+=\s+([1-9]|0x)[0-9A-z]*)\s*$$/' > $@) -$(build_datarootdir)/julia/src/uv_constants.jl: $(JULIAHOME)/src/uv_constants.h $(LIBUV_INC)/uv/errno.h - @mkdir -p $(dir $@) +$(BUILDDIR)/uv_constants.jl: $(SRCDIR)/../src/uv_constants.h $(LIBUV_INC)/uv/errno.h @$(call PRINT_PERL, $(CPP_STDOUT) "-I$(LIBUV_INC)" -DJULIA $< | tail -n 16 > $@) -$(build_datarootdir)/julia/src/build_h.jl.phony: $(BUILDDIR)/build_h.jl.phony $(BUILDDIR)/build_h.jl.phony: - @mkdir -p $(build_datarootdir)/julia/src @echo "# This file is automatically generated in base/Makefile" > $@ ifeq ($(XC_HOST),) @echo "const MACHINE = \"$(BUILD_MACHINE)\"" >> $@ @@ -109,44 +86,35 @@ endif @# This to ensure that we always rebuild this file, but only when it is modified do we touch build_h.jl, @# ensuring we rebuild the system image as infrequently as possible - @if ! cmp -s $@ $(build_datarootdir)/julia/src/build_h.jl; then \ + @if ! cmp -s $@ build_h.jl; then \ $(call PRINT_PERL,) \ - mv $@ $(build_datarootdir)/julia/src/build_h.jl; \ + mv $@ build_h.jl; \ else \ rm -f $@; \ fi -$(build_datarootdir)/julia/src/version_git.jl.phony: $(BUILDDIR)/version_git.jl.phony $(BUILDDIR)/version_git.jl.phony: $(SRCDIR)/version_git.sh - @mkdir -p $(build_datarootdir)/julia/src -ifneq ($(NO_GIT),1) - @sh $< $(SRCDIR) > $@ -else ifeq ($(shell [ -f $(BUILDDIR)/version_git.jl ] && echo "true"), true) - @# Give warning if boilerplate git is found here - @if grep -q "Default output if git is not available" $(BUILDDIR)/version_git.jl; then \ - echo "WARNING: Using boilerplate git version info" >&2; \ - fi - @cp $(BUILDDIR)/version_git.jl $@ -else ifeq ($(shell [ -f $(SRCDIR)/version_git.jl ] && echo "true"), true) - @# Give warning if boilerplate git is found here - @if grep -q "Default output if git is not available" $(SRCDIR)/version_git.jl; then \ - echo "WARNING: Using boilerplate git version info" >&2; \ - fi - @cp $(SRCDIR)/version_git.jl $@ -else - $(warning "WARNING: Generating boilerplate git version info") - @sh $< $(SRCDIR) NO_GIT > $@ -endif +ifneq ($(NO_GIT), 1) + sh $< $(SRCDIR) > $@ @# This to avoid touching version_git.jl when it is not modified, @# so that the system image does not need to be rebuilt. - @if ! cmp -s $@ $(build_datarootdir)/julia/src/version_git.jl; then \ + @if ! cmp -s $@ version_git.jl; then \ $(call PRINT_PERL,) \ - mv $@ $(build_datarootdir)/julia/src/version_git.jl; \ + mv $@ version_git.jl; \ else \ rm -f $@; \ fi -$(BUILDDIR)/version_git.jl: $(SRCDIR)/version_git.sh - sh $< $(SRCDIR) > $@ +else +ifeq ($(shell [ -f $(BUILDDIR)/version_git.jl ] && echo "true"), true) + @# Give warning if boilerplate git is used + @if grep -q "Default output if git is not available" $(BUILDDIR)/version_git.jl; then \ + echo "WARNING: Using boilerplate git version info" >&2; \ + fi +else + $(warning "WARNING: Generating boilerplate git version info") + @sh $(SRCDIR)/version_git.sh $(SRCDIR) NO_GIT > $(BUILDDIR)/version_git.jl +endif +endif ifeq (,$(filter $(OS), WINNT emscripten)) # For any USE_SYSTEM_* libraries that will be dynamically loaded by libjulia, @@ -194,7 +162,7 @@ endif define symlink_system_library libname_$2 := $$(notdir $(call versioned_libname,$2,$3)) libpath_$2 := $$(shell $$(call spawn,$$(LIBWHICH)) -p $$(libname_$2) 2>/dev/null) -symlink_$2: $$(build_private_libdir)/$$(libname_$2) .FORCE +symlink_$2: $$(build_private_libdir)/$$(libname_$2) $$(build_private_libdir)/$$(libname_$2): @if [ -e "$$(libpath_$2)" ]; then \ REALPATH=$$(libpath_$2); \ @@ -300,10 +268,7 @@ endif symlink_system_libraries: $(SYMLINK_SYSTEM_LIBRARIES) -.FORCE: -.PHONY: $(BUILDDIR)/version_git.jl $(BUILDDIR)/version_git.jl.phony $(build_datarootdir)/julia/src/version_git.jl.phony \ - $(BUILDDIR)/build_h.jl.phony $(build_datarootdir)/julia/src/build_h.jl.phony \ - clean all .FORCE +.PHONY: $(BUILDDIR)/build_h.jl.phony $(BUILDDIR)/version_git.jl.phony clean all symlink_* clean: -rm -f $(BUILDDIR)/pcre_h.jl @@ -315,5 +280,4 @@ clean: -rm -f $(BUILDDIR)/file_constants.jl -rm -f $(BUILDDIR)/version_git.jl -rm -f $(BUILDDIR)/version_git.jl.phony - -rm -rf $(build_datarootdir)/julia/src/* -rm -f $(build_private_libdir)/lib*.$(SHLIB_EXT)* diff --git a/base/cpuid.jl b/base/cpuid.jl index 476e4b49fa1dc..48930d8064ba9 100644 --- a/base/cpuid.jl +++ b/base/cpuid.jl @@ -21,7 +21,7 @@ Base.:<=(a::ISA, b::ISA) = a.features <= b.features Base.:<(a::ISA, b::ISA) = a.features < b.features Base.isless(a::ISA, b::ISA) = a < b -include("../features_h.jl") +include(string(length(Core.ARGS) >= 2 ? Core.ARGS[2] : "", "features_h.jl")) # include($BUILDROOT/base/features_h.jl) # Keep in sync with `arch_march_isa_mapping`. const ISAs_by_family = Dict( diff --git a/base/filesystem.jl b/base/filesystem.jl index ee25c63a557e5..63fe4281f6e59 100644 --- a/base/filesystem.jl +++ b/base/filesystem.jl @@ -90,7 +90,7 @@ uv_fs_req_cleanup(req) = ccall(:uv_fs_req_cleanup, Cvoid, (Ptr{Cvoid},), req) include("path.jl") include("stat.jl") include("file.jl") -include("../file_constants.jl") +include(string(length(Core.ARGS) >= 2 ? Core.ARGS[2] : "", "file_constants.jl")) # include($BUILDROOT/base/file_constants.jl) ## Operations with File (fd) objects ## diff --git a/base/initdefs.jl b/base/initdefs.jl index 89fc88b0673a3..1988e56c6eb1d 100644 --- a/base/initdefs.jl +++ b/base/initdefs.jl @@ -93,7 +93,6 @@ function append_default_depot_path!(DEPOT_PATH) path in DEPOT_PATH || push!(DEPOT_PATH, path) path = abspath(Sys.BINDIR, "..", "share", "julia") path in DEPOT_PATH || push!(DEPOT_PATH, path) - return DEPOT_PATH end function init_depot_path() @@ -112,7 +111,6 @@ function init_depot_path() else append_default_depot_path!(DEPOT_PATH) end - nothing end ## LOAD_PATH & ACTIVE_PROJECT ## @@ -222,7 +220,9 @@ function parse_load_path(str::String) end function init_load_path() - if haskey(ENV, "JULIA_LOAD_PATH") + if Base.creating_sysimg + paths = ["@stdlib"] + elseif haskey(ENV, "JULIA_LOAD_PATH") paths = parse_load_path(ENV["JULIA_LOAD_PATH"]) else paths = filter!(env -> env !== nothing, diff --git a/base/libc.jl b/base/libc.jl index a14920ec4f6b8..7d88e89bf605a 100644 --- a/base/libc.jl +++ b/base/libc.jl @@ -14,7 +14,7 @@ if Sys.iswindows() export GetLastError, FormatMessage end -include("../errno_h.jl") +include(string(length(Core.ARGS) >= 2 ? Core.ARGS[2] : "", "errno_h.jl")) # include($BUILDROOT/base/errno_h.jl) ## RawFD ## diff --git a/base/libuv.jl b/base/libuv.jl index ea3d64072378f..64b228c6500e7 100644 --- a/base/libuv.jl +++ b/base/libuv.jl @@ -2,7 +2,7 @@ # Core definitions for interacting with the libuv library from Julia -include("../uv_constants.jl") +include(string(length(Core.ARGS) >= 2 ? Core.ARGS[2] : "", "uv_constants.jl")) # include($BUILDROOT/base/uv_constants.jl) # convert UV handle data to julia object, checking for null function uv_sizeof_handle(handle) diff --git a/base/loading.jl b/base/loading.jl index 79bc66fe456c3..f8100fc0915a2 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -42,7 +42,7 @@ elseif Sys.isapple() # char filename[max_filename_length]; # }; # Buffer buf; - # getattrlist(path, &attr_list, &buf, sizeof(buf), FSOPT_NOFOLLOW); + # getattrpath(path, &attr_list, &buf, sizeof(buf), FSOPT_NOFOLLOW); function isfile_casesensitive(path) isaccessiblefile(path) || return false path_basename = String(basename(path)) @@ -813,7 +813,7 @@ end function find_source_file(path::AbstractString) (isabspath(path) || isfile(path)) && return path - base_path = joinpath(Sys.BINDIR, DATAROOTDIR, "julia", "src", "base", path) + base_path = joinpath(Sys.BINDIR, DATAROOTDIR, "julia", "base", path) return isfile(base_path) ? normpath(base_path) : nothing end diff --git a/base/pcre.jl b/base/pcre.jl index 963b3ee4726a2..d689e9be29113 100644 --- a/base/pcre.jl +++ b/base/pcre.jl @@ -6,7 +6,8 @@ module PCRE import ..RefValue -include("../pcre_h.jl") +# include($BUILDROOT/base/pcre_h.jl) +include(string(length(Core.ARGS) >= 2 ? Core.ARGS[2] : "", "pcre_h.jl")) const PCRE_LIB = "libpcre2-8" diff --git a/base/sysimg.jl b/base/sysimg.jl index 175d26c3fee9b..5a14bf5bfd3b9 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -11,13 +11,14 @@ import Base.MainInclude: eval, include pushfirst!(Base._included_files, (@__MODULE__, joinpath(@__DIR__, "Base.jl"))) pushfirst!(Base._included_files, (@__MODULE__, joinpath(@__DIR__, "sysimg.jl"))) +# set up depot & load paths to be able to find stdlib packages +@eval Base creating_sysimg = true +Base.init_depot_path() +Base.init_load_path() + if Base.is_primary_base_module # load some stdlib packages but don't put their names in Main let - # set up depot & load paths to be able to find stdlib packages - push!(empty!(LOAD_PATH), "@stdlib") - Base.append_default_depot_path!(DEPOT_PATH) - # Stdlibs sorted in dependency, then alphabetical, order by contrib/print_sorted_stdlibs.jl # Run with the `--exclude-jlls` option to filter out all JLL packages stdlibs = [ diff --git a/doc/src/devdocs/build/distributing.md b/doc/src/devdocs/build/distributing.md index 9ae75a8683020..c49f6f071224c 100644 --- a/doc/src/devdocs/build/distributing.md +++ b/doc/src/devdocs/build/distributing.md @@ -18,12 +18,12 @@ GPL licensed. We do hope to have a non-GPL distribution of Julia in the future. Versioning and Git ------------------ The Makefile uses both the `VERSION` file and commit hashes and tags from the -git repository to generate the `version_git.jl` with information we use to +git repository to generate the `base/version_git.jl` with information we use to fill the splash screen and the `versioninfo()` output. If you for some reason don't want to have the git repository available when building you should -pre-generate the `version_git.jl` file with: +pregenerate the `base/version_git.jl` file with: - make -C base version_git.jl + make -C base version_git.jl.phony Julia has lots of build dependencies where we use patched versions that has not yet been included by the popular package managers. These dependencies will usually diff --git a/src/base b/src/base deleted file mode 120000 index 24312d19b81d4..0000000000000 --- a/src/base +++ /dev/null @@ -1 +0,0 @@ -../base \ No newline at end of file diff --git a/stdlib/Profile/src/Profile.jl b/stdlib/Profile/src/Profile.jl index f260be3ae4dfe..705fcb6fa1dc5 100644 --- a/stdlib/Profile/src/Profile.jl +++ b/stdlib/Profile/src/Profile.jl @@ -521,7 +521,7 @@ function short_path(spath::Symbol, filenamecache::Dict{Symbol, String}) end end return path - elseif isfile(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "src", "base", path)) + elseif isfile(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "base", path)) # do the same mechanic for Base (or Core/Compiler) files as above, # but they start from a relative path return joinpath("@Base", normpath(path)) diff --git a/sysimage.mk b/sysimage.mk index 8b7d19926f9da..2d154672d8130 100644 --- a/sysimage.mk +++ b/sysimage.mk @@ -20,51 +20,54 @@ $(build_private_libdir)/%.$(SHLIB_EXT): $(build_private_libdir)/%-o.a @$(INSTALL_NAME_CMD)$(notdir $@) $@ @$(DSYMUTIL) $@ -BASE_DIR := $(build_datarootdir)/julia/src -COMPILER_SRCS := $(addprefix $(BASE_DIR)/base/, \ - boot.jl \ - docs/core.jl \ - abstractarray.jl \ - abstractdict.jl \ - array.jl \ - bitarray.jl \ - bitset.jl \ - bool.jl \ - ctypes.jl \ - error.jl \ - essentials.jl \ - expr.jl \ - generator.jl \ - int.jl \ - indices.jl \ - iterators.jl \ - namedtuple.jl \ - number.jl \ - operators.jl \ - options.jl \ - pair.jl \ - pointer.jl \ - promotion.jl \ - range.jl \ - reflection.jl \ - traits.jl \ - refvalue.jl \ - tuple.jl) -COMPILER_SRCS += $(shell find $(BASE_DIR)/base/compiler -name \*.jl) -BASE_SRCS := $(shell find $(BASE_DIR) -name \*.jl -and -not -name sysimg.jl) -STDLIB_SRCS := $(BASE_DIR)/base/sysimg.jl $(shell find $(build_datarootdir)/julia/stdlib/$(VERSDIR)/*/src -name \*.jl) +COMPILER_SRCS := $(addprefix $(JULIAHOME)/, \ + base/boot.jl \ + base/docs/core.jl \ + base/abstractarray.jl \ + base/abstractdict.jl \ + base/array.jl \ + base/bitarray.jl \ + base/bitset.jl \ + base/bool.jl \ + base/ctypes.jl \ + base/error.jl \ + base/essentials.jl \ + base/expr.jl \ + base/generator.jl \ + base/int.jl \ + base/indices.jl \ + base/iterators.jl \ + base/namedtuple.jl \ + base/number.jl \ + base/operators.jl \ + base/options.jl \ + base/pair.jl \ + base/pointer.jl \ + base/promotion.jl \ + base/range.jl \ + base/reflection.jl \ + base/traits.jl \ + base/refvalue.jl \ + base/tuple.jl) +COMPILER_SRCS += $(shell find $(JULIAHOME)/base/compiler -name \*.jl) +# sort these to remove duplicates +BASE_SRCS := $(sort $(shell find $(JULIAHOME)/base -name \*.jl -and -not -name sysimg.jl) \ + $(shell find $(BUILDROOT)/base -name \*.jl -and -not -name sysimg.jl)) +STDLIB_SRCS := $(JULIAHOME)/base/sysimg.jl $(shell find $(build_datarootdir)/julia/stdlib/$(VERSDIR)/*/src -name \*.jl) \ + $(build_prefix)/manifest/Pkg +RELBUILDROOT := $(call rel_path,$(JULIAHOME)/base,$(BUILDROOT)/base)/ # <-- make sure this always has a trailing slash $(build_private_libdir)/corecompiler.ji: $(COMPILER_SRCS) - @$(call PRINT_JULIA, cd $(BASE_DIR)/base && \ + @$(call PRINT_JULIA, cd $(JULIAHOME)/base && \ $(call spawn,$(JULIA_EXECUTABLE)) -C "$(JULIA_CPU_TARGET)" --output-ji $(call cygpath_w,$@).tmp \ --startup-file=no --warn-overwrite=yes -g$(BOOTSTRAP_DEBUG_LEVEL) -O0 compiler/compiler.jl) @mv $@.tmp $@ $(build_private_libdir)/sys.ji: $(build_private_libdir)/corecompiler.ji $(JULIAHOME)/VERSION $(BASE_SRCS) $(STDLIB_SRCS) - @$(call PRINT_JULIA, cd $(BASE_DIR)/base && \ + @$(call PRINT_JULIA, cd $(JULIAHOME)/base && \ if ! JULIA_BINDIR=$(call cygpath_w,$(build_bindir)) WINEPATH="$(call cygpath_w,$(build_bindir));$$WINEPATH" \ $(call spawn, $(JULIA_EXECUTABLE)) -g1 -O0 -C "$(JULIA_CPU_TARGET)" --output-ji $(call cygpath_w,$@).tmp $(JULIA_SYSIMG_BUILD_FLAGS) \ - --startup-file=no --warn-overwrite=yes --sysimage $(call cygpath_w,$<) sysimg.jl; then \ + --startup-file=no --warn-overwrite=yes --sysimage $(call cygpath_w,$<) sysimg.jl $(RELBUILDROOT); then \ echo '*** This error might be fixed by running `make clean`. If the error persists$(COMMA) try `make cleanall`. ***'; \ false; \ fi ) @@ -72,7 +75,7 @@ $(build_private_libdir)/sys.ji: $(build_private_libdir)/corecompiler.ji $(JULIAH define sysimg_builder $$(build_private_libdir)/sys$1-o.a $$(build_private_libdir)/sys$1-bc.a : $$(build_private_libdir)/sys$1-%.a : $$(build_private_libdir)/sys.ji - @$$(call PRINT_JULIA, cd $$(BASE_DIR)/base && \ + @$$(call PRINT_JULIA, cd $$(JULIAHOME)/base && \ if ! JULIA_BINDIR=$$(call cygpath_w,$(build_bindir)) WINEPATH="$$(call cygpath_w,$$(build_bindir));$$$$WINEPATH" \ JULIA_NUM_THREADS=1 \ $$(call spawn, $3) $2 -C "$$(JULIA_CPU_TARGET)" --output-$$* $$(call cygpath_w,$$@).tmp $$(JULIA_SYSIMG_BUILD_FLAGS) \