Subject: [PATCH v2 0/2] Fit the building tools to Plan 9 environment

From: "KADOTA, Kyohei via GitGitGadget" <[email-masked]>
Date: Wed, 09 Sep 2020 19:47:39 +0000

I've posted some commits for porting git to Plan 9.

This pull request is thing that cut off building scripts from #305 and is
re-constructed that.

I expect this don't change any artifacts.

differ from v1
==============

 * drop some adapters, printf, cut, expr or tar
 * drop using SHELL_PATH instead of sh
 * use real name at Signed-off-by signature

Kyohei Kadota (2):
  Fit to Plan 9's ANSI/POSIX compatibility layer
  Use $(LD) instead of $(CC) for linking the object files

 .github/workflows/main.yml |  1 +
 Makefile                   | 15 +++++----
 ci/lib.sh                  |  8 ++++-
 config.mak.in              |  1 +
 config.mak.uname           |  6 ++++
 generate-cmdlist.sh        |  4 +--
 t/chainlint.sed            | 66 +++++++++++++++++++-------------------
 7 files changed, 58 insertions(+), 43 deletions(-)

base-commit: 3a238e539bcdfe3f9eb5010fd218640c1b499f7a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-694%2Flufia%2Fcompat-p9-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-694/lufia/compat-p9-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/694

Range-diff vs v1:

 1:  1f63b4fc7c < -:  ---------- Use $(SHELL_PATH) instead of sh in Makefile.
 2:  22f8f3e37a < -:  ---------- Define TAR_CF and TAR_XF variables in Makefile
 3:  d15ed626de ! 1:  c850888c25 Fit to Plan 9's ANSI/POSIX compatibility layer
     @@
       ## Metadata ##
     -Author: lufia <[email-masked]>
     +Author: Kyohei Kadota <[email-masked]>
      
       ## Commit message ##
          Fit to Plan 9's ANSI/POSIX compatibility layer
      
     -    That haven't any commands: cut, expr and printf.
     +    tr(1) of ANSI/POSIX environment, aka APE, don't support \n literal.
     +    It's handles only octal(\ooo) or hexadecimal(\xhhhh) numbers.
      
          And its sed(1)'s label is limited to maximum seven characters.
          Therefore I replaced some labels to drop a character.
     @@ Commit message
          * shell -> sh
          * string -> str
      
     -    Signed-off-by: lufia <[email-masked]>
     -
     - ## GIT-VERSION-GEN ##
     -@@ GIT-VERSION-GEN: else
     - 	VN="$DEF_VER"
     - fi
     - 
     --VN=$(expr "$VN" : v*'\(.*\)')
     -+VN=${VN#v}
     - 
     - if test -r $GVF
     - then
     +    Signed-off-by: Kyohei Kadota <[email-masked]>
      
       ## generate-cmdlist.sh ##
     -@@ generate-cmdlist.sh: die () {
     - }
     - 
     - command_list () {
     --	eval "grep -ve '^#' $exclude_programs" <"$1"
     -+	eval "grep -v -e '^#' $exclude_programs" <"$1"
     +@@ generate-cmdlist.sh: command_list () {
       }
       
       get_categories () {
     @@ generate-cmdlist.sh: die () {
       	grep -v '^$' |
       	sort |
       	uniq
     -@@ generate-cmdlist.sh: get_categories () {
     - 
     - category_list () {
     - 	command_list "$1" |
     --	cut -c 40- |
     -+	awk '{ print substr($0, 40) }' |
     - 	get_categories
     - }
     +@@ generate-cmdlist.sh: category_list () {
       
       get_synopsis () {
       	sed -n '
     @@ generate-cmdlist.sh: get_categories () {
       		${
       			x
       			s/.*'"$1"' - \(.*\)/N_("\1")/
     -@@ generate-cmdlist.sh: define_category_names () {
     - 	echo "};"
     - }
     - 
     -+if test -z "$(echo -n)"
     -+then
     -+	alias print='echo -n'
     -+else
     -+	alias print='printf %s'
     -+fi
     -+
     - print_command_list () {
     - 	echo "static struct cmdname_help command_list[] = {"
     - 
     - 	command_list "$1" |
     - 	while read cmd rest
     - 	do
     --		printf "	{ \"$cmd\", $(get_synopsis $cmd), 0"
     -+		print "	{ \"$cmd\", $(get_synopsis $cmd), 0"
     - 		for cat in $(echo "$rest" | get_categories)
     - 		do
     --			printf " | CAT_$cat"
     -+			print " | CAT_$cat"
     - 		done
     - 		echo " },"
     - 	done
      
       ## t/chainlint.sed ##
      @@
 4:  4ebd56a3c5 ! 2:  6f35562965 Use $(LD) instead of $(CC) for linking the object files
     @@
       ## Metadata ##
     -Author: lufia <[email-masked]>
     +Author: Kyohei Kadota <[email-masked]>
      
       ## Commit message ##
          Use $(LD) instead of $(CC) for linking the object files
     @@ Commit message
          The compilers are called 8c, 6c... for each machine architectures;
          corresponded loaders are called 8l, 6l...
      
     -    Signed-off-by: lufia <[email-masked]>
     +    Signed-off-by: Kyohei Kadota <[email-masked]>
      
       ## .github/workflows/main.yml ##
      @@ .github/workflows/main.yml: jobs:
     @@ Makefile: compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
      -	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
      +	$(QUIET_LINK)$(LD) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
       
     - git-bugreport$X: bugreport.o GIT-LDFLAGS $(GITLIBS)
     --	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
     -+	$(QUIET_LINK)$(LD) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
     - 		$(LIBS)
     - 
       git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
      -	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
      +	$(QUIET_LINK)$(LD) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
     @@ Makefile: compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
      +	$(QUIET_LINK)$(LD) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
       		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
       
     - git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
     --	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
     -+	$(QUIET_LINK)$(LD) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
     - 	$(VCSSVN_LIB)
     - 
       $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
      @@ Makefile: $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
       	cp $< $@
     @@ Makefile: $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
       		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
       
       $(LIB_FILE): $(LIB_OBJS)
     -@@ Makefile: t/helper/test-svn-fe$X: $(VCSSVN_LIB)
     +@@ Makefile: perf: all
       t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
       
       t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)

-- 
gitgitgadget