diff options
Diffstat (limited to 'docs/dev/makefile.rst')
-rw-r--r-- | docs/dev/makefile.rst | 206 |
1 files changed, 169 insertions, 37 deletions
diff --git a/docs/dev/makefile.rst b/docs/dev/makefile.rst index ad5665de7..62ac2e905 100644 --- a/docs/dev/makefile.rst +++ b/docs/dev/makefile.rst @@ -1,32 +1,49 @@ .. _makefile: -======== -Makefile -======== +======================= +Makefile & ``./manage`` +======================= .. _gnu-make: https://www.gnu.org/software/make/manual/make.html#Introduction +All relevant build and development tasks are implemented in the +:origin:`./manage <manage>` script and for CI or IDE integration a small +:origin:`Makefile` wrapper is available. If you are not familiar with +Makefiles, we recommend to read gnu-make_ introduction. + .. sidebar:: build environment Before looking deeper at the targets, first read about :ref:`make install`. - To install system requirements follow :ref:`buildhosts`. - -All relevant build tasks are implemented in :origin:`manage` and for CI or -IDE integration a small ``Makefile`` wrapper is available. If you are not -familiar with Makefiles, we recommend to read gnu-make_ introduction. - -The usage is simple, just type ``make {target-name}`` to *build* a target. -Calling the ``help`` target gives a first overview (``make help``): + To install developer requirements follow :ref:`buildhosts`. -.. program-output:: bash -c "cd ..; make --no-print-directory help" .. contents:: :depth: 2 :local: :backlinks: entry +The usage is simple, just type ``make {target-name}`` to *build* a target. +Calling the ``help`` target gives a first overview (``make help``): + +.. tabs:: + + .. group-tab:: ``make`` + + .. program-output:: bash -c "cd ..; make --no-print-directory help" + + + .. group-tab:: ``./manage`` + + The Makefile targets are implemented for comfort, if you can do without + tab-completion and need to have a more granular control, use + :origin:`manage` without the Makefile wrappers. + + .. code:: sh + + $ ./manage help + .. _make install: Python environment (``make install``) @@ -158,29 +175,49 @@ Node.js environment (``make node.env``) Manager) to install latest LTS of Node.js_ locally: there is no need to install nvm_ or npm_ on your system. -Use ``make nvm.status`` to get the current status of you Node.js_ and nvm_ setup. +To install NVM_ and Node.js_ in once you can use :ref:`make nvm.nodejs`. + +.. _make nvm: + +NVM ``make nvm.install nvm.status`` +----------------------------------- -Here is the output you will typically get on a Ubuntu 20.04 system which serves -only a `no longer active <https://nodejs.org/en/about/releases/>`_ Release -`Node.js v10.19.0 <https://packages.ubuntu.com/focal/nodejs>`_. +Use ``make nvm.status`` to get the current status of your Node.js_ and nvm_ +setup. -:: +.. tabs:: - $ make nvm.status - INFO: Node.js is installed at /usr/bin/node - INFO: Node.js is version v10.19.0 - WARN: minimal Node.js version is 16.13.0 - INFO: npm is installed at /usr/bin/npm - INFO: npm is version 6.14.4 - WARN: NVM is not installed - INFO: to install NVM and Node.js (LTS) use: manage nvm install --lts + .. group-tab:: nvm.install -To install you can also use :ref:`make nvm.nodejs` + .. code:: sh + + $ LANG=C make nvm.install + INFO: install (update) NVM at ./searxng/.nvm + INFO: clone: https://github.com/nvm-sh/nvm.git + || Cloning into './searxng/.nvm'... + INFO: checkout v0.39.4 + || HEAD is now at 8fbf8ab v0.39.4 + + .. group-tab:: nvm.status (ubu2004) + + Here is the output you will typically get on a Ubuntu 20.04 system which + serves only a `no longer active <https://nodejs.org/en/about/releases/>`_ + Release `Node.js v10.19.0 <https://packages.ubuntu.com/focal/nodejs>`_. + + .. code:: sh + + $ make nvm.status + INFO: Node.js is installed at /usr/bin/node + INFO: Node.js is version v10.19.0 + WARN: minimal Node.js version is 16.13.0 + INFO: npm is installed at /usr/bin/npm + INFO: npm is version 6.14.4 + WARN: NVM is not installed .. _make nvm.nodejs: ``make nvm.nodejs`` -=================== +------------------- Install latest Node.js_ LTS locally (uses nvm_):: @@ -213,10 +250,29 @@ sources of the theme need to be rebuild. You can do that by running:: $ make themes.all Alternatively to ``themes.all`` you can run *live builds* of the theme you are -modify:: +modify (:ref:`make themes`):: $ LIVE_THEME=simple make run +.. _make format.python: + +``make format.python`` +====================== + +Format Python sourcee code using `Black code style`_. See ``$BLACK_OPTIONS`` +and ``$BLACK_TARGETS`` in :origin:`Makefile`. + +.. attention:: + + We stuck at Black 22.12.0, please read comment in PR `Bump black from 22.12.0 + to 23.1.0`_ + +.. _Bump black from 22.12.0 to 23.1.0: + https://github.com/searxng/searxng/pull/2159#pullrequestreview-1284094735 + +.. _Black code style: + https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html + .. _make clean: ``make clean`` @@ -237,18 +293,34 @@ calling ``make clean`` stop all processes using the :ref:`make install` or .. _make docs: -``make docs docs.autobuild docs.clean`` -======================================= +``make docs`` +============= + +Target ``docs`` builds the documentation: + +.. code:: bash + + $ make docs + HTML ./docs --> file:// + DOCS build build/docs/includes + ... + The HTML pages are in dist/docs. + +.. _make docs.clean: + +``make docs.clean docs.live`` +---------------------------------- We describe the usage of the ``doc.*`` targets in the :ref:`How to contribute / Documentation <contrib docs>` section. If you want to edit the documentation read our :ref:`make docs.live` section. If you are working in your own brand, adjust your :ref:`settings brand`. + .. _make docs.gh-pages: ``make docs.gh-pages`` -====================== +---------------------- To deploy on github.io first adjust your :ref:`settings brand`. For any further read :ref:`deploy on github.io`. @@ -261,17 +333,17 @@ further read :ref:`deploy on github.io`. Runs a series of tests: :ref:`make test.pylint`, ``test.pep8``, ``test.unit`` and ``test.robot``. You can run tests selective, e.g.:: - $ make test.pep8 test.unit test.sh + $ make test.pep8 test.unit test.shell TEST test.pep8 OK ... TEST test.unit OK ... - TEST test.sh OK + TEST test.shell OK .. _make test.shell: ``make test.shell`` -=================== +------------------- :ref:`sh lint` / if you have changed some bash scripting run this test before commit. @@ -279,7 +351,7 @@ commit. .. _make test.pylint: ``make test.pylint`` -==================== +-------------------- .. _Pylint: https://www.pylint.org/ @@ -289,8 +361,8 @@ found in project's root folder :origin:`.pylintrc`. .. _make search.checker: -``search.checker.{engine name}`` -================================ +``make search.checker.{engine name}`` +===================================== To check all engines:: @@ -318,3 +390,63 @@ To filter out HTTP redirects (3xx_):: https://news.google.com:443 "GET /search?q=computer&hl=en&lr=lang_en&ie=utf8&oe=utf8&ceid=US%3Aen&gl=US HTTP/1.1" 302 0 https://news.google.com:443 "GET /search?q=computer&hl=en-US&lr=lang_en&ie=utf8&oe=utf8&ceid=US:en&gl=US HTTP/1.1" 200 None -- + +.. _make themes: + +``make themes.*`` +================= + +.. sidebar:: further read + + - :ref:`devquickstart` + +The :origin:`Makefile` targets ``make theme.*`` cover common tasks to build the +theme(s). The ``./manage themes.*`` command line can be used to convenient run +common theme build tasks. + +.. program-output:: bash -c "cd ..; ./manage themes.help" + +To get live builds while modifying CSS & JS use (:ref:`make run`): + +.. code:: sh + + $ LIVE_THEME=simple make run + +.. _make static.build: + +``make static.build.*`` +======================= + +.. sidebar:: further read + + - :ref:`devquickstart` + +The :origin:`Makefile` targets ``static.build.*`` cover common tasks to build (a +commit of) the static files. The ``./manage static.build..*`` command line +can be used to convenient run common build tasks of the satic files. + +.. program-output:: bash -c "cd ..; ./manage static.help" + + +.. _manage redis.help: + +``./manage redis.help`` +======================= + +The ``./manage redis.*`` command line can be used to convenient run common Redis +tasks (:ref:`Redis developer notes`). + +.. program-output:: bash -c "cd ..; ./manage redis.help" + + +.. _manage go.help: + +``./manage go.help`` +==================== + +The ``./manage go.*`` command line can be used to convenient run common `go +(wiki)`_ tasks. + +.. _go (wiki): https://en.wikipedia.org/wiki/Go_(programming_language) + +.. program-output:: bash -c "cd ..; ./manage go.help" |