Re compiling on IRIX, shall I get the ball rolling then by submitting my
changes.

I'm using the MIPSpro version 7.3.1.1m compiler on an Octane running IRIX
6.5.  I am compiling the binaries as n32.  One of the target machines for
my project is an Origin on which binaries will be 64-bit so in time I'll
be able to test that too.

Attached are diffs for the following files:

src/Makefile.incl
src/runConfigure
src/util/PlatformUtils.hpp
src/util/Platforms/IRIX/IRIXPlatformUtils.cpp
samples/Makefile.incl
samples/runConfigure

I think that's all I changed.  Here is a summary:

src/Makefile.incl
-----------------
There is an extra target for .cpp.o already in Makefile.incl for IRIX,
presumably so that the linker can find the ii_files directory that CC
generates.  I changed it slightly because it wasn't working for files
nested more deeply that one directory within src.

src/runConfigure
----------------
Added an 'irix' target so that runConfigure would execute :) In order
to compile for non-default ABIs, I use the -z option, eg -z-n32.  This
sets $compileroption in runConfigure but this variable doesn't seem to get
added to the CFLAGS and CXXFLAGS, so I corrected this.

src/utils/PlatformUtils.hpp
---------------------------
IRIXPlatformUtils.cpp defines some methods of PlatformUtils for which
there are no declarations in PlatformUtils.hpp.  Also a static variable.
I don't quite understand this, as the same methods are implemented for
other architectures, eg Solaris.  Why does it compile for them?  I got an
error, so I added the declarations to PlatformUtils.hpp.  This might break
the compilation on other architectures if their PlatformUtils.cpp doesn't
implement them.  Maybe someone can propose a better solution.

src/util/Platforms/IRIX/IRIXPlatformUtils.cpp
---------------------------------------------
Added support for ABIs other than o32 (ie library path env variable),
defined the static data member added to PlatformUtils.hpp (see above),
implemented some missing methods (for the most part by copying the Solaris
code).  I kept my changes minimal because I don't really understand Xerces
yet.  Someone else may have more appropriate changes to this file.

samples/Makefile.incl
---------------------
Added IRIX target definitions.  They were in src/Makefile.incl but seemed
not to be in samples/Makefile.incl.

samples/runConfigure
--------------------
Added the 'irix' target.  Also added the -z flag as I needed it to compile
for non-default ABIs.

It compiles, links, doesn't give me any missing symbol or duplicate symbol
errors, and runs the small number of test programs I tried.

I haven't tried compiling with gcc (gcc doesn't work very well here) so
the gcc stuff I added to samples/Makefile.incl is possibly wrong :)

I look forward to hearing any feedback from the other IRIX users.

Cheers,
Matthew

--
Dr. Matthew Baker           [EMAIL PROTECTED]
GMD - FIT.MMK               http://fit.gmd.de/hci/pages/matthew.baker.html

