[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] 10: prefix-DESTDIR.patch



===
Name: prefix-DESTDIR.patch
Depends: INSTALL.patch, doc-make-vars.patch, fhs-paths.patch,
linux-2.4-modules.patch, parallel-make.patch, pic-lib.patch,
proper-depends.pat
ch
Description: use DESTDIR correctly
 Standard makefiles always attempt to install to the root(/).  Setting
 DESTDIR is the normal way to install to an alternative location.
 .
 Setting prefix has the possibility of breaking programs, as the prefix
 may have been embedded inside a compiled binary.
DiffStat:
 Makefile                       |   11 ++++++-----
 buildconfigs/mk.linux-2.4-xen0 |    4 ++--
 buildconfigs/mk.linux-2.4-xenU |    4 ++--
 buildconfigs/mk.linux-2.6-xen0 |    4 ++--
 buildconfigs/mk.linux-2.6-xenU |    4 ++--
 docs/Makefile                  |   13 +++++++------
 tools/examples/Makefile        |   20 ++++++++++----------
 tools/libxc/Makefile           |   12 ++++++------
 tools/libxutil/Makefile        |    8 ++++----
 tools/misc/Makefile            |    8 ++++----
 tools/misc/miniterm/Makefile   |    4 ++--
 tools/python/Makefile          |    6 ++----
 tools/sv/Makefile              |   14 +++++++-------
 tools/xentrace/Makefile        |   12 ++++++------
 tools/xfrd/Makefile            |    4 ++--
 xen/Makefile                   |   20 ++++++++++----------
 16 files changed, 74 insertions(+), 74 deletions(-)

===
Depends: INSTALL.patch, doc-make-vars.patch, fhs-paths.patch, 
linux-2.4-modules.patch, parallel-make.patch, pic-lib.patch, 
proper-depends.patch
Description: use DESTDIR correctly
 Standard makefiles always attempt to install to the root(/).  Setting
 DESTDIR is the normal way to install to an alternative location.
 .
 Setting prefix has the possibility of breaking programs, as the prefix
 may have been embedded inside a compiled binary.

--- xen-2.0.3.orig/xen/Makefile
+++ xen-2.0.3/xen/Makefile
@@ -8,7 +8,8 @@
 export XEN_SUBVERSION    = 0
 export XEN_EXTRAVERSION  = ".3"

-export BASEDIR          := $(shell pwd)
+export BASEDIR          := $(CURDIR)
+DESTDIR                        := $(CURDIR)/../dist/install

 include Rules.mk

@@ -21,16 +22,15 @@
        objdump -D -S $(TARGET)-syms > $(TARGET).s

 install: $(TARGET).gz
