Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install to lib/stublibs in legacy mode as well #40

Merged
merged 4 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
*.cmti
*.annot
src/META.top
src/META.modern
src/META.legacy
src/META.num
src/META
src/num_top*.ml*
test/test.byt
Expand Down
25 changes: 8 additions & 17 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SOURCES_NUM_TOP=\
$(addsuffix .mli,$(MODULES_NUM_TOP)) $(addsuffix .ml,$(MODULES_NUM_TOP))
CMOS_NUM_TOP=$(addsuffix .cmo,$(MODULES_NUM_TOP))

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

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

META.%:
META.num:
@echo 'requires = "num.core"' > $@
@echo 'requires(toploop) = "num.core,num-top"' >> $@
@echo 'version = "$(VERSION)"' >> $@
@echo 'description = "Arbitrary-precision rational arithmetic"' >> $@
@echo 'package "core" (' >> $@
# META.legacy installs num to the OCaml standard library directory so requires
# the extra directory line. META.modern installs num as a standard findlib
# package.
@echo ' directory = "^"' >> $(if $(*:legacy=),/dev/null,$@)
@echo ' version = "$(VERSION)"' >> $@
@echo ' browse_interfaces = ""' >> $@
@echo ' archive(byte) = "nums.cma"' >> $@
Expand Down Expand Up @@ -118,14 +114,13 @@ TOINSTALL_NUM_TOP=num_top.cma $(addsuffix .cmi,$(MODULES_NUM_TOP))
# - num artefacts to ocaml/ (legacy only)
# libexec_root section
# - nums.cmxs (legacy only)
# - dllnums.so to ocaml/stublibs/ (legacy only)
# lib section:
# - num META file
# - num artefacts (modern only)
# - num artefacts
# libexec section:
# - nums.cmxs (modern only)
# stublibs section:
# - dllnums.so (modern only)
# - dllnums.so
define GENERATE_INSTALL_FILE
num-$1.install:
@echo 'lib_root: [' > $$@
Expand All @@ -139,13 +134,10 @@ $(foreach file,$(TOINSTALL),
@echo 'libexec_root: [' >> $$@
$(foreach file,$(TOINSTALL_CMXS),
@echo ' "src/$(file)" {"ocaml/$(file)"}' >> $$@)
$(foreach file,$(TOINSTALL_STUBS),
@echo ' "src/$(file)" {"ocaml/stublibs/$(file)"}' >> $$@)
endif
@echo ']' >> $$@
@echo 'lib: [' >> $$@
@echo ' "src/META.$(1)" {"META"}' >> $$@
ifeq "$(1)" "modern"
@echo ' "src/META.num" {"META"}' >> $$@
$(foreach file,$(TOINSTALL),
@echo ' "src/$(file)"' >> $$@)
@echo ']' >> $$@
Expand All @@ -156,7 +148,6 @@ $(foreach file,$(TOINSTALL_CMXS),
@echo 'stublibs: [' >> $$@
$(foreach file,$(TOINSTALL_STUBS),
@echo ' "src/$(file)"' >> $$@)
endif
@echo ']' >> $$@
endef

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

install: num-top-install
$(INSTALL_DIR) $(DESTDIR)$(STDLIBDIR)
cp META.legacy META
cp META.num META
$(OCAMLFIND) install num META
rm -f META
$(INSTALL_DATA) $(TOINSTALL) $(DESTDIR)$(STDLIBDIR)
Expand All @@ -183,7 +174,7 @@ num-top-install:
rm -f META

findlib-install: num-top-install
cp META.modern META
cp META.num META
$(OCAMLFIND) install num META $(TOINSTALL) $(TOINSTALL_CMXS) $(TOINSTALL_STUBS)
rm -f META

Expand All @@ -201,7 +192,7 @@ endif

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

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