Support installation to chroot and allows easier settings lib64 for plugins

Hi,
I attached patch with allows easier packaging of emelfm2. It is needed
correct lib directory on 64-bit machines for some distros and also
installation to chroot.
Josef Reidinger
--- emelfm2-0.6.0/Makefile.old  2009-05-05 17:59:32.000000000 +0200
+++ emelfm2-0.6.0/Makefile      2009-05-12 15:15:15.000000000 +0200
@@ -241,44 +241,44 @@
 
 install: all install_plugins
        @echo "installing $(TARGET) to prefix '$(PREFIX)'"
-       @install -d -m 755 $(BIN_DIR)
-       @install -m 755 $(TARGET) $(BIN_DIR)
-       @install -d $(ICON_DIR)
+       @install -d -m 755 $(DESTDIR)$(BIN_DIR)
+       @install -m 755 $(TARGET) $(DESTDIR)$(BIN_DIR)
+       @install -d $(DESTDIR)$(ICON_DIR)
        @for file in `ls $(ICONS)/ |grep -v svn`; do \
-               install -m 644 $(ICONS)/$$file $(ICON_DIR); \
+               install -m 644 $(ICONS)/$$file $(DESTDIR)$(ICON_DIR); \
        done
-       @install -d $(DOC_DIR)
+       @install -d $(DESTDIR)$(DOC_DIR)
        @for file in `ls $(DOCS)/ |grep -v svn |grep -v desktop_environment 
|grep -v api |grep -v $(TARGET).1`; do \
-               install -m 644 $(DOCS)/$$file $(DOC_DIR); \
+               install -m 644 $(DOCS)/$$file $(DESTDIR)$(DOC_DIR); \
        done
-       @install -d $(MAN_DIR)
-       @install -m 644 $(DOCS)/$(TARGET).1 $(MAN_DIR);
+       @install -d $(DESTDIR)$(MAN_DIR)
+       @install -m 644 $(DOCS)/$(TARGET).1 $(DESTDIR)$(MAN_DIR);
 #      @bzip2 -f $(MAN_DIR)/$(TARGET).1;
 
 ifeq ($(XDG_INTEGRATION), 1)
-       @install -d $(XDG_DESKTOP_DIR)
-       @install -m 644 $(DOCS)/desktop_environment/$(TARGET).desktop 
$(XDG_DESKTOP_DIR)
-       @install -d $(XDG_APPLICATION_DIR)
-       @install -m 644 $(DOCS)/desktop_environment/$(TARGET).applications 
$(XDG_APPLICATION_DIR)
+       @install -d $(DESTDIR)$(XDG_DESKTOP_DIR)
+       @install -m 644 $(DOCS)/desktop_environment/$(TARGET).desktop 
$(DESTDIR)$(XDG_DESKTOP_DIR)
+       @install -d $(DESTDIR)$(XDG_APPLICATION_DIR)
+       @install -m 644 $(DOCS)/desktop_environment/$(TARGET).applications 
$(DESTDIR)$(XDG_APPLICATION_DIR)
 endif
 # no i18n install unless specific target used
 
 install_plugins: plugins
        @echo "installing plugins to prefix '$(PREFIX)'"
-       @install -d $(PLUGINS_DIR)
+       @install -d $(DESTDIR)$(PLUGINS_DIR)
        @for file in "$(LIBS_OBJECTS) $(LIBS_XOBJECTS)"; do \
-               install -c -m 755 $$file $(PLUGINS_DIR); \
+               install -c -m 755 $$file $(DESTDIR)$(PLUGINS_DIR); \
        done
-       @install -d $(ICON_DIR)
+       @install -d $(DESTDIR)$(ICON_DIR)
 #FIXME also handle svg icons etc
 ifeq ($(WITH_THUMBS),1)
-       @install -c -m 644 $(OPTLIBS)/$(ICONFILEPREFIX)$(BASENAME1)_48.png 
$(ICON_DIR);
+       @install -c -m 644 $(OPTLIBS)/$(ICONFILEPREFIX)$(BASENAME1)_48.png 
$(DESTDIR)$(ICON_DIR);
 endif
 ifeq ($(WITH_TRACKER),1)
-       @install -c -m 644 $(OPTLIBS)/$(ICONFILEPREFIX)$(BASENAME2)_48.png 
$(ICON_DIR);
+       @install -c -m 644 $(OPTLIBS)/$(ICONFILEPREFIX)$(BASENAME2)_48.png 
$(DESTDIR)$(ICON_DIR);
 endif
 ifeq ($(WITH_ACL),1)
-       @install -c -m 644 $(OPTLIBS)/$(ICONFILEPREFIX)$(BASENAME3)_48.png 
$(ICON_DIR);
+       @install -c -m 644 $(OPTLIBS)/$(ICONFILEPREFIX)$(BASENAME3)_48.png 
$(DESTDIR)$(ICON_DIR);
 endif
 
 uninstall: uninstall_plugins
--- emelfm2-0.6.0/Makefile.config.old   2009-05-12 15:10:44.000000000 +0200
+++ emelfm2-0.6.0/Makefile.config       2009-05-12 15:16:01.000000000 +0200
@@ -161,9 +161,11 @@
 TARGET = emelfm2
 
 #as well as 'make' usage, all in-code uses of these paths assumes they're 
localised
+DESTDIR ?= /
 PREFIX ?= /usr/local
 BIN_DIR ?= $(PREFIX)/bin
-PLUGINS_DIR ?= $(PREFIX)/lib/$(TARGET)/plugins
+LIB_DIR ?= $(PREFIX)/lib
+PLUGINS_DIR ?= $(LIB_DIR)/$(TARGET)/plugins
 #FIXME by default, apps should look for icons in $XDG_DATA_DIRS/icons
 # and in /usr/share/pixmaps (in that order).
 ICON_DIR ?= $(PREFIX)/share/pixmaps/$(TARGET)

Other related posts: