LoginSignup
0
2

More than 3 years have passed since last update.

HereRocksなるものがあるらしい

Last updated at Posted at 2020-11-16

hererocks のメモ

なにやらLuaRocksの上位互換らしきものがあるらしいので、それについてのメモ。
Windowsでも簡単にLuaRocksが扱えるとのこと。

Github

概要

Githubには以下のように記載がある。

hererocks is a single file Python 2.7/3.x script for installing Lua (or LuaJIT or moonjit or RaptorJIT) and LuaRocks, its package manager, into a local directory. It configures Lua to only see packages installed by that bundled version of LuaRocks, so that the installation is isolated.

ローカルファイルにLuaやその派生言語、およびLuaRocksをインストールするためのPythonスクリプトとのこと。つまりPythonがないと始まらない。
メンテナンスもLuaRocksのチームが担っているらしい。
なんでもいいやとりあえず落とせ落とせ。

実行環境

必要なもの:

  • Python 2.7 or 3.x
  • Git
  • コンパイラ
    • Windows: MinGW + gcc (PATHを通してあること)、あるいはVisual Studio 2008 or later
    • (2020年11月27日追記) MSVC 2015 までっぽい
    • OS X: cc
    • その他: gcc
PS C:Users\hogehoge> pip -V
pip 20.2.4 from C:users\hogehoge\appdata\local\programs\python\python39\lib\site-packages\pip (python 3.9)
PS C:Users\hogehoge> python -V
Python 3.9.0
PS C:\Users\hogehoge> mingw-get.exe -V
mingw-get version 0.6.3-pre-20170905-1
Copyright (C) 2009-2013, MinGW.org Project

インストール

pipでインストールする。
pip install git+https://github.com/luarocks/hererocksと打てば数秒で終わる。

PS C:\Users\hogehoge> pip install git+https://github.com/luarocks/hererocks
Collecting git+https://github.com/luarocks/hererocks
  Cloning https://github.com/luarocks/hererocks to c:\users\hogehoge\appdata\local\temp\pip-req-build-9p8s_l6u

#    ⋮ 

Successfully installed hererocks-0.22.0

PS C:\Users\hogehoge> hererocks.exe --help
usage: hererocks [-l LUA] [-j LUAJIT] [-m MOONJIT] [--raptorjit RAPTORJIT] [-r LUAROCKS]
                 [--show] [-i] [--compat {default,none,all,5.1,5.2}] [--patch]
                 [--cflags CFLAGS]
                 [--target {linux,macosx,freebsd,mingw,posix,generic,mingw,vs,vs_XX,vsXX_YY}]

#    ⋮

Luaのインストール

Lua自体は元々インストールされているが、hererocksで管理しておきたいのでやっておく。
hererocks.exe lua53 -l 5.3 -r latestでlua5.3がインストールされる。

PS C:\Users\hogehoge> hererocks.exe lua53 -l 5.3 -r latest
Fetching Lua 5.3.6 (target: mingw) from http://www.lua.org/ftp/lua-5.3.6.tar.gz
Verifying SHA256 checksum
Building Lua 5.3.6 (target: mingw)
No patches available for Lua 5.3.6
Installing Lua 5.3.6 (target: mingw)
Fetching LuaRocks 3.4.0 from http://luarocks.github.io/luarocks/releases/luarocks-3.4.0-win32.zip
Verifying SHA256 checksum
Building and installing LuaRocks 3.4.0
Done.

なんか勢いでユーザーフォルダ直下に落としてしまった。まいっか。
このままだとPATHが通っていないので、通しておくこと。

LuaRocks で make

本題。とはいえ使い方はいたって普通。
LuaのPATH(\lua5x\bin)を通してあれば普通に使える。

PS C:\Users\hogehoge\Path\To\rockspec> luarocks make

mymodule scm-1 depends on lua >= 5.1 (5.1-1 provided by VM)
C:\mingw\bin\gcc.exe -O2 -c -o src/mymodule.o -IC:\Users\hogehoge\lua51\include src/mymodule.c
C:\mingw\bin\gcc.exe -shared -o mymodule.dll src/mymodule.o C:\Users\hogehoge\lua51\bin/lua51.dll -lm
mymodule scm-1 is now installed in c:\users\hogehoge\lua51\ (license: MIT/X11)
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2