Add bin/build-ldc-runtime.sh helper script#2198
Conversation
DMD must have changed it sometime; verified with DMD 2.074.0.
… part of LDC This gets a stand-alone runtimes build to work via something like: cmake -DLDC_EXE_FULL=/home/martin/ldc2-1.3.0-linux-x86_64/bin/ldc2 -DD_VERSION=2 -DDMDFE_MINOR_VERSION=073 -DDMDFE_PATCH_VERSION=2 <ldc-src>/runtime && make -j<N>
|
It'd be nice if someone on OSX could give this a try:
This should build static+shared druntime & Phobos libs with LTO support into |
|
This fixes #2196 for me on Linux x64. Executing |
-conf= from default config file to none|
(for LTO, I think it'd be best to have LDC search for phobos/druntime with |
|
Interesting approach, I was thinking of using dub, since we now package it alongside ldc anyway. This would mean no dependency on CMake or Make, only a C cross-compiler for the few C/asm files the stdlib uses, but presumably would require writing a whole new dub.sdl that builds the stdlib. I have not looked at or used dub enough to know if that's a good idea, thoughts? Another possibility is that we could bundle in reggae and the Phobos reggaefile that Atila already wrote for us, along with one we write for druntime. I'm not sold on D syntax for build scripts, but it's certainly better than CMake. |
|
I think the CMake (a pretty old version should suffice, only LLVM's CMake scripts require a pretty recent version) and make requirements aren't a big hurdle for interested users. Moving from CMake to a dub or reggae script for the runtime libs may be worth the trouble if the resulting script ends up clearly more compact and more readable while supporting the same platforms. Looking at Atila's 500-lines reggae script for Phobos alone, I doubt that goal is easily achievable, given the numerous special cases in our current 830-lines CMake script ( |
You're probably right for many, as setting up a C cross-compilation toolchain usually isn't easy, and still required if they want to do anything with our cross-compiler. But at that point, we could just tell them to
Do we really want to support all that for the compiler release though? The reason Atila's script is so large is that it translates all build-related steps from Phobos's I've never written a dub build file, any one have an opinion on it? |
Well, there's no git dependency for example. ;) - It should be really only CMake ≥ 2.8.9 on top of an anyway-required C toolchain incl. make [as well as bash, wget and tar]. I.e., no need for git, LLVM libs and headers, Python and recent CMake + gcc ≥ 4.9 (for LLVM) as required for a full LDC build. |
You mean keeping the existing CMake script for the stdlibs produced as part of the full LDC build and adding a new lightweight dub script for standalone stdlib building? If it's very compact and doesn't need a lot of maintenance, that may be an option, but it'll have to compete against this proposed 30-lines bash script with 0 maintenance cost and full configurability. ;) |
|
Yes, I'm talking about having a separate dub script for quickly building druntime and phobos from the release, with a few options for cross-compiling, LTO, and the like. Quickly looking at some dub scripts, they seem almost impossibly small, might be a good fit, particularly if we can get rid of the CMake/make dependencies too. We'd have to actually include all druntime and phobos source in the ldc binary release though, some of which we don't ship now. I'll look at it after I finally get my cross-compilation PR up for the runtime's CMake file, the last remaining bit from my Android fork of ldc. |
|
Updated: don't install the |
That was exactly one use case I had in mind for this script. Wouldn't something like |
Can you pass |
|
Sure - you can specify all CMake variables in |
|
OK, I was thinking of including a list of |
|
Afaict, And at some point, we should replace the host OS checks via a
Sounds good. I never intended to release this script alone; the plan is to build on top of it via some handy wrapper scripts for LTO and cross-compilations and some way of installing the freshly built libs incl. |
f64592b to
68671b7
Compare
|
Any objections? I'll probably rename the script to |
|
I would like it if I could run this also from my dev setup (i.e. from a git checkout of master). Perhaps add a way to point it to a source tree and bypass the download? |
|
no objections, other than renaming the |
|
No objection, seems fine. |
Yep, makes sense. |
This new script will automatically download and extract the full LDC source archive of the release it was packaged with and then build druntime/Phobos stand-alone (taking a few minutes) using * user-supplied CMake command-line args, * the LDC compiler in the same directory as the script for the D parts, * and the `CC` C compiler for the C/ASM parts and linking the shared libs (on POSIX at least). So we can build on top of that to let the user build the runtime libs with LTO support or for cross-compilation targets any time he/she wants to. Requirements are CMake >= 2.8.9 and make [as well as bash, wget and tar] in addition to an anyway-required C toolchain.
|
Alright, script reworked to take into account optional env variables |
Update:
This new script will automatically download and extract the full LDC source archive of the release it was packaged with and then build druntime/Phobos stand-alone (taking a few minutes) using
CCC compiler for the C/ASM parts and linking the shared libs (on POSIX at least).So we can build on top of that to let the user build the runtime libs with LTO support or for cross-compilation targets any time he/she wants to.