Skip to content

Created a no-dependency script to bootstrap Windows DMD. #18

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

Merged
merged 4 commits into from
Jul 2, 2013

Conversation

Abscissa
Copy link
Contributor

While this pull is just for Windows, a Posix version is in the works.

This is a one-file tool that has no prerequisites other than an internet connection and a working Windows machine (XP and up - untested on 2k). It will use Git if it's detected, but does not require it. The only other dependencies (DMC and a command-line unzip) are automatically downloaded by this script (but not installed system-wide, just placed in a subdirectory).

One nice effect of the above is that, if this pull is merged, any internet-connected Windows user who has wget installed can go from having no DMD whatsoever to a basic bootstrapped DMD with nothing more than one command:

wget https://raw.github.com/D-Programming-Language/installer/master/bootstrap/bootstrap-dmd.bat && bootstrap-dmd

(However, this script does not require wget or curl.)

This script is deliberately limited to building and setting up nothing more than Win32 DMD, Druntime, Phobos and RDMD. My intention is with that much bootstrapped by this batch file, any further tasks can be implemented in D.

I tested this on WinXP 32-bit and Win7 64-bit, and also from arbitrary directories (it not just the directory with the script), and inside paths containing spaces.

BTW, I put it in it's own separate "bootstrap" subdirectory because my intention is to also have an equivalent Posix script plus D-based cross-platform "stage 2" files. Using this common directory ensures both Windows and Posix users can run the script using the same command: "path"~dirSep~"boostrap-dmd"

rem -------------------------------------------------------------------------

rem Detect whether Git is available
call gitsssssssa --help > NUL 2> NUL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Wed, 29 May 2013 07:02:58 -0700
Andrei Alexandrescu notifications@github.com wrote:

+echo.rename %%WORK_DIR%%%%2-%%DMD_BRANCH%%

%%2 >> %FAKE_GIT_SCRIPT% +rem

  • +rem Generate script to run real Git
    +rem

    +echo.^@echo
    off >
    %REAL_GIT_SCRIPT% +echo.rem This script is only intended to be run
    from bootstrap-dmd.bat >> %REAL_GIT_SCRIPT%
    +echo.

    %REAL_GIT_SCRIPT%
    +echo.pushd .

    %REAL_GIT_SCRIPT% +echo.cd
    %%WORK_DIR%%

    %REAL_GIT_SCRIPT% +echo.call git clone --depth 1 --branch
    %%DMD_BRANCH%% %%1.git %%2 >> %REAL_GIT_SCRIPT%
    +echo.popd

    %REAL_GIT_SCRIPT%
    +rem


  • +rem Detect whether Git is available
    +call gitsssssssa --help > NUL 2> NUL

what's this?

A debugging edit that I accidentally left in ;)

@andralex
Copy link
Member

This is nice work. I'll leave review to people who are more fluent with Windows.

@MartinNowak
Copy link
Member

This is nice but we will need a binary bootstrap once we port part of the compiler to D.

@ghost
Copy link

ghost commented May 29, 2013

Script looks fine to me, can't comment on the Visual Basic stuff, I'm clueless there. I've tried it on Win7 and it works. Nice work!

But, I think maybe using "bin32" as the folder name for the binary could confuse some tools. E.g. IDE tools might expect a "bin" directory instead. And some build tools for libraries expect to find a "lib" folder instead of "lib32". Other than that it looks great.

Btw, if you want to redirect both stdout and stderr at once you can do command > NUL 2>&1.

Also, Nick your avatar is scary. :P

@Abscissa
Copy link
Contributor Author

This is nice but we will need a binary bootstrap once we port part of the compiler to D.

Hmm, I suppose that does kinda throw a wrench in it....

Although...Perhaps it could be useful as a backup-solution if, for some reason, there's ever any trouble with the (future) binary bootstrap (ex: Maybe a new version of the OS that breaks something?). Then this could be used to bootstrap the last C++-only version, and then use that to compile a newer D, and so on up to the latest. Just a thought.

But, I think maybe using "bin32" as the folder name for the binary
could confuse some tools. E.g. IDE tools might expect a "bin"
directory instead. And some build tools for libraries expect to find
a "lib" folder instead of "lib32".

I was thinking partly about forward compatibility since, presumably, there'd eventually be a 64 bit binary. (Or not?) Also, this keeps the directory names the same between Win/Lin (but then again OSX is just "bin" and "lib" too, though IIRC...)

But maybe it is better to just keep with existing DMD convention and then change to "bin32", etc if/when the DMD releases start doing that. Opinions? Consensus?

Btw, if you want to redirect both stdout and stderr at once you can
do command > NUL 2>&1.

Normally, yea, but if they're just going to NUL anyway than > NUL 2> NUL works just the same and is easier to read/remember. The 2>&1 just helps make sure stdout/stderr don't get reordered in the destination, so it doesn't really matter here.

Also, Nick your avatar is scary. :P

Heh :) I originally made it for a Nine Inch Nails message board some years back (partly inspired by what the "DOOM guy" does in the HUD when you're doing well.) It's probably more Marilyn Manson-ish than NIN-ish, but heck, he was on Trent Reznor's Nothing label, too. The picture actually is me...sort of...

@Abscissa
Copy link
Contributor Author

This is nice but we will need a binary bootstrap once we port part of the compiler to D.

Although...Perhaps it could be useful as a backup-solution if, for some reason, there's ever any trouble with the (future) binary bootstrap (ex: Maybe a new version of the OS that breaks something?). Then this could be used to bootstrap the last C++-only version, and then use that to compile a newer D, and so on up to the latest. Just a thought.

Or, a newer version of this script could just simply auto-download an existing already-packaged-and-released DMD, just like it currently does with DMC, and use that to build a newer version (say, a beta or master) off of GitHub. I think that could still be potentially useful.

@MartinNowak
Copy link
Member

Or, a newer version of this script could just simply auto-download an existing already-packaged-and-released DMD, just like it currently does with DMC, and use that to build a newer version (say, a beta or master) off of GitHub. I think that could still be potentially useful.

Definitely.

@andralex
Copy link
Member

ping - ready to merge?

@Abscissa
Copy link
Contributor Author

AndrejMitrovic is right: The bin/lib directory names should match current DMD Windows convention. I've just done that now.

@ghost
Copy link

ghost commented Jun 29, 2013

I would have merged this myself, but I don't have merge rights here (btw, where can one see a list of projects they have write access to?)

@MartinNowak
Copy link
Member

LGTM, please merge.

andralex added a commit that referenced this pull request Jul 2, 2013
Created a no-dependency script to bootstrap Windows DMD.
@andralex andralex merged commit 1e704fc into dlang:master Jul 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants