koch.rst 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. ===============================
  2. Nim maintenance script
  3. ===============================
  4. :Version: |nimversion|
  5. .. contents::
  6. .. raw:: html
  7. <blockquote><p>
  8. "A great chef is an artist that I truly respect" -- Robert Stack.
  9. </p></blockquote>
  10. Introduction
  11. ============
  12. The `koch`:idx: program is Nim's maintenance script. It is a replacement
  13. for make and shell scripting with the advantage that it is much more portable.
  14. The word *koch* means *cook* in German. ``koch`` is used mainly to build the
  15. Nim compiler, but it can also be used for other tasks. This document
  16. describes the supported commands and their options.
  17. Commands
  18. ========
  19. boot command
  20. ------------
  21. The `boot`:idx: command bootstraps the compiler, and it accepts different
  22. options:
  23. -d:release
  24. By default a debug version is created, passing this option will
  25. force a release build, which is much faster and should be preferred
  26. unless you are debugging the compiler.
  27. -d:useGnuReadline
  28. Includes the `rdstdin module <rdstdin.html>`_ for `interactive
  29. mode <nimc.html#nim-interactive-mode>`_ (aka ``nim i``).
  30. This is not needed on Windows. On other platforms this may
  31. incorporate the GNU readline library.
  32. -d:nativeStacktrace
  33. Use native stack traces (only for Mac OS X or Linux).
  34. -d:avoidTimeMachine
  35. Only for Mac OS X, activating this switch will force excluding
  36. the generated ``nimcache`` directories from Time Machine backups.
  37. By default ``nimcache`` directories will be included in backups,
  38. and just for the Nim compiler itself it means backing up 20MB
  39. of generated files each time you update the compiler. Using this
  40. option will make the compiler invoke the `tmutil
  41. <https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man8/tmutil.8.html>`_
  42. command on all ``nimcache`` directories, setting their backup
  43. exclusion bit.
  44. You can use the following command to locate all ``nimcache``
  45. directories and check their backup exclusion bit::
  46. $ find . -type d -name nimcache -exec tmutil isexcluded \{\} \;
  47. --gc:refc|v2|markAndSweep|boehm|go|none
  48. Selects which garbage collection strategy to use for the compiler
  49. and generated code. See the `Nim's Garbage Collector <gc.html>`_
  50. documentation for more information.
  51. After compilation is finished you will hopefully end up with the nim
  52. compiler in the ``bin`` directory. You can add Nim's ``bin`` directory to
  53. your ``$PATH`` or use the `install command`_ to place it where it will be
  54. found.
  55. csource command
  56. ---------------
  57. The `csource`:idx: command builds the C sources for installation. It accepts
  58. the same options as you would pass to the `boot command`_.
  59. temp command
  60. ------------
  61. The temp command builds the Nim compiler but with a different final name
  62. (``nim_temp``), so it doesn't overwrite your normal compiler. You can use
  63. this command to test different options, the same you would issue for the `boot
  64. command`_.
  65. test command
  66. ------------
  67. The `test`:idx: command can also be invoked with the alias ``tests``. This
  68. command will compile and run ``tests/testament/tester.nim``, which is the main
  69. driver of Nim's test suite. You can pass options to the ``test`` command,
  70. they will be forwarded to the tester. See its source code for available
  71. options.
  72. web command
  73. -----------
  74. The `web`:idx: command converts the documentation in the ``doc`` directory
  75. from rst to HTML. It also repeats the same operation but places the result in
  76. the ``web/upload`` which can be used to update the website at
  77. https://nim-lang.org.
  78. By default the documentation will be built in parallel using the number of
  79. available CPU cores. If any documentation build sub commands fail, they will
  80. be rerun in serial fashion so that meaninful error output can be gathered for
  81. inspection. The ``--parallelBuild:n`` switch or configuration option can be
  82. used to force a specific number of parallel jobs or run everything serially
  83. from the start (``n == 1``).
  84. zip command
  85. -----------
  86. The `zip`:idx: command builds the installation ZIP package.