Skip to content

Commit 9c664fd

Browse files
committed
Use git-external to install Pkg during build.
1 parent dd8ebdc commit 9c664fd

File tree

7 files changed

+63
-9
lines changed

7 files changed

+63
-9
lines changed

Makefile

+10-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ all: debug release
99
# sort is used to remove potential duplicates
1010
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))
1111
ifneq ($(BUILDROOT),$(JULIAHOME))
12-
BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src ui doc deps test test/embedding test/llvmpasses)
12+
BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src ui doc deps stdlib test test/embedding test/llvmpasses)
1313
BUILDDIRMAKE := $(addsuffix /Makefile,$(BUILDDIRS))
1414
DIRS := $(DIRS) $(BUILDDIRS)
1515
$(BUILDDIRMAKE): | $(BUILDDIRS)
@@ -39,9 +39,6 @@ endif
3939
$(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir))))
4040
$(foreach link,base $(JULIAHOME)/test,$(eval $(call symlink_target,$(link),$(build_datarootdir)/julia,$(notdir $(link)))))
4141

42-
build_defaultpkgdir = $(build_datarootdir)/julia/stdlib/$(shell echo $(VERSDIR))
43-
$(eval $(call symlink_target,$(JULIAHOME)/stdlib,$(build_datarootdir)/julia/stdlib,$(shell echo $(VERSDIR))))
44-
4542
julia_flisp.boot.inc.phony: julia-deps
4643
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src julia_flisp.boot.inc.phony
4744

@@ -56,9 +53,12 @@ ifndef JULIA_VAGRANT_BUILD
5653
endif
5754
endif
5855

59-
julia-deps: | $(DIRS) $(build_datarootdir)/julia/base $(build_datarootdir)/julia/test $(build_defaultpkgdir)
56+
julia-deps: | $(DIRS) $(build_datarootdir)/julia/base $(build_datarootdir)/julia/test
6057
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/deps
6158

59+
julia-stdlib: | $(DIRS)
60+
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/stdlib
61+
6262
julia-base: julia-deps $(build_sysconfdir)/julia/startup.jl $(build_man1dir)/julia.1 $(build_datarootdir)/julia/julia-config.jl
6363
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/base
6464

@@ -74,10 +74,10 @@ julia-ui-release julia-ui-debug : julia-ui-% : julia-src-%
7474
julia-sysimg : julia-base julia-ui-$(JULIA_BUILD_MODE)
7575
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/sys.ji JULIA_EXECUTABLE='$(JULIA_EXECUTABLE)'
7676

77-
julia-sysimg-release : julia-sysimg julia-ui-release
77+
julia-sysimg-release : julia-stdlib julia-sysimg julia-ui-release
7878
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/sys.$(SHLIB_EXT)
7979

80-
julia-sysimg-debug : julia-sysimg julia-ui-debug
80+
julia-sysimg-debug : julia-stdlib julia-sysimg julia-ui-debug
8181
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/sys-debug.$(SHLIB_EXT)
8282

8383
julia-debug julia-release : julia-% : julia-ui-% julia-sysimg-% julia-symlink julia-libccalltest julia-base-cache
@@ -527,10 +527,11 @@ source-dist:
527527
full-source-dist: light-source-dist.tmp
528528
# Get all the dependencies downloaded
529529
@$(MAKE) -C deps getall NO_GIT=1
530+
@$(MAKE) -C stdlib getall
530531

