This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[JAVA] /bin/sh portability issues in scripts/jar.in
- From: Roger Sayle <roger at eyesopen dot com>
- To: java-patches at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org, Paolo Bonzini <bonzini at gnu dot org>
- Date: Thu, 6 Jul 2006 22:31:32 -0600 (MDT)
- Subject: [JAVA] /bin/sh portability issues in scripts/jar.in
The following patch is the third in the series to allow use of the
native /bin/sh on Solaris/x86. These changes allow Paolo Bonzini's
impressive "jar" script to be used to build libjava on i386-pc-solaris2.10.
The change to the function "copy" replaces the use of the test's "-e"
operator, which isn't available on solaris, with the more portable "-f".
The second change avoid the "mkdir_p: command not found" error messages.
I'm not sure whether the disambiguation of the shell function and the
shell variable identifiers is necessary, but it was the first thing I
tried. However placing the opening brace of the function declaration
on the same line seemed to ultimately resolve the failures I was seeing.
Tested on i386-pc-solaris2.10 with a full top-level "make bootstrap",
which gets further with these changes than without.
2006-07-06 Roger Sayle <roger@eyesopen.com>
* scripts/jar.in (copy): Use "test -f ..." instead of "test -e"
for improved portability.
(mkdir_p): Rename as mkdir_p_fun to disambiguate from the shell
variable of the same name. Make sure the open brace is on the same
line as the function declaration.
Set the mkdir_p shell variable to value "mkdir_p_fun".
Index: scripts/jar.in
===================================================================
*** scripts/jar.in (revision 115223)
--- scripts/jar.in (working copy)
*************** copy () {
*** 96,102 ****
return 0
fi
! if test -e "$2"/"$1"; then
error "$1": Duplicate entry.
fi
dir=`dirname "$1"`
--- 96,102 ----
return 0
fi
! if test -f "$2"/"$1"; then
error "$1": Duplicate entry.
fi
dir=`dirname "$1"`
*************** jar_list_verbose () {
*** 249,256 ****
}
# mkdir -p emulation based on the mkinstalldirs script.
! mkdir_p ()
! {
for file
do
case $file in
--- 249,255 ----
}
# mkdir -p emulation based on the mkinstalldirs script.
! mkdir_p_fun () {
for file
do
case $file in
*************** mkdir_p ()
*** 290,296 ****
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
mkdir_p='mkdir -p'
else
! mkdir_p='mkdir_p'
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
--- 289,295 ----
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
mkdir_p='mkdir -p'
else
! mkdir_p='mkdir_p_fun'
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
Roger
--