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

Provide findlib-install target #6

Merged
merged 1 commit into from Jan 11, 2018
Merged

Conversation

@dra27
Copy link
Contributor

@dra27 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

Copy link
Contributor

@xavierleroy xavierleroy left a comment

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
Author 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
Author 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
Author 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
Author 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
Author 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.

Allows installing the entire library using ocamlfind.
@dra27 dra27 force-pushed the dra27:install-findlib branch from 164e4b5 to 86670fb Jan 10, 2018
@dra27
Copy link
Contributor Author

@dra27 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
yakobowski added a commit to yakobowski/opam-repository-mingw that referenced this pull request May 14, 2019
Need to ocaml/opam-repository#10857, which
is solved by ocaml/num#6 (but this patch is not
merged in num 1.1)
yakobowski added a commit to yakobowski/opam-repository-mingw that referenced this pull request May 28, 2019
Need to ocaml/opam-repository#10857, which
is solved by ocaml/num#6 (but this patch is not
merged in num 1.1)

Also fix syntax for 'preinstalled' flag, which has evolved since the PR
on the ocaml/num repo.
@yakobowski
Copy link

@yakobowski yakobowski commented May 29, 2019

@xavierleroy would you consider making a new release of Num, which would contain in particular this PR? The changes have been propagated to the Opam repo as a patch, but not to the Windows one (which admittedly is not supposed to use a ocaml-system compiler). As a result, I have been bitten by this issue. Also, this also mean that you cannot easily pin opam pin num, should you wish to do so.

@xavierleroy
Copy link
Contributor

@xavierleroy xavierleroy commented Jun 21, 2019

Release 1.2 is here: https://github.com/ocaml/num/releases/tag/v1.2 . Enjoy!

@dra27
Copy link
Contributor Author

@dra27 dra27 commented Jun 21, 2019

@xavierleroy - are you going to do a package release to opam-repository, or would you like me to?

@dra27 dra27 deleted the dra27:install-findlib branch Jun 21, 2019
@xavierleroy
Copy link
Contributor

@xavierleroy xavierleroy commented Jun 21, 2019

I submitted a tentative OPAM package: ocaml/opam-repository#14331 . I'd be happy if you could review it and make sure I didn't make mistakes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants