Skip to content

Commit f6e31b1

Browse files
Install to lib/stublibs in legacy mode as well (#40)
* Install to `lib`/`stublibs` in legacy mode too * Generate the same META file for modern and legacy * Unify `META.modern` & `META.legacy` into `META.num` * Only install dllnums.so once The switch will be configured to load dllnums.so from the switch stublibs directory anyway and the compatibility is necessary for the cma and cmxa to be in the stdlib directory, not for the stubs library. --------- Co-authored-by: David Allsopp <[email protected]>
1 parent a2b9a58 commit f6e31b1

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
*.cmti
1010
*.annot
1111
src/META.top
12-
src/META.modern
13-
src/META.legacy
12+
src/META.num
1413
src/META
1514
src/num_top*.ml*
1615
test/test.byt

src/Makefile

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SOURCES_NUM_TOP=\
2727
$(addsuffix .mli,$(MODULES_NUM_TOP)) $(addsuffix .ml,$(MODULES_NUM_TOP))
2828
CMOS_NUM_TOP=$(addsuffix .cmo,$(MODULES_NUM_TOP))
2929

30-
all:: libnums.$(A) nums.cma num_top.cma META.legacy META.modern META.top \
30+
all:: libnums.$(A) nums.cma num_top.cma META.num META.top \
3131
num-legacy.install num-modern.install
3232

3333
ifeq "$(NATIVE_COMPILER)" "true"
@@ -42,16 +42,12 @@ META.top: META.num-top.in
4242
echo 'version = "$(VERSION)"' > $@
4343
cat $^ >> $@
4444

45-
META.%:
45+
META.num:
4646
@echo 'requires = "num.core"' > $@
4747
@echo 'requires(toploop) = "num.core,num-top"' >> $@
4848
@echo 'version = "$(VERSION)"' >> $@
4949
@echo 'description = "Arbitrary-precision rational arithmetic"' >> $@
5050
@echo 'package "core" (' >> $@
51-
# META.legacy installs num to the OCaml standard library directory so requires
52-
# the extra directory line. META.modern installs num as a standard findlib
53-
# package.
54-
@echo ' directory = "^"' >> $(if $(*:legacy=),/dev/null,$@)
5551
@echo ' version = "$(VERSION)"' >> $@
5652
@echo ' browse_interfaces = ""' >> $@
5753
@echo ' archive(byte) = "nums.cma"' >> $@
@@ -118,14 +114,13 @@ TOINSTALL_NUM_TOP=num_top.cma $(addsuffix .cmi,$(MODULES_NUM_TOP))
118114
# - num artefacts to ocaml/ (legacy only)
119115
# libexec_root section
120116
# - nums.cmxs (legacy only)
121-
# - dllnums.so to ocaml/stublibs/ (legacy only)
122117
# lib section:
123118
# - num META file
124-
# - num artefacts (modern only)
119+
# - num artefacts
125120
# libexec section:
126121
# - nums.cmxs (modern only)
127122
# stublibs section:
128-
# - dllnums.so (modern only)
123+
# - dllnums.so
129124
define GENERATE_INSTALL_FILE
130125
num-$1.install:
131126
@echo 'lib_root: [' > $$@
@@ -139,13 +134,10 @@ $(foreach file,$(TOINSTALL),
139134
@echo 'libexec_root: [' >> $$@
140135
$(foreach file,$(TOINSTALL_CMXS),
141136
@echo ' "src/$(file)" {"ocaml/$(file)"}' >> $$@)
142-
$(foreach file,$(TOINSTALL_STUBS),
143-
@echo ' "src/$(file)" {"ocaml/stublibs/$(file)"}' >> $$@)
144137
endif
145138
@echo ']' >> $$@
146139
@echo 'lib: [' >> $$@
147-
@echo ' "src/META.$(1)" {"META"}' >> $$@
148-
ifeq "$(1)" "modern"
140+
@echo ' "src/META.num" {"META"}' >> $$@
149141
$(foreach file,$(TOINSTALL),
150142
@echo ' "src/$(file)"' >> $$@)
151143
@echo ']' >> $$@
@@ -156,7 +148,6 @@ $(foreach file,$(TOINSTALL_CMXS),
156148
@echo 'stublibs: [' >> $$@
157149
$(foreach file,$(TOINSTALL_STUBS),
158150
@echo ' "src/$(file)"' >> $$@)
159-
endif
160151
@echo ']' >> $$@
161152
endef
162153

@@ -165,7 +156,7 @@ $(eval $(call GENERATE_INSTALL_FILE,modern))
165156

166157
install: num-top-install
167158
$(INSTALL_DIR) $(DESTDIR)$(STDLIBDIR)
168-
cp META.legacy META
159+
cp META.num META
169160
$(OCAMLFIND) install num META
170161
rm -f META
171162
$(INSTALL_DATA) $(TOINSTALL) $(DESTDIR)$(STDLIBDIR)
@@ -183,7 +174,7 @@ num-top-install:
183174
rm -f META
184175

185176
findlib-install: num-top-install
186-
cp META.modern META
177+
cp META.num META
187178
$(OCAMLFIND) install num META $(TOINSTALL) $(TOINSTALL_CMXS) $(TOINSTALL_STUBS)
188179
rm -f META
189180

@@ -201,7 +192,7 @@ endif
201192

202193
clean:
203194
rm -f *.cm[ioxta] *.cmx[as] *.cmti *.$(O) *.$(A) *$(EXT_DLL) \
204-
META.top META.legacy META.modern $(SOURCES_NUM_TOP) \
195+
META.top META.num $(SOURCES_NUM_TOP) \
205196
num-legacy.install num-modern.install
206197

207198
$(SOURCES_NUM_TOP:num_=%): $(addprefix ../toplevel/,$(SOURCES_NUM_TOP))

0 commit comments

Comments
 (0)