dune 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ; https://stackoverflow.com/a/53325230/349514
  2. (executable
  3. (name shaarli_cgi)
  4. (libraries Lib)
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6. ;; Prepare for static linking
  7. ;
  8. ; http://rgrinberg.com/posts/static-binaries-tutorial/
  9. ; https://discuss.ocaml.org/t/statically-link/1464/9
  10. ; Issue https://discuss.ocaml.org/t/statically-link/1464/13
  11. ; https://www.systutorials.com/how-to-statically-link-ocaml-programs/
  12. ;
  13. ; $ date
  14. ; Tue Mar 24 11:36:40 CET 2020
  15. ; $ uname -o -m
  16. ; x86_64 GNU/Linux
  17. ; $ cat /etc/issue
  18. ; Devuan GNU/Linux 1 \n \l
  19. ;
  20. ; # on Ubuntu Bionic note
  21. ; # https://github.com/ocaml/ocaml/issues/9131#issuecomment-599765888
  22. ; $ sudo add-apt-repository -y ppa:avsm/musl
  23. ; $ sudo apt-get -y install musl-tools
  24. ;
  25. ; $ sudo apt-get install musl-tools
  26. ; $ eval (opam env)
  27. ; $ opam switch create 4.10.0+musl+static+flambda
  28. ; $ opam switch 4.10.0+musl+static+flambda
  29. ; $ eval (opam env)
  30. ; $ opam install dune
  31. ; $ make clean build
  32. ; $ file _build/default/bin/*.exe
  33. ; _build/default/bin/meta.exe: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
  34. (link_flags (-ccopt "-static"))
  35. )