Browse Source

'build' scripts before installing.

Earlier we renamed git-foo.sh to git-foo while installing, which
was mostly done by inertia than anything else.  This however
made writing tests to use scripts harder.

This patch builds the scripts the same way as we build binaries
from their sources.  As a side effect, you can now specify
non-standard paths you have your Perl binary is in when running
the make.

Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Junio C Hamano 19 years ago
parent
commit
bc6146d2ab
  1. 44
      Makefile
  2. 0
      git.sh
  3. 2
      t/t1005-read-tree-m-2way-emu23.sh
  4. 6
      t/t3200-branch.sh
  5. 6
      t/t5400-send-pack.sh

44
Makefile

@ -142,6 +142,13 @@ ifeq ($(shell uname -s),SunOS)
PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1 PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
endif endif


ifndef SHELL_PATH
SHELL_PATH = /bin/sh
endif
ifndef PERL_PATH
PERL_PATH = /usr/bin/perl
endif

ifndef NO_OPENSSL ifndef NO_OPENSSL
LIB_OBJS += epoch.o LIB_OBJS += epoch.o
OPENSSL_LIBSSL = -lssl OPENSSL_LIBSSL = -lssl
@ -179,21 +186,32 @@ endif


DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)' DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'


SCRIPTS = $(SCRIPT_SH) $(SCRIPT_PERL) gitk SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.perl,%,$(SCRIPT_PERL)) gitk


### Build rules ### Build rules


all: $(PROGRAMS) git.sh all: $(PROGRAMS) $(SCRIPTS)


all: all:
$(MAKE) -C templates $(MAKE) -C templates


git.sh: git.sh.in Makefile git: git.sh Makefile
rm -f $@+ $@ rm -f $@+ $@
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.in >$@+ sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
chmod +x $@+ chmod +x $@+
mv $@+ $@ mv $@+ $@


$(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
rm -f $@
sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh >$@
chmod +x $@

$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
rm -f $@
sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@
chmod +x $@

%.o: %.c %.o: %.c
$(CC) -o $*.o -c $(ALL_CFLAGS) $< $(CC) -o $*.o -c $(ALL_CFLAGS) $<
%.o: %.S %.o: %.S
@ -250,19 +268,8 @@ check:


install: $(PROGRAMS) $(SCRIPTS) install: $(PROGRAMS) $(SCRIPTS)
$(INSTALL) -m755 -d $(DESTDIR)$(bindir) $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
$(INSTALL) $(PROGRAMS) $(DESTDIR)$(bindir) $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
@for s in $(SCRIPTS); \ $(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
do \
case "$$s" in \
*.*) \
e=`expr "$$s" : '\(.*\)\.[^.]*$$'` ;; \
*) \
e="$$s" ;; \
esac && \
echo ": install $$s $(DESTDIR)$(bindir)/$$e" && \
$(INSTALL) $$s $(DESTDIR)$(bindir)/$$e || exit; \
done
$(INSTALL) git-revert.sh $(DESTDIR)$(bindir)/git-cherry-pick
sh ./cmd-rename.sh $(DESTDIR)$(bindir) sh ./cmd-rename.sh $(DESTDIR)$(bindir)
$(MAKE) -C templates install $(MAKE) -C templates install


@ -299,7 +306,8 @@ deb: dist


clean: clean:
rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE) rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE)
rm -f git-core.spec git.sh rm -f $(filter-out gitk,$(SCRIPTS))
rm -f git-core.spec
rm -rf $(GIT_TARNAME) rm -rf $(GIT_TARNAME)
rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc

0
git.sh.in → git.sh

2
t/t1005-read-tree-m-2way-emu23.sh

@ -25,7 +25,7 @@ In the test, these paths are used:
read_tree_twoway () { read_tree_twoway () {
git-read-tree --emu23 "$1" "$2" && git-read-tree --emu23 "$1" "$2" &&
git-ls-files --stage && git-ls-files --stage &&
git-merge-index ../../git-merge-one-file.sh -a && git-merge-index git-merge-one-file -a &&
git-ls-files --stage git-ls-files --stage
} }



6
t/t3200-branch.sh

@ -13,12 +13,12 @@ handled. Specifically, that a bogus branch is not created.
test_expect_success \ test_expect_success \
'prepare an trivial repository' \ 'prepare an trivial repository' \
'echo Hello > A && 'echo Hello > A &&
../../git-update-index --add A && git-update-index --add A &&
../../git-commit.sh -m "Initial commit."' git-commit -m "Initial commit."'


test_expect_failure \ test_expect_failure \
'git branch --help should return error code' \ 'git branch --help should return error code' \
'../../git-branch.sh --help' 'git-branch --help'


test_expect_failure \ test_expect_failure \
'git branch --help should not have created a bogus branch' \ 'git branch --help should not have created a bogus branch' \

6
t/t5400-send-pack.sh

@ -21,9 +21,9 @@ test_expect_success setup '
parent=$commit || return 1 parent=$commit || return 1
done && done &&
echo "$commit" >.git/HEAD && echo "$commit" >.git/HEAD &&
git-clone.sh -l ./. victim && git-clone -l ./. victim &&
cd victim && cd victim &&
git-log.sh && git-log &&
cd .. && cd .. &&
echo $zero >.git/HEAD && echo $zero >.git/HEAD &&
parent=$zero && parent=$zero &&
@ -35,7 +35,7 @@ test_expect_success setup '
done && done &&
echo "$commit" >.git/HEAD && echo "$commit" >.git/HEAD &&
echo Rebase && echo Rebase &&
git-log.sh' git-log'


test_expect_success \ test_expect_success \
'pushing rewound head should not barf but require --force' ' 'pushing rewound head should not barf but require --force' '

Loading…
Cancel
Save