Patch #718286: Support DESTDIR.

This commit is contained in:
Martin v. Löwis 2003-05-11 20:25:35 +00:00
parent 172d9ef47e
commit 3b8ee0871e
3 changed files with 73 additions and 63 deletions

View File

@ -563,16 +563,16 @@ oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
@for i in X $(SHAREDMODS); do \ @for i in X $(SHAREDMODS); do \
if test $$i != X; then \ if test $$i != X; then \
echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
$(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
fi; \ fi; \
done done
$(DESTSHARED): $(DESTSHARED):
@for i in $(DESTDIRS); \ @for i in $(DESTDIRS); \
do \ do \
if test ! -d $$i; then \ if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \ echo "Creating directory $$i"; \
$(INSTALL) -d -m $(DIRMODE) $$i; \ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
else true; \ else true; \
fi; \ fi; \
done done
@ -580,11 +580,11 @@ $(DESTSHARED):
# Install the interpreter (by creating a hard link to python$(VERSION)) # Install the interpreter (by creating a hard link to python$(VERSION))
bininstall: altbininstall bininstall: altbininstall
-if test -f $(BINDIR)/$(PYTHON) -o -h $(BINDIR)/$(PYTHON); \ -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
then rm -f $(BINDIR)/$(PYTHON); \ then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
else true; \ else true; \
fi fi
(cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)) (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
# Install the interpreter with $(VERSION) affixed # Install the interpreter with $(VERSION) affixed
# This goes into $(exec_prefix) # This goes into $(exec_prefix)
@ -597,18 +597,18 @@ altbininstall: $(BUILDPYTHON)
fi fi
@for i in $(BINDIR) $(LIBDIR); \ @for i in $(BINDIR) $(LIBDIR); \
do \ do \
if test ! -d $$i; then \ if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \ echo "Creating directory $$i"; \
$(INSTALL) -d -m $(DIRMODE) $$i; \ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
else true; \ else true; \
fi; \ fi; \
done done
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(BINDIR)/python$(VERSION)$(EXE) $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
if test -f libpython$(VERSION)$(SO); then \ if test -f libpython$(VERSION)$(SO); then \
if test "$(SO)" = .dll; then \ if test "$(SO)" = .dll; then \
$(INSTALL_SHARED) libpython$(VERSION)$(SO) $(BINDIR); \ $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
else \ else \
$(INSTALL_SHARED) libpython$(VERSION)$(SO) $(LIBDIR)/$(INSTSONAME); \ $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
fi; \ fi; \
else true; \ else true; \
fi fi
@ -617,14 +617,14 @@ altbininstall: $(BUILDPYTHON)
maninstall: maninstall:
@for i in $(MANDIR) $(MANDIR)/man1; \ @for i in $(MANDIR) $(MANDIR)/man1; \
do \ do \
if test ! -d $$i; then \ if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \ echo "Creating directory $$i"; \
$(INSTALL) -d -m $(DIRMODE) $$i; \ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
else true; \ else true; \
fi; \ fi; \
done done
$(INSTALL_DATA) $(srcdir)/Misc/python.man \ $(INSTALL_DATA) $(srcdir)/Misc/python.man \
$(MANDIR)/man1/python.1 $(DESTDIR)$(MANDIR)/man1/python.1
# Install the library # Install the library
PLATDIR= plat-$(MACHDEP) PLATDIR= plat-$(MACHDEP)
@ -649,9 +649,9 @@ LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \
libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
@for i in $(SCRIPTDIR) $(LIBDEST); \ @for i in $(SCRIPTDIR) $(LIBDEST); \
do \ do \
if test ! -d $$i; then \ if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \ echo "Creating directory $$i"; \
$(INSTALL) -d -m $(DIRMODE) $$i; \ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
else true; \ else true; \
fi; \ fi; \
done done
@ -660,19 +660,19 @@ libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
a=$(srcdir)/Lib/$$d; \ a=$(srcdir)/Lib/$$d; \
if test ! -d $$a; then continue; else true; fi; \ if test ! -d $$a; then continue; else true; fi; \
b=$(LIBDEST)/$$d; \ b=$(LIBDEST)/$$d; \
if test ! -d $$b; then \ if test ! -d $(DESTDIR)$$b; then \
echo "Creating directory $$b"; \ echo "Creating directory $$b"; \
$(INSTALL) -d -m $(DIRMODE) $$b; \ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
else true; \ else true; \
fi; \ fi; \
done done
@for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \ @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
do \ do \
if test -x $$i; then \ if test -x $$i; then \
$(INSTALL_SCRIPT) $$i $(LIBDEST); \ $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
else \ else \
$(INSTALL_DATA) $$i $(LIBDEST); \ $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
echo $(INSTALL_DATA) $$i $(LIBDEST); \ echo $(INSTALL_DATA) $$i $(LIBDEST); \
fi; \ fi; \
done done
@ -692,27 +692,27 @@ libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
if test -d $$i; then continue; fi; \ if test -d $$i; then continue; fi; \
if test -x $$i; then \ if test -x $$i; then \
echo $(INSTALL_SCRIPT) $$i $$b; \ echo $(INSTALL_SCRIPT) $$i $$b; \
$(INSTALL_SCRIPT) $$i $$b; \ $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
else \ else \
echo $(INSTALL_DATA) $$i $$b; \ echo $(INSTALL_DATA) $$i $$b; \
$(INSTALL_DATA) $$i $$b; \ $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
fi;; \ fi;; \
esac; \ esac; \
done; \ done; \
done done
$(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -Wi -tt $(LIBDEST)/compileall.py \ ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-x 'badsyntax|site-packages' $(LIBDEST) -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -Wi -tt -O $(LIBDEST)/compileall.py \ ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-x 'badsyntax|site-packages' $(LIBDEST) -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -Wi -t $(LIBDEST)/compileall.py \ ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-x badsyntax $(LIBDEST)/site-packages -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -Wi -t -O $(LIBDEST)/compileall.py \ ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
-x badsyntax $(LIBDEST)/site-packages -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
# Create the PLATDIR source directory, if one wasn't distributed.. # Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR): $(srcdir)/Lib/$(PLATDIR):
@ -729,18 +729,18 @@ INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
inclinstall: inclinstall:
@for i in $(INCLDIRSTOMAKE); \ @for i in $(INCLDIRSTOMAKE); \
do \ do \
if test ! -d $$i; then \ if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \ echo "Creating directory $$i"; \
$(INSTALL) -d -m $(DIRMODE) $$i; \ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
else true; \ else true; \
fi; \ fi; \
done done
@for i in $(srcdir)/Include/*.h; \ @for i in $(srcdir)/Include/*.h; \
do \ do \
echo $(INSTALL_DATA) $$i $(INCLUDEPY); \ echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
$(INSTALL_DATA) $$i $(INCLUDEPY); \ $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
done done
$(INSTALL_DATA) pyconfig.h $(CONFINCLUDEPY)/pyconfig.h $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
# Install the library and miscellaneous stuff needed for extending/embedding # Install the library and miscellaneous stuff needed for extending/embedding
# This goes into $(exec_prefix) # This goes into $(exec_prefix)
@ -748,55 +748,55 @@ LIBPL= $(LIBP)/config
libainstall: all libainstall: all
@for i in $(LIBDIR) $(LIBP) $(LIBPL); \ @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
do \ do \
if test ! -d $$i; then \ if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \ echo "Creating directory $$i"; \
$(INSTALL) -d -m $(DIRMODE) $$i; \ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
else true; \ else true; \
fi; \ fi; \
done done
@if test -d $(LIBRARY); then :; else \ @if test -d $(LIBRARY); then :; else \
if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
if test "$(SO)" = .dll; then \ if test "$(SO)" = .dll; then \
$(INSTALL_DATA) $(LDLIBRARY) $(LIBPL) ; \ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
else \ else \
$(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
$(RANLIB) $(LIBPL)/$(LIBRARY) ; \ $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
fi; \ fi; \
else \ else \
echo Skip install of $(LIBRARY) - use make frameworkinstall; \ echo Skip install of $(LIBRARY) - use make frameworkinstall; \
fi; \ fi; \
fi fi
$(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
$(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ) $(INSTALL_DATA) Modules/$(MAINOBJ) $(DESTDIR)$(LIBPL)/$(MAINOBJ)
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
$(INSTALL_DATA) Makefile $(LIBPL)/Makefile $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
$(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
$(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
$(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
@if [ -s Modules/python.exp -a \ @if [ -s Modules/python.exp -a \
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
echo; echo "Installing support files for building shared extension modules on AIX:"; \ echo; echo "Installing support files for building shared extension modules on AIX:"; \
$(INSTALL_DATA) Modules/python.exp \ $(INSTALL_DATA) Modules/python.exp \
$(LIBPL)/python.exp; \ $(DESTDIR)$(LIBPL)/python.exp; \
echo; echo "$(LIBPL)/python.exp"; \ echo; echo "$(LIBPL)/python.exp"; \
$(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \ $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
$(LIBPL)/makexp_aix; \ $(DESTDIR)$(LIBPL)/makexp_aix; \
echo "$(LIBPL)/makexp_aix"; \ echo "$(LIBPL)/makexp_aix"; \
$(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \ $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
$(LIBPL)/ld_so_aix; \ $(DESTDIR)$(LIBPL)/ld_so_aix; \
echo "$(LIBPL)/ld_so_aix"; \ echo "$(LIBPL)/ld_so_aix"; \
echo; echo "See Misc/AIX-NOTES for details."; \ echo; echo "See Misc/AIX-NOTES for details."; \
else true; \ else true; \
fi fi
@case "$(MACHDEP)" in beos*) \ @case "$(MACHDEP)" in beos*) \
echo; echo "Installing support files for building shared extension modules on BeOS:"; \ echo; echo "Installing support files for building shared extension modules on BeOS:"; \
$(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \ $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
echo; echo "$(LIBPL)/README"; \ echo; echo "$(LIBPL)/README"; \
$(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \ $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
echo "$(LIBPL)/ar_beos"; \ echo "$(LIBPL)/ar_beos"; \
$(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \ $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
echo "$(LIBPL)/ld_so_beos"; \ echo "$(LIBPL)/ld_so_beos"; \
echo; echo "See Misc/BeOS-NOTES for details."; \ echo; echo "See Misc/BeOS-NOTES for details."; \
;; \ ;; \
@ -808,7 +808,8 @@ sharedinstall:
$(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \ --prefix=$(prefix) \
--install-scripts=$(BINDIR) \ --install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) --install-platlib=$(DESTSHARED) \
--root=/$(DESTDIR)
# Here are a couple of targets for MacOSX again, to install a full # Here are a couple of targets for MacOSX again, to install a full
# framework-based Python. frameworkinstall installs everything, the # framework-based Python. frameworkinstall installs everything, the
@ -833,7 +834,7 @@ frameworkinstallstructure: $(LDLIBRARY)
else true; \ else true; \
fi fi
@for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\ @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
if test ! -d $$i; then \ if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \ echo "Creating directory $$i"; \
$(INSTALL) -d -m $(DIRMODE) $$i; \ $(INSTALL) -d -m $(DIRMODE) $$i; \
else true; \ else true; \
@ -875,14 +876,16 @@ idleinstall:
--check-tkinter \ --check-tkinter \
--prefix=$(prefix) \ --prefix=$(prefix) \
--install-scripts=$(BINDIR) \ --install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) --install-platlib=$(DESTSHARED) \
--root=/$(DESTDIR)
# This installs a few of the useful scripts in Tools/scripts # This installs a few of the useful scripts in Tools/scripts
scriptsinstall: scriptsinstall:
SRCDIR=$(srcdir) $(RUNSHARED) \ SRCDIR=$(srcdir) $(RUNSHARED) \
./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \ ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
--prefix=$(prefix) \ --prefix=$(prefix) \
--install-scripts=$(BINDIR) --install-scripts=$(BINDIR) \
--root=/$(DESTDIR)
# Build the toplevel Makefile # Build the toplevel Makefile
Makefile.pre: Makefile.pre.in config.status Makefile.pre: Makefile.pre.in config.status

View File

@ -53,6 +53,9 @@ Tools/Demos
Build Build
----- -----
- Setting DESTDIR during 'make install' now allows to specify a
different root directory.
C API C API
----- -----

4
README
View File

@ -878,6 +878,10 @@ platform-specific files will be installed in subdirectories if the
directory given by --exec-prefix or the `exec_prefix' Make variable directory given by --exec-prefix or the `exec_prefix' Make variable
(defaults to the --prefix directory) is given. (defaults to the --prefix directory) is given.
If DESTDIR is set, it will be taken as the root directory of the
installation, and files will be installed into $(DESTDIR)$(prefix),
$(DESTDIR)$(exec_prefix), etc.
All subdirectories created will have Python's version number in their All subdirectories created will have Python's version number in their
name, e.g. the library modules are installed in name, e.g. the library modules are installed in
"/usr/local/lib/python<version>/" by default, where <version> is the "/usr/local/lib/python<version>/" by default, where <version> is the