Add DESTDIR support. Patch by Alucryd. Closes #1376.

Originally committed to SVN as r6198.
This commit is contained in:
Thomas Goyne 2012-01-08 01:03:45 +00:00
parent 58d6ac1fad
commit c4251bd181
4 changed files with 24 additions and 25 deletions

View file

@ -1,7 +1,6 @@
# *** THERE ARE NO USER-EDITABLE ITEMS HERE. ***
#
# TODO:
# * DESTDIR= support for make install.
# * Allow variables to be overridden on the CL.
.PHONY: all install clean subdirs $(SUBDIRS)
@ -66,30 +65,30 @@ install: $(SUBDIRS) install-share install-program install-lib
install-program:
ifdef PROGRAM_INSTALL
@$(BIN_MKDIR) -p $(P_BINDIR)
@$(BIN_INSTALL) $(PROGRAM) $(P_BINDIR)/$(PROGRAM)
@$(BIN_MKDIR) -p $(DESTDIR)$(P_BINDIR)
@$(BIN_INSTALL) $(PROGRAM) $(DESTDIR)$(P_BINDIR)/$(PROGRAM)
endif
install-lib:
ifdef LIB_SHARED_INSTALL
$(BIN_MKDIR) -p $(P_LIB)
$(BIN_INSTALL) $(LIB_SHARED_FULL) $(P_LIB)/$(LIB_SHARED_FULL)
$(BIN_LN) -sf $(LIB_SHARED_FULL) $(P_LIB)/$(LIB_SHARED)
$(BIN_MKDIR) -p $(DESTDIR)$(P_LIB)
$(BIN_INSTALL) $(LIB_SHARED_FULL) $(DESTDIR)$(P_LIB)/$(LIB_SHARED_FULL)
$(BIN_LN) -sf $(LIB_SHARED_FULL) $(DESTDIR)$(P_LIB)/$(LIB_SHARED)
endif
install-share:
ifdef DATA_SHARE
@$(BIN_MKDIR) -p $(addprefix $(P_DATA)/, $(dir $(DATA_SHARE)))
@$(BIN_MKDIR) -p $(addprefix $(DESTDIR)$(P_DATA)/, $(dir $(DATA_SHARE)))
@for i in $(DATA_SHARE); do \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_DATA)/$$i"; \
$(BIN_INSTALL) $$i $(P_DATA)/$$i; \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/$$i"; \
$(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/$$i; \
done
endif
ifdef DATA_SHARE_DOC
@$(BIN_MKDIR) -p $(addprefix $(P_DOC)/, $(dir $(DATA_SHARE_DOC)))
@$(BIN_MKDIR) -p $(addprefix $(DESTDIR)$(P_DOC)/, $(dir $(DATA_SHARE_DOC)))
@for i in $(DATA_SHARE_DOC); do \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_DOC)/$$i"; \
$(BIN_INSTALL) $$i $(P_DOC)/$$i; \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_DOC)/$$i"; \
$(BIN_INSTALL) $$i $(DESTDIR)$(P_DOC)/$$i; \
done
endif

View file

@ -35,10 +35,10 @@ all: ;
install: install-share
@$(BIN_MKDIR) -p $(addprefix $(P_DATA)/automation/, $(dir $(DATA_AUTOMATION)))
@$(BIN_MKDIR) -p $(addprefix $(DESTDIR)$(P_DATA)/automation/, $(dir $(DATA_AUTOMATION)))
@for i in $(DATA_AUTOMATION); do \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_DATA)/automation/$$i"; \
$(BIN_INSTALL) $$i $(P_DATA)/automation/$$i; \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/automation/$$i"; \
$(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/automation/$$i; \
done
DATA_SHARE_DOC = $(DATA_GENERAL_DOC) $(DATA_AUTOMATION_DOC)

View file

@ -31,19 +31,19 @@ EXTRA_DIST = \
install: install-desktop install-icons
install-desktop:
@$(BIN_MKDIR) -p $(P_DESKTOP)
$(BIN_INSTALL) $(DESKTOP_FILE) $(P_DESKTOP)/$(DESKTOP_FILE)
@$(BIN_MKDIR) -p $(DESTDIR)$(P_DESKTOP)
$(BIN_INSTALL) $(DESKTOP_FILE) $(DESTDIR)$(P_DESKTOP)/$(DESKTOP_FILE)
install-icons:
@$(BIN_MKDIR) -p $(addprefix $(P_ICON)/hicolor/, $(dir $(ICON_HICOLOR)))
@for i in $(ICON_HICOLOR); do \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_ICON)/hicolor/$$i"; \
$(BIN_INSTALL) $$i $(P_ICON)/hicolor/$$i; \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_ICON)/hicolor/$$i"; \
$(BIN_INSTALL) $$i $(DESTDIR)$(P_ICON)/hicolor/$$i; \
done
$(BIN_TOUCH) $(P_ICON)/hicolor
$(BIN_MKDIR) -p $(P_ICON)/hicolor/scalable/apps
$(BIN_CP) $(ICON_SCALABLE) $(P_ICON)/hicolor/$(ICON_SCALABLE)
$(BIN_TOUCH) $(DESTDIR)$(P_ICON)/hicolor
$(BIN_MKDIR) -p $(DESTDIR)$(P_ICON)/hicolor/scalable/apps
$(BIN_CP) $(ICON_SCALABLE) $(DESTDIR)$(P_ICON)/hicolor/$(ICON_SCALABLE)
CLEANFILES = aegisub.desktop

View file

@ -35,10 +35,10 @@ all: $(MO)
$(BIN_MSGFMT) -o $@ $<
install:
@$(BIN_MKDIR) -p $(addsuffix /LC_MESSAGES/, $(addprefix $(P_LOCALE)/, $(basename $(PO))))
@$(BIN_MKDIR) -p $(addsuffix /LC_MESSAGES/, $(addprefix $(DESTDIR)$(P_LOCALE)/, $(basename $(PO))))
@for i in $(basename $(PO)); do \
echo $(BIN_INSTALL) $$i.mo $(P_LOCALE)/$$i/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
$(BIN_INSTALL) $$i.mo $(P_LOCALE)/$$i/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
echo $(BIN_INSTALL) $$i.mo $(DESTDIR)$(P_LOCALE)/$$i/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
$(BIN_INSTALL) $$i.mo $(DESTDIR)$(P_LOCALE)/$$i/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
done