niminst.rst 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. .. default-role:: code
  2. =========================
  3. niminst User's manual
  4. =========================
  5. :Author: Andreas Rumpf
  6. :Version: |nimversion|
  7. .. contents::
  8. Introduction
  9. ============
  10. niminst is a tool to generate an installer for a Nim program. Currently
  11. it can create an installer for Windows
  12. via `Inno Setup <http://www.jrsoftware.org/isinfo.php>`_ as well as
  13. installation/deinstallation scripts for UNIX. Later versions will support
  14. Linux' package management systems.
  15. niminst works by reading a configuration file that contains all the
  16. information that it needs to generate an installer for the different operating
  17. systems.
  18. Configuration file
  19. ==================
  20. niminst uses the Nim `parsecfg <parsecfg.html>`_ module to parse the
  21. configuration file. Here's an example of how the syntax looks like:
  22. .. include:: mytest.cfg
  23. :literal:
  24. The value of a key-value pair can reference user-defined variables via
  25. the `$variable` notation: They can be defined in the command line with the
  26. `--var:name=value` switch. This is useful to not hard-coding the
  27. program's version number into the configuration file, for instance.
  28. It follows a description of each possible section and how it affects the
  29. generated installers.
  30. Project section
  31. ---------------
  32. The project section gathers general information about your project. It must
  33. contain the following key-value pairs:
  34. ==================== =======================================================
  35. Key description
  36. ==================== =======================================================
  37. `Name` the project's name; this needs to be a single word
  38. `DisplayName` the project's long name; this can contain spaces. If
  39. not specified, this is the same as `Name`.
  40. `Version` the project's version
  41. `OS` the OSes to generate C code for; for example:
  42. `"windows;linux;macosx"`
  43. `CPU` the CPUs to generate C code for; for example:
  44. `"i386;amd64;powerpc"`
  45. `Authors` the project's authors
  46. `Description` the project's description
  47. `App` the application's type: "Console" or "GUI". If
  48. "Console", niminst generates a special batch file
  49. for Windows to open up the command-line shell.
  50. `License` the filename of the application's license
  51. ==================== =======================================================
  52. `files` key
  53. -------------
  54. Many sections support the `files` key. Listed filenames
  55. can be separated by semicolon or the `files` key can be repeated. Wildcards
  56. in filenames are supported. If it is a directory name, all files in the
  57. directory are used::
  58. [Config]
  59. Files: "configDir"
  60. Files: "otherconfig/*.conf;otherconfig/*.cfg"
  61. Config section
  62. --------------
  63. The `config` section currently only supports the `files` key. Listed files
  64. will be installed into the OS's configuration directory.
  65. Documentation section
  66. ---------------------
  67. The `documentation` section supports the `files` key.
  68. Listed files will be installed into the OS's native documentation directory
  69. (which might be `$appdir/doc`).
  70. There is a `start` key which determines whether the Windows installer
  71. generates a link to e.g. the `index.html` of your documentation.
  72. Other section
  73. -------------
  74. The `other` section currently only supports the `files` key.
  75. Listed files will be installed into the application installation directory
  76. (`$appdir`).
  77. Lib section
  78. -----------
  79. The `lib` section currently only supports the `files` key.
  80. Listed files will be installed into the OS's native library directory
  81. (which might be `$appdir/lib`).
  82. Windows section
  83. ---------------
  84. The `windows` section supports the `files` key for Windows-specific files.
  85. Listed files will be installed into the application installation directory
  86. (`$appdir`).
  87. Other possible options are:
  88. ==================== =======================================================
  89. Key description
  90. ==================== =======================================================
  91. `BinPath` paths to add to the Windows `%PATH%` environment
  92. variable. Example: ``BinPath: r"bin;dist\mingw\bin"``
  93. `InnoSetup` boolean flag whether an Inno Setup installer should be
  94. generated for Windows. Example: `InnoSetup: "Yes"`
  95. ==================== =======================================================
  96. UnixBin section
  97. ---------------
  98. The `UnixBin` section currently only supports the `files` key.
  99. Listed files will be installed into the OS's native bin directory
  100. (e.g. `/usr/local/bin`). The exact location depends on the
  101. installation path the user specifies when running the `install.sh` script.
  102. Unix section
  103. ------------
  104. Possible options are:
  105. ==================== =======================================================
  106. Key description
  107. ==================== =======================================================
  108. `InstallScript` boolean flag whether an installation shell script
  109. should be generated. Example: `InstallScript: "Yes"`
  110. `UninstallScript` boolean flag whether a de-installation shell script
  111. should be generated.
  112. Example: `UninstallScript: "Yes"`
  113. ==================== =======================================================
  114. InnoSetup section
  115. -----------------
  116. Possible options are:
  117. ==================== =======================================================
  118. Key description
  119. ==================== =======================================================
  120. `path` Path to Inno Setup.
  121. Example: ``path = r"c:\inno setup 5\iscc.exe"``
  122. `flags` Flags to pass to Inno Setup.
  123. Example: `flags = "/Q"`
  124. ==================== =======================================================
  125. C_Compiler section
  126. ------------------
  127. Possible options are:
  128. ==================== =======================================================
  129. Key description
  130. ==================== =======================================================
  131. `path` Path to the C compiler.
  132. `flags` Flags to pass to the C Compiler.
  133. Example: `flags = "-w"`
  134. ==================== =======================================================
  135. Real-world example
  136. ==================
  137. The installers for the Nim compiler itself are generated by niminst. Have a
  138. look at its configuration file:
  139. .. include:: ../compiler/installer.ini
  140. :literal: