ngs-lang / ngs

Next Generation Shell (NGS)
https://ngs-lang.org/
GNU General Public License v3.0
1.49k stars 41 forks source link

[build] Make building documentation configurable #672

Closed Artturin closed 3 months ago

Artturin commented 4 months ago

Also pulled in https://git.alpinelinux.org/aports/tree/testing/ngs/busybox-compat.patch

Artturin commented 4 months ago

There seems to be a random segfault issue going on in the tests https://github.com/ngs-lang/ngs/actions/runs/9910596236/job/27381341997?pr=672#step:4:270 (darwin) Previous CI run https://github.com/ngs-lang/ngs/actions/runs/9910403102/job/27380707730?pr=672 (arch) I got it once locally(NixOS) but after rebuilding it worked.

Artturin commented 4 months ago
* I'm thinking of 3 modes switch: build, don't build, build if `pandoc` is available (default). What do you think?

Build if available is not easy to do in cmake.

find_program(PANDOC pandoc)

Outside if (BUILD_MAN)

Stops the build with CMake Error at CMakeLists.txt:134 (message): Could not find pandoc if pandoc isn't found

In meson it would be as simple.

pandoc = find_program('pandoc', required : get_option('man'))
if pandoc.found()
   ...
endif

And having the man option as auto

ilyash-b commented 4 months ago
* I'm thinking of 3 modes switch: build, don't build, build if `pandoc` is available (default). What do you think?

Build if available is not easy to do in cmake.

find_program(PANDOC pandoc)

Outside if (BUILD_MAN)

This part I did not understand.

Stops the build with CMake Error at CMakeLists.txt:134 (message): Could not find pandoc if pandoc isn't found

Docs:

If the program is found the result is stored in the variable and the search will not be repeated unless the variable is cleared. If nothing is found, the result will be \<VAR>-NOTFOUND.

Added find_program(PANDOC pandoc) in the middle of the file. No error. Please elaborate.

Edit: added find_program(PANDOC pandoc-not-found), not the above

Artturin commented 4 months ago
* I'm thinking of 3 modes switch: build, don't build, build if `pandoc` is available (default). What do you think?

Build if available is not easy to do in cmake.

find_program(PANDOC pandoc)

Outside if (BUILD_MAN)

This part I did not understand.

Stops the build with CMake Error at CMakeLists.txt:134 (message): Could not find pandoc if pandoc isn't found

Docs:

If the program is found the result is stored in the variable and the search will not be repeated unless the variable is cleared. If nothing is found, the result will be -NOTFOUND.

Added find_program(PANDOC pandoc) in the middle of the file. No error. Please elaborate.

Edit: added find_program(PANDOC pandoc-not-found), not the above

My bad, I forgot to remove the

if(NOT PANDOC)
      message(FATAL_ERROR "Could not find pandoc")
endif()

The error message had the line of the error message in it put I overlooked it

PR Ready

ilyash-b commented 4 months ago

I'm thinking of 3 modes switch: build, don't build, build if pandoc is available (default).

I'm still for this design unless convinced otherwise. It should be possible to have control as follows (not solvable with single boolean flag):

Artturin commented 4 months ago

I'm thinking of 3 modes switch: build, don't build, build if pandoc is available (default).

I'm still for this design unless convinced otherwise. It should be possible to have control as follows (not solvable with single boolean flag):

* "I need the man pages to be built". Fails if there is no `pandoc`

* "I don't need the man pages to be built". Skips completely. Doesn't even check for `pandoc` presence.

* "I don't mind. Build the man pages if possible". If `pandoc` is not available, gives a message and moves on, doesn't fail. Builds the man pages if `pandoc` is there. This should be the default.

Found the way to do it in https://cmake.org/pipermail/cmake/2016-October/064342.html

ilyash-b commented 3 months ago

Thanks!

Artturin commented 3 months ago

:rocket:

@jirutka The changes in your patch are now merged (in this PR and a few others) https://git.alpinelinux.org/aports/tree/testing/ngs/cmakelists.patch