niminst.rst 6.6 KB

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