* ./configure script prototype
@ 2005-11-14 12:18 Andreas Ericsson
2005-11-14 12:18 ` Andreas Ericsson
0 siblings, 1 reply; 13+ messages in thread
From: Andreas Ericsson @ 2005-11-14 12:18 UTC (permalink / raw)
To: Git Mailing List
I've started writing up a configuration script to move some of the logic
out of the Makefile and make it a bit easier to enable/disable certain
stuff.
I'm not exactly fluent in what sh flavours accept what syntax and the
uname -m output is a bit of a mystery for some architectures (PowerPC,
notably) so the SHA1 method selection stuff might not work.
Thoughts? Comments? Patches?
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 12:18 ./configure script prototype Andreas Ericsson
@ 2005-11-14 12:18 ` Andreas Ericsson
2005-11-14 13:29 ` Petr Baudis
0 siblings, 1 reply; 13+ messages in thread
From: Andreas Ericsson @ 2005-11-14 12:18 UTC (permalink / raw)
To: Git Mailing List
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
Andreas Ericsson wrote:
> I've started writing up a configuration script to move some of the logic
> out of the Makefile and make it a bit easier to enable/disable certain
> stuff.
>
> I'm not exactly fluent in what sh flavours accept what syntax and the
> uname -m output is a bit of a mystery for some architectures (PowerPC,
> notably) so the SHA1 method selection stuff might not work.
>
> Thoughts? Comments? Patches?
>
Attachments? ;)
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
[-- Attachment #2: configure --]
[-- Type: text/plain, Size: 5978 bytes --]
#!/bin/sh
# VERSION must be here so we know where to put the git_libexec_dir later on
VERSION=0.99.9.GIT
# some default values
default_prefix=$HOME
enable_http=Yes
enable_expat=Yes
without_openssl=0
tar=$(which gtar 2>/dev/null || which tar 2>/dev/null)
install=$(which ginstall 2>/dev/null || which install 2>/dev/null)
function usage ()
{
cat << EOF
Usage: $0 [VAR=VALUE]...
Installation directories:
--prefix=PREFIX files go in directories under PREFIX [$default_prefix]
--exec-prefix=EPREFIX executables go in directories under EPREFIX [PREFIX]
--bindir=DIR user executables [EPREFIX/bin]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--mandir=DIR man-page base directory [\$datadir/man]
git specific stuff and where to install it:
--git-exec-path=DIR git executables path [*currently* \$bindir]
--git-python-dir=DIR git python scripts [\$datadir/git/python]
--git-template-dir=DIR git templates [\$datadir/git/templates]
Other compilation options:
--disable-http disable http transport support [enable]
--without-expat build without expat (disables http-push) [enable]
--with-curl=DIR path to curl installation [/usr]
--with-expat=DIR path to libexpat installation [/usr]
--with-sha1=METHOD possible options are MOZILLA_SHA1, PPC_SHA1, ARM_SHA1
and OPENSSL_SHA1 [autodetect / OPENSSL_SHA1]
--with-shell=PATH path to bourne-like shell [/bin/sh]
--with-perl=PATH path to perl [/usr/bin/perl]
--with-python=PATH path to python [/usr/bin/python]
EOF
exit 0
}
# for debugging, really
: ${outfile=config.mak}
# Try to keep these in the same order as the help output above.
while [ $# -gt 0 ]; do
case "$1" in
--help*)
usage
;;
--prefix=*)
prefix=${1##*=}
;;
--exec-prefix=*)
exec_prefix=${1##*=}
;;
--bindir=*)
bindir=${1##*=}
;;
--datadir=*)
datadir=${1##*=}
;;
--mandir=*)
mandir=${1##*=}
;;
--git-exec-path=*)
git_exec_path=${1##*=}
;;
--git-python-dir=*)
git_python_dir=${1##*=}
;;
--git-template-dir=*)
git_template_dir=${1##*=}
;;
--disable-http*)
enable_http=No
enable_expat=No
;;
--without-expat*)
enable_expat=No
;;
--with-curl=*)
curl_dir=${1##*=}
;;
--with-expat=*)
expat_dir=${1##*=}
;;
--with-sha1=*)
sha1=${1##*=}
;;
--with-shell=*)
shell=${1##*=}
;;
--with-perl=*)
perl=${1##*=}
;;
--with-python=*)
python=${1##*=}
;;
esac
shift
done
[ "$prefix" ] || prefix="$HOME"
[ "$libdir" ] || libdir="$prefix/lib"
[ "$bindir" ] || bindir="$prefix/bin"
[ "$datadir" ] || datadir="$prefix/share"
[ "$mandir" ] || mandir="$datadir/man"
[ "$git_exec_path" ] || git_exec_path="$bindir"
[ "$git_python_dir"] || git_python_dir=$datadir/git/python
[ "$git_template_dir" ] || git_template_dir=$datadir/git/templates
[ "$shell" ] || shell=/bin/sh
if [ -z "$perl" ]; then
perl=$(which perl 2>/dev/null || perl=/usr/bin/perl)
fi
if [ -z "$python" ]; then
python=$(which python 2>/dev/null || python=/usr/bin/python)
fi
function need () {
echo "Need $@"
for n in "$@"; do
echo "NEEDS_$n = YesPlease" >> $outfile
done
}
function no () {
echo "Working around missing $@"
for n in "$@"; do
echo "NO_$n = YesPlease" >> $outfile
done
}
function cflag () {
echo "ALL_CFLAGS += $@" >> $outfile
}
# for now this is just an alias
alias ldflag=cflag
#function ldflag () {
# echo "ALL_LDFLAGS += $@" >> $outfile
#}
sys=$(uname -s)
case $sys in
Darwin)
need SSL_WITH_CRYPTO LIBICONV
## fink
cflag -I/sw/include
ldflag -L/sw/lib
## darwinports
cflag -I/opt/local/include
ldflag -L/opt/local/lib
;;
SunOS)
need SOCKET NSL LIBICONV
no STRCASESTR
cflag -D__EXTENSIONS__
[ "$shell" = /bin/sh -a -x /bin/bash ] && shell=/bin/bash
;;
OpenBSD)
need LIBICONV
no STRCASESTR
cflag -I/usr/local/include
ldflag -L/usr/local/lib
;;
esac
os=$(uname -o)
case $os in
Cygwin)
need LIBICONV
no STRCASESTR IPV6
cflag -DUSE_SYMLINK_HEAD=0
echo "X = .exe" >> $outfile
;;
esac
if [ -z "$sha1" ]; then
mach=$(uname -m)
case $mach in
*arm*)
sha1=ARM_SHA1
;;
i*86)
sha1=OPENSSL_SHA1
;;
# Is this uname -m output for PPC??
PPC|PowerPC)
sha1=PPC_SHA1
;;
*)
sha1=MOZILLA_SHA1
;;
esac
fi
cat << EOF > $outfile
GIT_VERSION := $VERSION
# Installation destinations
prefix = $prefix
bindir = $bindir
template_dir = $git_template_dir
GIT_EXEC_PATH = $git_exec_path
CFG_GIT_EXEC_PATH := $git_exec_path
GIT_PYTHON_DIR = $git_python_dir
# SHA1 method
$sha1 = YesPlease
# paths to system tools
SHELL_PATH = $shell
PERL_PATH = $perl
PYTHON_PATH = $python
TAR = $tar
INSTALL = $install
# Compilation options, library paths etc. etc.
EOF
# http transport support
if [ "$enable_http" = Yes ]; then
echo "# HTTP transport is enabled" >> $outfile
echo 'PROGRAMS += git-http-fetch$X' >> $outfile
if [ "$curl_dir" ]; then
cflag -I$curl_dir/include
echo "CURL_LIBCURL = -L$curl_dir/lib"
fi
echo "CURL_LIBCURL += -lcurl" >> $outfile
if [ "$enable_expat" = Yes ]; then
echo "# expat (push over http) is enabled" >> $outfile
echo 'PROGRAMS += git-http-push$X' >> $outfile
if [ "$expat_dir" ]; then
cflag -I$expat_dir/include
echo "EXPAT_LIBEXPAT = -L$expat_dir/lib" >> $outfile
fi
echo "EXPAT_LIBEXPAT += -lexpat" >> $outfile
fi
fi
cat << EOF
Configuration summary:
----------------------
Compilation options:
SHA1 method : $sha1
HTTP transport : $enable_http
HTTP push support : $enable_expat
System tools locations:
shell : $shell
Perl : $perl
Python : $python
tar : $tar
install : $install
Installation paths:
bindir utilities : $bindir
templates : $git_template_dir
python scripts : $git_python_dir
Everything else : $git_exec_path
Please see config.mak and top of Makefile for ways to tweak the build further.
EOF
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 12:18 ` Andreas Ericsson
@ 2005-11-14 13:29 ` Petr Baudis
2005-11-14 14:32 ` Andreas Ericsson
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Petr Baudis @ 2005-11-14 13:29 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Git Mailing List
Dear diary, on Mon, Nov 14, 2005 at 01:18:52PM CET, I got a letter
where Andreas Ericsson <ae@op5.se> said that...
> --prefix=*)
> prefix=${1##*=}
Aren't those heavy bashisms?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 13:29 ` Petr Baudis
@ 2005-11-14 14:32 ` Andreas Ericsson
2005-11-14 15:51 ` Chris Wedgwood
2005-11-14 16:32 ` Fernando J. Pereda
2005-11-14 18:19 ` Joel Becker
2 siblings, 1 reply; 13+ messages in thread
From: Andreas Ericsson @ 2005-11-14 14:32 UTC (permalink / raw)
To: Git Mailing List
Petr Baudis wrote:
> Dear diary, on Mon, Nov 14, 2005 at 01:18:52PM CET, I got a letter
> where Andreas Ericsson <ae@op5.se> said that...
>
>> --prefix=*)
>> prefix=${1##*=}
>
>
> Aren't those heavy bashisms?
>
Dunno. I only know bash-scripting, really. I'll replace them with some
sed thing instead.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 14:32 ` Andreas Ericsson
@ 2005-11-14 15:51 ` Chris Wedgwood
2005-11-14 16:11 ` Andreas Ericsson
0 siblings, 1 reply; 13+ messages in thread
From: Chris Wedgwood @ 2005-11-14 15:51 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Git Mailing List
On Mon, Nov 14, 2005 at 03:32:13PM +0100, Andreas Ericsson wrote:
> Dunno. I only know bash-scripting, really. I'll replace them with
> some sed thing instead.
For some people /bin/sh != /bin/bash so you probably want "!/bin/bash"
instead.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 15:51 ` Chris Wedgwood
@ 2005-11-14 16:11 ` Andreas Ericsson
2005-11-14 17:45 ` Chris Wedgwood
0 siblings, 1 reply; 13+ messages in thread
From: Andreas Ericsson @ 2005-11-14 16:11 UTC (permalink / raw)
To: Chris Wedgwood; +Cc: Git Mailing List
Chris Wedgwood wrote:
> On Mon, Nov 14, 2005 at 03:32:13PM +0100, Andreas Ericsson wrote:
>
>
>>Dunno. I only know bash-scripting, really. I'll replace them with
>>some sed thing instead.
>
>
> For some people /bin/sh != /bin/bash so you probably want "!/bin/bash"
> instead.
Ach no. The configure script really needs to be portable. POSIX (or SUS
or some such) define a minimum syntax that any shell must support when
invoked as /bin/sh.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 13:29 ` Petr Baudis
2005-11-14 14:32 ` Andreas Ericsson
@ 2005-11-14 16:32 ` Fernando J. Pereda
2005-11-14 18:19 ` Joel Becker
2 siblings, 0 replies; 13+ messages in thread
From: Fernando J. Pereda @ 2005-11-14 16:32 UTC (permalink / raw)
To: Git Mailing List
[-- Attachment #1: Type: text/plain, Size: 871 bytes --]
On Mon, Nov 14, 2005 at 02:29:56PM +0100, Petr Baudis wrote:
| Dear diary, on Mon, Nov 14, 2005 at 01:18:52PM CET, I got a letter
| where Andreas Ericsson <ae@op5.se> said that...
| > --prefix=*)
| > prefix=${1##*=}
|
| Aren't those heavy bashisms?
As far as I know, it should be supported by a POSIX 'sh'[1]:
---8<---
${parameter##word}
Remove Largest Prefix Pattern. The word shall be expanded to produce a
pattern. The parameter expansion shall then result in parameter, with
the largest portion of the prefix matched by the pattern deleted.
---8<---
Whether other shells support it or not... I don't know.
Cheers,
Ferdy
[1] http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
--
Fernando J. Pereda Garcimartin
Gentoo Developer (Alpha,net-mail,mutt,git)
20BB BDC3 761A 4781 E6ED ED0B 0A48 5B0C 60BD 28D4
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 16:11 ` Andreas Ericsson
@ 2005-11-14 17:45 ` Chris Wedgwood
0 siblings, 0 replies; 13+ messages in thread
From: Chris Wedgwood @ 2005-11-14 17:45 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Git Mailing List
On Mon, Nov 14, 2005 at 05:11:58PM +0100, Andreas Ericsson wrote:
> Ach no. The configure script really needs to be portable. POSIX (or
> SUS or some such) define a minimum syntax that any shell must
> support when invoked as /bin/sh.
Then bashism need to go away and it should be test with
dash/ash/whatever.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 13:29 ` Petr Baudis
2005-11-14 14:32 ` Andreas Ericsson
2005-11-14 16:32 ` Fernando J. Pereda
@ 2005-11-14 18:19 ` Joel Becker
2005-11-14 18:39 ` Linus Torvalds
2 siblings, 1 reply; 13+ messages in thread
From: Joel Becker @ 2005-11-14 18:19 UTC (permalink / raw)
To: Petr Baudis; +Cc: Andreas Ericsson, Git Mailing List
On Mon, Nov 14, 2005 at 02:29:56PM +0100, Petr Baudis wrote:
> Dear diary, on Mon, Nov 14, 2005 at 01:18:52PM CET, I got a letter
> where Andreas Ericsson <ae@op5.se> said that...
> > --prefix=*)
> > prefix=${1##*=}
${i# and ${i% are POSIX, iirc.
Joel
--
Life's Little Instruction Book #197
"Don't forget, a person's greatest emotional need is to
feel appreciated."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 18:19 ` Joel Becker
@ 2005-11-14 18:39 ` Linus Torvalds
2005-11-14 18:59 ` Joel Becker
2005-11-14 19:03 ` Andreas Ericsson
0 siblings, 2 replies; 13+ messages in thread
From: Linus Torvalds @ 2005-11-14 18:39 UTC (permalink / raw)
To: Joel Becker; +Cc: Petr Baudis, Andreas Ericsson, Git Mailing List
On Mon, 14 Nov 2005, Joel Becker wrote:
> On Mon, Nov 14, 2005 at 02:29:56PM +0100, Petr Baudis wrote:
> > Dear diary, on Mon, Nov 14, 2005 at 01:18:52PM CET, I got a letter
> > where Andreas Ericsson <ae@op5.se> said that...
> > > --prefix=*)
> > > prefix=${1##*=}
>
> ${i# and ${i% are POSIX, iirc.
They may be in POSIX, but they sure as h*ll aren't portable.
There's a _lot_ of machines out there that don't do POSIX, just because
those "newfangled" things are so complicated.
Also, even in POSIX, there's tons of different substandards, and you might
follow one but not the other.
Finally, even if somebody is certified, they can very well be certified
with "exceptions", so if they claim POSIX it doesn't necessarily mean that
they follow all of it.
If you want to do a "configure" script (and I'm not sure it's worth it),
you should cater to the lowest common denominator for it to be meaningful.
What the hell that would be, I have no idea, since if you ever want to run
on native Windows, it won't even be traditional shell. But traditional
shell is at least a lot closer to that lowest common denominator than
POSIX shell is.
That said, most of those ${var...} sequences definitely _are_ very
traditional, and for all I know, ## may be too.
Linus
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 18:39 ` Linus Torvalds
@ 2005-11-14 18:59 ` Joel Becker
2005-11-14 19:03 ` Andreas Ericsson
1 sibling, 0 replies; 13+ messages in thread
From: Joel Becker @ 2005-11-14 18:59 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Petr Baudis, Andreas Ericsson, Git Mailing List
On Mon, Nov 14, 2005 at 10:39:26AM -0800, Linus Torvalds wrote:
> > ${i# and ${i% are POSIX, iirc.
>
> They may be in POSIX, but they sure as h*ll aren't portable.
By POSIX I meant POSIX shell, which is ksh. That's available on
just about all modern non-free Unices, and we all know bash and zsh are
compatible with it.
But I had no intention of arguing how portable POSIX is, I was
just trying to describe the minimum breadth of support. My personal
experience is that these particular variable forms have worked on Linux,
Solaris, AIX, Ultrix, IRIX, and the BSDs for, I dunno, eight to ten
years or so.
That said, $(echo | sed), or `echo | sed` for even more
backwards portability (I bet $() is about as portable as ${i%}), can be
used to replace the ${i%} forms.
Joel
--
"I always thought the hardest questions were those I could not answer.
Now I know they are the ones I can never ask."
- Charlie Watkins
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 18:39 ` Linus Torvalds
2005-11-14 18:59 ` Joel Becker
@ 2005-11-14 19:03 ` Andreas Ericsson
2005-11-14 20:21 ` Junio C Hamano
1 sibling, 1 reply; 13+ messages in thread
From: Andreas Ericsson @ 2005-11-14 19:03 UTC (permalink / raw)
To: Git Mailing List
Linus Torvalds wrote:
>
> On Mon, 14 Nov 2005, Joel Becker wrote:
>
>
>>On Mon, Nov 14, 2005 at 02:29:56PM +0100, Petr Baudis wrote:
>>
>>>Dear diary, on Mon, Nov 14, 2005 at 01:18:52PM CET, I got a letter
>>>where Andreas Ericsson <ae@op5.se> said that...
>>>
>>>> --prefix=*)
>>>> prefix=${1##*=}
>>
>> ${i# and ${i% are POSIX, iirc.
>
>
> They may be in POSIX, but they sure as h*ll aren't portable.
>
A bit funny really. I've already said I'll change them to some sed
thing, so the last 16 emails on this thread have been purely academic. I
guess more people than me are bored by mondays.
> If you want to do a "configure" script (and I'm not sure it's worth it),
Perhaps not. I was under the impression that Junio was for it to
simplify the possible move of binaries to GIT_EXEC_PATH.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ./configure script prototype
2005-11-14 19:03 ` Andreas Ericsson
@ 2005-11-14 20:21 ` Junio C Hamano
0 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2005-11-14 20:21 UTC (permalink / raw)
To: git
Andreas Ericsson <ae@op5.se> writes:
> Linus Torvalds wrote:
>
>> If you want to do a "configure" script (and I'm not sure it's worth
>> it),
>
> Perhaps not. I was under the impression that Junio was for it to
> simplify the possible move of binaries to GIT_EXEC_PATH.
I do not see how that is related to it.
Offtopic, but if you really want to do ${var##} and friends
portably, expr(1) is the tool traditionalists prefer; not echo
piped to sed, please.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2005-11-14 20:21 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-14 12:18 ./configure script prototype Andreas Ericsson
2005-11-14 12:18 ` Andreas Ericsson
2005-11-14 13:29 ` Petr Baudis
2005-11-14 14:32 ` Andreas Ericsson
2005-11-14 15:51 ` Chris Wedgwood
2005-11-14 16:11 ` Andreas Ericsson
2005-11-14 17:45 ` Chris Wedgwood
2005-11-14 16:32 ` Fernando J. Pereda
2005-11-14 18:19 ` Joel Becker
2005-11-14 18:39 ` Linus Torvalds
2005-11-14 18:59 ` Joel Becker
2005-11-14 19:03 ` Andreas Ericsson
2005-11-14 20:21 ` Junio C Hamano
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).