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

Oasis build system #78

Closed
wants to merge 24 commits into from
Closed

Oasis build system #78

wants to merge 24 commits into from

Conversation

jstolarek
Copy link
Contributor

@jstolarek jstolarek commented Oct 3, 2016

Here's a preliminary patch replacing OCamlMake build system with Oasis (#62). Big thanks go to Gabriel Radanne for his help. Please review this patch but don't merge yet.

What we get with Oasis:

  • no need to specify dependencies manually. All the modules still need to be listed but this can be done in any order (I suggest sticking to alphabetic order)
  • all build artefacts are placed in _build directory and no longer clutter the directory with source files
  • Oasis conveniently generates configure and Makefile, so now we build things like ./configure --enable-postgresql --enable-tests --enable-docs && make && make docs && make test
  • it also seems that we can maintain parallel builds. This can be controlled with THREADS environment variable. By default parallel build is on.

What changes in our workflow:

  • As developers we need to have oasis package installed. Oasis generates several files (setup.ml, configure, Makefile). These files are stored inside the repo, which means that end users should not need oasis to install Links. At first I was worried about stroging automatically generated files in the repository but I believe these files will hardly ever change. I think adding new flags and sections to _oasis file will change configure script and that's it. From now on we use configure/make routine.

Questions

  • I have removed removed deriving directory along with executable inside it. Things seem to magically work nevertheless. Can someone more knowledgeable than me verify that this is indeed OK?

TODO

  • parametrize test script on the generated executable name. This solves the problem that oasis generates file named links.native rather than links. This can be done in _oasis file with Command: testing_script $links_executable, where $links_executable is executable section name
  • I was unable to recover some setting present in the original Makefile. One that worries me the most is OCAMLFLAGS=-dtypes -w Ae-44-45 -g -cclib -lunix. I will keep working on this. EDIT: fix this in _tags file - see comments below
  • Each database backend needs to be in its separate directory. We should think what this directory should be. I will strongly insist on putting all source file in a separate directory once all large branches (like application server) are merged. I suggest to put all source files in src and backends on src/drivers/. At the moment they are in lib, per Gabriel's patch. I guess it is best to take a look at other OCaml projects and see whether they tend to store their library source files in src or lib
  • All of this needs to be documented on the wiki. I will write the documentation once I get an 'OK' to merge this change.
  • Documentation sections of _oasis file need tweaking before we make a release. We need to specify which files should be installed and where. Related to Figure out how to do a release #61.
  • We should decide on a default backend and enable it. Currently all backends are disabled. Related to Decide which database backends we support #76.

Jan Stolarek and others added 21 commits September 30, 2016 08:39
Makefile, configure and setup.ml are generated automatically by Oasis.
Makefile.old is a previous version of Makefile using OCamlMake.
myocamlbuild.ml contains some code to silence silly warnings and nothing
much but that.
Also use Objects instead of Libraries.
This ensure a reasonably recent version of ocamlbuild. Oasis outputs a
more favorable myocamlbuild/_tags when doing so.
This reverts commit fd103c4.

Conflicts:
	_oasis
	lib/lite/lite_database.ml
	lib/lite3/lite3_database.ml
	lib/lite3_database.ml
	lib/lite_database.ml
	lib/m5_database.ml
	lib/monetdb/m5_database.ml
	lib/mysql/mysql_database.ml
	lib/mysql_database.ml
	lib/pg_database.ml
	lib/postgres/pg_database.ml
	lite3_database.ml
	lite_database.ml
	m5_database.ml
	mysql_database.ml
	pg_database.ml
@jstolarek
Copy link
Contributor Author

I think I should elaborate a bit more on this one:

I was unable to recover some setting present in the original Makefile. One that worries me the most is OCAMLFLAGS=-dtypes -w Ae-44-45 -g -cclib -lunix. I will keep working on this.

Actually, Oasis has a simple way of passing extra arguments to the compiler. One either uses ByteOpt or NativeOpt setting, depending on whether one wants to build bytecode version or native version. The problem is that these options would have to be duplicated. Slightly annoying but not a big deal.

Also, which version do we want to build by default: byte or native? I see no easy way to switch between them other than changing entry in the _oasis file. Sadly, Oasis does not allow field CompiledObject to be conditional depending on a flag.

@Drup
Copy link

Drup commented Oct 3, 2016

We should decide on a default backend and enable it. Currently all backends are disabled.

You don't need to: just add an OR dependency in the opam file. In any cases, that's better left for the opam description.

One that worries me the most is OCAMLFLAGS=-dtypes -w Ae-44-45 -g -cclib -lunix.

Add to _tags the following line:

true: annot, warn(Ae-44-45)

annot is the new name of dtypes. -g is added by default by ocamlbuild and I'm pretty sure you don't need the rest (not even sure why it was there to begin with). You might want bin_annot there too (for merlin).

@jstolarek
Copy link
Contributor Author

Add to _tags the following line:

Won't _tags be overwritten by oasis?

@Drup
Copy link

Drup commented Oct 3, 2016

Won't _tags be overwritten by oasis?

No, just give oasis his section and it'll be happy. Example.

@jstolarek jstolarek mentioned this pull request Oct 3, 2016
Jan Stolarek added 2 commits October 5, 2016 15:46
This recovers warning setting defined previously in a Makefile
@jstolarek jstolarek modified the milestone: Gorgie Oct 14, 2016
@jamescheney
Copy link
Contributor

For comparison, here is a branch that uses OMake instead of ocamlbuild. Conditional building works much the same way as the existing OCamlMakefile approach, and does not require reorganizing the directory.

https://github.com/links-lang/links/tree/jrc-omake-test

@jamescheney
Copy link
Contributor

Closing without merging, as just discussed.

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

Successfully merging this pull request may close these issues.

None yet

3 participants