Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Building and Bootstrapping

Ramsey Nasser edited this pageOct 23, 2020 ·1 revision

Because of the complexity of the project and the fact that it is bootstrapped, building MAGIC requires a few careful steps.

Overview

The bootstrapping strategy depends on compiled binaries (DLL files) because these can be loaded into the CLR without a compiler. The basic idea is to build Clojure.Runtime and MAGIC (and its dependencies and runtime), copy those into Nostrand, and build Nostrand as a final step. The result is a fully bootstrapped REPL with MAGIC as its compiler.

Roughly speaking the process flows like this:

https://user-images.githubusercontent.com/412966/97043759-f0625b00-1540-11eb-9a12-bdfed1a80bec.png

Building Clojure.Runtime

Clojure.Runtime is a normal C# project and is built using the standarddotnet CLI tool.

$ git clone https://github.com/nasser/Clojure.Runtime.git$cd Clojure.Runtime$ dotnet build...Clojure -> bin/Debug/netstandard2.0/Clojure.dllClojure -> bin/Debug/net40/Clojure.dll...

You may see some warnings, but that is normal. The relevant files produced arebin/Debug/netstandard2.0/Clojure.dll andbin/Debug/net40/Clojure.dll for .NET Standard and .NET Framework 4.0 respectively (.NET 3.5 is not supported yet).

Building MAGIC

MAGIC is a Clojure project with dependencies. It is designed to be built from Nostrand, which circularly depends on MAGIC. You can use a released version of Nostrand or a Nostrand you built previously using this procedure to build MAGIC.

MAGIC's Clojure code is built with the following

$ git clone https://github.com/nasser/magic$cd magic$ nos build/bootstrap

This runs theboostrap function in thebuild.clj file which is configured to compile all of MAGIC and its dependencies into.clj.dll files in aboostrap folder.

You then need to build Magic.Runtime

$cd Magic.Runtime$ dotnet build...Magic.Runtime -> bin/Debug/net35/Magic.Runtime.dllMagic.Runtime -> bin/Debug/net40/Magic.Runtime.dllMagic.Runtime -> bin/Debug/netstandard2.0/Magic.Runtime.dll...

That produces binaries for .NET 3.5, .NET 4.0 and .NET Standard.

Building Nostrand

Nostrand is written in C# and Clojure and depends on the binaries produced during the previous steps. You need to copy them into the relevant locations in the Nostrand file tree and then build Nostrand using thedotnet CLI tool.

$ git clone https://github.com/nasser/nostrand$cd nostrand$ cp /path/to/magic/boostrap/* references/$ cp /path/to/magic/Magic.Runtime/bin/Debug/netstandard2.0/* references-netstandard/$ cp /path/to/Clojure.Runtime/bin/Debug/netstandard2.0/* references-netstandard/$ cp /path/to/magic/Magic.Runtime/bin/Debug/net40/* references-net4x/$ cp /path/to/Clojure.Runtime/bin/Debug/net40/* references-net4x/$ dotnet build...Nostrand -> bin/x64/Debug/netcoreapp3.0/Nostrand.dllNostrand -> bin/x64/Debug/net471/Nostrand.exe...

Replace/path/to/magic with the path you clonemagic into and/path/to/Clojure.Runtime with the path you clonedClojure.Runtime into.

The resulting Nostrand.exe should be usable from Mono, and Nostrand.dll should be usable fromdotnet.

$ mono bin/x64/Debug/net471/Nostrand.exe cli-repluser> ...$ dotnet bin/x64/Debug/netcoreapp3.0/Nostrand.dll cli-repluser> ...

Building MAGIC from ClojureCLR

In some instances, especially when debugging compiler bugs, you may need to build MAGIC from the original ClojureCLR compiler as opposed to building it from itself. To do this, you will need to use a patched Nostrand REPL that is set up for MAGIC bootstrapping.

$ git clone https://github.com/nasser/nostrand$cd nostrand$ git checkout magic-bootstrap$ dotnet build...Nostrand -> bin/x64/Debug/net471/Nostrand.exe...

You can then use this Nostrand REPL to build MAGIC

$cd /path/to/magic$ mono /path/to/nostrand/bin/x64/Debug/net471/Nostrand.exe build/boostrap :portable

Note the addition of the:portable argument which ensures that the resulting binaries are usable in .NET Framework or .NET Standard contexts.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp