Druntime and phobos with dub

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 14 19:42:31 PST 2015


On 15/01/2015 4:35 p.m., Rikki Cattermole wrote:
> I'm currently working on getting dub package files for Druntime and phobos.
> It has been reasonably easy getting code to compile atleast for 2.066
> branch.
>
> Problems:
> - Druntime contains assembly + c files requiring external compilers.
> To play nicely with dub repos and having them dependencies, they could
> be stored in git like I have it right now.
> But the real problem here is that atleast one of these assembly files
> can't even be compiled by pretty much anyone but Walter.
> - Phobos has zlib which is in the same situation as druntime for c files.
> We seriously should consider rewriting or porting that.
> *wink* GSOC.
> That would only leave curl but that's manual anyway.
> - Documentation building.
> This is separated out into dlang.org and druntime/phobos.
>    - Dlang.org repo contains the base website and formatting.
>    Dub doesn't really understand past sourceLibrary that certain files
> are ddoc macro files and should include them in all packages that depend
> upon it.
>    That is okay. The problem is both the formatting but also
> images/css/js are required as part of this.
>    - With druntime/phobos they merely need resources from dlang.org.
> Which are detailed above.
>    - Dlang.org IS A MESS
>    I'm not joking here. Before tackling getting a dub file for e.g. html
> output I moved everything into a new folder.
> - std.c.linux and std.c.osx need guard version statements. Other then
> that only issue is std.metastrings doesn't compile so is excluded.
>
> TLDR: Turning druntime/phobos into dub repos are easy. Getting
> documentation to play nicely does not.
>
>
>
> For reference here are the files:
> Druntime's dub.json:
> {
>      "name": "druntime",
>      "description": "This is DRuntime. It is the low-level runtime
> library backing the D programming language.",
>      "homepage": "http://dlang.org",
>      "authors": ["Walter Bright", "Andrei Alexandrescu"],
>      "license": "Boost",
>
>      "targetType": "none",
>      "targetPath": "bin",
>      "sourcePaths": [],
>      "dependencies": {
>          "druntime:rt": "*",
>          "druntime:core": "*",
>          "druntime:gc": "*",
>          "druntime:etc": "*"
>      },
>
>      "subPackages": [
>          {
>              "name": "gcstub",
>              "targetType": "staticLibrary",
>              "targetPath": "bin",
>              "sourcePaths": [],
>              "sourceFiles": ["src/gcstub/gc.d"]
>          },
>          {
>              "name": "rt",
>              "targetType": "staticLibrary",
>              "targetPath": "bin",
>              "sourcePaths": ["src/rt"],
>              "sourceFiles": ["src/object_.d"],
>              "sourceFiles-windows": ["bin/rt_minit.obj"],
>              "sourceFiles-posix": ["bin/rt_bss_section.obj"]
>          },
>          {
>              "name": "gc",
>              "targetType": "staticLibrary",
>              "targetPath": "bin",
>              "sourcePaths": ["src/gc"]
>          },
>          {
>              "name": "core",
>              "targetType": "staticLibrary",
>              "targetPath": "bin",
>              "sourcePaths": ["src/core"],
>              "sourceFiles-windows": ["bin/stdc_errno_c.obj"],
>              "sourceFiles-posix": ["bin/stdc_errno_c.obj",
> "bin/core_threadasm.obj"]
>          },
>          {
>              "name": "etc",
>              "targetType": "staticLibrary",
>              "targetPath": "bin",
>              "sourcePaths": ["src/etc"]
>          }
>      ]
> }
>
> Phobos's dub.json:
> {
>      "name": "phobos",
>      "description": "Phobos is the standard library that comes with the
> D Programming Language Compiler.",
>      "homepage": "http://dlang.org",
>      "authors": ["Walter Bright", "Andrei Alexandrescu"],
>      "license": "Boost",
>
>      "targetPath": "bin",
>      "sourcePaths": ["std", "etc"],
>      "excludedSourceFiles": ["std/metastrings.d"],
>      "sourceFiles-windows-x86": ["bin/zlib.lib"],
>      "sourceFiles-windows-x86_64": ["bin/zlib64.lib"],
>      "sourceFiles-osx": ["bin/zlib_osx.a"],
>      "sourceFiles-linux": ["bin/zlib_linux.a"],
>      "dependencies": {
>          "druntime": "*"
>      },
>
>      "configurations": [
>          {
>              "name": "staticLibrary",
>              "targetType": "staticLibrary"
>          },
>          {
>              "name": "dynamicLibrary",
>              "targetType": "dynamicLibrary",
>              "dflags": ["-main"]
>          }
>      ]
> }
>
> This is not about debating who should be listed as authors FYI.

Personally I believe we should move towards a model where every library 
is represented by JSON (maybe with help of e.g. markdown) that gets e.g. 
parsed by client side technologies such as json.

Benefits:
  - We can have central documentation as part of dub registry for all 
libraries registered
  - Same look and feel for every piece of documentation
  - Less dependencies between druntime/phobos docs and dlang.org
Negatives:
  - Loss of control over end formatting excluding what e.g. markdown support
  - If javascript is disabled, nothing gets displayed


More information about the Digitalmars-d mailing list