Skip to content

Merge Unix and Windows build systems in the ocamldoc directory#808

Merged
alainfrisch merged 1 commit intoocaml:trunkfrom
shindere:merge-ocamldoc-makefiles
Sep 14, 2016
Merged

Merge Unix and Windows build systems in the ocamldoc directory#808
alainfrisch merged 1 commit intoocaml:trunkfrom
shindere:merge-ocamldoc-makefiles

Conversation

@shindere
Copy link
Contributor

This PR continues the build-systems merging work started in PRs
#762, #764, #785 and #788.

Here again, the aim is to make ocamldoc/Makefile work for both
Unix and Windows, so that ocamldoc/Makefile.nt can just include it.

So, although this PR improves a few aspects of the build process of ocamldoc
(see commit log for details of those improvements and changes), it is
worth emphasizing that improving the build process itself is not the primary
target of this PR, whose goal is, again, to merge the build systems.

ifeq "$(UNIX_OR_WIN32)" "unix"
OCAMLDEPFLAGS =
else # Windows
OCAMLDEPFLAGS = -slash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems -slash does nothing under Unix, so one might be able to avoid this conditional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alain Frisch (2016/09/13 13:54 -0700):

+OCAMLDEP = $(OCAMLRUN) $(ROOTDIR)/tools/ocamldep
+ifeq "$(UNIX_OR_WIN32)" "unix"
+OCAMLDEPFLAGS =
+else # Windows
+OCAMLDEPFLAGS = -slash

It seems -slash does nothing under Unix,

Indeed (I chekced). Many thanks for having spotted this.

so one might be able to avoid this conditional.

Doone.

@shindere shindere force-pushed the merge-ocamldoc-makefiles branch 3 times, most recently from 38c85d7 to e913ca4 Compare September 14, 2016 08:30
@shindere shindere force-pushed the merge-ocamldoc-makefiles branch from e913ca4 to c5c4835 Compare September 14, 2016 14:03
This commit changes the behaviour of both the Unix and Windows build systems.
The changes are either specific to one build system or common to both.

Changes specific to the Unix build system:

  - Use the -slash option when invoking ocamldep. This does nothing on
    Unix and makes it possible to use the same command under Unix and Windows.

  - install target:

    - Directories are created unconditionnally, instead of creating them
      only if they do not already exist
      (also true for the installopt target)

    - cp no longer uses the -f flag, to be consistent with the
      other directories

    - The custom directory $(INSTALL_LIBDIR)/custom is no longer created
      because nothing was installed there anyway

  - In the opt.opt target, consecutive calls to make have been
    replaced by prerequisites, enhancing parallelisation opportunities.

Changes specific to the Windows build system:

  - Whaen compiling .ml files, use the same line-number-preserving
    preprocessor as under Unix, rather than the grep -v DEBUG command.

  - ocamldoc generators and odoc_test are now compiled

  - ocamldoc can now be run from sources to generate the documentation
    of the standard library

  - The test targets are now also available under Windows

  - opt.opt now builds native-code versions of the generators

Changes affecting both Unix and Windows build systems:

  - The targets that were depending on the empty "dummy" target
    are now declared as .PHONY targets, dummy has been removed.

  - In the all target, successive calls to make have been replaced
    by prerequisites.

  - Commands executed by make clean are now displayed instead of being
    executed silently.
@shindere shindere force-pushed the merge-ocamldoc-makefiles branch from c5c4835 to d51851a Compare September 14, 2016 14:28
@alainfrisch alainfrisch merged commit 28f91df into ocaml:trunk Sep 14, 2016
@gasche
Copy link
Member

gasche commented Sep 15, 2016

As a meta comment: you have been doing a lot of excellent work on deduplicating and improving the compiler distribution build system, in a series of distinct pull requests. Very few of those changes had a Changes entry giving credit for your work.

I think it is probably time for a comprehensive Changes entry that is global in scope (it corresponds to the work of sharing Unix and Windows Makefile across the whole compiler distribution). I think it would be best if it listed all affected directories (in case there is a regression somewhere, users can find the mention of the problematic directory in the changelog), and give the PR numbers of each.

@shindere
Copy link
Contributor Author

shindere commented Sep 15, 2016 via email

@shindere shindere deleted the merge-ocamldoc-makefiles branch September 15, 2016 08:03
@alainfrisch
Copy link
Contributor

I've found a problem with this PR, related to calling the bytecode executable ocamldoc under Windows. Even if the PATH is extended with explicit paths to otherlibs/win32unix and otherlibs/str, ocamlrun will still look up the stub dlls in the installation directory first, as can be seen by setting OCAMLRUNPARAM=v=256.

If another version was installed in the same target directory before, the old dlls will be loaded which can lead to failure (e.g. I just got "Fatal error: unknown C primitive 'unix_lstat'").

A fix could be to set:

CAML_LD_LIBRARY_PATH="../otherlibs/win32unix;../otherlibs/str"

instead of changing PATH.

@shindere Do you think this is the right thing to do?

@alainfrisch
Copy link
Contributor

alainfrisch commented Nov 9, 2016

Ping @shindere . @dra27 : also interested in your opinion about the note above.

@shindere
Copy link
Contributor Author

shindere commented Nov 10, 2016 via email

shindere added a commit to shindere/ocaml that referenced this pull request Nov 10, 2016
This fixes a problem related to the way ocamldoc's bytecode executable
is called under Windows, reported by @alainfrisch at
ocaml#808 (comment)

