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

Provide findlib-install target #6

Merged
merged 1 commit into from Jan 11, 2018

Conversation

Projects
None yet
2 participants
@dra27
Contributor

dra27 commented Jan 10, 2018

See also discussions in ocaml/opam-repository#10857 and #5.

This is an adaptation of #5 providing a separate findlib-install target which the opam num package can use for system switches.

Not installing things in /usr/local/lib/ocaml in an opam system switch is of course an opam packaging concern, but it seems better to me to control the process here in num's repository and have it that the packaging concern is running make findlib-install if appropriate.

In future, we could change the install target to be the same as findlib-install.

This patch is presently being applied to 1.0 and 1.1 in ocaml/opam-repository#11207

@xavierleroy

Thanks for this suggestion, I like it very much.

Some suggested updates below, plus one:

  • Add one sentence to the comment at the top of file META.in to say "If the directory line is removed, it installs in a subdirectory, as normal for a findlib package."
findlib-install:
$(MAKE) -C src findlib-install
$(MAKE) -C toplevel install
uninstall:
$(MAKE) -C src uninstall
$(MAKE) -C toplevel uninstall

This comment has been minimized.

@xavierleroy

xavierleroy Jan 10, 2018

Contributor

Please add a findlib-uninstall entry for symmetry.

This comment has been minimized.

@dra27

dra27 Jan 10, 2018

Contributor

Good point!

META.findlib: META.in
rm -f META.legacy
fgrep -v directory $^ > META
touch $@

This comment has been minimized.

@xavierleroy

xavierleroy Jan 10, 2018

Contributor

I haven't seen fgrep used in ages :-) It's not part of POSIX (IEEE Std 1003.1 2004) so please just use grep.

This comment has been minimized.

@dra27

dra27 Jan 10, 2018

Contributor

😄 I didn't know I was so old-fashioned, though is anyone surprised?!

install:
META.legacy: META.in
rm -f META.findlib

This comment has been minimized.

@xavierleroy

xavierleroy Jan 10, 2018

Contributor

The two META.legacy and META.findlib entries are hard to understand. I think you can simplify by removing those two entries and "inlining" the construction of META from META.in in the install and findlib-install entries, see below.

This comment has been minimized.

@dra27

dra27 Jan 10, 2018

Contributor

OK - my personal Makefile "taste" (if you can call it that) is that even cping a file is a compilation step, so it's a dependency, but I've changed it!

fgrep -v directory $^ > META
touch $@
install: META.legacy
$(OCAMLFIND) install num META

This comment has been minimized.

@xavierleroy

xavierleroy Jan 10, 2018

Contributor

After "inlining" this would be

install:
    cp META.in META
   ...
   rm -f META
$(OCAMLFIND) install num META
$(INSTALL_DATA) $(TOINSTALL) $(STDLIBDIR)
ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
$(INSTALL_DIR) $(STDLIBDIR)/stublibs
$(INSTALL_DLL) $(TOINSTALL_STUBS) $(STDLIBDIR)/stublibs
endif
findlib-install: META.findlib
$(OCAMLFIND) install num META $(TOINSTALL) $(TOINSTALL_STUBS)

This comment has been minimized.

@xavierleroy

xavierleroy Jan 10, 2018

Contributor

After "inlining" this would be:

findlib-install:
    grep -v 'directory' META.in > META
    $(OCAMLFIND) install ...
    rm -f META

This comment has been minimized.

@dra27

dra27 Jan 10, 2018

Contributor

Actually, for neatness, I've changed the grep to grep -Fv '^' as that exactly removes the directory instruction and not also various lines of the comment.

$(OCAMLFIND) install num META
$(INSTALL_DATA) $(TOINSTALL) $(STDLIBDIR)
ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
$(INSTALL_DIR) $(STDLIBDIR)/stublibs
$(INSTALL_DLL) $(TOINSTALL_STUBS) $(STDLIBDIR)/stublibs
endif
findlib-install: META.findlib
$(OCAMLFIND) install num META $(TOINSTALL) $(TOINSTALL_STUBS)
uninstall:
cd $(STDLIBDIR) && rm -f $(TOINSTALL)

This comment has been minimized.

@xavierleroy

xavierleroy Jan 10, 2018

Contributor

Please add findlib-uninstall entry for symmetry.

This comment has been minimized.

@dra27

dra27 Jan 10, 2018

Contributor

It irrelevantly changes the order of the uninstall, but I've made findlib-uninstall a "dependency" of uninstall, as that's actually the same command.

Provide findlib-install target
Allows installing the entire library using ocamlfind.

@dra27 dra27 force-pushed the dra27:install-findlib branch from 164e4b5 to 86670fb Jan 10, 2018

@dra27

This comment has been minimized.

Contributor

dra27 commented Jan 10, 2018

Thanks Xavier - all points addressed, I think. I changed the sense of the sentence in the META file, as META files describe what has happened rather than what will happen.

@xavierleroy xavierleroy merged commit 7dd5e93 into ocaml:master Jan 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment