LinuxCommandLibrary

makensis

Create Windows installers using NSIS scripts

TLDR

Compile a NSIS script

$ makensis [path/to/file.nsi]
copy

Compile a NSIS script in strict mode (treat warnings as errors)
$ makensis -WX [path/to/file.nsi]
copy

Display help for a specific command
$ makensis -CMDHELP [command]
copy

SYNOPSIS

makensis [options] script.nsi

PARAMETERS

-v[level]
    Set verbosity level. 0=none, 1=errors, 2=warnings, 3=info, 4=details. Default is 2.

-NOCD
    Do not change the current directory to that of the script.

-INPUTCHARSET charset
    Set the input charset for the script. Example: "-INPUTCHARSET UTF-8".

-OUTPUTCHARSET charset
    Set the output charset for the generated installer. Example: "-OUTPUTCHARSET UTF-16LE".

-Ddefine[=value]
    Define a preprocessor symbol. If value is omitted, the symbol is defined with a value of '1'.

-Xcommand
    Execute an NSIS command directly.

-Px64=1
    Compiles for x64 platform

-Parch=value
    Sets the target architecture for the compiler. (X86, ARM64, ...)

-LICENSE
    Displays the NSIS license.

-VERSION
    Displays the NSIS version.

DESCRIPTION

The makensis command is a compiler for NSIS (Nullsoft Scriptable Install System) scripts, enabling the creation of Windows installers on Linux and other non-Windows platforms. It reads an NSIS script (typically with the .nsi extension), interprets its instructions, and generates a Windows executable installer. This allows developers to build Windows applications and installers without needing a Windows environment.

makensis provides command-line options to customize the build process, such as preprocessor definitions, output filename, and error reporting. The compiler supports a wide range of NSIS features, including file compression, registry manipulation, user interface customization, and plugin integration.

Using makensis you can Automate the build process for NSIS-based installers, Integrate installer creation into cross-platform development workflows, Build installers on build servers without Windows dependencies, or Package Windows applications and libraries for distribution.

CAVEATS

makensis relies on a valid NSIS script. Errors in the script will cause the compiler to fail. Ensure that the NSIS environment is correctly set up, including plugin paths, before running makensis.

EXIT CODES

makensis returns an exit code of 0 on success and a non-zero exit code on failure. This is useful for scripting and automation.

CHARACTER SETS

Specifying the correct INPUTCHARSET and OUTPUTCHARSET is crucial for handling non-ASCII characters correctly in your installer. UTF-8 and UTF-16LE are common choices.

HISTORY

NSIS was originally created by Justin Frankel of Nullsoft, the makers of Winamp. It's a successor to an earlier installer system called PiMP (Plugin Mini Packager). NSIS was designed to be small, efficient, and scriptable. The first public release was in 1997. Over the years, it has become a popular choice for creating Windows installers due to its flexibility and free availability. makensis, the compiler, has evolved alongside NSIS, adding support for new features and platforms, including compilation on Linux and macOS.

SEE ALSO

wine(1), gcc(1)

Copied to clipboard