You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.6 KiB

1. export SLEDGE=$HOME/sat/sledge
2. clone llvm, clang, and libcxxabi
- cd $SLEDGE
- git clone https://github.com/jberdine/llvm.git --branch ocaml_api
- git clone https://github.com/llvm-mirror/clang.git llvm/tools/clang
- git -C llvm/tools/clang checkout 32f603c58965543e256fdf8c3cb6eaceec2974da
- git clone https://github.com/llvm-mirror/libcxx.git llvm/projects/libcxx
- git clone https://github.com/llvm-mirror/libcxxabi.git llvm/projects/libcxxabi
3. export OPAMJOBS=$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
4. create opam switches
- for variant in '' '+flambda'; do opam switch --yes create sledge$variant 4.07.1+rc1$variant; done
5. install llvm deps
- install deps + sudo yum install cmake ninja
+ brew install cmake ninja
- for switch in sledge sledge+flambda; do opam install --yes --switch=$switch ctypes; done
6. build llvm & clang
- cd $SLEDGE/llvm
- mkdir _build
- cd _build
- for switch in sledge sledge+flambda; do cmake -G Ninja -DCMAKE_INSTALL_PREFIX=../_install/$switch -DLLVM_OCAML_INSTALL_PATH=../_install/$switch -DLLVM_TARGETS_TO_BUILD="X86" .. && ninja && ninja install; done
7. install deps
- cd $SLEDGE/llvm
- for switch in sledge sledge+flambda; do opam pin --switch=$switch add -n -k git llvm .; done
- cd $SLEDGE
- for switch in sledge sledge+flambda; do PATH=$SLEDGE/llvm/_install/$switch/bin:$PATH opam install --yes --switch=$switch ./sledge.opam --deps-only; done
8. hush `ld: warning: directory not found for option '-L/opt/local/lib'`
- the zarith package adds a spurious linker option unless you have both brew and macports, so if you see this linker warning when compiling, execute + sudo mkdir -p /opt/local/lib
9. install dev tools
- opam pin --yes --switch=sledge add tools/opam
10. if needed: point new clang to xcode c++ lib
- cd $SLEDGE/$(opam switch show)/include
- ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++ .
11. llvm dev workflow
- modify llvm sources
- cd $SLEDGE/llvm/_build; ninja
- iterate
- (optional?) git add -u; git commit -m ...
- ninja && ninja ocaml_doc && ninja install && opam upgrade llvm
- cd $SLEDGE; make
- it is not uncommon to get "inconsistent assumptions" errors: clean and re-make
12. llvm emacs mode
- (add-to-list 'load-path (expand-file-name "$SLEDGE/llvm/utils/emacs"))
- (require 'llvm-mode)
- (require 'autodisass-llvm-bitcode)
13. install llair for llvm_sil
- cd $SLEDGE
- opam pin add -n -k git llair .
+ when prompted, ok to create new package
- opam install llair