Implement 95% of the NO_PERL functionality, to build Git without any Perl support, because some Gentoo users want a Git without any Perl whatesoever (Gentoo bug #214168). Remaining bits are doing configure.ac as well as git-remote usage in: t5502-quickfetch.sh t5512-ls-remote.sh t5520-pull.sh Signed-off-by: Robin H. Johnson Bugzilla-URL: http://bugs.gentoo.org/show_bug.cgi?id=214168 diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/Makefile git-1.5.4.4/Makefile --- git-1.5.4.4.orig/Makefile 2008-03-22 15:25:24.986081000 -0700 +++ git-1.5.4.4/Makefile 2008-03-22 16:46:04.612806869 -0700 @@ -123,6 +123,8 @@ # # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's # MakeMaker (e.g. using ActiveState under Cygwin). + +# Define NO_PERL if you do not want Perl scripts at all. # # Define NO_TCLTK if you do not want Tcl/Tk GUI. # @@ -233,15 +235,18 @@ git-stash.sh \ git-help--browse.sh +SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) +ifndef NO_PERL SCRIPT_PERL = \ git-add--interactive.perl \ git-archimport.perl git-cvsimport.perl git-relink.perl \ git-cvsserver.perl git-remote.perl git-cvsexportcommit.perl \ git-send-email.perl git-svn.perl - -SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ - $(patsubst %.perl,%,$(SCRIPT_PERL)) \ - git-instaweb +SCRIPTS += $(patsubst %.perl,%,$(SCRIPT_PERL)) \ + git-instaweb +else +SCRIPT_PERL = +endif # ... and all the rest that could be moved out of bindir to gitexecdir PROGRAMS = \ @@ -276,7 +281,10 @@ ALL_PROGRAMS += git-merge-subtree$X # what 'all' will build but not install in gitexecdir -OTHER_PROGRAMS = git$X gitweb/gitweb.cgi +OTHER_PROGRAMS = git$X +ifndef NO_PERL +OTHER_PROGRAMS += gitweb/gitweb.cgi +endif # Set paths to tools early so that they can be used for version tests. ifndef SHELL_PATH @@ -570,6 +578,10 @@ endif endif +ifdef NO_PERL + BASIC_CFLAGS += -DNO_PERL +endif + ifdef ZLIB_PATH BASIC_CFLAGS += -I$(ZLIB_PATH)/include EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib) @@ -731,6 +743,11 @@ ifeq ($(TCLTK_PATH),) NO_TCLTK=NoThanks endif +ifeq ($(PERL_PATH),) +NO_PERL=NoThanks +export NO_PERL +export NO_PERL_MAKEMAKER +endif QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir QUIET_SUBDIR1 = @@ -803,7 +820,9 @@ $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) all $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all endif +ifndef NO_PERL $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all +endif $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) strip: $(PROGRAMS) git$X @@ -844,6 +863,7 @@ chmod +x $@+ && \ mv $@+ $@ +ifndef NO_PERL $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL @@ -902,6 +922,7 @@ $@.sh > $@+ && \ chmod +x $@+ && \ mv $@+ $@ +endif # NO_PERL configure: configure.ac $(QUIET_GEN)$(RM) $@ $<+ && \ @@ -1052,7 +1073,9 @@ $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)' $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install +ifndef NO_PERL $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install +endif ifndef NO_TCLTK $(MAKE) -C gitk-git install $(MAKE) -C git-gui install @@ -1141,9 +1164,11 @@ $(RM) -r $(GIT_TARNAME) .doc-tmp-dir $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz $(RM) $(htmldocs).tar.gz $(manpages).tar.gz - $(RM) gitweb/gitweb.cgi $(MAKE) -C Documentation/ clean +ifndef NO_PERL + $(RM) gitweb/gitweb.cgi $(MAKE) -C perl clean +endif $(MAKE) -C templates/ clean $(MAKE) -C t/ clean ifndef NO_TCLTK diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/builtin-add.c git-1.5.4.4/builtin-add.c --- git-1.5.4.4.orig/builtin-add.c 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/builtin-add.c 2008-03-22 15:57:31.759925335 -0700 @@ -135,6 +135,7 @@ free(seen); } +#ifndef NO_PERL static const char **validate_pathspec(int argc, const char **argv, const char *prefix) { const char **pathspec = get_pathspec(prefix, argv); @@ -170,6 +171,7 @@ free(args); return status; } +#endif static struct lock_file lock_file; @@ -182,8 +184,10 @@ OPT__DRY_RUN(&show_only), OPT__VERBOSE(&verbose), OPT_GROUP(""), +#ifndef NO_PERL OPT_BOOLEAN('i', "interactive", &add_interactive, "interactive picking"), OPT_BOOLEAN('p', "patch", &patch_interactive, "interactive patching"), +#endif OPT_BOOLEAN('f', NULL, &ignored_too, "allow adding otherwise ignored files"), OPT_BOOLEAN('u', NULL, &take_worktree_changes, "update tracked files"), OPT_BOOLEAN( 0 , "refresh", &refresh_only, "don't add, only refresh the index"), @@ -198,10 +202,12 @@ argc = parse_options(argc, argv, builtin_add_options, builtin_add_usage, 0); +#ifndef NO_PERL if (patch_interactive) add_interactive = 1; if (add_interactive) exit(interactive_add(argc, argv, prefix)); +#endif git_config(git_default_config); diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/builtin-commit.c git-1.5.4.4/builtin-commit.c --- git-1.5.4.4.orig/builtin-commit.c 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/builtin-commit.c 2008-03-22 15:58:41.139317545 -0700 @@ -96,7 +96,9 @@ OPT_GROUP("Commit contents options"), OPT_BOOLEAN('a', "all", &all, "commit all changed files"), OPT_BOOLEAN('i', "include", &also, "add specified files to index for commit"), +#ifndef NO_PERL OPT_BOOLEAN(0, "interactive", &interactive, "interactively add files"), +#endif OPT_BOOLEAN('o', "only", &only, ""), OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"), OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"), @@ -213,11 +215,13 @@ struct path_list partial; const char **pathspec = NULL; +#ifndef NO_PERL if (interactive) { interactive_add(argc, argv, prefix); commit_style = COMMIT_AS_IS; return get_index_file(); } +#endif if (read_cache() < 0) die("index file corrupt"); diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/t/lib-git-svn.sh git-1.5.4.4/t/lib-git-svn.sh --- git-1.5.4.4.orig/t/lib-git-svn.sh 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/t/lib-git-svn.sh 2008-03-22 16:02:12.797409374 -0700 @@ -6,6 +6,12 @@ test_done exit fi +if test -n "$NO_PERL" +then + test_expect_success 'skipping git-svn tests, NO_PERL defined' : + test_done + exit +fi GIT_DIR=$PWD/.git GIT_SVN_DIR=$GIT_DIR/svn/git-svn diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/t/t5505-remote.sh git-1.5.4.4/t/t5505-remote.sh --- git-1.5.4.4.orig/t/t5505-remote.sh 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/t/t5505-remote.sh 2008-03-22 16:22:58.012694493 -0700 @@ -3,6 +3,12 @@ test_description='git remote porcelain-ish' . ./test-lib.sh +if test -n "$NO_PERL" +then + test_expect_success 'skipping git-cvsimport tests, NO_PERL defined' : + test_done + exit +fi setup_repository () { mkdir "$1" && ( diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/t/t7501-commit.sh git-1.5.4.4/t/t7501-commit.sh --- git-1.5.4.4.orig/t/t7501-commit.sh 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/t/t7501-commit.sh 2008-03-22 16:14:25.513913653 -0700 @@ -38,7 +38,7 @@ "echo King of the bongo >file && git-commit -m foo -a file" -test_expect_failure \ +[ -z "$NO_PERL" ] && test_expect_failure \ "using paths with --interactive" \ "echo bong-o-bong >file && echo 7 | git-commit -m foo --interactive file" @@ -119,7 +119,7 @@ "echo 'gak' >file && \ git-commit -m 'author' --author 'Rubber Duck ' -a" -test_expect_success \ +[ -z "$NO_PERL" ] && test_expect_success \ "interactive add" \ "echo 7 | git-commit --interactive | grep 'What now'" diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/t/t9001-send-email.sh git-1.5.4.4/t/t9001-send-email.sh --- git-1.5.4.4.orig/t/t9001-send-email.sh 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/t/t9001-send-email.sh 2008-03-22 16:03:58.490510442 -0700 @@ -2,6 +2,12 @@ test_description='git-send-email' . ./test-lib.sh +if test -n "$NO_PERL" +then + test_expect_success 'skipping git-send-email tests, NO_PERL defined' : + test_done + exit +fi PROG='git send-email' test_expect_success \ diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/t/t9200-git-cvsexportcommit.sh git-1.5.4.4/t/t9200-git-cvsexportcommit.sh --- git-1.5.4.4.orig/t/t9200-git-cvsexportcommit.sh 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/t/t9200-git-cvsexportcommit.sh 2008-03-22 16:04:12.535965488 -0700 @@ -13,6 +13,12 @@ test_done exit fi +if test -n "$NO_PERL" +then + test_expect_success 'skipping git-cvsexportcommit tests, NO_PERL defined' : + test_done + exit +fi CVSROOT=$(pwd)/cvsroot CVSWORK=$(pwd)/cvswork diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/t/t9400-git-cvsserver-server.sh git-1.5.4.4/t/t9400-git-cvsserver-server.sh --- git-1.5.4.4.orig/t/t9400-git-cvsserver-server.sh 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/t/t9400-git-cvsserver-server.sh 2008-03-22 16:04:20.038686248 -0700 @@ -17,6 +17,12 @@ test_done exit fi +if test -n "$NO_PERL" +then + test_expect_success 'skipping git-cvsserver tests, NO_PERL defined' : + test_done + exit +fi perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || { test_expect_success 'skipping git-cvsserver tests, Perl SQLite interface unavailable' : test_done diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/t/t9500-gitweb-standalone-no-errors.sh git-1.5.4.4/t/t9500-gitweb-standalone-no-errors.sh --- git-1.5.4.4.orig/t/t9500-gitweb-standalone-no-errors.sh 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/t/t9500-gitweb-standalone-no-errors.sh 2008-03-22 16:17:00.350148743 -0700 @@ -67,6 +67,13 @@ } . ./test-lib.sh +if test -n "$NO_PERL" +then + test_expect_success 'skipping gitweb-standalone-no-errors tests, NO_PERL defined' : + test_done + exit +fi + perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || { test_expect_success 'skipping gitweb tests, perl version is too old' : diff -Nuar --exclude gitweb.cgi --exclude config.mak.in --exclude configure.ac git-1.5.4.4.orig/t/t9600-cvsimport.sh git-1.5.4.4/t/t9600-cvsimport.sh --- git-1.5.4.4.orig/t/t9600-cvsimport.sh 2008-03-09 03:18:13.000000000 -0700 +++ git-1.5.4.4/t/t9600-cvsimport.sh 2008-03-22 16:04:28.501086452 -0700 @@ -9,6 +9,12 @@ test_done exit fi +if test -n "$NO_PERL" +then + test_expect_success 'skipping git-cvsimport tests, NO_PERL defined' : + test_done + exit +fi cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` case "$cvsps_version" in