Skip to content

Commit 2a8bf25

Browse files
authored
gh-100221: Fix creating dirs in make sharedinstall (GH-100329)
Fix creating install directories in `make sharedinstall` if they exist already outside `DESTDIR`. The previous make rules assumed that the directories would be created via a dependency on a rule for `$(DESTSHARED)` that did not fire if the directory did exist outside `$(DESTDIR)`. While technically `$(DESTDIR)` could be prepended to the rule name, moving the rules for creating directories straight into the `sharedinstall` rule seems to fit the common practices better. Since the rule explicitly checks whether the individual directories exist anyway, there seems to be no reason to rely on make determining that implicitly as well.
1 parent 35dd550 commit 2a8bf25

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Makefile.pre.in

+9-12
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,15 @@ commoninstall: check-clean-src @FRAMEWORKALTINSTALLFIRST@ \
18161816
# Install shared libraries enabled by Setup
18171817
DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
18181818

1819-
sharedinstall: $(DESTSHARED) all
1819+
sharedinstall: all
1820+
@for i in $(DESTDIRS); \
1821+
do \
1822+
if test ! -d $(DESTDIR)$$i; then \
1823+
echo "Creating directory $$i"; \
1824+
$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1825+
else true; \
1826+
fi; \
1827+
done
18201828
@for i in X $(SHAREDMODS); do \
18211829
if test $$i != X; then \
18221830
echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
@@ -1828,17 +1836,6 @@ sharedinstall: $(DESTSHARED) all
18281836
fi; \
18291837
done
18301838

1831-
1832-
$(DESTSHARED):
1833-
@for i in $(DESTDIRS); \
1834-
do \
1835-
if test ! -d $(DESTDIR)$$i; then \
1836-
echo "Creating directory $$i"; \
1837-
$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1838-
else true; \
1839-
fi; \
1840-
done
1841-
18421839
# Install the interpreter with $(VERSION) affixed
18431840
# This goes into $(exec_prefix)
18441841
altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix creating install directories in ``make sharedinstall`` if they exist
2+
outside ``DESTDIR`` already.

0 commit comments

Comments
 (0)