[deimos] [tutorial] [rfc] How to set up a git repository to simplify keeping bindings up to date

mta`chrono chrono at mta-international.net
Sat Nov 12 06:08:39 PST 2011


> According to the deimos manifesto:
> ---------------------------------
> Deimos is a collection of C header files to publicly available C
> libraries and their translations to D. The idea is that if, in C, to
> interface to a library one would write:
> #include "foo.h"
> then the corresponding D code would look like:
>    import foo;
> or:
>    import deimos.foo;

Sorry, that I've to say that, but I think this is crap. A very different
approach that we know from C, the D language offers a great feature
called namespaces. In fact we're able to arrange our modules in the
namespace that doesn't have necessarily to match with the corresponding
filename.

There has always been the bump that some people wrote #include <mysql.h>
and compiled with -I/usr/include instead of -I/usr/include/mysql.

Most of the .h files that are stored directly (without subfolders) in
/usr/include are already covered by druntime.

So, why not just use __ONE__ convention for all the rest?

import deimos.library.modulename;

=== Examples: ===

private import deimos.lzma.base,
               deimos.lzma.block,
               deimos.lzma.container,
               deimos.lzma.version;

private import deimos.gtk.gtk,
               deimos.gtk.window,
               deimos.gtk.celllayout,
               deimos.gtk.assistant,
               deimos.gtk.misc;

private import deimos.x11.xlib,
               deimos.x11.xutil,
               deimos.x11.xos,
               deimox.x11.keysym,
               deimos.x11.xatom;

private import deimos.libpng.png,
               deimos.libpng.conf;

private import deimos.cairo.pdf,
               deimos.cairo.svg,
               deimos.cairo.ps;

private import deimos.mysql.global,
               deimos.mysql.embed,
               deimos.mysql.version;


Additionally we could provide some shortcuts. If you do import
deimos.library; it will public import deimos.library.*;

=== Examples: ===

import deimos.lzma;
import deimos.gtk;
import deimos.x11;
import deimos.libpng;
import deimos.cairo;
import deimos.mysql;

And last but not least I prefer using
https://github.com/D-Programming-Deimos instead of
https://github.com/D-Programming-Language/deimos. Imagine if deimos
becomes bigger and we'll have more than 100 pending pull requests across
different bindings. That will all result in a big mess. So please each
binding should have it's own repository.

If you're going to install all, then add d-p-l to your
/etc/apt/sources.lst and enter apt-get install deimos-*. Or make use of
a shell script that iterates through all repos in
/usr/include/d/dmd/deimos and calls git pull.


More information about the Digitalmars-d-announce mailing list