Skip to content

Commit

Permalink
When installing, be prepared that template_dir may be relative.
Browse files Browse the repository at this point in the history
Since the Makefile in the template/ subdirectory is only used to install
the templates, we do not simply pass down the setting of template_dir
when it is relative, but construct the intended destination in a new
variable: A relative template_dir is relative to gitexecdir.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
  • Loading branch information
Johannes Sixt committed Jun 26, 2008
1 parent 8512439 commit 0b50b86
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ GITWEB_FAVICON = git-favicon.png
GITWEB_SITE_HEADER =
GITWEB_SITE_FOOTER =

export prefix bindir gitexecdir sharedir template_dir htmldir sysconfdir
export prefix bindir gitexecdir sharedir htmldir sysconfdir

CC = gcc
AR = ar
Expand Down Expand Up @@ -1297,6 +1297,13 @@ remove-dashes:

### Installation rules

ifeq ($(firstword $(subst /, ,$(template_dir))),..)
template_instdir = $(gitexecdir)/$(template_dir)
else
template_instdir = $(template_dir)
endif
export template_instdir

install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
Expand Down
8 changes: 4 additions & 4 deletions templates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ INSTALL ?= install
TAR ?= tar
RM ?= rm -f
prefix ?= $(HOME)
template_dir ?= $(prefix)/share/git-core/templates
template_instdir ?= $(prefix)/share/git-core/templates
# DESTDIR=

# Shell quote (do not use $(call) to accommodate ancient setups);
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
template_dir_SQ = $(subst ','\'',$(template_dir))
template_instdir_SQ = $(subst ','\'',$(template_instdir))

all: boilerplates.made custom

Expand Down Expand Up @@ -46,6 +46,6 @@ clean:
$(RM) -r blt boilerplates.made

install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_dir_SQ)'
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
(cd blt && $(TAR) cf - .) | \
(cd '$(DESTDIR_SQ)$(template_dir_SQ)' && umask 022 && $(TAR) xf -)
(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xf -)

0 comments on commit 0b50b86

Please sign in to comment.