[tlbuild] OpenSolaris
Mojca Miklavec
mojca.miklavec.lists at gmail.com
Mon Feb 29 10:46:54 CET 2016
> small progress: my SunOS openindian 5.11 is using this switch
> -DLUAJIT_OS=LUAJIT_OS_OTHER
>
> but the standard luajit no.
> If I remove it from luajittex compilation I have a working luajittry.
> Now I will why it's there.
The following is inconsistent. In one case one gets LUAJIT_OS_POSIX
and in the other case one gets LUAJIT_OS_OTHER. Similar is true for
any BSD (only that LUAJIT_OS_BSD is then defined in one case).
src/lj_arch.h:
-------------
/* Select native OS if no target OS defined. */
#ifndef LUAJIT_OS
#if defined(_WIN32) && !defined(_XBOX_VER)
#define LUAJIT_OS LUAJIT_OS_WINDOWS
#elif defined(__linux__)
#define LUAJIT_OS LUAJIT_OS_LINUX
#elif defined(__MACH__) && defined(__APPLE__)
#define LUAJIT_OS LUAJIT_OS_OSX
#elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || defined(__OpenBSD__)) && !defined(__ORBIS__)
#define LUAJIT_OS LUAJIT_OS_BSD
#elif (defined(__sun__) && defined(__svr4__)) || defined(__CYGWIN__)
#define LUAJIT_OS LUAJIT_OS_POSIX
#else
#define LUAJIT_OS LUAJIT_OS_OTHER
#endif
src/Makefile:
------------
ifneq ($(HOST_SYS),$(TARGET_SYS))
ifeq (Windows,$(TARGET_SYS))
HOST_XCFLAGS+= -malign-double -DLUAJIT_OS=LUAJIT_OS_WINDOWS
else
ifeq (Linux,$(TARGET_SYS))
HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_LINUX
else
ifeq (Darwin,$(TARGET_SYS))
HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX
else
ifeq (iOS,$(TARGET_SYS))
HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX
else
HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER
endif
The thing is that the chunk of code in Makefile (used when building
luajit alone) is only executed when cross-compiling (it's probably
still wrong, but that's currently irrelevant). If it's not defined by
Makefile, it will be properly defined by lj_arch.h. But configure from
TeX Live contains some code that is *always* executed and is thus
problematic everywhere except Windows, Linux & OS X:
case $LJHOST in #(
Windows) :
echo '-DLUAJIT_OS=LUAJIT_OS_WINDOWS' >>native_flags ;; #(
Darwin | iOS) :
echo '-DLUAJIT_OS=LUAJIT_OS_OSX' >>native_flags ;; #(
Linux) :
echo '-DLUAJIT_OS=LUAJIT_OS_LINUX' >>native_flags ;; #(
*) :
echo '-DLUAJIT_OS=LUAJIT_OS_OTHER' >>native_flags ;;
esac
Maybe it would help to fix the following code in
source/libs/luajit/m4/lj-system.m4:
AS_CASE([$LJHOST],
[Windows], [echo '-DLUAJIT_OS=LUAJIT_OS_WINDOWS' >>native_flags],
[Darwin | iOS], [echo '-DLUAJIT_OS=LUAJIT_OS_OSX' >>native_flags],
[Linux], [echo '-DLUAJIT_OS=LUAJIT_OS_LINUX' >>native_flags],
[echo '-DLUAJIT_OS=LUAJIT_OS_OTHER' >>native_flags])
(and regenerate the configure script)
The problem is most likely here (not necessarily the only place):
#define LUAJIT_OS_OTHER 0
#define LUAJIT_OS_WINDOWS 1
#define LUAJIT_OS_LINUX 2
#define LUAJIT_OS_OSX 3
#define LUAJIT_OS_BSD 4
#define LUAJIT_OS_POSIX 5
#define LJ_TARGET_POSIX (LUAJIT_OS > LUAJIT_OS_WINDOWS)
If the names ends up as "LUAJIT_OS_OTHER", it won't be treated as a
POSIX system and the source code is full of code that depends on
whether one is using POSIX or not (random examples):
#if LJ_TARGET_POSIX
#include <unistd.h>
#else
#include <stdio.h>
#endif
#if LJ_TARGET_POSIX
char buf[15+1];
int fp;
strcpy(buf, "/tmp/lua_XXXXXX");
fp = mkstemp(buf);
if (fp != -1)
close(fp);
else
lj_err_caller(L, LJ_ERR_OSUNIQF);
#else
char buf[L_tmpnam];
if (tmpnam(buf) == NULL)
lj_err_caller(L, LJ_ERR_OSUNIQF);
#endif
#if LJ_TARGET_POSIX
struct tm rtm;
#endif
if (*s == '!') { /* UTC? */
s++; /* Skip '!' */
#if LJ_TARGET_POSIX
stm = gmtime_r(&t, &rtm);
#else
stm = gmtime(&t);
#endif
} else {
#if LJ_TARGET_POSIX
stm = localtime_r(&t, &rtm);
#else
stm = localtime(&t);
#endif
More information about the tlbuild
mailing list