Skip to content

Commit f848718

Browse files
raalkmlJunio C Hamano
authored and
Junio C Hamano
committed
Make perl/ build procedure ActiveState friendly.
On Cygwin + ActivateState Perl, Makefile generated with MakeMaker is not usable because of line-endings and back-slashes. This teaches perl/Makefile to write a handcrafted equivalent perl.mak file with 'make NO_PERL_MAKEMAKER=NoThanks'. Signed-off-by: Alex Riesen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 396db81 commit f848718

File tree

3 files changed

+57
-7
lines changed

3 files changed

+57
-7
lines changed

Makefile

+16-6
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ all:
9191
#
9292
# Define USE_STDEV below if you want git to care about the underlying device
9393
# change being considered an inode change from the update-cache perspective.
94+
#
95+
# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
96+
# MakeMaker (e.g. using ActiveState under Cygwin).
97+
#
9498

9599
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
96100
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -539,6 +543,9 @@ endif
539543
ifdef NO_ACCURATE_DIFF
540544
BASIC_CFLAGS += -DNO_ACCURATE_DIFF
541545
endif
546+
ifdef NO_PERL_MAKEMAKER
547+
export NO_PERL_MAKEMAKER
548+
endif
542549

543550
# Shell quote (do not use $(call) to accommodate ancient setups);
544551

@@ -568,8 +575,8 @@ export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
568575

569576
all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi
570577

571-
all: perl/Makefile
572-
$(MAKE) -C perl
578+
all:
579+
$(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
573580
$(MAKE) -C templates
574581

575582
strip: $(PROGRAMS) git$X
@@ -602,7 +609,11 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
602609
chmod +x $@+
603610
mv $@+ $@
604611

605-
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile
612+
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
613+
614+
perl/perl.mak: GIT-CFLAGS
615+
$(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
616+
606617
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
607618
rm -f $@ $@+
608619
INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
@@ -796,7 +807,7 @@ install: all
796807
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
797808
$(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)'
798809
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
799-
$(MAKE) -C perl install
810+
$(MAKE) -C perl prefix='$(prefix_SQ)' install
800811
if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
801812
then \
802813
ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
@@ -866,8 +877,7 @@ clean:
866877
rm -f $(htmldocs).tar.gz $(manpages).tar.gz
867878
rm -f gitweb/gitweb.cgi
868879
$(MAKE) -C Documentation/ clean
869-
[ ! -f perl/Makefile ] || $(MAKE) -C perl/ clean || $(MAKE) -C perl/ clean
870-
rm -f perl/ppport.h perl/Makefile.old
880+
$(MAKE) -C perl clean
871881
$(MAKE) -C templates/ clean
872882
$(MAKE) -C t/ clean
873883
rm -f GIT-VERSION-FILE GIT-CFLAGS

perl/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Makefile
1+
perl.mak
2+
perl.mak.old
23
blib
34
blibdirs
45
pm_to_blib

perl/Makefile

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# Makefile for perl support modules and routine
3+
#
4+
makfile:=perl.mak
5+
6+
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
7+
prefix_SQ = $(subst ','\'',$(prefix))
8+
9+
all install instlibdir: $(makfile)
10+
$(MAKE) -f $(makfile) $@
11+
12+
clean:
13+
test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0
14+
$(RM) ppport.h
15+
$(RM) $(makfile)
16+
$(RM) $(makfile).old
17+
18+
ifdef NO_PERL_MAKEMAKER
19+
instdir_SQ = $(subst ','\'',$(prefix)/lib)
20+
$(makfile): ../GIT-CFLAGS Makefile
21+
echo all: > $@
22+
echo ' :' >> $@
23+
echo install: >> $@
24+
echo ' mkdir -p $(instdir_SQ)' >> $@
25+
echo ' $(RM) $(instdir_SQ)/Git.pm; cp Git.pm $(instdir_SQ)' >> $@
26+
echo ' $(RM) $(instdir_SQ)/Error.pm; \
27+
cp private-Error.pm $(instdir_SQ)/Error.pm' >> $@
28+
echo instlibdir: >> $@
29+
echo ' echo $(instdir_SQ)' >> $@
30+
else
31+
$(makfile): Makefile.PL ../GIT-CFLAGS
32+
'$(PERL_PATH_SQ)' $< FIRST_MAKEFILE='$@' PREFIX='$(prefix_SQ)'
33+
endif
34+
35+
# this is just added comfort for calling make directly in perl dir
36+
# (even though GIT-CFLAGS aren't used yet. If ever)
37+
../GIT-CFLAGS:
38+
$(MAKE) -C .. GIT-CFLAGS
39+

0 commit comments

Comments
 (0)