-
Notifications
You must be signed in to change notification settings - Fork 31
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
Build script should allow choice of compiler #5
Comments
I agree, the build script is pretty limited right now. Keep in mind, when I wrote it, the other D2 compilers weren't even close to being up-to-date with the language. I am currently working on a better build system, which will allow the use of any compiler, provide full flexibility in setting compiler options, and so on. This is going a bit slowly, though, so don't hold your breath. ;-) Note that the library itself is straightforwardly compiled by hand. There are no quirks or special considerations that I am aware of. Using DMD (any other compiler should be similar), just issue the following command in the root directory of the repository:
The main benefit of using the build script is auto-generation of headers (which aren't really necessary; just use the full source code) and CandyDoc documentation. |
Not intended as a deep critique, just to make sure the question was raised :-) Re using the full source code: I think this is actually what's done also with Phobos packages in Linux distro repositories, at least for Debian/Ubuntu; there's no compiled libphobos at all. |
The main reason for this is that header generation has historically been very buggy in DMD. I believe many (maybe all?) of the problems have been fixed in recent releases, however. |
Back to the build script: forgetting the choice of compiler called within the script, there's some problem related to running it as a script with gdmd.
generates an error: In fact, if you include a couple of lines at the beginning of the writeln("Number of arguments: ",args.length);
foreach(string a; args)
writeln("\t",a); ... you find that gdmd translates to a rather extensively-optioned form that clearly causes that
Using std.getopt with --lib, --headers, etc. is probably a better way to determine what to build. If you think it'll be useful I'll try and prepare a patch to that end. |
I disagree. To me it seems that the problem is with gdmd, and not the build script. Does the following work for you?
If so, I'll add a notice to that effect in the README and on the wiki. |
Yes, it runs fine if you compile it first. Adding those instructions to README and wiki is probably a good idea. Agree that gdmd has a problem here, but still think that the way you handle build arguments is problematic. |
I've added a bug report for GDC on this point: https://bitbucket.org/goshawk/gdc/issue/335/gdmd-run-interferes-with-program-arguments |
Could you explain why it is problematic? It looks at the first command line argument for a build target, and builds that target. If no target is specified, it assumes the user wants to build the library file and the headers. If you pass it an argument it doesn't recognise, it terminates gracefully with an error message. I don't think a simple build script should be expected to recover from invalid user input. One simple improvement that could be made, however, is to pass anything past that first argument, i.e.
Great, thanks! |
Done: kyllingstad@45569e9 |
Agree, I was being harsh on what is a simple build script. Put simply my thought was for the bigger picture and a build script that would carefully check all arguments. Anyway, your fix looks nice :-) |
Fixed a long time ago, just forgot to close it then. |
If I understand correctly, the current build script hardcodes in dmd as the compiler. This is undesirable for a couple of reasons.
The text was updated successfully, but these errors were encountered: