lua-users home
lua-l archive

Re: Build configuration via defines

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Jul 9, 2018, at 16:47, Reinder Feenstra wrote:
On Mon, 9 Jul 2018, 15:41 Pierre Chapuis, <catwell@archlinux.us> wrote:
On Mon, Jul 9, 2018, at 15:18, Marc Balmer wrote:

> I‘d very much appreciate that, esp. for Lua in NetBSD.

Same here, it would probably help for Android / iOS (even though I think they would probably still require patching luaconf.h).

I've built and used liblua 5.3.4 with success on Android and iOS. For iOS I patched the os_system function, as system() isn't available on iOS.
And made some changes in the Makefile. I didn't need to change luaconf.h

That's a bit out of the topic but I build for both platforms.

For system, I do this in luaconf.h to avoid patching the rest of the sources:

+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#if defined(TARGET_IPHONE_SIMULATOR) || defined(TARGET_OS_IPHONE)
+#define LUA_USE_IOS
+#endif
+#endif

+/* iOS does not have system() (Seriously, Apple...) */
+#ifdef LUA_USE_IOS
+#include <stdlib.h>
+#undef system
+#define system(command) ({ command ? -1 : 0; })
+#endif

Regarding Android, I have a patch related to LOCALE:

+#if defined(LUA_USE_ANDROID) && !defined(lua_getlocaledecpoint)
+#define lua_getlocaledecpoint() ('.')
+#endif

... and I have a patch in lmathlib.c to avoid using log2().

I have a few other patches for Windows / MinGW. I should Open Source that fork...

--
Pierre Chapuis

AltStyle によって変換されたページ (->オリジナル) /