Commits

camlspotter committed d0ef6ea Merge

merge

Comments (0)

Files changed (2)

 
     export
   else
-    install:
+    install: $(targets)
 	$(OCAMLFIND) remove $(library_name)
         $(OCAMLFIND) install $(library_name) $(targets)
 
-# /home/jun/.opam/system/lib
-# Free var
-# 
 OCAMLFIND_DESTDIR=$(HOME)/.opam/system/lib
 
-OMyOPAM(name) =
-    $(Installed $(name)): 
-        opam --yes install $(name)
-        # (cd install-$(name); spotinstall $(name))
-        CreateInstalled($(name), $(find $(OCAMLFIND_DESTDIR)$(DIRSEP)$(name) -f {}))
+GetOPAMVersion(opamname) =
+    return $(shell opam list -installed | awk '$$1 ~ /^$(opamname)$$/ { print $$2 }')
 
-OMyOPAM2(name, ocamlfindpackname) =
-    $(Installed $(ocamlfindpackname)): 
-        opam --yes install $(name)
-        # (cd install-$(name); spotinstall $(name))
-        CreateInstalled($(ocamlfindpackname), $(find $(OCAMLFIND_DESTDIR)$(DIRSEP)$(ocamlfindpackname) -f {}))
+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 {}))