From: Junio C Hamano <junkio@cox.net>
To: "Peter Eriksen" <s022018@student.dtu.dk>
Cc: git@vger.kernel.org, "Sean" <seanlkml@sympatico.ca>
Subject: Re: /bin/sh portability question
Date: Fri, 23 Sep 2005 18:13:54 -0700 [thread overview]
Message-ID: <7vwtl78dyl.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 20050923121705.GA11377@sunq05.gbar.dtu.dk
"Peter Eriksen" <s022018@student.dtu.dk> writes:
> GCC is not complaining. :-)
>
> My current make command is like this:
>
> gmake NO_STRCASESTR=YesPlease CURLDIR=/opt/sfw/ \
> SHELL_PATH=/bin/bash INSTALL=ginstall install
>
> There are two problems:
>
> * First of all there really needs to be a TAR variable,
> since Solaris tar doesn't like the C option.
>
> * Secondly I've noticed that git.sh and gitk don't get
> their /bin/sh line changed during install.
Thanks.
Would something like the attached patch, on top of what I sent
out, look good? I do not think bash vs ksh vs bourne makes a
difference in the case of gitk.
------------
[PATCH] Solaris: give a bit more built-in defaults.
Taking the make command line Peter Eriksen uses, give defaults
to SHELL_PATH, TAR, CURLDIR, NO_STRCASESTR, and INSTALL.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Makefile | 43 ++++++++++++++++++++++++++-----------------
git-clone.sh | 3 ++-
templates/Makefile | 10 ++++++----
3 files changed, 34 insertions(+), 22 deletions(-)
49cbdf77449687da471ee9289796f7c480e7bd73
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -27,8 +27,6 @@
# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
# Patrick Mauritz).
#
-# Define NO_GETDOMAINNAME if your library lack it (SunOS, Patrick Mauritz).
-#
# Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3.
#
# Define COLLISION_CHECK below if you believe that SHA1's
@@ -63,6 +61,7 @@ GIT_PYTHON_DIR = $(prefix)/share/git-cor
CC = gcc
AR = ar
+TAR = tar
INSTALL = install
RPMBUILD = rpmbuild
@@ -133,17 +132,6 @@ ifdef WITH_SEND_EMAIL
SCRIPT_PERL += git-send-email.perl
endif
-ifndef NO_CURL
- ifdef CURLDIR
- # This is still problematic -- gcc does not want -R.
- CFLAGS += -I$(CURLDIR)/include
- CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl
- else
- CURL_LIBCURL = -lcurl
- endif
- PROGRAMS += git-http-fetch
-endif
-
LIB_FILE=libgit.a
LIB_H = \
@@ -166,6 +154,9 @@ LIB_OBJS = \
LIBS = $(LIB_FILE)
LIBS += -lz
+#
+# Platform specific tweaks
+#
ifeq ($(shell uname -s),Darwin)
NEEDS_SSL_WITH_CRYPTO = YesPlease
NEEDS_LIBICONV = YesPlease
@@ -173,12 +164,28 @@ endif
ifeq ($(shell uname -s),SunOS)
NEEDS_SOCKET = YesPlease
NEEDS_NSL = YesPlease
+ SHELL_PATH = /bin/bash
+ NO_STRCASESTR = YesPlease
+ CURLDIR = /opt/sfw
+ INSTALL = ginstall
+ TAR = gtar
PLATFORM_DEFINES += -D__EXTENSIONS__
endif
ifneq (,$(findstring arm,$(shell uname -m)))
ARM_SHA1 = YesPlease
endif
+ifndef NO_CURL
+ ifdef CURLDIR
+ # This is still problematic -- gcc does not want -R.
+ CFLAGS += -I$(CURLDIR)/include
+ CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl
+ else
+ CURL_LIBCURL = -lcurl
+ endif
+ PROGRAMS += git-http-fetch
+endif
+
ifndef SHELL_PATH
SHELL_PATH = /bin/sh
endif
@@ -245,6 +252,7 @@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)
$(patsubst %.py,%,$(SCRIPT_PYTHON)) \
gitk
+export TAR INSTALL DESTDIR
### Build rules
all: $(PROGRAMS) $(SCRIPTS)
@@ -254,7 +262,8 @@ all:
git: git.sh Makefile
rm -f $@+ $@
- sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
+ sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
+ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
chmod +x $@+
mv $@+ $@
@@ -356,7 +365,7 @@ dist: git-core.spec git-tar-tree
./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
@mkdir -p $(GIT_TARNAME)
@cp git-core.spec $(GIT_TARNAME)
- tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec
+ $(TAR) rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec
@rm -rf $(GIT_TARNAME)
gzip -f -9 $(GIT_TARNAME).tar
@@ -365,7 +374,7 @@ rpm: dist
deb: dist
rm -rf $(GIT_TARNAME)
- tar zxf $(GIT_TARNAME).tar.gz
+ $(TAR) zxf $(GIT_TARNAME).tar.gz
dpkg-source -b $(GIT_TARNAME)
cd $(GIT_TARNAME) && fakeroot debian/rules binary
@@ -380,5 +389,5 @@ clean:
rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc
rm -f git-tk_$(GIT_VERSION)-*.deb
$(MAKE) -C Documentation/ clean
- $(MAKE) -C templates/ clean
+ $(MAKE) -C templates clean
$(MAKE) -C t/ clean
diff --git a/git-clone.sh b/git-clone.sh
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -139,7 +139,8 @@ yes,yes)
then
HEAD=HEAD
fi
- tar Ccf "$repo" - refs $HEAD | tar Cxf "$D/.git" - || exit 1
+ (cd "$repo" && tar cf - refs $HEAD) |
+ (cd "$D/.git" && tar xf -) || exit 1
;;
*)
case "$repo" in
diff --git a/templates/Makefile b/templates/Makefile
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -1,8 +1,9 @@
# make and install sample templates
-INSTALL=install
-prefix=$(HOME)
-template_dir=$(prefix)/share/git-core/templates/
+INSTALL ?= install
+TAR ?= tar
+prefix ?= $(HOME)
+template_dir ?= $(prefix)/share/git-core/templates/
# DESTDIR=
all: boilerplates custom
@@ -35,4 +36,5 @@ clean:
install: all
$(INSTALL) -d -m755 $(DESTDIR)$(template_dir)
- tar Ccf blt - . | tar Cxf $(DESTDIR)$(template_dir) -
+ (cd blt && $(TAR) cf - .) | \
+ (cd $(DESTDIR)$(template_dir) && $(TAR) xf -)
next prev parent reply other threads:[~2005-09-24 1:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-23 7:50 /bin/sh portability question Peter Eriksen
2005-09-23 8:24 ` Junio C Hamano
[not found] ` <54643.10.10.10.28.1127466177.squirrel@linux1>
2005-09-23 9:02 ` Sean
2005-09-23 9:19 ` Junio C Hamano
[not found] ` <39450.10.10.10.28.1127471685.squirrel@linux1>
2005-09-23 10:34 ` Sean
2005-09-25 19:26 ` Nico -telmich- Schottelius
[not found] ` <33541.10.10.10.28.1127677005.squirrel@linux1>
2005-09-25 19:36 ` Sean
2005-09-23 9:07 ` Junio C Hamano
2005-09-23 12:17 ` Peter Eriksen
2005-09-24 1:13 ` Junio C Hamano [this message]
[not found] ` <20050924195029.GA20514@bohr.gbar.dtu.dk>
2005-09-24 21:31 ` Junio C Hamano
2005-09-24 17:35 ` Patrick Mauritz
2005-09-23 19:48 ` H. Peter Anvin
2005-09-23 19:55 ` Morten Welinder
2005-09-23 19:57 ` Joel Becker
2005-09-23 20:00 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vwtl78dyl.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=s022018@student.dtu.dk \
--cc=seanlkml@sympatico.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).