如何使用 MinGW 和 MSYS 为 Windows 构建 Lua? [英] How Do I Build Lua For Windows Using MinGW and MSYS?

查看:22
本文介绍了如何使用 MinGW 和 MSYS 为 Windows 构建 Lua?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一本书叫做开始 Lua 编程",它应该介绍原始基础知识,但它让我陷入困境.这是压缩3页的努力:

I have a book called Beginning Lua Programming which is suppose to go over the raw basics but it is sort of leaving me stranded. Here is an effort to condense 3 pages:

引用:

The following environment variables are recommended for Windows:
UTIL_DIR=c:program filesutility
LUA_DIR=c:program fileslua5.1
LUA_CPATH=?.dll;%LUA_DIR%?.dll
LUA_PATH=?.lua;%LUA_DIR%?.lua
The UTIL_DIR variable identifies the utility directory you created in the preceding section. 

在此之后,有一段关于为lua设置'windows搜索路径'.基本上,它告诉我查找 'doskey/?' 的输出和路径"并自己弄清楚.我不知道这些是做什么的,如何使用它们,它们之间的区别是什么.

After this, there is a segment about setting the 'windows search path' for lua. Basically, it tells me to look up the output of 'doskey /?' and 'path' and figure it out myself. I have no idea what these do, how to use them, and what the difference between them is.

我已经无能为力了.非常感谢详细解释或详细博客/文章或 YouTube 视频的链接!

I'm at my wits end. A detailed explanation or a link to a detailed blog/article or youtube video is EXTREMELY appreciated!

推荐答案

有几种方法可以让 Lua 在你的机器上工作.如果您只是想要一个功能强大的 Lua 环境,而不会大惊小怪,那么请考虑下载一个预编译的 Lua 二进制文件.常见的是 Lua for WindowsLuaBinaries.

There are a few ways to get Lua working on your machine. If you just want to a functional Lua environment in a hurry with minimal fuss then consider downloading one of the precompiled Lua binaries. The common ones being Lua for Windows and LuaBinaries.

用 Mingw 构建 Lua 并不太难:

Building Lua with Mingw isn't too difficult:

  • 首先在此处获取所需的 Lua 版本.
  • 在某处提取包含 Lua 源代码的 tar 文件.对于这个例子,我假设你解压到 c:lua
  • 如果您已经设置了 Msys,您可以从该环境运行 make 文件.在 Msys shell 中,您可以使用以下命令构建 lua:

  • First get your desired Lua version here.
  • Extract the tar file containing Lua's source somewhere. For this example, I'll assume you extracted to c:lua
  • If you have Msys already set up, you can run the make file from that environment. From the Msys shell, you can build lua with the follow commands:

cd /c/lua
make PLAT=mingw
make install

  • 构建完成后,您应该会在其中的某处找到 lua.exeluac.exe.此时 Lua 应该可以使用了.

  • You should find lua.exe and luac.exe somewhere in there after the build completes. Lua should be ready for use at this point.

    常规的 cmd.exe shell 也可以通过对命令进行一些更改来工作:

    The regular cmd.exe shell can work too with some changes to the commands:

        cd lua
        mingw32-make PLAT=mingw
    

    make install 假定一个 *nix 环境,因此不能在普通的 windows cmd shell 下工作.在这种情况下,您可以手动将编译后的文件从 .luasrc 复制到您想要的位置,或者您可以根据需要直接从那里运行它.

    The make install assumes a *nix environment and so doesn't work under a normal windows cmd shell. In this case you can just manually copy the compiled files from .luasrc to where you want or you can just run it directly from there if desired.

    这篇关于如何使用 MinGW 和 MSYS 为 Windows 构建 Lua?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