aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ocaml-num/install-findlib.patch
blob: 5d0c99151cc9182bc0680c2767f0d990f5888922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
diff --git a/.gitignore b/.gitignore
index 6acd3bc..4802fdc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,6 @@
 *.cmx[as]
 *.cmti
 *.annot
+src/META
+test/test.byt
+test/test.exe
diff --git a/Changelog b/Changelog
index 791b18b..72a3999 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,9 @@
+- GPR#6: provide findlib-install target to install everything using ocamlfind
+- Issue#3: make sur the stublibs/ directory exists before installing DLLs 
+  inside it.
+- Issue#4: wrong DLL file names for Win32 ports, causing errors at
+  installation time.
+
 Release 1.1 (2017-10-13):
 
 - Install .cmx files as well.
diff --git a/Makefile b/Makefile
index 6a5d08f..b40e588 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,16 @@ install:
 	$(MAKE) -C src install
 	$(MAKE) -C toplevel install
 
+findlib-install:
+	$(MAKE) -C src findlib-install
+	$(MAKE) -C toplevel install
+
 uninstall:
 	$(MAKE) -C src uninstall
 	$(MAKE) -C toplevel uninstall
 
-.PHONY: all test clean install uninstall
+findlib-uninstall:
+	$(MAKE) -C src findlib-uninstall
+	$(MAKE) -C toplevel uninstall
+
+.PHONY: all test clean install uninstall findlib-install findlib-uninstall
diff --git a/src/META b/src/META.in
similarity index 72%
rename from src/META
rename to src/META.in
index 66ac170..b5678b7 100644
--- a/src/META
+++ b/src/META.in
@@ -1,6 +1,8 @@
 # This META is the one provided by findlib when the "num" library was
 # part of the core OCaml distribution.  For backward compatibility,
-# it installs into OCaml's standard library directory, not in a subdirectory
+# it is installed into OCaml's standard library directory. If the
+# directory line below is removed, then it's installed in a
+# subdirectory, as normal for a findlib package.
 
 requires = "num.core"
 requires(toploop) = "num.core,num-top"
diff --git a/src/Makefile b/src/Makefile
index 97dc074..8a88035 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -5,6 +5,7 @@ OCAMLMKLIB=ocamlmklib
 OCAMLFIND=ocamlfind
 INSTALL_DATA=install -m 644
 INSTALL_DLL=install
+INSTALL_DIR=install -d
 STDLIBDIR=$(shell $(OCAMLC) -where)
 
 include $(STDLIBDIR)/Makefile.config
@@ -75,29 +76,43 @@ nat_stubs.$(O): bng.h nat.h
 
 TOINSTALL=nums.cma libnums.$(A) $(CMIS) $(CMIS:.cmi=.mli) $(CMIS:.cmi=.cmti)
 ifneq "$(ARCH)" "none"
-TOINSTALL+=nums.cmxa nums.$(A) $(CMIS:.cmi=.cmx)
+TOINSTALL+=nums.cmxa nums.$(A) $(CMXS)
 endif
 ifeq "$(NATDYNLINK)" "true"
 TOINSTALL+=nums.cmxs
 endif
-TOINSTALL_STUBS=dllnums.$(SO)
+ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
+TOINSTALL_STUBS=dllnums$(EXT_DLL)
+else
+TOINSTALL_STUBS=
+endif
 
 install:
+	cp META.in META
 	$(OCAMLFIND) install num META
+	rm -f META
 	$(INSTALL_DATA) $(TOINSTALL) $(STDLIBDIR)
 ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
+	$(INSTALL_DIR) $(STDLIBDIR)/stublibs
 	$(INSTALL_DLL) $(TOINSTALL_STUBS) $(STDLIBDIR)/stublibs
 endif
 
-uninstall:
+findlib-install:
+	grep -Fv '^' META.in > META
+	$(OCAMLFIND) install num META $(TOINSTALL) $(TOINSTALL_STUBS)
+	rm -f META
+
+findlib-uninstall:
+	$(OCAMLFIND) remove num
+
+uninstall: findlib-uninstall
 	cd $(STDLIBDIR) && rm -f $(TOINSTALL)
 ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
 	cd $(STDLIBDIR)/stublibs && rm -f $(TOINSTALL_STUBS) 
 endif
-	$(OCAMLFIND) remove num
 
 clean:
-	rm -f *.cm[ioxta] *.cmx[as] *.cmti *.$(O) *.$(A) *.$(SO)
+	rm -f *.cm[ioxta] *.cmx[as] *.cmti *.$(O) *.$(A) *$(EXT_DLL)
 
 depend:
 	$(OCAMLDEP) -slash *.mli *.ml > .depend