caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Adrien Nader <adrien@notk.org>
To: Yotam Barnoy <yotambarnoy@gmail.com>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] One build system to rule them all?
Date: Fri, 12 Sep 2014 17:34:24 +0200	[thread overview]
Message-ID: <20140912153424.GA13391@notk.org> (raw)
In-Reply-To: <CAN6ygOn+jD7waa0tAm-Ad6=0JR4RTL8sdBnUq9Mc5CnmMNRf6Q@mail.gmail.com>

On Fri, Sep 12, 2014, Yotam Barnoy wrote:
> Also, while I understand some of the windows hatred, the fact is, most of
> the world uses windows. Even using cygwin as a translation layer hurts
> ocaml's ability to reach people. Ideally, a windows programmer could
> download opam, ocaml and perhaps a mingw compiler, and begin to build
> projects without any need for a shell or anything POSIX-like. This means
> that the build system needs to obviate the need for any shell commands or
> makefiles.

I'm worried it my message which sounded like Windows hatred.
I don't hate Windows, really. I hate cmake and qt however because the
design they _chose_ was already a step back more than a decade ago. It's
similar to advocating static linking despite the current needs to
regularly update libraries because of security issues.
(NB: similar feelings towards people who do not use ocamlfind; hopefully
they're very uncommon nowadays)

As for using only cmd.exe. Well. You probably don't know cmd.exe. You
probably don't know how command-line argument parsing works on Windows.
I can't believe you would and not do your best to avoid them.
The main issue is that the newly-launched process does not receive its
arguments as an array of strings. Instead it receives them as a string.
When you call execv() on windows, it concatenates the string array
you've given and it will be the new process which will have to split
them back into a "char* []" for use with main().
So you have to prepare your arguments. But how? According to the spec of
course! Ah, easy! Except there is no real logic behind it: it's
completely ad-hoc stuff and while probably doable with only a few lines
of code (probably as many as this email), it's looks error-prone (and,
let's face it, boring). Oh and, it might well break compat and the issue
has been in OCaml since 1994.

This is the reason ocamlbuild depends on an sh.exe from msys/cygwin btw
(I'm actually wondering if cygwin's is fit for this task...).
It will receive a single string of arguments, parse it like it would do
on POSIX; in other words, its only purpose is to get back to well-known
and manageable parsing rules.

To be honest, OCamlbuild also has a large tendency to shell-out but in
90% of the cases, it's not a big issue although re-implementing "cp -r"
is annoying (did someone mention that if ocamlbuild moves out of the
compiler, it can depend on Fileutils which implements this kind of
operations?).

That said, ocamlbuild works well on Windows because besides these few
shell-outs, it's written in OCaml.

Btw, there are open bug reports on mantis about that. If you're
interested in getting these fixed, the links to the docs are already
there and the work is definitely manageable so speak up.

Btw2, there's a fairly recent "zsh for windows" (last release from 2011
or 2012) and which, if it works, and if it works for our use-case, could
maybe be integrated in the ocaml installers and could simplify the
process.
(note the number of "ifs" and conditionals used above)


In any case, if you plan on integrating with something else, and you
will, unless you don't want to use any C stubs, including the ones for
the OS, you will have to understand and integrate into the existing
C-building setups which already exist one way or another.


-- 
Adrien Nader

  parent reply	other threads:[~2014-09-12 15:34 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 12:49 Yotam Barnoy
2014-09-10 13:00 ` Simon Cruanes
2014-09-10 13:02 ` Adrien Nader
2014-09-10 13:05 ` David Sheets
2014-09-10 14:04   ` Thomas Braibant
2014-09-10 14:13     ` Adrien Nader
2014-09-10 13:18 ` Mark Shinwell
2014-09-10 13:29 ` Francois Berenger
2014-09-10 13:53   ` Jacques-Pascal Deplaix
2014-09-10 13:55     ` Francois Berenger
2014-09-10 14:17   ` Maxence Guesdon
2014-09-10 19:13     ` Drup
2014-09-10 22:56       ` Gerd Stolpmann
2014-09-13 12:01       ` rixed
2014-09-13 12:21         ` Drup
2014-09-13 12:37           ` rixed
2014-09-13 12:50             ` Adrien Nader
2014-09-13 13:05             ` Drup
2014-09-19 11:15       ` Matej Kosik
2014-09-10 14:23   ` Gerd Stolpmann
2014-09-10 15:17     ` Leonardo Laguna Ruiz
2014-09-10 18:59       ` Yotam Barnoy
2014-09-10 19:16         ` Peter Zotov
2014-09-10 19:56           ` Sebastien Mondet
2014-09-10 20:15             ` Gabriel Scherer
2014-09-10 23:20             ` Gerd Stolpmann
2014-09-10 20:13         ` Adrien Nader
2014-09-11  7:53         ` Francois Berenger
2014-09-11 10:37           ` Yaron Minsky
2014-09-12 14:08             ` Yotam Barnoy
2014-09-12 14:31               ` Francois Berenger
2014-09-12 14:36               ` Anil Madhavapeddy
2014-09-12 18:49                 ` Yaron Minsky
2014-09-12 15:10               ` SF Markus Elfring
2014-09-12 15:34               ` Adrien Nader [this message]
2014-09-12 18:50               ` Fabrice Le Fessant
2014-09-14 18:46               ` Richard W.M. Jones
2014-09-13 12:22         ` rixed
2014-09-15 13:34         ` Stéphane Glondu
2014-09-18 21:15           ` Yotam Barnoy
2014-09-18 21:21             ` Anil Madhavapeddy
2014-09-18 21:36               ` Yaron Minsky
2014-09-19 12:31                 ` Daniel Bünzli
2014-09-19 13:06                   ` Anil Madhavapeddy
2014-09-18 21:23             ` Yaron Minsky
2014-09-19  7:27               ` Gabriel Scherer
2014-09-19 15:03                 ` Yaron Minsky
2014-09-12 16:54 ` [Caml-list] Re : " r.3
2014-09-14 18:16 ` [Caml-list] " Richard W.M. Jones
2014-09-19  9:14 ` r.3

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140912153424.GA13391@notk.org \
    --to=adrien@notk.org \
    --cc=caml-list@inria.fr \
    --cc=yotambarnoy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).