www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Bootstrap D template

reply Seb <seb wilzba.ch> writes:
Have you ever wanted to use D in a project where not everyone had 
D installed or maybe you wanted to fix the compiler to a specific 
version?

I typically use a simple Makefile in such cases and download my 
preferred DMD and LDC version. As others who I have shown this 
have found this useful, I thought it might be helpful to other 
people (even so it's pretty straight-forward).

The cool part about this is that you don't have to worry about 
anything. People can just type `make` and everything works 
magically.

It's essentially a poor man's version of virtualenv for use cases 
where people are too lazy to use the install script or 
auto-env/dir-env can't be used either.

I added a few other common "boilerplate" things (CI integration, 
CodeCov, Documentation build, linting, ...) to this template:

https://github.com/wilzbach/d-bootstrap

Happy bootstrapping!

Why not Docker?
---------------

Docker is typically used to allow a consistent work environment, 
but in my use cases Docker isn't available.
If you want to use Docker, check out the [D docker 
images](https://hub.docker.com/r/dlanguage/dmd/).

Additional bonus
----------------

Want to use D in a Web IDE?
Use [Cloud9](https://aws.amazon.com/cloud9), clone this repo and 
run `make` - it will work out of the box.
Jan 29 2018
next sibling parent Dukc <ajieskola gmail.com> writes:
On Monday, 29 January 2018 at 11:04:19 UTC, Seb wrote:
 As others who I have shown this have found this useful, I 
 thought it might be helpful to other people (even so it's 
 pretty straight-forward).
You're truly becoming the bearer of good news...
Jan 29 2018
prev sibling next sibling parent reply Mengu <mengukagan gmail.com> writes:
On Monday, 29 January 2018 at 11:04:19 UTC, Seb wrote:
 Have you ever wanted to use D in a project where not everyone 
 had D installed or maybe you wanted to fix the compiler to a 
 specific version?

 [...]
clojure's lein support starter templates. it'd be great if dub did such a thing too. thanks for the effort.
Jan 30 2018
parent Seb <seb wilzba.ch> writes:
On Tuesday, 30 January 2018 at 17:14:15 UTC, Mengu wrote:
 On Monday, 29 January 2018 at 11:04:19 UTC, Seb wrote:
 Have you ever wanted to use D in a project where not everyone 
 had D installed or maybe you wanted to fix the compiler to a 
 specific version?

 [...]
clojure's lein support starter templates. it'd be great if dub did such a thing too. thanks for the effort.
Yep it would be nice and it's planned to support `-t` for dub init: See https://github.com/dlang/dub/pull/1326#issuecomment-357233196 As always it happens faster if someone makes a PR for it ;-)
Jan 30 2018
prev sibling next sibling parent reply Tony <tonytdominguez aol.com> writes:
On Monday, 29 January 2018 at 11:04:19 UTC, Seb wrote:

 https://github.com/wilzbach/d-bootstrap

 Happy bootstrapping!
What does "|" do in a makefile?
Feb 01 2018
parent reply Mike Wey <mike-wey example.com> writes:
On 01-02-18 22:53, Tony wrote:
 On Monday, 29 January 2018 at 11:04:19 UTC, Seb wrote:
 
 https://github.com/wilzbach/d-bootstrap

 Happy bootstrapping!
What does "|" do in a makefile?
The target depends on `bin` but don't rebuild the target if `bin` is newer than the target. https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html#Prerequisite-Types -- Mike Wey
Feb 01 2018
parent reply Tony <tonytdominguez aol.com> writes:
On Thursday, 1 February 2018 at 22:01:52 UTC, Mike Wey wrote:

 https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html#Prerequisite-Types
Thanks! Couldn't seem to get a search to work. I was hoping the "|" would explain the behavior that I don't understand, but I don't think it does. The instructions say to just type "make". My understanding is that without a specified target, the topmost target in the Makefile is used. In this case it is "bin", which has no dependencies, and one action - mkdir. I would think that the Makefile would stop after making that directory as no other actions are given and no dependencies were specified. But it doesn't.
Feb 01 2018
parent reply Seb <seb wilzba.ch> writes:
On Thursday, 1 February 2018 at 23:35:43 UTC, Tony wrote:
 On Thursday, 1 February 2018 at 22:01:52 UTC, Mike Wey wrote:

 https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html#Prerequisite-Types
Thanks! Couldn't seem to get a search to work. I was hoping the "|" would explain the behavior that I don't understand, but I don't think it does. The instructions say to just type "make". My understanding is that without a specified target, the topmost target in the Makefile is used. In this case it is "bin", which has no dependencies, and one action - mkdir. I would think that the Makefile would stop after making that directory as no other actions are given and no dependencies were specified. But it doesn't.
`DEFAULT_GOAL` allows to set an explicit target and keep a everything nicely ordered. Is something not working when you just type `make`? Or are you just trying to understand how things work? In the latter case: you don't need to use make, to build your files, I just use it for small projects because it's super easy. Anyhow there are other ways you could use this without needing to dive into make: - as a wrapper - call your actions from a new Makefile target and simply depend on the compiler (that's how I use dub in such projects) - execute `make` as part of your build script. It will fetch the compiler if non-existent and be a no-op otherwise. What are you planning to do?
Feb 01 2018
parent Tony <tonytdominguez aol.com> writes:
On Friday, 2 February 2018 at 01:16:50 UTC, Seb wrote:

 `DEFAULT_GOAL` allows to set an explicit target and keep a 
 everything nicely ordered.
Thanks! (didn't even notice that line)
 Is something not working when you just type `make`?
No
 Or are you just trying to understand how things work?
Yes, sorry for the confusion.
 What are you planning to do?
I was only trying to understand the Makefile.
Feb 01 2018
prev sibling parent Martin Nowak <code dawg.eu> writes:
On Monday, 29 January 2018 at 11:04:19 UTC, Seb wrote:

Just giving this a different title as I'm having troubles finding 
this topic.
https://github.com/wilzbach/d-bootstrap
Mar 08 2018