432c432
<       $(CC1) -c $(XML_BUILD_OPTIONS) $(XML_DEF) $(XML_INCL) 
$(EXTRA_COMPILE_OPTIONS) -o $(OBJ_OUT)$(@) $(<)
---
>       $(CC1) -c $(XML_BUILD_OPTIONS) $(XML_DEF) $(XML_INCL) 
> $(EXTRA_COMPILE_OPTIONS) -o $(OBJ_OUT)$(@F) $(<)
184c184
<     echo "       -p <platform> (accepts 'aix', 'linux', 'solaris', 'hp-10', 
'hp-11', 'unixware', 'os400' )"
---
>     echo "       -p <platform> (accepts 'aix', 'linux', 'solaris', 'hp-10', 
> 'hp-11', 'unixware', 'os400', 'irix' )"
296c296
<    aix | linux | solaris | hp-10 | hp-11 | irix | unixware | os400)
---
>    aix | linux | solaris | hp-10 | hp-11 | irix | unixware | os400 | irix)
304d303
< 
316c315,319
<       debugflag="-O";
---
>         if test $platform = "irix"; then
>            debugflag="-O2";
>         else
>          debugflag="-O";
>         fi
484c487
< CXXFLAGS="$debugflag $transcodingDefines $msgloaderDefines $threadingDefines 
$netaccessorDefines"
---
> CXXFLAGS="$compileroption $debugflag $transcodingDefines $msgloaderDefines 
> $threadingDefines $netaccessorDefines"
487c490
< CFLAGS="$debugflag $transcodingDefines $msgloaderDefines $threadingDefines 
$netaccessorDefines"
---
> CFLAGS="$compileroption $debugflag $transcodingDefines $msgloaderDefines 
> $threadingDefines $netaccessorDefines"
490c493
< LIBS="$transcodingLibs $threadingLibs $netaccessorLibs"
---
> LIBS="$compileroption $transcodingLibs $threadingLibs $netaccessorLibs"
418a419,425
> 
> void writeToStdErr(const char* const toWrite);
> void writeToStdErr(const XMLCh* const toWrite);
> void writeToStdOut(const XMLCh* const toWrite);
> void writeToStdOut(const char* const toWrite);
> XMLCh* getBasePath(const XMLCh* const srcPath);
> static char *fgLibLocation;
81a82
> #define PATH_MAX MAXPATHLEN
96a98
> #include    <sys/param.h>
105d106
< 
122a124
> char *XMLPlatformUtils::fgLibLocation = 0;
207c209,223
<     static const char*  sharedLibEnvVar = "LD_LIBRARY_PATH";
---
> #if _MIPS_SIM == _MIPS_SIM_ABI32
>     static const char*  sharedLibEnvVar    = "LD_LIBRARY_PATH";
>     static char*        defSharedLibEnvVar =
>   
> "/usr/lib:/usr/lib/internal:/lib:/lib/cmplrs/cc:/usr/lib/cmplrs/cc:/opt/lib";
> #else
> #if _MIPS_SIM == _MIPS_SIM_NABI32
>     static const char*  sharedLibEnvVar = "LD_LIBRARYN32_PATH";
>     static char*        defSharedLibEnvVar =
>        "/usr/lib32:/usr/lib32/internal:/lib32:/opt/lib32";
> #else
>     static const char*  sharedLibEnvVar = "LD_LIBRARY64_PATH";
>     static char*        defSharedLibEnvVar =
>        "/usr/lib64:/usr/lib64/internal:/lib64:/opt/lib64";
> #endif
> #endif
210a227
>     // get the appropriate library_path variable
222c239,240
<         panic(XMLPlatformUtils::Panic_CantFindLib);
---
>        //panic(XMLPlatformUtils::Panic_CantFindLib);
>        libEnvVar = defSharedLibEnvVar;
500a519,542
> XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
> {
>       //
>     //  NOTE: THe path provided has always already been opened successfully,
>     //  so we know that its not some pathological freaky path. It comes in
>     //  in native format, and goes out as Unicode always
>     //
>     char* newSrc = XMLString::transcode(srcPath);
>     ArrayJanitor<char> janText(newSrc);
> 
>     // Use a local buffer that is big enough for the largest legal path
>     char *absPath = new char[PATH_MAX];
>     ArrayJanitor<char> janText2(absPath);
>     //get the absolute path
>     *absPath = 0;
>     char* retPath = realpath(newSrc, absPath);
>     printf("%s : %s : %s : %s\n", srcPath, newSrc, absPath, retPath);
> 
>     if (!*absPath)
>     {
>         ThrowXML(XMLPlatformUtilsException, 
> XML4CExcepts::File_CouldNotGetBasePathName);
>     }
>     return XMLString::transcode(absPath);
> }
549a592,699
> XMLCh* XMLPlatformUtils::weavePaths
>     (
>         const   XMLCh* const    basePath
>         , const XMLCh* const    relativePath
>     )
> {
> // Create a buffer as large as both parts and empty it
>     XMLCh* tmpBuf = new XMLCh[XMLString::stringLen(basePath)
>                               + XMLString::stringLen(relativePath)
>                               + 2];
>     *tmpBuf = 0;
> 
>     //
>     //  If we have no base path, then just take the relative path as
>     //  is.
>     //
>     if (!basePath)
>     {
>         XMLString::copyString(tmpBuf, relativePath);
>         return tmpBuf;
>     }
> 
>     if (!*basePath)
>     {
>         XMLString::copyString(tmpBuf, relativePath);
>         return tmpBuf;
>     }
> 
>     const XMLCh* basePtr = basePath + (XMLString::stringLen(basePath) - 1);
>     if ((*basePtr != chForwardSlash)
>     &&  (*basePtr != chBackSlash))
>     {
>         while ((basePtr >= basePath)
>         &&     ((*basePtr != chForwardSlash) && (*basePtr != chBackSlash)))
>         {
>             basePtr--;
>         }
>     }
> 
>     // There is no relevant base path, so just take the relative part
>     if (basePtr < basePath)
>     {
>         XMLString::copyString(tmpBuf, relativePath);
>         return tmpBuf;
>     }
> 
>     // After this, make sure the buffer gets handled if we exit early
>     ArrayJanitor<XMLCh> janBuf(tmpBuf);
> 
>     //
>     //  We have some path part, so we need to check to see if we ahve to
>     //  weave any of the parts together.
>     //
>     const XMLCh* pathPtr = relativePath;
>     while (true)
>     {
>         // If it does not start with some period, then we are done
>         if (*pathPtr != chPeriod)
>             break;
> 
>               unsigned int periodCount = 1;
>         pathPtr++;
>         if (*pathPtr == chPeriod)
>         {
>             pathPtr++;
>             periodCount++;
>         }
> 
>         // Has to be followed by a \ or / or the null to mean anything
>         if ((*pathPtr != chForwardSlash) && (*pathPtr != chBackSlash)
>         &&  *pathPtr)
>         {
>             break;
>         }
>         if (*pathPtr)
>             pathPtr++;
> 
>         // If its one period, just eat it, else move backwards in the base
>         if (periodCount == 2)
>         {
>             basePtr--;
>             while ((basePtr >= basePath)
>             &&     ((*basePtr != chForwardSlash) && (*basePtr != 
> chBackSlash)))
>             {
>                 basePtr--;
>             }
> 
>             if (basePtr < basePath)
>             {
>                 // The base cannot provide enough levels, so its in error
>                 // <TBD>
>             }
>         }
>     }
> 
>     // Copy the base part up to the base pointer
>     XMLCh* bufPtr = tmpBuf;
>     const XMLCh* tmpPtr = basePath;
>     while (tmpPtr <= basePtr)
>         *bufPtr++ = *tmpPtr++;
> 
>     // And then copy on the rest of our path
>     XMLString::copyString(bufPtr, pathPtr);
> 
>     // Orphan the buffer and return it
>     janBuf.orphan();
>     return tmpBuf;
> }
115a116,133
> #=============== IRIX SPECIFIC OPTIONS =========================
> ifeq (${PLATFORM}, IRIX)
>   ifeq (${COMPILER}, g++)
>       CMP= -c ${CXXFLAGS}
>       CC= g++ -c -D${PLATFORM} -D_REENTRANT -fpic -instances=static
>       LINK = g++ -D${PLATFORM} -fpic
>       PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
>       EXTRA_LINK_OPTIONS=-lc
>   else
>       CMP= -c ${CXXFLAGS}
>       CC= CC -c -D${PLATFORM} -LANG:pch -LANG:std -O2 -D_REENTRANT 
> -I/usr/local/include 
>       LINK =  CC -D${PLATFORM} 
>       PLATFORM_LIB_LINK_OPTIONS=
>       EXTRA_LINK_OPTIONS=-lgen
>   endif
>   SHLIBSUFFIX=.so
> endif
> 
139c139
<     echo "       -p <platform> (accepts 'aix', 'linux', 'solaris', 'hp-10', 
'hp-11', 'os400')"
---
>     echo "       -p <platform> (accepts 'aix', 'linux', 'solaris', 'hp-10', 
> 'hp-11', 'os400' 'irix')"
143a144
>     echo "       -z <extra compiler options>"
185c186
< 
---
> compileroptions=""
200a202,204
>    -z)
>         compileroptions="$compileroptions $2"; shift 2;;
> 
228c232
<    aix | linux | solaris | hp-10 | hp-11 | os400)
---
>    aix | linux | solaris | hp-10 | hp-11 | os400 | irix)
251c255,259
<        LIBS="-L/usr/lib -L/usr/ccs/lib"; export LIBS ;;
---
>        if test $platform = "irix"; then
>           LIBS=""; export LIBS 
>        else
>           LIBS="-L/usr/lib -L/usr/ccs/lib"; export LIBS 
>        fi ;;
265,266c273,274
< CXXFLAGS="$debugflag $compileroption"; export CXXFLAGS
< CFLAGS="$debugflag $compileroption"; export CFLAGS
---
> CXXFLAGS="$compileroptions $debugflag $compileroption"; export CXXFLAGS
> CFLAGS="$compileroptions $debugflag $compileroption"; export CFLAGS

Reply via email to