chore: improve HOL Light path detection and update gitignore#336
chore: improve HOL Light path detection and update gitignore#336arademaker wants to merge 9 commits intoawslabs:mainfrom
Conversation
- Use `which hol.sh` and `hol.sh -dir` to detect HOL Light installation - Support both git installations and opam package installations - Add .DS_Store to gitignore for macOS compatibility
There was a problem hiding this comment.
Pull request overview
This PR improves HOL Light path detection by using which hol.sh and hol.sh -dir to support both git installations and opam package installations. It also adds .DS_Store to gitignore for macOS compatibility.
Key changes:
- Modified HOL Light detection to query
hol.shdirectly for installation path - Updated
.gitignoreto exclude macOS-specific.DS_Storefiles
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tools/build-proof.sh | Updated to use hol.sh -dir to query the actual HOLLIGHT_DIR location, supporting both git and opam installations |
| arm/Makefile | Changed HOLLIGHT detection to use which hol.sh instead of hardcoded path |
| .gitignore | Added .DS_Store pattern to ignore macOS system files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
arm/Makefile
Outdated
| HOLDIR?=$(HOME)/hol-light | ||
| HOLLIGHT:=$(HOLDIR)/hol.sh | ||
| HOLLIGHT=$(shell which hol.sh) | ||
| HOLDIR?=$(${HOLLIGHT} -dir) |
There was a problem hiding this comment.
The variable HOLDIR is defined but never used anywhere in the Makefile. Only HOLLIGHT is referenced in the build rules. This variable definition appears to be unnecessary and can be removed, or if it's intended for future use or external consumption, this should be documented.
| HOLDIR?=$(${HOLLIGHT} -dir) |
arm/Makefile
Outdated
|
|
||
| HOLDIR?=$(HOME)/hol-light | ||
| HOLLIGHT:=$(HOLDIR)/hol.sh | ||
| HOLLIGHT=$(shell which hol.sh) |
There was a problem hiding this comment.
If which hol.sh fails to find hol.sh in the PATH, HOLLIGHT will be empty, which will cause cryptic errors later when the build rules try to use it. Consider adding an error check after this line or providing a more helpful error message when HOLLIGHT is not found.
| HOLLIGHT=$(shell which hol.sh) | |
| HOLLIGHT?=$(shell which hol.sh 2>/dev/null) | |
| ifeq ($(HOLLIGHT),) | |
| $(error hol.sh not found in PATH. Please install HOL Light and ensure hol.sh is on your PATH, or set HOLLIGHT to the hol.sh path.) | |
| endif |
arm/Makefile
Outdated
| HOLLIGHT=$(shell which hol.sh) | ||
| HOLDIR?=$(${HOLLIGHT} -dir) |
There was a problem hiding this comment.
The x86/Makefile still uses the old HOL Light detection approach (HOLDIR?=$(HOME)/hol-light). For consistency and to support both git installations and opam package installations, the x86/Makefile should be updated to use the same approach as this arm/Makefile (using which hol.sh and hol.sh -dir).
arm/Makefile
Outdated
| HOLDIR?=$(HOME)/hol-light | ||
| HOLLIGHT:=$(HOLDIR)/hol.sh | ||
| HOLLIGHT=$(shell which hol.sh) | ||
| HOLDIR?=$(${HOLLIGHT} -dir) |
There was a problem hiding this comment.
The syntax for the shell command is incorrect. In Makefiles, you should use $(HOLLIGHT) instead of ${HOLLIGHT} when invoking shell commands with $(shell ...). The current syntax will not properly expand the variable.
| HOLDIR?=$(${HOLLIGHT} -dir) | |
| HOLDIR?=$(shell $(HOLLIGHT) -dir) |
There was a problem hiding this comment.
not relevant, since the HOLDIR variable was removed.
tools/build-proof.sh
Outdated
| output_path=${s2n_bignum_arch}/$3 | ||
|
|
||
| export HOLLIGHT_DIR="$(dirname ${hol_sh_cmd})" | ||
| # Query hol.sh for the actual HOLLIGHT_DIR location This works for |
There was a problem hiding this comment.
Missing period at the end of the first sentence. The comment should read "Query hol.sh for the actual HOLLIGHT_DIR location." with a period after "location".
| # Query hol.sh for the actual HOLLIGHT_DIR location This works for | |
| # Query hol.sh for the actual HOLLIGHT_DIR location. This works for |
… does not require HOL Light by default (it only builds assembly files)
|
Hi Alexandre, thank you for writing a pull request! I added minor commits that make the Github Action tests pass. |
- presents OPAM installation as the recommended option with the specific commands - keeps source installation as an alternative for those who prefer it - removes the outdated warning about OPAM not working - removes the HOLDIR environment variable reference (since the build system now uses `hol.sh -dir` automatically) - emphasizes that hol.sh must be in PATH (which is how the Makefiles discover HOL Light via `which hol.sh`)
|
Hi @aqjune-aws , I have updated the README. I preserved the option to install HOL Light from source, but I now make it clear that HOL Light can be installed with OCaml 5.2 using OPAM, and that it works fine. I believe this is the easier way to install HOL Light.
I don't want to impose any particular solution! Please take all my comments as suggestions. First, the HOL Light folder is named I didn't really test this comment in the Makefiles. I guess we need to remove it now since HOLDIR is not defined in the Makefiles. I haven't tried HOL Light from the source installation, but I guess the command So the question is: what should the default location of Let me know what do you prefer. I would replace this comment above from the Makfiles with somethink like:
|
|
Hi Alexandre,
Yes, indeed this is more for backward compatibility. I think the new update of using -- Another comment is - could you slightly update the doc to recommend the latest HOL Light than the OPAM version? It is because to run the full proofs ( |
|
README updated to make clear that OPAM installation is the easier option, but the GitHub clone-based approach is recommended. What may confuse people is that at https://github.com/jrh13/hol-light/, the latest release is HOL-Light-3.1.0, whereas on https://opam.ocaml.org/packages/hol_light/, the OPAM package appears to use the same latest HOL Light release, 3.1.0. Moreover, in https://github.com/jrh13/hol-light, OPAM is the first recommended approach for installing HOL Light. Both versions, from OPAM and from source, finished the loading of the files with the same message (before the REPL: "Camlp5 parsing version (HOL-Light) 8.03.06" and both have the same version at the beginning of the I didn't install the tools to build a standalone image. That may be the only big difference between the two versions. |
Issue #335
Description of changes:
which hol.shandhol.sh -dirto detect HOL Light installationBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.