diff --git a/Makefile b/Makefile index e0f1a54bd3040..d5a8d9527b07f 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,10 @@ $(foreach link,base $(JULIAHOME)/test,$(eval $(call symlink_target,$(link),$(bui build_defaultpkgdir = $(build_datarootdir)/julia/site/$(shell echo $(VERSDIR)) $(eval $(call symlink_target,$(JULIAHOME)/stdlib,$(build_datarootdir)/julia/site,$(shell echo $(VERSDIR)))) +build_defaultpkgcachedir = $(build_datarootdir)/julia/lib/$(shell echo $(VERSDIR)) +$(build_defaultpkgcachedir): | $(DIRS) $(build_defaultpkgdir) + mkdir -p $@ + julia_flisp.boot.inc.phony: julia-deps @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src julia_flisp.boot.inc.phony @@ -103,7 +107,7 @@ julia-sysimg-release : julia-inference julia-ui-release julia-sysimg-debug : julia-inference julia-ui-debug @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/sys-debug.$(SHLIB_EXT) JULIA_BUILD_MODE=debug -julia-debug julia-release : julia-% : julia-ui-% julia-sysimg-% julia-symlink julia-libccalltest julia-base-cache +julia-debug julia-release : julia-% : julia-ui-% julia-sysimg-% julia-symlink julia-libccalltest julia-base-cache stdlibcache debug release : % : julia-% @@ -209,7 +213,7 @@ $(build_private_libdir)/inference.ji: $(CORE_SRCS) | $(build_private_libdir) RELBUILDROOT := $(shell $(JULIAHOME)/contrib/relative_path.sh "$(JULIAHOME)/base" "$(BUILDROOT)/base/") COMMA:=, define sysimg_builder -$$(build_private_libdir)/sys$1.o: $$(build_private_libdir)/inference.ji $$(JULIAHOME)/VERSION $$(BASE_SRCS) $$(STDLIB_SRCS) +$$(build_private_libdir)/sys$1.o: $$(build_private_libdir)/inference.ji $$(JULIAHOME)/VERSION $$(BASE_SRCS) @$$(call PRINT_JULIA, cd $$(JULIAHOME)/base && \ if $$(call spawn,$3) $2 -C "$$(JULIA_CPU_TARGET)" --output-o $$(call cygpath_w,$$@).tmp $$(JULIA_SYSIMG_BUILD_FLAGS) \ --startup-file=no --warn-overwrite=yes --sysimage $$(call cygpath_w,$$<) sysimg.jl $$(RELBUILDROOT); then \ @@ -222,6 +226,16 @@ endef $(eval $(call sysimg_builder,,-O3,$(JULIA_EXECUTABLE_release))) $(eval $(call sysimg_builder,-debug,-O0,$(JULIA_EXECUTABLE_debug))) + +$(build_defaultpkgcachedir)/cache.compiled: $(build_defaultpkgdir) $(build_defaultpkgcachedir) $(STDLIB_SRCS) julia-sysimg-$(JULIA_BUILD_MODE) | julia-ui-$(JULIA_BUILD_MODE) + env JULIA_SKIP_PKGCACHE=1 $(JULIA_EXECUTABLE) contrib/stdlib_cache.jl $< $(word 2,$^) + echo 1 > $@ + +stdlibcache: $(build_defaultpkgcachedir)/cache.compiled +CLEAN_TARGETS += clean-stdlibcache +clean-stdlibcache:: + @-rm -fr $(build_defaultpkgcachedir) + $(build_depsbindir)/stringreplace: $(JULIAHOME)/contrib/stringreplace.c | $(build_depsbindir) @$(call PRINT_CC, $(HOSTCC) -o $(build_depsbindir)/stringreplace $(JULIAHOME)/contrib/stringreplace.c) diff --git a/base/deprecated.jl b/base/deprecated.jl index 9e12dc14d574d..49d65413de53d 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1255,8 +1255,13 @@ deprecate(Base, :DSP, 2) using .DSP export conv, conv2, deconv, filt, filt!, xcorr +@deprecate_binding Test nothing true ", run `using Test` instead" + @deprecate_moved SharedArray "SharedArrays" true true +@deprecate_binding Mmap nothing true ", run `using Mmap` instead" + +@deprecate_binding Profile nothing true ", run `using Profile` instead" @eval @deprecate_moved $(Symbol("@profile")) "Profile" true true @deprecate_moved base64encode "Base64" true true @@ -1277,6 +1282,7 @@ export conv, conv2, deconv, filt, filt!, xcorr @eval @deprecate_moved $(Symbol("@everywhere")) "Distributed" true true @eval @deprecate_moved $(Symbol("@parallel")) "Distributed" true true +@deprecate_binding Distributed nothing true ", run `using Distributed` instead" @deprecate_moved addprocs "Distributed" true true @deprecate_moved CachingPool "Distributed" true true @deprecate_moved clear! "Distributed" true true @@ -1308,6 +1314,7 @@ export conv, conv2, deconv, filt, filt!, xcorr @deprecate_moved crc32c "CRC32c" true true +@deprecate_binding Dates nothing true ", run `using Dates` instead" @deprecate_moved DateTime "Dates" true true @deprecate_moved DateFormat "Dates" true true @eval @deprecate_moved $(Symbol("@dateformat_str")) "Dates" true true diff --git a/base/initdefs.jl b/base/initdefs.jl index d634c105dc0f8..3442a902b638d 100644 --- a/base/initdefs.jl +++ b/base/initdefs.jl @@ -66,7 +66,7 @@ function init_load_path(BINDIR = Sys.BINDIR) end push!(LOAD_PATH, abspath(BINDIR, "..", "local", "share", "julia", "site", vers)) push!(LOAD_PATH, abspath(BINDIR, "..", "share", "julia", "site", vers)) - #push!(LOAD_CACHE_PATH, abspath(BINDIR, "..", "lib", "julia")) #TODO: add a builtin location? + push!(LOAD_CACHE_PATH, abspath(BINDIR, "..", "share", "julia", "lib", vers)) end function early_init() diff --git a/base/pkg/pkg.jl b/base/pkg/pkg.jl index 8f20166f8b0bb..90f4f77ef078e 100644 --- a/base/pkg/pkg.jl +++ b/base/pkg/pkg.jl @@ -85,6 +85,9 @@ custom METADATA setup. init(meta::AbstractString=DEFAULT_META, branch::AbstractString=META_BRANCH) = Dir.init(meta,branch) function __init__() + if haskey(ENV, "JULIA_SKIP_PKGCACHE") && ENV["JULIA_SKIP_PKGCACHE"] == "1" + return + end vers = "v$(VERSION.major).$(VERSION.minor)" pushfirst!(Base.LOAD_CACHE_PATH, abspath(Dir._pkgroot(), "lib", vers)) end diff --git a/base/sysimg.jl b/base/sysimg.jl index 5af80aba4c182..922e42435a128 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -487,31 +487,6 @@ using Base # Ensure this file is also tracked pushfirst!(Base._included_files, (@__MODULE__, joinpath(@__DIR__, "sysimg.jl"))) -# load some stdlib packages but don't put their names in Main -Base.require(:Base64) -Base.require(:CRC32c) -Base.require(:Dates) -Base.require(:DelimitedFiles) -Base.require(:FileWatching) -Base.require(:Logging) -Base.require(:IterativeEigensolvers) -Base.require(:Mmap) -Base.require(:Profile) -Base.require(:SharedArrays) -Base.require(:SuiteSparse) -Base.require(:Test) -Base.require(:Unicode) -Base.require(:Distributed) -Base.require(:Printf) - -@eval Base begin - @deprecate_binding Test root_module(:Test) true ", run `using Test` instead" - @deprecate_binding Mmap root_module(:Mmap) true ", run `using Mmap` instead" - @deprecate_binding Profile root_module(:Profile) true ", run `using Profile` instead" - @deprecate_binding Dates root_module(:Dates) true ", run `using Dates` instead" - @deprecate_binding Distributed root_module(:Distributed) true ", run `using Distributed` instead" -end - empty!(LOAD_PATH) Base.isfile("userimg.jl") && Base.include(Main, "userimg.jl") diff --git a/contrib/stdlib_cache.jl b/contrib/stdlib_cache.jl new file mode 100644 index 0000000000000..41a593dd7e68f --- /dev/null +++ b/contrib/stdlib_cache.jl @@ -0,0 +1,30 @@ +#!/usr/bin/env julia +# This file is a part of Julia. License is MIT: https://julialang.org/license + +# Builds a cache for all stdlib packages and installs that alongside Julia. + +@assert length(ARGS) == 2 +pkgdir = ARGS[1] +cachedir = ARGS[2] + +let cache_path = Base.LOAD_CACHE_PATH + empty!(cache_path) + push!(cache_path, cachedir) +end + +let load_path = Base.LOAD_PATH + empty!(load_path) + push!(load_path, pkgdir) +end + +for pkg in readdir(pkgdir) + @info "Building cache for $pkg" + mfile = joinpath(pkgdir, pkg, "src", string(pkg, ".jl")) + if isfile(mfile) + # We can't use Base.compilecache since we don't know the order of dependencies + Base.require(Symbol(pkg)) + else + @info "Directory $pkg doesn't have a $mfile. Skipping." + continue + end +end diff --git a/stdlib/IterativeEigensolvers/test/runtests.jl b/stdlib/IterativeEigensolvers/test/runtests.jl index 9012e128ba8f6..b305146179132 100644 --- a/stdlib/IterativeEigensolvers/test/runtests.jl +++ b/stdlib/IterativeEigensolvers/test/runtests.jl @@ -2,6 +2,7 @@ using IterativeEigensolvers using Test +using SuiteSparse @testset "eigs" begin srand(1234) diff --git a/test/sparse/sparse.jl b/test/sparse/sparse.jl index 1dc792bda0f86..22fe4d792d62a 100644 --- a/test/sparse/sparse.jl +++ b/test/sparse/sparse.jl @@ -2,6 +2,7 @@ using Base.LinAlg: mul!, ldiv!, rdiv!, Adjoint, Transpose using Base.Printf.@printf +using SuiteSparse @testset "issparse" begin @test issparse(sparse(ones(5,5)))