Source

omy / OMyOPAM

Full commit
OCAMLFIND_DESTDIR=$(HOME)/.opam/system/lib

GetOPAMVersion(opamname) =
    return $(shell opam list -installed | awk '$$1 ~ /^$(opamname)$$/ { print $$2 }')

OPAMPrefix = $(shell opam config -var prefix)

GetOPAMBuildDir(opamname) =
    ver = $(GetOPAMVersion $(opamname))
    return "$(OPAMPrefix)$(DIRSEP)build$(DIRSEP)$(opamname).$(ver)"

OMyOPAM(flname) =
    $(Installed $(flname)):
        section:
            opam --yes install $(flname)
            opambuilddir=$(GetOPAMBuildDir $(flname))
            println(Running spotinstall at $(opambuilddir))
            (cd $(opambuilddir); spotinstall $(flname))
            CreateInstalled($(flname), $(find $(OCAMLFIND_DESTDIR)$(DIRSEP)$(flname) -f {}))

OMyOPAM2(name, flname) =
    $(Installed $(flname)):
        section:
            opam --yes install $(name)
            opambuilddir=$(GetOPAMBuildDir $(name))
            println(Running spotinstall at $(opambuilddir))
            (cd $(opambuilddir); spotinstall $(flname))
            CreateInstalled($(flname), $(find $(OCAMLFIND_DESTDIR)$(DIRSEP)$(flname) -f {}))