-       $(INSTALL_DIR) $(prefix)/boot
-       $(INSTALL_DATA) $(TARGET).gz $(prefix)/boot
-       $(INSTALL_DATA) $(TARGET)-syms $(prefix)/boot
-       $(INSTALL_DIR) $(prefix)/usr/include/xen/io
-       $(INSTALL_DATA) include/public/*.h $(prefix)/usr/include/xen
-       $(INSTALL_DATA) include/public/io/*.h $(prefix)/usr/include/xen/io
-       $(INSTALL_DATA) include/public/COPYING $(prefix)/usr/include/xen
+       $(INSTALL_DIR) $(DESTDIR)/boot
+       $(INSTALL_DATA) $(TARGET).gz $(DESTDIR)/boot
+       $(INSTALL_DATA) $(TARGET)-syms $(DESTDIR)/boot
+       $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/io
+       $(INSTALL_DATA) include/public/*.h $(DESTDIR)/usr/include/xen
+       $(INSTALL_DATA) include/public/io/*.h $(DESTDIR)/usr/include/xen/io
+       $(INSTALL_DATA) include/public/COPYING $(DESTDIR)/usr/include/xen

-dist: $(TARGET)
-       $(MAKE) prefix=`pwd`/../dist/install dist=yes install
+dist: install

 clean: tools.clean common.clean drivers.clean arch/$(TARGET_ARCH).clean
        rm -f include/asm *.o $(TARGET)* *~ core include/xen/compile.h
--- xen-2.0.3.orig/tools/python/Makefile
+++ xen-2.0.3/tools/python/Makefile
@@ -3,12 +3,10 @@
        python setup.py build

 install: all
-       if [ "$(prefix)" = "" ]; then                   \
+       if [ "$(DESTDIR)" = "" ]; then                   \
            python setup.py install;                    \
-       elif [ "$(dist)" = "yes" ]; then                \
-           python setup.py install --home="$(prefix)"; \
        else                                            \
-           python setup.py install --root="$(prefix)"; \
+           python setup.py install --root="$(DESTDIR)"; \
        fi

 clean:
--- xen-2.0.3.orig/tools/libxutil/Makefile
+++ xen-2.0.3/tools/libxutil/Makefile
@@ -72,10 +72,10 @@
        fi

 install: all
-       $(INSTALL_DIR) -p $(prefix)/usr/lib
-       $(INSTALL_PROG) $(LIB) $(prefix)/usr/lib
-       ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) 
$(prefix)/usr/lib/$(LIB_NAME).so.$(MAJOR)
-       ln -sf $(LIB_NAME).so.$(MAJOR) $(prefix)/usr/lib/$(LIB_NAME).so
+       $(INSTALL_DIR) -p $(DESTDIR)/usr/lib
+       $(INSTALL_PROG) $(LIB) $(DESTDIR)/usr/lib
+       ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) 
$(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR)
+       ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so

 clean:
        $(RM) *.a *.so *.so.* *.o *.opic *.rpm
--- xen-2.0.3.orig/tools/libxc/Makefile
+++ xen-2.0.3/tools/libxc/Makefile
@@ -68,12 +68,12 @@
          ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )

 install: all
-       $(INSTALL_DIR) $(prefix)/usr/lib
-       $(INSTALL_DIR) $(prefix)/usr/include
-       $(INSTALL_PROG) $(LIB) $(prefix)/usr/lib
-       ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) 
$(prefix)/usr/lib/$(LIB_NAME).so.$(MAJOR)
-       ln -sf $(LIB_NAME).so.$(MAJOR) $(prefix)/usr/lib/$(LIB_NAME).so
-       $(INSTALL_DATA) xc.h $(prefix)/usr/include
+       $(INSTALL_DIR) $(DESTDIR)/usr/lib
+       $(INSTALL_DIR) $(DESTDIR)/usr/include
+       $(INSTALL_PROG) $(LIB) $(DESTDIR)/usr/lib
+       ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) 
$(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR)
+       ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so
+       $(INSTALL_DATA) xc.h $(DESTDIR)/usr/include

 clean:
        rm -rf *.a *.so *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
--- xen-2.0.3.orig/tools/sv/Makefile
+++ xen-2.0.3/tools/sv/Makefile
@@ -1,4 +1,4 @@
-sv_insdir      := $(prefix)/var/lib/xen/sv
+sv_insdir := /var/lib/xen/sv
 INSTALL                = install
 INSTALL_DIR    = $(INSTALL) -d -m0755
 INSTALL_DATA   = $(INSTALL) -m0644
@@ -17,16 +17,16 @@

 install:
        # copy XenSV Main.rpy file
-       @$(INSTALL_DIR) $(sv_insdir)
-       @$(INSTALL_DATA) Main.rpy $(sv_insdir)
+       @$(INSTALL_DIR) $(DESTDIR)$(sv_insdir)
+       @$(INSTALL_DATA) Main.rpy $(DESTDIR)$(sv_insdir)

        # copy XenSV images
-       @($(INSTALL_DIR) $(sv_insdir)/images
-       @(cd images && $(INSTALL_DATA) $(IMAGES) $(sv_insdir)/images)
+       @$(INSTALL_DIR) $(DESTDIR)$(sv_insdir)/images
+       @(cd images && $(INSTALL_DATA) $(IMAGES) $(DESTDIR)$(sv_insdir)/images)

        # copy XenSV stylesheet
-       @$(INSTALL_DIR) $(sv_insdir)/inc
-       @$(INSTALL_DATA) inc/style.css inc/script.js $(sv_insdir)/inc
+       @$(INSTALL_DIR) $(DESTDIR)$(sv_insdir)/inc
+       @$(INSTALL_DATA) inc/style.css inc/script.js $(DESTDIR)$(sv_insdir)/inc

 clean:

--- xen-2.0.3.orig/tools/misc/miniterm/Makefile
+++ xen-2.0.3/tools/misc/miniterm/Makefile
@@ -9,8 +9,8 @@
 all: $(TARGET)

 install: all
-       $(INSTALL_DIR) $(prefix)/usr/bin
-       $(INSTALL_PROG) $(TARGET) $(prefix)/usr/bin
+       $(INSTALL_DIR) $(DESTDIR)/usr/bin
+       $(INSTALL_PROG) $(TARGET) $(DESTDIR)/usr/bin

 clean:
        $(RM) *.o $(TARGET) *~
--- xen-2.0.3.orig/tools/misc/Makefile
+++ xen-2.0.3/tools/misc/Makefile
@@ -23,10 +23,10 @@
        $(MAKE) -C miniterm

 install: all
-       $(INSTALL_DIR) $(prefix)/usr/bin
-       $(INSTALL_DIR) $(prefix)/usr/sbin
-       $(INSTALL_PROG) $(INSTALL_BIN) $(prefix)/usr/bin
-       $(INSTALL_PROG) $(INSTALL_SBIN) $(prefix)/usr/sbin
+       $(INSTALL_DIR) $(DESTDIR)/usr/bin
+       $(INSTALL_DIR) $(DESTDIR)/usr/sbin
+       $(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin
+       $(INSTALL_PROG) $(INSTALL_SBIN) $(DESTDIR)/usr/sbin
        $(MAKE) -C miniterm install

 clean:
--- xen-2.0.3.orig/tools/xentrace/Makefile
+++ xen-2.0.3/tools/xentrace/Makefile
@@ -24,12 +24,12 @@
 all: $(BIN)

 install: all
-       $(INSTALL_DIR) $(prefix)/usr/bin
-       $(INSTALL_DIR) $(prefix)/usr/man/man1
-       $(INSTALL_DIR) $(prefix)/usr/man/man8
-       $(INSTALL_PROG) $(BIN) $(SCRIPTS) $(prefix)/usr/bin
-       $(INSTALL_DATA) $(MAN1) $(prefix)/usr/man/man1
-       $(INSTALL_DATA) $(MAN8) $(prefix)/usr/man/man8
+       $(INSTALL_DIR) $(DESTDIR)/usr/bin
+       $(INSTALL_DIR) $(DESTDIR)/usr/man/man1
+       $(INSTALL_DIR) $(DESTDIR)/usr/man/man8
+       $(INSTALL_PROG) $(BIN) $(SCRIPTS) $(DESTDIR)/usr/bin
+       $(INSTALL_DATA) $(MAN1) $(DESTDIR)/usr/man/man1
+       $(INSTALL_DATA) $(MAN8) $(DESTDIR)/usr/man/man8

 clean:
        $(RM) *.a *.so *.o *.rpm $(BIN)
--- xen-2.0.3.orig/tools/examples/Makefile
+++ xen-2.0.3/tools/examples/Makefile
@@ -25,23 +25,23 @@
 install: all install-initd install-configs install-scripts

 install-initd:
-       $(INSTALL_DIR) $(prefix)/etc/init.d
-       $(INSTALL_PROG) $(XEND_INITD) $(prefix)/etc/init.d
-       $(INSTALL_PROG) $(XENDOMAINS_INITD) $(prefix)/etc/init.d
+       $(INSTALL_DIR) $(DESTDIR)/etc/init.d
+       $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d
+       $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)/etc/init.d

 install-configs:
-       $(INSTALL_DIR) $(prefix)$(XEN_CONFIG_DIR)
-       $(INSTALL_DIR) $(prefix)$(XEN_CONFIG_DIR)/auto
+       $(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
+       $(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)/auto
        for i in $(XEN_CONFIGS); \
-           do [ -a $(prefix)/$(XEN_CONFIG_DIR)/$$i ] || \
-           $(INSTALL_DATA) $$i $(prefix)$(XEN_CONFIG_DIR); \
+           do [ -a $(DESTDIR)/$(XEN_CONFIG_DIR)/$$i ] || \
+           $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \
        done

 install-scripts:
-       $(INSTALL_DIR) $(prefix)$(XEN_SCRIPT_DIR)
+       $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
        for i in $(XEN_SCRIPTS); \
-           do [ -a $(prefix)/$()/$$i ] || \
-           $(INSTALL_PROG) $$i $(prefix)$(XEN_SCRIPT_DIR); \
+           do [ -a $(DESTDIR)/$()/$$i ] || \
+           $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
        done

 clean:
--- xen-2.0.3.orig/tools/xfrd/Makefile
+++ xen-2.0.3/tools/xfrd/Makefile
@@ -72,8 +72,8 @@

 .PHONY: install
 install: xfrd
-       $(INSTALL_DIR) $(prefix)/$(XFRD_INSTALL_DIR)
-       $(INSTALL_PROG) xfrd $(prefix)/$(XFRD_INSTALL_DIR)
+       $(INSTALL_DIR) $(DESTDIR)/$(XFRD_INSTALL_DIR)
+       $(INSTALL_PROG) xfrd $(DESTDIR)/$(XFRD_INSTALL_DIR)

 .PHONY: libutil
 libutil: $(UTIL_LIB)
--- xen-2.0.3.orig/docs/Makefile
+++ xen-2.0.3/docs/Makefile
@@ -11,7 +11,8 @@
 LATEX2HTML     := latex2html

 package                = xen
-docdir         = /usr/share/doc
+prefix         = /usr
+docdir         = $(prefix)/share/doc
 pkgdocdir      = $(docdir)/$(package)

 DOC_TEX                := $(wildcard src/*.tex)
@@ -37,11 +38,11 @@
        rm -rf $(GFX) ps pdf html

 install: all
-       rm -rf $(prefix)$(pkgdocdir)
-       $(INSTALL_DIR) $(prefix)$(pkgdocdir)
-       cp -dR ps $(prefix)$(pkgdocdir)
-       cp -dR pdf $(prefix)$(pkgdocdir)
-       cp -dR html $(prefix)$(pkgdocdir)
+       rm -rf $(DESTDIR)$(pkgdocdir)
+       $(INSTALL_DIR) $(DESTDIR)$(pkgdocdir)
+       cp -dR ps $(DESTDIR)$(pkgdocdir)
+       cp -dR pdf $(DESTDIR)$(pkgdocdir)
+       cp -dR html $(DESTDIR)$(pkgdocdir)

 pdf/%.pdf: ps/%.ps
        $(INSTALL_DIR) $(@D)
--- xen-2.0.3.orig/buildconfigs/mk.linux-2.4-xen0
+++ xen-2.0.3/buildconfigs/mk.linux-2.4-xen0
@@ -15,9 +15,9 @@
 build: $(LINUX_DIR)/include/linux/autoconf.h
        if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \
            $(MAKE) -C $(LINUX_DIR) ARCH=xen modules ; \
-           $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) 
modules_install ; \
+           $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(DESTDIR) 
modules_install ; \
        fi
-       $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install
+       $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install

 patches/tmp/ebtables.diff:
        mkdir -p patches/tmp
--- xen-2.0.3.orig/buildconfigs/mk.linux-2.4-xenU
+++ xen-2.0.3/buildconfigs/mk.linux-2.4-xenU
@@ -15,9 +15,9 @@
 build: $(LINUX_DIR)/include/linux/autoconf.h
        if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \
            $(MAKE) -C $(LINUX_DIR) ARCH=xen modules ; \
-           $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) 
modules_install ; \
+           $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(DESTDIR) 
modules_install ; \
        fi
-       $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install
+       $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install

 $(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
        rm -rf $(LINUX_DIR)
--- xen-2.0.3.orig/buildconfigs/mk.linux-2.6-xenU
+++ xen-2.0.3/buildconfigs/mk.linux-2.6-xenU
@@ -15,9 +15,9 @@
 build: $(LINUX_DIR)/include/linux/autoconf.h
        if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \
            $(MAKE) -C $(LINUX_DIR) ARCH=xen modules ; \
-           $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) 
modules_install ; \
+           $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(DESTDIR) 
modules_install ; \
        fi
-       $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install
+       $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install

 $(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
        rm -rf $(LINUX_DIR)
--- xen-2.0.3.orig/buildconfigs/mk.linux-2.6-xen0
+++ xen-2.0.3/buildconfigs/mk.linux-2.6-xen0
@@ -15,9 +15,9 @@
 build: $(LINUX_DIR)/include/linux/autoconf.h
        if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \
            $(MAKE) -C $(LINUX_DIR) ARCH=xen modules ; \
-           $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) 
modules_install ; \
+           $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_MOD_PATH=$(DESTDIR) 
modules_install ; \
        fi
-       $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install
+       $(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install

 $(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
        rm -rf $(LINUX_DIR)
--- xen-2.0.3.orig/Makefile
+++ xen-2.0.3/Makefile
@@ -2,8 +2,9 @@
 # Grand Unified Makefile for Xen.
 #

-DIST_DIR    ?= $(shell pwd)/dist
-INSTALL_DIR ?= $(DIST_DIR)/install
+DIST_DIR       := $(CURDIR)/dist
+DESTDIR                := $(DIST_DIR)/install
+
 INSTALL                := install
 INSTALL_DIR    := $(INSTALL) -d -m0755
 INSTALL_DATA   := $(INSTALL) -m0644
@@ -18,7 +19,7 @@
 XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst 
buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) )


-export INSTALL_DIR
+export DESTDIR

 include buildconfigs/Rules.mk

@@ -56,10 +58,10 @@
        $(INSTALL_PROG) tools/check/chk tools/check/check_* $(DIST_DIR)/check

 xen:
-       $(MAKE) prefix=$(INSTALL_DIR) dist=yes -C xen install
+       $(MAKE) dist=yes -C xen install

 tools:
-       $(MAKE) prefix=$(INSTALL_DIR) dist=yes -C tools install
+       $(MAKE) dist=yes -C tools install

 kernels: $(addsuffix -build,$(XKERNELS))


===



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.