diff options
Diffstat (limited to '')
-rw-r--r-- | docs/installation_instructions_for_windows.md | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/docs/installation_instructions_for_windows.md b/docs/installation_instructions_for_windows.md new file mode 100644 index 00000000..b8c18c9d --- /dev/null +++ b/docs/installation_instructions_for_windows.md | |||
@@ -0,0 +1,159 @@ | |||
1 | # Installation instructions for Windows | ||
2 | |||
3 | There are two packages for Windows: | ||
4 | |||
5 | * if you already have a Lua installation, the <b>single binary</b> package | ||
6 | which you can use: get the [latest windows-32.zip file | ||
7 | here](http://luarocks.github.io/luarocks/releases), unpack it and you'll | ||
8 | have a <tt>luarocks.exe</tt> ready to use. Make sure the executable is | ||
9 | available from your executable PATH so you can run <tt>luarocks</tt> from | ||
10 | the command line the same way you run <tt>lua</tt>. | ||
11 | |||
12 | * we also provide an all-in-one package which includes Lua 5.1 and LuaRocks in | ||
13 | source format; get the [latest win32.zip file | ||
14 | here](http://luarocks.github.io/luarocks/releases). The instructions below | ||
15 | are about this package. | ||
16 | |||
17 | This page refers to the second method. The all-in-one package includes | ||
18 | everything you need to launch LuaRocks, including helper binaries and a | ||
19 | Lua interpreter. (You can use your own Lua interpreter if you already have | ||
20 | one installed, see below.) | ||
21 | |||
22 | <b>Important:</b> To compile many Lua packages, you will also need a C compiler. | ||
23 | The installer batch file included in the all-in-one package attempts to detect | ||
24 | if you have Microsoft Visual Studio or [Mingw](https://mingw.org) (Minimalistic GNU for Windows, which includes GCC). | ||
25 | |||
26 | The installer script, <tt>INSTALL.BAT</tt>, provides a number of options for | ||
27 | customizing your installation. Run <tt>INSTALL /?</tt> for details. | ||
28 | |||
29 | Run `INSTALL.BAT` it from a Command Prompt window. If you will be using it | ||
30 | with Microsoft Visual Studio, it is recommended to use LuaRocks with the | ||
31 | Visual Studio Command Prompt, where all environment variables for using the | ||
32 | MSVC compiler, `cl`, are set. | ||
33 | |||
34 | * If you using <a href="https://www.cygwin.com/">Cygwin</a> then go through [installation instructions for Unix](installation_instructions_for_unix.md). | ||
35 | |||
36 | # The default settings | ||
37 | |||
38 | The default settings are suitable for installing LuaRocks globally | ||
39 | in your system while allowing both system-wide and per-user sets of rocks. | ||
40 | Non-priviledged accounts will be able to install their own rocks in their | ||
41 | %APPDATA% directory, and administrator accounts can install rocks that | ||
42 | will be available for everyone. | ||
43 | |||
44 | # Making a system-wide repository | ||
45 | |||
46 | All paths described above can be overridden with flags in the INSTALL.BAT script, | ||
47 | or entries in the configuration file. | ||
48 | |||
49 | {| | ||
50 | | /P _dir_ || Where to install. Default is %PROGRAMFILES%\LuaRocks\_version_. Because LuaRocks contains 32bit executables, this will be in the c:\program files (x86)\ path on 64bit systems. | ||
51 | |} | ||
52 | |||
53 | Configuring the destinations: | ||
54 | |||
55 | {| cellpadding=5px | ||
56 | | /TREE _dir_ || Root of the local tree of installed rocks. Default is %PROGRAMFILES%\LuaRocks\systree. On 64bit systems this default depends on the Lua interpreter used. A 64bit interpreter will have the c:\program files\ path, where a 32bit interpreter on a 64bit system will follow the c:\program files (x86)\ path. | ||
57 | |------------------------------------------------------------------------- | ||
58 | | /SCRIPTS _dir_ || Where to install commandline scripts installed by rocks. Default is {TREE}/bin. | ||
59 | |------------------------------------------------------------------------- | ||
60 | | /CONFIG _dir_ || Location where the config file should be installed. Default is to follow /P option | ||
61 | |------------------------------------------------------------------------- | ||
62 | | /SELFCONTAINED || Creates a self contained installation in a single directory given by /P. Sets the /TREE and /CONFIG options to the same location as /P. And does not load registry info with option /NOREG. The only option NOT self contained is the user rock tree, so don't use that if you create a self contained installation. | ||
63 | |} | ||
64 | |||
65 | Configuring the Lua interpreter: | ||
66 | |||
67 | {| cellpadding=5px | ||
68 | | /LV _version_ || Lua version to use; either 5.1, 5.2 or 5.3. Default is auto-detected. | ||
69 | |------------------------------------------------------------------------- | ||
70 | | /LUA _dir_ || Location where Lua is installed - e.g. c:\lua\5.1\. If not provided, the installer will search the system path and some default locations for a valid Lua installation. This is the base directory, the installer will look for subdirectories bin, lib, include. Alternatively these can be specified explicitly using the /INC, /LIB, and /BIN options. | ||
71 | |------------------------------------------------------------------------- | ||
72 | | /INC _dir_ || Location of Lua includes - e.g. c:\lua\5.1\include. If provided overrides sub directory found using /LUA. | ||
73 | |------------------------------------------------------------------------- | ||
74 | | /LIB _dir_ || Location of Lua libraries (.dll/.lib) - e.g. c:\lua\5.1\lib. If provided overrides sub directory found using /LUA. | ||
75 | |------------------------------------------------------------------------- | ||
76 | | /BIN _dir_ || Location of Lua executables - e.g. c:\lua\5.1\bin. If provided overrides sub directory found using /LUA. | ||
77 | |------------------------------------------------------------------------- | ||
78 | | /L || Install LuaRocks' own copy of Lua even if detected, this will always be a 5.1 installation. (/LUA, /INC, /LIB, /BIN cannot be used with /L) | ||
79 | within an application. | ||
80 | |} | ||
81 | |||
82 | Compiler configuration: | ||
83 | |||
84 | {| cellpadding=5px | ||
85 | | /MW || Use mingw as build system instead of MSVC. | ||
86 | |} | ||
87 | |||
88 | Other options: | ||
89 | |||
90 | {| cellpadding=5px | ||
91 | | /FORCECONFIG || Use a single config location. Do not use the LUAROCKS_CONFIG variable or the user's home directory. Useful to avoid conflicts when LuaRocks is embedded | ||
92 | |------------------------------------------------------------------------- | ||
93 | | /F || Force. Remove installation directory if it already exists. | ||
94 | |------------------------------------------------------------------------- | ||
95 | | /NOREG || Do not load registry info to register '.rockspec' extension with LuaRocks commands (right-click). | ||
96 | |------------------------------------------------------------------------- | ||
97 | | /NOADMIN || The installer requires admin priviledges. If not available it will elevate a new process. Use this switch to prevent elevation, but make sure the destination paths are all accessible for the current user. | ||
98 | |------------------------------------------------------------------------- | ||
99 | | /Q || Do not prompt for confirmation of settings | ||
100 | |} | ||
101 | |||
102 | After installation, a default config file called config.lua will be installed at the directory defined by /CONFIG. For further configuration of LuaRocks paths, see the [Config file format](config_file_format.md). For more information on the structure of rocks trees see [rocks repositories](rocks_repositories.md). | ||
103 | |||
104 | # Making a self-contained installation | ||
105 | |||
106 | Another option is to install LuaRocks in a self-contained manner. This | ||
107 | is an interesting alternative when shipping an application which uses | ||
108 | third-party modules. Bundling them as rocks reduces maintenance overhead | ||
109 | and allows the user to perform updates. | ||
110 | |||
111 | In this scenario, it is not desired to have the user's (or the system's) | ||
112 | configuration affect the self-contained LuaRocks install, in case the | ||
113 | user or the system also have different LuaRocks installations. For this | ||
114 | reason, the INSTALL.BAT script allows to hardcode the location of a | ||
115 | configuration file. For example, the compilation process of a package | ||
116 | bundling LuaRocks could do something like this: | ||
117 | |||
118 | ``` | ||
119 | SET PREFIX=C:\mypackage | ||
120 | INSTALL /P %PREFIX% /CONFIG %PREFIX%\luarocks | ||
121 | ``` | ||
122 | |||
123 | The copy of LuaRocks installed in C:\mypackage will ignore | ||
124 | customization schemes such as the %LUAROCKS_CONFIG% environment variable | ||
125 | and will only use C:\mypackage\luarocks\config.lua. | ||
126 | |||
127 | An interesting option in those cases is for the application to provide | ||
128 | in its configuration file an URL for their own rocks repository, so they | ||
129 | can have control over updates to be performed. Continuing the previous | ||
130 | example, luarocks\config.lua could contain something like this: | ||
131 | |||
132 | ``` | ||
133 | repositories = { | ||
134 | "http://www.example.com/rocks/" | ||
135 | } | ||
136 | ``` | ||
137 | |||
138 | # Picking the Lua interpreter | ||
139 | |||
140 | LuaRocks can use its own Lua interpreter provided by the Lua for WIndows project, | ||
141 | and will do so by default if it fails to find your Lua installation | ||
142 | automatically. If you want to use your own interpreter, which is not on the system path, | ||
143 | you can pass its path using the /LUA variable (or /BIN, /LIB and /INC explicitly, if | ||
144 | you have a custom directory structure). | ||
145 | |||
146 | When looking for an interpreter, it will also try to figure out the name of | ||
147 | the Lua binary (lua.exe, lua5.1.exe). This is set in the `lua_interpreter` | ||
148 | variable in the configuration file. If you want to use an alternative name to the | ||
149 | interpreter, you can set that variable in your configuration file directly. | ||
150 | |||
151 | An important element is the runtime libraries used by the interpreter, as LuaRocks must | ||
152 | compile additional rocks installed with the same runtime as the interpreter. To do this | ||
153 | LuaRocks will analyse the executable found. | ||
154 | |||
155 | # Next steps | ||
156 | |||
157 | Once LuaRocks is installed, learn more about [using LuaRocks](using_luarocks.md). | ||
158 | |||
159 | |||