531532
# Create file full-source-dist.tmp to hold all the filenames that go into the tarball
532533
cp light-source-dist.tmp full-source-dist.tmp
533-
-ls deps/srccache/*.tar.gz deps/srccache/*.tar.bz2 deps/srccache/*.tar.xz deps/srccache/*.tgz deps/srccache/*.zip deps/srccache/*.pem >> full-source-dist.tmp
534+
-ls deps/srccache/*.tar.gz deps/srccache/*.tar.bz2 deps/srccache/*.tar.xz deps/srccache/*.tgz deps/srccache/*.zip deps/srccache/*.pem stdlib/srccache/*.tar.gz >> full-source-dist.tmp
534535

535536
# Prefix everything with the current directory name (usually "julia"), then create tarball
536537
DIRNAME=$$(basename $$(pwd)); \
@@ -543,6 +544,7 @@ clean: | $(CLEAN_TARGETS)
543544
@-$(MAKE) -C $(BUILDROOT)/src clean
544545
@-$(MAKE) -C $(BUILDROOT)/ui clean
545546
@-$(MAKE) -C $(BUILDROOT)/test clean
547+
@-$(MAKE) -C $(BUILDROOT)/stdlib clean-pkg
546548
-rm -f $(BUILDROOT)/julia
547549
-rm -f $(BUILDROOT)/*.tar.gz
548550
-rm -f $(build_depsbindir)/stringreplace \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
df1b07419d50db883998ca9bb8fc7ea1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c2a1427d3d8fec20746676133b41db6a082e9b3fc7c1941a43e0398cfe8b33d1547ab58d89391a99b26816909e77258d6331894295d5c6084997da8104f9ac7b

stdlib/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/srccache
2+
/Pkg

stdlib/Makefile

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
default: install
2+
3+
.PHONY: default extract-pkg get-pkg clean-pkg getall install
4+
5+
SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
6+
JULIAHOME := $(abspath $(SRCDIR)/..)
7+
SRCCACHE := $(abspath $(SRCDIR)/srccache)
8+
BUILDDIR := $(SRCCACHE)
9+
10+
include $(JULIAHOME)/Make.inc
11+
include $(JULIAHOME)/deps/tools/common.mk
12+
include $(JULIAHOME)/deps/tools/git-external.mk
13+
14+
VERSDIR := v`cut -d. -f1-2 < $(JULIAHOME)/VERSION`
15+
16+
# Download and extract Pkg
17+
PKG := https://github.com/JuliaLang/Pkg.jl
18+
PKG_TAR_URL = https://api.github.com/repos/JuliaLang/Pkg.jl/tarball/$1
19+
$(eval $(call git-external,Pkg,PKG,,,$(BUILDDIR)))
20+
21+
extract-pkg: $(BUILDDIR)/$(PKG_SRC_DIR)/source-extracted
22+
Pkg: $(BUILDDIR)/$(PKG_SRC_DIR)/source-extracted
23+
rm -rf $@
24+
cp -r $(BUILDDIR)/$(PKG_SRC_DIR) $@
25+
get-pkg: Pkg
26+
clean-pkg:
27+
-rm -rf Pkg
28+
-rm -rf $(BUILDDIR)/$(PKG_SRC_DIR)
29+
30+
# Generate symlinks to all stdlibs from usr/share/julia/stdlib/vX.Y/
31+
STDLIBS = Base64 CRC32c Dates DelimitedFiles Distributed FileWatching \
32+
Future InteractiveUtils Libdl LibGit2 LinearAlgebra Logging \
33+
Markdown Mmap Printf Profile Random REPL Serialization SHA \
34+
SharedArrays Sockets SparseArrays Statistics SuiteSparse Test Unicode UUIDs
35+
36+
$(foreach pkg, $(STDLIBS), $(eval $(call symlink_target,$(JULIAHOME)/stdlib/$(pkg),$(build_datarootdir)/julia/stdlib/$(shell echo $(VERSDIR)),$(pkg))))
37+
$(eval $(call symlink_target,$(BUILDROOT)/stdlib/Pkg,$(build_datarootdir)/julia/stdlib/$(shell echo $(VERSDIR)),Pkg))
38+
39+
$(build_datarootdir)/julia/stdlib/$(shell echo $(VERSDIR)):
40+
mkdir -p $@
41+
42+
STDLIBS_LINK_TARGETS = $(addprefix $(build_datarootdir)/julia/stdlib/$(shell echo $(VERSDIR))/, $(STDLIBS) Pkg)
43+
44+
install: Pkg $(STDLIBS_LINK_TARGETS)
45+
getall: get-pkg
46+

stdlib/Pkg.version

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PKG_BRANCH = master
2+
PKG_SHA1 = ed5908796128c6227dcddefa9ec06a47066b8b01

test/choosetests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Random, Sockets
44

55
const STDLIB_DIR = joinpath(Sys.BINDIR, "..", "share", "julia", "stdlib", "v$(VERSION.major).$(VERSION.minor)")
6-
const STDLIBS = filter!(x -> isdir(joinpath(STDLIB_DIR, x)), readdir(STDLIB_DIR))
6+
const STDLIBS = filter!(x -> isfile(joinpath(STDLIB_DIR, x, "src", "$(x).jl")), readdir(STDLIB_DIR))
77

88
"""
99

0 commit comments

Comments
 (0)