[Dev-luatex] platform/architecture

Mojca Miklavec mojca.miklavec.lists at gmail.com
Thu Aug 18 01:34:13 CEST 2011


Dear Taco,

(moved from the context mailing list)

On Thu, Jan 27, 2011 at 07:25, Taco Hoekwater wrote:
> On 01/27/11 00:21, Mojca Miklavec wrote:
>> However ... this discussion was already being held long ago ... there
>> is no reason why luatex could not be as smart as "bash --version" is
>> and aware of the architecture it was compiled for (that is not
>> necessary the platform it is running on; an obvious case being i386
>> luatex running on 64-bit Mas OS X for example). Somebody would have to
>> write some simple code to check for that though.
>
> http://tracker.luatex.org/view.php?id=562

I'm reviving this discussion since my next question would be a request
for Hans to add support for mips to ConTeXt. But that is a highly
tricky business. I don't know any better how to do it than
config.guess does (please close your eyes :)

    mips:Linux:*:* | mips64:Linux:*:*)
	eval $set_cc_for_build
	sed 's/^	//' << EOF >$dummy.c
	#undef CPU
	#undef ${UNAME_MACHINE}
	#undef ${UNAME_MACHINE}el
	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) ||
defined(MIPSEL)
	CPU=${UNAME_MACHINE}el
	#else
	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) ||
defined(MIPSEB)
	CPU=${UNAME_MACHINE}
	#else
	CPU=
	#endif
	#endif
EOF

It actually runs the compiler and tests for some flags. You could do
the same, except that this script is well maintained and has
(hopefully) proper support for many exotic platforms.

I see that config.guess resides in the mpost & luatex repository
already. The latest version can probably be fetched from
    http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
but that is not really important in most cases.

To me it seems that the script does a really decent job (except when
it doesn't :) Honestly, I'm not sure what exactly it does in case of
cross-compilers; I would need your help with that.

There are two other problems that I'm aware of, but I'm almost able to
fix both and can try to send patches upstream to see if they accept
them. If they don't, it can still be fixed in luatex source
repository.

1.) Configuration for Apple is slightly wrong in case of
cross-compilers, but I can either submit a patch to the project or you
could patch the file in your repository in case that they reject the
patch (I also need somebody's assistance for writing the patch, but at
least I know exactly what has to be checked).

2.) In case of Debian (including mips) it doesn't check if the system
is actually 64-bit or not. In my opinion this should be fixed.

Apart from that, the script returns three (four) parameters, separated
with a dash: CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
    1.) cpu type (uname -m; UNAME_MACHINE)
    2.) manufacturer
    3.) os (uname -s; UNAME_SYSTEM)
    4.) version; optional; UNAME_RELEASE (and no dash separating
system & version)

The versions are almost arbitrary or absent. For linux it is "-gnu" or
"-$(libc)" (I wonder why the dash in this case).

The call luatex --version could return exactly the same string as
config.guess or as bash --version (with slight modifications where
needed). But it would have to know at least about the first and third
variable, possibly about version as well (when present and when it
makes sense).

The function os.uname returns a table with
    sysname, machine, release, version, and nodename
I would suggest to provide one similar set of values, providing
information about the build architecture as obtained by config.guess.

Honestly, I don't mind if luatex uses "darwin" instead of "macosx".
Actually, I probably prefer darwin. If ConTeXt wants to further modify
these names, it should be free to do so, but LuaTeX should be as close
to original as possible.

The number 11 (config.guess returns x86_64-apple-darwin11) is useful
to have as the information about backward compatibility, at least in
case of mac. But I'm not yet sure how to check for that during
compilation. I can try to figure it out.

What do you think?

Mojca


More information about the dev-luatex mailing list