diff --git a/README.md b/README.md index ece7de5..0762efb 100644 --- a/README.md +++ b/README.md @@ -36,4 +36,18 @@ You can reference the E2E test in Ubuntu 20.04: [https://github.com/version-fox/ brew install autoconf libxslt fop wxwidgets openssl ``` -You can reference the E2E test in MacOS 13: [https://github.com/version-fox/vfox-erlang/actions/workflows/e2e_test.yaml](https://github.com/version-fox/vfox-erlang/actions/workflows/e2e_test.yaml) \ No newline at end of file +You can reference the E2E test in MacOS 13: [https://github.com/version-fox/vfox-erlang/actions/workflows/e2e_test.yaml](https://github.com/version-fox/vfox-erlang/actions/workflows/e2e_test.yaml) + +## Note + +By default, vfox-erlang plugin will Build [EEP-48 documentation chunks](https://www.erlang.org/doc/apps/kernel/eep48_chapter) for get doc in REPL (eg: h(list).) and [lsp docs hint](https://github.com/elixir-lsp/vscode-elixir-ls/issues/284). + +![erl get docs](./assets/get_docs_in_repl.png) + +You cal also use the `OTP_CONFIGURE_ARGS` environment variable to control install behavior. reference this documentation [https://github.com/erlang/otp/blob/master/HOWTO/INSTALL.md#configuring-1](https://github.com/erlang/otp/blob/master/HOWTO/INSTALL.md#configuring-1) for more configuration. eg: + +```shell +# example +export OTP_CONFIGURE_ARGS="--enable-jit --enable-kernel-poll" +vfox install erlang@25.3.2.10 +``` diff --git a/assets/get_docs_in_repl.png b/assets/get_docs_in_repl.png new file mode 100644 index 0000000..3fc1315 Binary files /dev/null and b/assets/get_docs_in_repl.png differ diff --git a/hooks/post_install.lua b/hooks/post_install.lua index b1cbb34..daa655d 100644 --- a/hooks/post_install.lua +++ b/hooks/post_install.lua @@ -4,26 +4,25 @@ function PLUGIN:PostInstall(ctx) --- ctx.rootPath SDK installation directory -- use ENV OTP_COMPILE_ARGS to control compile behavior - local compile_args = os.getenv("OTP_COMPILE_ARGS") or "" - print("Erlang/OTP compile with: %s", compile_args) + local configure_args = os.getenv("OTP_CONFIGURE_ARGS") or "" + print("Erlang/OTP compile configure args: %s", configure_args) -- use ENV OTP_BUILD_DOCS to control bytecode with docs chunks - local with_docs_chunks = os.getenv("OTP_BUILD_DOCS") or "" + local docs_target = os.getenv("DOC_TARGETS") or "chunks" - print("If you enable some Erlang/OTP features, maybe you can reference this guide: https://github.com/asdf-vm/asdf-erlang?tab=readme-ov-file#before-asdf-install") + print("If you enable some Erlang/OTP features, maybe you can reference this guide: https://github.com/erlang/otp/blob/master/HOWTO/INSTALL.md#configuring-1") os.execute("sleep " .. tonumber(3)) local sdkInfo = ctx.sdkInfo['erlang'] local path = sdkInfo.path - local install_erlang_cmd = "cd " .. path .. " && ./configure --prefix=" .. path .. "/release " .. compile_args .. "&& make && make install" - -- install for IDE docs hits & type hits - local install_erlang_docs_cmd = "cd " .. path .. " && make docs DOC_TARGETS=chunks && make release_docs DOC_TARGETS=chunks" + local configure_cmd = "cd " .. path .. " && ./configure --prefix=" .. path .. "/release " .. configure_args - local status = os.execute(install_erlang_cmd .. " && " ..install_erlang_docs_cmd) + local install_erlang_cmd = "cd " .. path .. "&& make && make install" + -- install with docs chunk for IDE/REPL docs hits & type hits + local install_erlang_docs_cmd = "cd " .. path .. " && make docs DOC_TARGETS=" .. docs_target .. " && make release_docs DOC_TARGETS=" .. docs_target - -- local status = os.execute("cd " .. path .. " && ./configure --prefix=" .. path .. "/release " .. compile_args .. "&& make && make install") - -- status = os.execute("cd " .. path .. " && make docs DOC_TARGETS=chunks && make release_docs DOC_TARGETS=chunks") + local status = os.execute(configure_cmd .. " && " .. install_erlang_cmd .. " && " ..install_erlang_docs_cmd) if status ~= 0 then error("Erlang/OTP install failed, please check the stdout for details. Make sure you have the required utilties: https://www.erlang.org/doc/installation_guide/install#required-utilities") end