I'm definitely not a shell scripting compatibility expert.
But one thing became clear: Bourne shell is slightly outdated. And not
everybody outside Sun has been maintaining backward compatibility. Once
I fixed the problem below I ran into the next one. And into the next
five. Then I looked for a better hack:
My "fix" is now to use bash.
The reason for all those unusual problems with mesalib is, that it
doesn't use SVR4-install, BSD-install nor GNU-install, but its own
intelligent shell script "minstall".
The workaround is now to just change that shell script's default shell
to /bin/bash.
$ file ./build_32/Mesa-6.5.2/bin/minstall
./build_32/Mesa-6.5.2/bin/minstall: executable /bin/bash script
...
- /bin/sh
+ /bin/bash
That solves a myriad of problems. As I use snv_70 I cannot test, if
ksh93 would work similarily good. But let's give ksh88 a try ... [testing]
--->> Yes, ksh88 works.
A 20 years old Korn shell is slightly more capable, than a 35 years old
Bourne.
I hope ksh93 will soon be symlinked to /usr/bin/sh.
Bourne should be mature for historic books and museums, but not for
being ZFS-os's system shell.
Martin Bochnig wrote:
> Now that I was told that the SPARC part of the fox-gate might really be
> used for something, I began eating some coffee powder and am now
> determined to get that merge finished soon (next days).
> I'm finally in the process of systematically paging through the entire
> buildit-XW logfiles in all three of my current worspaces.
> And aha, some coffe powder and voila, the solution to the bash versus
> Bourne /bin/sh problem with mesalibs (which normally weren't built under
> SPARC before I enabled them).
> Q: I wonder if nobody ever got that problem under x86??
>
> For some strange reason
>
> if [ -e ../../lib/libGL.so ]; then \
> ../../bin/minstall ../../lib/libGL* /usr/X11/lib; \
> fi
>
> ### which is equivalent to ###
>
> if test ! -e "../../lib/libGL.so"; then \
> ../../bin/minstall ../../lib/libGL* /usr/X11/lib; \
> fi
>
> does *not* work with Bourne shell, which is odd.
> ("make install" would work, if /bin/sh happened to be bash).
> If we test for
>
> *-s* FileName
> ### -- FileName has a size greater than 0.###
>
> instead of
>
> *-e* FileName -- FileName exists.
>
> it suddenly works as expected, also with /bin/sh being the default outdated
> Bourne.
> As "-s" is actually much better test, than "-e", I added a patch to
> /FOX/MERCURIAL_20070830thu/fox-gate__Aha_Testing__pre20070913thu/XW_NV/open-src/lib/mesa
> which changes lines
>
> Makefile:157: @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
> Makefile:160: @if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
>
> in
> /FOX/MERCURIAL_20070830thu/fox-gate__Aha_Testing__pre20070913thu/XW_NV/open-src/lib/mesa/build_32/Mesa-6.5.2/src/mesa/Makefile
>
>
> to
>
> Makefile:157: @if [ -s $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
> Makefile:160: @if [ -s $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
>
> before each archive extraction.
>
> See below:
>
> -bash-3.00$ pwd
> /FOX/MERCURIAL_20070830thu/fox-gate__Aha_Testing__pre20070913thu/XW_NV/open-src/lib/mesa/build_32/Mesa-6.5.2/src/mesa
> -bash-3.00$ make
> -bash-3.00$ make install
> ../../bin/minstall -d /usr/X11/include/GL
> ../../bin/minstall -d /usr/X11/lib
> ../../bin/minstall -m 644 ../../include/GL/*.h /usr/X11/include/GL
> sh: test: argument expected
> *** Error code 1
> The following command caused the error:
> if [ -e ../../lib/libGL.so ]; then \
> ../../bin/minstall ../../lib/libGL* /usr/X11/lib; \
> fi
> make: Fatal error: Command failed for target `install'
> -bash-3.00$ if test ! -e "../../lib/libGL.so"; then \
> > ../../bin/minstall ../../lib/libGL* /usr/X11/lib; \
> > fi
> -bash-3.00$ sh
> $ if test ! -e "../../lib/libGL.so"; then \
> ../../bin/minstall ../../lib/libGL* /usr/X11/lib; \
> fi
> > > test: argument expected
> $ if test ! -s "../../lib/libGL.so"; then \
> ../../bin/minstall ../../lib/libGL* /usr/X11/lib; \
> fi
> > > $ grep -n "if \[ -e" *
> Makefile:157: @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
> Makefile:160: @if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
> Makefile__ORIG_preBourne:157: @if [ -e
> $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
> Makefile__ORIG_preBourne:160: @if [ -e
> $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
> $ pwd
> /FOX/MERCURIAL_20070830thu/fox-gate__Aha_Testing__pre20070913thu/XW_NV/open-src/lib/mesa/build_32/Mesa-6.5.2/src/mesa
> $
>
>
> References:
> http://en.wikipedia.org/wiki/Test_(Unix)
>
>
> Regards,
> Martin
> _______________________________________________
> fox-notify mailing list
> fox-notify at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/fox-notify
>
>