Skip to content

Commit 18c3eb8

Browse files
nalimilanKristofferC
authored andcommitted
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`. (cherry picked from commit eb2e968)
1 parent 06058a5 commit 18c3eb8

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
@@ -303,6 +303,9 @@ private_libdir := $(libdir)/julia
303303
endif
304304
build_private_libdir := $(build_libdir)/julia
305305

306+
private_libexecdir := $(libexecdir)/julia
307+
build_private_libexecdir := $(build_libexecdir)/julia
308+
306309
# A helper functions for dealing with lazily-evaluated, expensive operations.. Spinning
307310
# up a python process to, for exaxmple, parse a TOML file is expensive, and we must wait
308311
# until the TOML files are on-disk before we can parse them. This means that we cannot
@@ -327,7 +330,7 @@ define cache_rel_path
327330
$(1)_rel_eval = $(call rel_path,$(2),$($(1)))
328331
$(1)_rel = $$(call hit_cache,$(1)_rel_eval)
329332
endef
330-
$(foreach D,libdir private_libdir datarootdir libexecdir docdir sysconfdir includedir,$(eval $(call cache_rel_path,$(D),$(bindir))))
333+
$(foreach D,libdir private_libdir datarootdir libexecdir private_libexecdir docdir sysconfdir includedir,$(eval $(call cache_rel_path,$(D),$(bindir))))
331334
$(foreach D,build_libdir build_private_libdir,$(eval $(call cache_rel_path,$(D),$(build_bindir))))
332335

333336
# 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
@@ -238,7 +238,7 @@ endef
238238

239239
install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html
240240
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
241-
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(libexecdir); do \
241+
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(private_libexecdir); do \
242242
mkdir -p $(DESTDIR)$$subdir; \
243243
done
244244

@@ -253,8 +253,8 @@ else ifeq ($(JULIA_BUILD_MODE),debug)
253253
-$(INSTALL_M) $(build_libdir)/libjulia-internal-debug.dll.a $(DESTDIR)$(libdir)/
254254
endif
255255

256-
# We have a single exception; we want 7z.dll to live in libexec, not bin, so that 7z.exe can find it.
257-
-mv $(DESTDIR)$(bindir)/7z.dll $(DESTDIR)$(libexecdir)/
256+
# We have a single exception; we want 7z.dll to live in private_libexecdir, not bindir, so that 7z.exe can find it.
257+
-mv $(DESTDIR)$(bindir)/7z.dll $(DESTDIR)$(private_libexecdir)/
258258
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/
259259
-$(INSTALL_M) $(build_libdir)/libssp.dll.a $(DESTDIR)$(libdir)/
260260
# The rest are compiler dependencies, as an example memcpy is exported by msvcrt
@@ -311,14 +311,14 @@ endif
311311
done \
312312
done
313313
endif
314-
# Install `7z` into libexec/
315-
$(INSTALL_M) $(build_bindir)/7z$(EXE) $(DESTDIR)$(libexecdir)/
314+
# Install `7z` into private_libexecdir
315+
$(INSTALL_M) $(build_bindir)/7z$(EXE) $(DESTDIR)$(private_libexecdir)/
316316

317-
# Install `lld` into libexec/
318-
$(INSTALL_M) $(build_depsbindir)/lld$(EXE) $(DESTDIR)$(libexecdir)/
317+
# Install `lld` into private_libexecdir
318+
$(INSTALL_M) $(build_depsbindir)/lld$(EXE) $(DESTDIR)$(private_libexecdir)/
319319

320-
# Install `dsymutil` into libexec/
321-
$(INSTALL_M) $(build_depsbindir)/dsymutil$(EXE) $(DESTDIR)$(libexecdir)/
320+
# Install `dsymutil` into private_libexecdir/
321+
$(INSTALL_M) $(build_depsbindir)/dsymutil$(EXE) $(DESTDIR)$(private_libexecdir)/
322322

323323
# Copy public headers
324324
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)