As he explains, ``Even if the PATH is extended with explicit paths to
otherlibs/win32unix and otherlibs/str, ocamlrun will still look up
the stub dlls in the installation directory first, as can be seen by
setting OCAMLRUNPARAM=v=256. If another version was installed in the
same target directory before, the old dlls will be loaded which can lead
to failure (e.g. I just got "Fatal error: unknown C primitive 'unix_lstat'").
A fix could be to set:
CAML_LD_LIBRARY_PATH="../otherlibs/win32unix;../otherlibs/str"
instead of changing PATH''.

This commit implements the proposed fix, due to @alainfrisch.
shindere added a commit to shindere/ocaml that referenced this pull request Nov 10, 2016
This fixes a problem related to the way ocamldoc's bytecode executable
is called under Windows, reported by @alainfrisch at
ocaml#808 (comment)

As he explains, ``Even if the PATH is extended with explicit paths to
otherlibs/win32unix and otherlibs/str, ocamlrun will still look up
the stub dlls in the installation directory first, as can be seen by
setting OCAMLRUNPARAM=v=256. If another version was installed in the
same target directory before, the old dlls will be loaded which can lead
to failure (e.g. I just got "Fatal error: unknown C primitive 'unix_lstat'").
A fix could be to set:
CAML_LD_LIBRARY_PATH="../otherlibs/win32unix;../otherlibs/str"
instead of changing PATH''.

This commit implements the proposed fix, due to @alainfrisch.
@shindere
Copy link
Contributor Author

shindere commented Nov 10, 2016 via email

shindere added a commit to shindere/ocaml that referenced this pull request Nov 10, 2016
This fixes a problem related to the way ocamldoc's bytecode executable
is called under Windows, reported by @alainfrisch at
ocaml#808 (comment)

As he explains, ``Even if the PATH is extended with explicit paths to
otherlibs/win32unix and otherlibs/str, ocamlrun will still look up
the stub dlls in the installation directory first, as can be seen by
setting OCAMLRUNPARAM=v=256. If another version was installed in the
same target directory before, the old dlls will be loaded which can lead
to failure (e.g. I just got "Fatal error: unknown C primitive 'unix_lstat'").
A fix could be to set:
CAML_LD_LIBRARY_PATH="../otherlibs/win32unix;../otherlibs/str"
instead of changing PATH''.

This commit implements the proposed fix, due to @alainfrisch.
alainfrisch pushed a commit that referenced this pull request Nov 10, 2016
…#906)

This fixes a problem related to the way ocamldoc's bytecode executable
is called under Windows, reported by @alainfrisch at
#808 (comment)

As he explains, ``Even if the PATH is extended with explicit paths to
otherlibs/win32unix and otherlibs/str, ocamlrun will still look up
the stub dlls in the installation directory first, as can be seen by
setting OCAMLRUNPARAM=v=256. If another version was installed in the
same target directory before, the old dlls will be loaded which can lead
to failure (e.g. I just got "Fatal error: unknown C primitive 'unix_lstat'").
A fix could be to set:
CAML_LD_LIBRARY_PATH="../otherlibs/win32unix;../otherlibs/str"
instead of changing PATH''.

This commit implements the proposed fix, due to @alainfrisch.
camlspotter pushed a commit to camlspotter/ocaml that referenced this pull request Oct 17, 2017
…#808)

This commit changes the behaviour of both the Unix and Windows build systems.
The changes are either specific to one build system or common to both.

Changes specific to the Unix build system:

  - Use the -slash option when invoking ocamldep. This does nothing on
    Unix and makes it possible to use the same command under Unix and Windows.

  - install target:

    - Directories are created unconditionnally, instead of creating them
      only if they do not already exist
      (also true for the installopt target)

    - cp no longer uses the -f flag, to be consistent with the
      other directories

    - The custom directory $(INSTALL_LIBDIR)/custom is no longer created
      because nothing was installed there anyway

  - In the opt.opt target, consecutive calls to make have been
    replaced by prerequisites, enhancing parallelisation opportunities.

Changes specific to the Windows build system:

  - Whaen compiling .ml files, use the same line-number-preserving
    preprocessor as under Unix, rather than the grep -v DEBUG command.

  - ocamldoc generators and odoc_test are now compiled

  - ocamldoc can now be run from sources to generate the documentation
    of the standard library

  - The test targets are now also available under Windows

  - opt.opt now builds native-code versions of the generators

Changes affecting both Unix and Windows build systems:

  - The targets that were depending on the empty "dummy" target
    are now declared as .PHONY targets, dummy has been removed.

  - In the all target, successive calls to make have been replaced
    by prerequisites.

  - Commands executed by make clean are now displayed instead of being
    executed silently.
camlspotter pushed a commit to camlspotter/ocaml that referenced this pull request Oct 17, 2017
…ocaml#906)

This fixes a problem related to the way ocamldoc's bytecode executable
is called under Windows, reported by @alainfrisch at
ocaml#808 (comment)

As he explains, ``Even if the PATH is extended with explicit paths to
otherlibs/win32unix and otherlibs/str, ocamlrun will still look up
the stub dlls in the installation directory first, as can be seen by
setting OCAMLRUNPARAM=v=256. If another version was installed in the
same target directory before, the old dlls will be loaded which can lead
to failure (e.g. I just got "Fatal error: unknown C primitive 'unix_lstat'").
A fix could be to set:
CAML_LD_LIBRARY_PATH="../otherlibs/win32unix;../otherlibs/str"
instead of changing PATH''.

This commit implements the proposed fix, due to @alainfrisch.
ctk21 pushed a commit to ocaml-multicore/ocaml that referenced this pull request Dec 21, 2021
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants