Skip to content

Commit 67b8ac0

Browse files
authored
build: separate stdlib manifests by version (#47596)
We install these by version, so it helps a lot if they reflect that in the manifest name. Also some other mild cleanup.
1 parent bba41d4 commit 67b8ac0

File tree

9 files changed

+59
-47
lines changed

9 files changed

+59
-47
lines changed

Make.inc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,6 @@ endif
135135
export BUILDROOT
136136
unexport O
137137

138-
# Make sure the user didn't try to specify a path that will confuse the shell / make
139-
METACHARACTERS := ][?*{}() $$%:;&|!\#,\\`\":
140-
ifneq (,$(findstring ',$(value BUILDROOT)))
141-
$(error cowardly refusing to build into directory with a single-quote in the path)
142-
endif
143-
ifneq (,$(findstring ',$(value JULIAHOME)))
144-
$(error cowardly refusing to build from source directory with a single-quote in the path)
145-
endif
146-
ifneq (,$(shell echo '$(value BUILDROOT)' | grep '[$(METACHARACTERS)]'))
147-
$(error cowardly refusing to build into directory with a shell-metacharacter in the path\
148-
(got: $(value BUILDROOT)))
149-
endif
150-
ifneq (,$(shell echo '$(value JULIAHOME)' | grep '[$(METACHARACTERS)]'))
151-
$(error cowardly refusing to build from source directory with a shell-metacharacter in the path\
152-
(got: $(value JULIAHOME)))
153-
endif
154-
155138
# we include twice to pickup user definitions better
156139
# include from JULIAHOME first so that BUILDROOT can override
157140
MAYBE_HOST :=

Makefile

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@ include $(JULIAHOME)/Make.inc
33
# import LLVM_SHARED_LIB_NAME
44
include $(JULIAHOME)/deps/llvm-ver.make
55

6+
# Make sure the user didn't try to build in a path that will confuse the shell or make
7+
METACHARACTERS := [][?*{}() $$%:;&|!\#,\\`\":]\|/\./\|/\.\./
8+
ifneq (,$(findstring ',$(value BUILDROOT)))
9+
$(error cowardly refusing to build into directory with a single-quote in the path)
10+
endif
11+
ifneq (,$(findstring ',$(value JULIAHOME)))
12+
$(error cowardly refusing to build from source directory with a single-quote in the path)
13+
endif
14+
ifneq (,$(shell echo '$(value BUILDROOT)/' | grep '$(METACHARACTERS)'))
15+
$(error cowardly refusing to build into directory with a shell-metacharacter in the path\
16+
(got: $(value BUILDROOT)))
17+
endif
18+
ifneq (,$(shell echo '$(value JULIAHOME)/' | grep '$(METACHARACTERS)'))
19+
$(error cowardly refusing to build from source directory with a shell-metacharacter in the path\
20+
(got: $(value JULIAHOME)))
21+
endif
22+
623
VERSDIR := v`cut -d. -f1-2 < $(JULIAHOME)/VERSION`
724

825
default: $(JULIA_BUILD_MODE) # contains either "debug" or "release"
@@ -13,7 +30,7 @@ DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_priva
1330
ifneq ($(BUILDROOT),$(JULIAHOME))
1431
BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src src/flisp src/support src/clangsa cli doc deps stdlib test test/clangsa test/embedding test/llvmpasses)
1532
BUILDDIRMAKE := $(addsuffix /Makefile,$(BUILDDIRS)) $(BUILDROOT)/sysimage.mk
16-
DIRS := $(DIRS) $(BUILDDIRS)
33+
DIRS += $(BUILDDIRS)
1734
$(BUILDDIRMAKE): | $(BUILDDIRS)
1835
@# add Makefiles to the build directories for convenience (pointing back to the source location of each)
1936
@echo '# -- This file is automatically generated in julia/Makefile -- #' > $@
@@ -44,10 +61,6 @@ $(foreach link,base $(JULIAHOME)/test,$(eval $(call symlink_target,$(link),$$(bu
4461
julia_flisp.boot.inc.phony: julia-deps
4562
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src julia_flisp.boot.inc.phony
4663

47-
# Build the HTML docs (skipped if already exists, notably in tarballs)
48-
$(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)
49-
@$(MAKE) docs
50-
5164
julia-symlink: julia-cli-$(JULIA_BUILD_MODE)
5265
ifeq ($(OS),WINNT)
5366
echo '@"%~dp0/'"$$(echo '$(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE))')"'" %*' | tr / '\\' > $(BUILDROOT)/julia.bat
@@ -236,7 +249,7 @@ define stringreplace
236249
endef
237250

238251

239-
install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html
252+
install: $(build_depsbindir)/stringreplace docs
240253
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
241254
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(libexecdir); do \
242255
mkdir -p $(DESTDIR)$$subdir; \
@@ -484,7 +497,7 @@ app:
484497
darwinframework:
485498
$(MAKE) -C $(JULIAHOME)/contrib/mac/framework
486499

487-
light-source-dist.tmp: $(BUILDROOT)/doc/_build/html/en/index.html
500+
light-source-dist.tmp: docs
488501
ifneq ($(BUILDROOT),$(JULIAHOME))
489502
$(error make light-source-dist does not work in out-of-tree builds)
490503
endif
@@ -561,12 +574,13 @@ distcleanall: cleanall
561574
@-$(MAKE) -C $(BUILDROOT)/deps distcleanall
562575
@-$(MAKE) -C $(BUILDROOT)/doc cleanall
563576

564-
.PHONY: default debug release check-whitespace release-candidate \
577+
.FORCE:
578+
.PHONY: .FORCE default debug release check-whitespace release-candidate \
565579
julia-debug julia-release julia-stdlib julia-deps julia-deps-libs \
566580
julia-cli-release julia-cli-debug julia-src-release julia-src-debug \
567581
julia-symlink julia-base julia-sysimg julia-sysimg-ji julia-sysimg-release julia-sysimg-debug \
568-
test testall testall1 test test-* test-revise-* \
569-
clean distcleanall cleanall clean-* \
582+
test testall testall1 test \
583+
clean distcleanall cleanall $(CLEAN_TARGETS) \
570584
run-julia run-julia-debug run-julia-release run \
571585
install binary-dist light-source-dist.tmp light-source-dist \
572586
dist full-source-dist source-dist
@@ -583,12 +597,12 @@ testall: check-whitespace $(JULIA_BUILD_MODE)
583597
testall1: check-whitespace $(JULIA_BUILD_MODE)
584598
@env JULIA_CPU_THREADS=1 $(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test all JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
585599

586-
test-%: check-whitespace $(JULIA_BUILD_MODE)
600+
test-%: check-whitespace $(JULIA_BUILD_MODE) .FORCE
587601
@([ $$(( $$(date +%s) - $$(date -r $(build_private_libdir)/sys.$(SHLIB_EXT) +%s) )) -le 100 ] && \
588602
printf '\033[93m HINT The system image was recently rebuilt. Are you aware of the test-revise-* targets? See CONTRIBUTING.md. \033[0m\n') || true
589603
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test $* JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
590604

591-
test-revise-%:
605+
test-revise-%: .FORCE
592606
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test revise-$* JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
593607

594608
# download target for some hardcoded windows dependencies

cli/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ dump-trampolines: $(SRCDIR)/trampolines/trampolines_$(ARCH).S
7070
$(CC) $(SHIPFLAGS) $(LOADER_CFLAGS) $< -S | sed -E 's/ ((%%)|;) /\n/g' | sed -E 's/.global/\n.global/g'
7171

7272
DIRS = $(build_bindir) $(build_libdir)
73-
$(DIRS):
74-
@mkdir -p $@
73+
$(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir))))
7574

7675
ifeq ($(OS),WINNT)
7776
$(BUILDDIR)/julia_res.o: $(JULIAHOME)/contrib/windows/julia.rc $(JULIAHOME)/VERSION

deps/tools/common.mk

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ endif
107107
DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_includedir) $(build_sysconfdir) $(build_datarootdir) $(build_staging) $(build_prefix)/manifest)
108108

109109
$(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir))))
110-
111110
$(build_prefix): | $(DIRS)
111+
112112
$(eval $(call dir_target,$(SRCCACHE)))
113113

114114

@@ -174,6 +174,7 @@ $$(build_prefix)/manifest/$(strip $1): $$(build_staging)/$2.tar | $(build_prefix
174174
$(UNTAR) $$< -C $$(build_prefix)
175175
$6
176176
echo '$$(UNINSTALL_$(strip $1))' > $$@
177+
.PHONY: $(addsuffix -$(strip $1),stage install distclean uninstall reinstall)
177178
endef
178179

179180
define staged-uninstaller
@@ -192,14 +193,18 @@ endef
192193
define symlink_install # (target-name, rel-from, abs-to)
193194
clean-$1: uninstall-$1
194195
install-$1: $$(build_prefix)/manifest/$1
195-
reinstall-$1: install-$1
196+
reinstall-$1:
197+
+$$(MAKE) uninstall-$1
198+
+$$(MAKE) stage-$1
199+
+$$(MAKE) install-$1
200+
.PHONY: $(addsuffix -$1,clean install reinstall)
196201

197202
UNINSTALL_$(strip $1) := $2 symlink-uninstaller $3
198203

199-
$$(build_prefix)/manifest/$1: $$(BUILDDIR)/$2/build-compiled | $3 $$(build_prefix)/manifest
204+
$$(build_prefix)/manifest/$1: $$(BUILDDIR)/$2/build-compiled | $$(abspath $$(dir $3/$1)) $$(abspath $$(dir $$(build_prefix)/manifest/$1))
200205
-+[ ! \( -e $3/$1 -o -h $3/$1 \) ] || $$(MAKE) uninstall-$1
201206
ifeq ($$(BUILD_OS), WINNT)
202-
cmd //C mklink //J $$(call mingw_to_dos,$3/$1,cd $3 &&) $$(call mingw_to_dos,$$(BUILDDIR)/$2,)
207+
cmd //C mklink //J $$(call mingw_to_dos,$3/$1,cd $3/$(dir $1) &&) $$(call mingw_to_dos,$$(BUILDDIR)/$2,)
203208
else ifneq (,$$(findstring CYGWIN,$$(BUILD_OS)))
204209
cmd /C mklink /J $$(call cygpath_w,$3/$1) $$(call cygpath_w,$$(BUILDDIR)/$2)
205210
else ifdef JULIA_VAGRANT_BUILD
@@ -213,7 +218,7 @@ endef
213218
define symlink-uninstaller
214219
uninstall-$1:
215220
ifeq ($$(BUILD_OS), WINNT)
216-
-cmd //C rmdir $$(call mingw_to_dos,$3/$1,cd $3 &&)
221+
-cmd //C rmdir $$(call mingw_to_dos,$3/$1,cd $3/$(dir $1) &&)
217222
else
218223
rm -rf $3/$1
219224
endif

deps/tools/git-external.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ $5/$$($2_SRC_DIR)/source-extracted: $$($2_SRC_FILE)
6868
$(TAR) -C $$(dir $$@) --strip-components 1 -xf $$<
6969
echo 1 > $$@
7070

71-
checksum-$(1): $$($2_SRC_FILE)
71+
checksum-$1: $$($2_SRC_FILE)
7272
$$(JLCHECKSUM) $$<
7373
endif # DEPS_GIT
7474

7575
$$(build_prefix)/manifest/$1: $$(SRCDIR)/$1.version # make the manifest stale if the version file is touched (causing re-install for compliant targets)
7676
distclean-$1:
7777
rm -rf $5/$$($2_SRC_DIR) $$($2_SRC_FILE) $$(BUILDDIR)/$$($2_SRC_DIR)
78+
.PHONY: $(addsuffix -$1,checksum distclean)
7879
endef

deps/tools/stdlib-external.mk

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@ $$(eval $$(call git-external,$1,$2,,,$$(BUILDDIR)))
1616
$$(BUILDDIR)/$$($2_SRC_DIR)/build-compiled: $$(BUILDDIR)/$$($2_SRC_DIR)/source-extracted
1717
@# no build steps
1818
echo 1 > $$@
19-
$$(eval $$(call symlink_install,$1,$$$$($2_SRC_DIR),$$$$(build_datarootdir)/julia/stdlib/$$$$(VERSDIR)))
19+
$$(eval $$(call symlink_install,$$$$(VERSDIR)/$1,$$$$($2_SRC_DIR),$$$$(build_datarootdir)/julia/stdlib))
2020
clean-$1:
2121
-rm -f $$(BUILDDIR)/$$($2_SRC_DIR)/build-compiled
2222
get-$1: $$($2_SRC_FILE)
2323
extract-$1: $$(BUILDDIR)/$$($2_SRC_DIR)/source-extracted
2424
configure-$1: extract-$1
2525
compile-$1: $$(BUILDDIR)/$$($2_SRC_DIR)/build-compiled
26-
26+
install-$1: install-$$(VERSDIR)/$1
27+
uninstall-$1: uninstall-$$(VERSDIR)/$1
28+
reinstall-$1: reinstall-$$(VERSDIR)/$1
29+
version-check-$1: version-check-$$(VERSDIR)/$1
30+
clean-$1: clean-$$(VERSDIR)/$1
31+
.PHONY: $(addsuffix -$1,get extract configure compile install uninstall reinstall clean)
2732
endef

deps/tools/uninstallers.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ else
1717
uninstall-$1:
1818
@echo "skipping uninstall: $1 not installed"
1919
endif
20+
.PHONY: uninstall-$1
2021
endef
2122
$(foreach dep,$(DEP_LIBS_STAGED_ALL),$(eval $(call define-uninstaller,$(dep))))
2223

stdlib/Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ include $(JULIAHOME)/deps/*.version
1414

1515

1616
VERSDIR := v$(shell cut -d. -f1-2 < $(JULIAHOME)/VERSION)
17-
18-
$(build_datarootdir)/julia/stdlib/$(VERSDIR):
19-
mkdir -p $@
17+
DIRS := $(build_datarootdir)/julia/stdlib/$(VERSDIR) $(build_prefix)/manifest/$(VERSDIR)
18+
$(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir))))
2019

2120
JLLS = DSFMT GMP CURL LIBGIT2 LLVM LIBSSH2 LIBUV MBEDTLS MPFR NGHTTP2 \
2221
BLASTRAMPOLINE OPENBLAS OPENLIBM P7ZIP PCRE LIBSUITESPARSE ZLIB \
@@ -43,14 +42,19 @@ $(foreach jll,$(JLLS),$(eval $(call download-artifacts-toml,$(jll))))
4342

4443
STDLIBS = Artifacts Base64 CRC32c Dates Distributed FileWatching \
4544
Future InteractiveUtils LazyArtifacts Libdl LibGit2 LinearAlgebra Logging \
46-
Markdown Mmap Printf Profile Random REPL Serialization SHA \
47-
SharedArrays Sockets SparseArrays SuiteSparse Test TOML Unicode UUIDs \
45+
Markdown Mmap Printf Profile Random REPL Serialization \
46+
SharedArrays Sockets Test TOML Unicode UUIDs \
4847
$(JLL_NAMES)
4948

5049
STDLIBS_EXT = Pkg Statistics LibCURL Downloads ArgTools Tar NetworkOptions SuiteSparse SparseArrays SHA
5150

5251
$(foreach module, $(STDLIBS_EXT), $(eval $(call stdlib-external,$(module),$(shell echo $(module) | tr a-z A-Z))))
5352

53+
ifneq ($(filter $(STDLIBS),$(STDLIBS_EXT)),)
54+
$(error ERROR duplicated STDLIBS in list)
55+
endif
56+
57+
5458
# Generate symlinks to all stdlibs at usr/share/julia/stdlib/vX.Y/
5559
$(foreach module, $(STDLIBS), $(eval $(call symlink_target,$$(JULIAHOME)/stdlib/$(module),$$(build_datarootdir)/julia/stdlib/$$(VERSDIR),$(module))))
5660

@@ -68,5 +72,5 @@ clean: $(addprefix clean-, $(STDLIBS_EXT)) $(CLEAN_TARGETS) extstdlibclean
6872
distclean: $(addprefix distclean-, $(STDLIBS_EXT)) clean
6973
checksumall: $(addprefix checksum-, $(STDLIBS_EXT))
7074

71-
DEP_LIBS_STAGED_ALL := $(STDLIBS_EXT)
75+
DEP_LIBS_STAGED_ALL := $(addprefix $(VERSDIR)/,$(STDLIBS_EXT))
7276
include $(JULIAHOME)/deps/tools/uninstallers.mk

sysimage.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sysimg-bc: $(build_private_libdir)/sys-bc.a
1010
sysimg-release: $(build_private_libdir)/sys.$(SHLIB_EXT)
1111
sysimg-debug: $(build_private_libdir)/sys-debug.$(SHLIB_EXT)
1212

13-
VERSDIR := v`cut -d. -f1-2 < $(JULIAHOME)/VERSION`
13+
VERSDIR := v$(shell cut -d. -f1-2 < $(JULIAHOME)/VERSION)
1414

1515
$(build_private_libdir)/%.$(SHLIB_EXT): $(build_private_libdir)/%-o.a
1616
@$(call PRINT_LINK, $(CXX) $(LDFLAGS) -shared $(fPIC) -L$(build_private_libdir) -L$(build_libdir) -L$(build_shlibdir) -o $@ \
@@ -54,7 +54,7 @@ COMPILER_SRCS += $(shell find $(JULIAHOME)/base/compiler -name \*.jl)
5454
BASE_SRCS := $(sort $(shell find $(JULIAHOME)/base -name \*.jl -and -not -name sysimg.jl) \
5555
$(shell find $(BUILDROOT)/base -name \*.jl -and -not -name sysimg.jl))
5656
STDLIB_SRCS := $(JULIAHOME)/base/sysimg.jl $(shell find $(build_datarootdir)/julia/stdlib/$(VERSDIR)/*/src -name \*.jl) \
57-
$(build_prefix)/manifest/Pkg
57+
$(wildcard $(build_prefix)/manifest/$(VERSDIR)/*)
5858
RELBUILDROOT := $(call rel_path,$(JULIAHOME)/base,$(BUILDROOT)/base)/ # <-- make sure this always has a trailing slash
5959

6060
$(build_private_libdir)/corecompiler.ji: $(COMPILER_SRCS)

0 commit comments

Comments
 (0)