Skip to content

Commit eb2e968

Browse files
authored
Install 7z, lld and dsymutils to private libexec/julia directory (#48931)
* Install 7z, lld, dsymutil to private libexec/julia directory Installing files directly into /usr/libexec pollutes the install tree and can create conflicts if other apps do the same. Instead, install them to `private_libdir`, which defaults to `$(libexecdir)/julia`. This is similar to what we do with `private_libdir`.
1 parent a580556 commit eb2e968

File tree

7 files changed

+23
-18
lines changed

7 files changed

+23
-18
lines changed

Make.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ private_libdir := $(libdir)/julia
286286
endif
287287
build_private_libdir := $(build_libdir)/julia
288288

289+
private_libexecdir := $(libexecdir)/julia
290+
build_private_libexecdir := $(build_libexecdir)/julia
291+
289292
# A helper functions for dealing with lazily-evaluated, expensive operations.. Spinning
290293
# up a python process to, for exaxmple, parse a TOML file is expensive, and we must wait
291294
# until the TOML files are on-disk before we can parse them. This means that we cannot
@@ -310,7 +313,7 @@ define cache_rel_path
310313
$(1)_rel_eval = $(call rel_path,$(2),$($(1)))
311314
$(1)_rel = $$(call hit_cache,$(1)_rel_eval)
312315
endef
313-
$(foreach D,libdir private_libdir datarootdir libexecdir docdir sysconfdir includedir,$(eval $(call cache_rel_path,$(D),$(bindir))))
316+
$(foreach D,libdir private_libdir datarootdir libexecdir private_libexecdir docdir sysconfdir includedir,$(eval $(call cache_rel_path,$(D),$(bindir))))
314317
$(foreach D,build_libdir build_private_libdir,$(eval $(call cache_rel_path,$(D),$(build_bindir))))
315318

316319
# Save a special one: reverse_private_libdir_rel: usually just `../`, but good to be general:

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ endef
253253

254254
install: $(build_depsbindir)/stringreplace docs
255255
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
256-
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(libexecdir); do \
256+
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(private_libexecdir); do \
257257
mkdir -p $(DESTDIR)$$subdir; \
258258
done
259259

@@ -268,8 +268,8 @@ else ifeq ($(JULIA_BUILD_MODE),debug)
268268
-$(INSTALL_M) $(build_libdir)/libjulia-internal-debug.dll.a $(DESTDIR)$(libdir)/
269269
endif
270270

271-
# We have a single exception; we want 7z.dll to live in libexec, not bin, so that 7z.exe can find it.
272-
-mv $(DESTDIR)$(bindir)/7z.dll $(DESTDIR)$(libexecdir)/
271+
# We have a single exception; we want 7z.dll to live in private_libexecdir, not bindir, so that 7z.exe can find it.
272+
-mv $(DESTDIR)$(bindir)/7z.dll $(DESTDIR)$(private_libexecdir)/
273273
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/
274274
-$(INSTALL_M) $(build_libdir)/libssp.dll.a $(DESTDIR)$(libdir)/
275275
# The rest are compiler dependencies, as an example memcpy is exported by msvcrt
@@ -331,14 +331,14 @@ endif
331331
done \
332332
done
333333
endif
334-
# Install `7z` into libexec/
335-
$(INSTALL_M) $(build_bindir)/7z$(EXE) $(DESTDIR)$(libexecdir)/
334+
# Install `7z` into private_libexecdir
335+
$(INSTALL_M) $(build_bindir)/7z$(EXE) $(DESTDIR)$(private_libexecdir)/
336336

337-
# Install `lld` into libexec/
338-
$(INSTALL_M) $(build_depsbindir)/lld$(EXE) $(DESTDIR)$(libexecdir)/
337+
# Install `lld` into private_libexecdir
338+
$(INSTALL_M) $(build_depsbindir)/lld$(EXE) $(DESTDIR)$(private_libexecdir)/
339339

340-
# Install `dsymutil` into libexec/
341-
$(INSTALL_M) $(build_depsbindir)/dsymutil$(EXE) $(DESTDIR)$(libexecdir)/
340+
# Install `dsymutil` into private_libexecdir/
341+
$(INSTALL_M) $(build_depsbindir)/dsymutil$(EXE) $(DESTDIR)$(private_libexecdir)/
342342

343343
# Copy public headers
344344
cp -R -L $(build_includedir)/julia/* $(DESTDIR)$(includedir)/julia

base/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ ifeq ($(OS),WINNT)
6666
@printf 'const LIBDIR = "%s"\n' '$(subst /,\\,$(libdir_rel))' >> $@
6767
@printf 'const LIBEXECDIR = "%s"\n' '$(subst /,\\,$(libexecdir_rel))' >> $@
6868
@printf 'const PRIVATE_LIBDIR = "%s"\n' '$(subst /,\\,$(private_libdir_rel))' >> $@
69+
@printf 'const PRIVATE_LIBEXECDIR = "%s"\n' '$(subst /,\\,$(private_libexecdir_rel))' >> $@
6970
@printf 'const INCLUDEDIR = "%s"\n' '$(subst /,\\,$(includedir_rel))' >> $@
7071
else
7172
@echo "const SYSCONFDIR = \"$(sysconfdir_rel)\"" >> $@
@@ -74,6 +75,7 @@ else
7475
@echo "const LIBDIR = \"$(libdir_rel)\"" >> $@
7576
@echo "const LIBEXECDIR = \"$(libexecdir_rel)\"" >> $@
7677
@echo "const PRIVATE_LIBDIR = \"$(private_libdir_rel)\"" >> $@
78+
@echo "const PRIVATE_LIBEXECDIR = \"$(private_libexecdir_rel)\"" >> $@
7779
@echo "const INCLUDEDIR = \"$(includedir_rel)\"" >> $@
7880
endif
7981
ifeq ($(DARWIN_FRAMEWORK), 1)

base/linking.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ end
4949

5050
function __init_lld_path()
5151
# Prefer our own bundled lld, but if we don't have one, pick it up off of the PATH
52-
# If this is an in-tree build, `lld` will live in `tools`. Otherwise, it'll be in `libexec`
53-
for bundled_lld_path in (joinpath(Sys.BINDIR, Base.LIBEXECDIR, lld_exe),
52+
# If this is an in-tree build, `lld` will live in `tools`. Otherwise, it'll be in `private_libexecdir`
53+
for bundled_lld_path in (joinpath(Sys.BINDIR, Base.PRIVATE_LIBEXECDIR, lld_exe),
5454
joinpath(Sys.BINDIR, "..", "tools", lld_exe),
5555
joinpath(Sys.BINDIR, lld_exe))
5656
if isfile(bundled_lld_path)
@@ -64,7 +64,7 @@ end
6464

6565
function __init_dsymutil_path()
6666
#Same as with lld but for dsymutil
67-
for bundled_dsymutil_path in (joinpath(Sys.BINDIR, Base.LIBEXECDIR, dsymutil_exe),
67+
for bundled_dsymutil_path in (joinpath(Sys.BINDIR, Base.PRIVATE_LIBEXECDIR, dsymutil_exe),
6868
joinpath(Sys.BINDIR, "..", "tools", dsymutil_exe),
6969
joinpath(Sys.BINDIR, dsymutil_exe))
7070
if isfile(bundled_dsymutil_path)

stdlib/LLD_jll/src/LLD_jll.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ end
7070

7171
function init_lld_path()
7272
# Prefer our own bundled lld, but if we don't have one, pick it up off of the PATH
73-
# If this is an in-tree build, `lld` will live in `tools`. Otherwise, it'll be in `libexec`
74-
for bundled_lld_path in (joinpath(Sys.BINDIR, Base.LIBEXECDIR, lld_exe),
73+
# If this is an in-tree build, `lld` will live in `tools`. Otherwise, it'll be in `private_libexecdir`
74+
for bundled_lld_path in (joinpath(Sys.BINDIR, Base.PRIVATE_LIBEXECDIR, lld_exe),
7575
joinpath(Sys.BINDIR, "..", "tools", lld_exe),
7676
joinpath(Sys.BINDIR, lld_exe))
7777
if isfile(bundled_lld_path)

stdlib/p7zip_jll/src/p7zip_jll.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ end
6969

7070
function init_p7zip_path()
7171
# Prefer our own bundled p7zip, but if we don't have one, pick it up off of the PATH
72-
# If this is an in-tree build, `7z` will live in `bin`. Otherwise, it'll be in `libexec`
73-
for bundled_p7zip_path in (joinpath(Sys.BINDIR, Base.LIBEXECDIR, p7zip_exe),
72+
# If this is an in-tree build, `7z` will live in `bindir`. Otherwise, it'll be in `private_libexecdir`
73+
for bundled_p7zip_path in (joinpath(Sys.BINDIR, Base.PRIVATE_LIBEXECDIR, p7zip_exe),
7474
joinpath(Sys.BINDIR, p7zip_exe))
7575
if isfile(bundled_p7zip_path)
7676
global p7zip_path = abspath(bundled_p7zip_path)

test/osutils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ end
5151
if Sys.iswindows()
5252
@testset "path variables use correct path delimiters on windows" begin
5353
for path in (Base.SYSCONFDIR, Base.DATAROOTDIR, Base.DOCDIR,
54-
Base.LIBDIR, Base.PRIVATE_LIBDIR, Base.INCLUDEDIR, Base.LIBEXECDIR)
54+
Base.LIBDIR, Base.PRIVATE_LIBDIR, Base.INCLUDEDIR, Base.LIBEXECDIR, Base.PRIVATE_LIBEXECDIR)
5555
@test !occursin("/", path)
5656
@test !occursin("\\\\", path)
5757
end

0 commit comments

Comments
 (0)