Skip to content

Commit

Permalink
opt: install configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
yeshan333 committed Apr 25, 2024
1 parent ffb0ec7 commit 65e7a4a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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 [email protected]
```
Binary file added assets/get_docs_in_repl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 9 additions & 10 deletions hooks/post_install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 65e7a4a

Please sign in to comment.