Skip to content

Commit 601f0c5

Browse files
committed
Update build instructions
1 parent 0c143af commit 601f0c5

File tree

1 file changed

+79
-104
lines changed

1 file changed

+79
-104
lines changed

README.md

Lines changed: 79 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ Mac support is provided for 10.8.x and recent versions (2.x) of Aquamacs.
2020
The binary distribution requires that you have installed Tcl/Tk 8.5 on your
2121
system.
2222

23-
24-
25-
# Build instructions
23+
# Build Instructions
2624

2725
This main Readme is shamefully biased towards Linux. Side-along Readmes are
2826
available for [Mac OS](README.MacOS.md), [Windows](README.Windows.md), and [OpenBSD](README.OpenBSD.md).
2927

30-
## Requirements
28+
## Prerequisites
3129

3230
In order to build Mozart 2, you need the following tools on your computer:
3331

@@ -48,105 +46,95 @@ For building CLANG/LLVM:
4846
On Linux, use your favorite package manager to grab these tools. Refer to the
4947
specialized Readmes for recommendations on Mac OS and Windows.
5048

51-
## Suggested directory layout
52-
53-
We suggest that you use the following directory layout, starting from a
54-
directory `<projects>` where you store your projects:
55-
56-
```
57-
<projects>
58-
+ mozart2 // cloned from this repo
59-
+ externals
60-
+ gtest // source of GTest (see below)
61-
+ llvm // source of LLVM (see below)
62-
+ builds // root for your builds
63-
+ gtest-debug // debug build of GTest
64-
+ llvm-release // release build of LLVM
65-
+ mozart2-debug // debug build of Mozart
66-
+ mozart2-release // release build of Mozart
67-
```
68-
69-
Throughout the following instructions, we will assume this layout.
70-
71-
## Obtaining GTest and LLVM
72-
73-
Mozart2 uses GTest and LLVM as subprojects, which you have to download and
74-
build prior to building Mozart 2.
75-
76-
**Not recommended.** If you do not want to mess with these, you can choose to skip
77-
this section, and let the automatic build process fetch them and build them for
78-
you. Use this "feature" at your own risk, because none of us tests this
79-
anymore, and we may decide to remove support for it at some point.
80-
First download all the sources. GTest uses Git, whereas LLVM uses Subversion.
81-
82-
```
83-
projects$ cd externals
84-
externals$ git clone https://github.com/google/googletest.git gtest
85-
[...]
86-
externals$ svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_34/final llvm
87-
[...]
88-
externals$ cd llvm/tools/
89-
tools$ svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_34/final clang
90-
[...]
91-
tools$ cd ../../..
92-
projects$
93-
```
94-
95-
Next, build the projects. Except on Windows (where parallel make does not
96-
work, it seems), we suggest you use the `-jN` option of `make`, specifying
97-
how many tasks make can run in parallel. Building LLVM is quite long, and this
98-
can significantly speed up the process.
99-
100-
```
101-
projects$ cd builds
102-
builds$ mkdir gtest-debug
103-
builds$ cd gtest-debug
104-
gtest-debug$ cmake -DCMAKE_BUILD_TYPE=Debug ../../externals/gtest
105-
[...]
106-
gtest-debug$ make # (optionally with -jN for a given N)
107-
[...]
108-
gtest-debug$ cd ..
109-
builds$ mkdir llvm-release
110-
builds$ cd llvm-release
111-
llvm-release$ cmake -DCMAKE_BUILD_TYPE=Release ../../externals/llvm
112-
[...]
113-
llvm-release$ make # (optionally with -jN for a given N)
114-
[...]
115-
llvm-release$
116-
```
49+
## Pre-generated source tree
50+
51+
The release source snapshots contain pre-generated C++ code that allows you
52+
to build without requiring LLVM or Clang. This is the easiest way to build
53+
a version of Mozart 2 from source. The latest pre-generated source snapshot
54+
is [mozart2-2.0.0-beta.0-Source.zip](https://github.com/layus/mozart2/releases/download/v2.0.0-beta.0/mozart2-2.0.0-beta.0-Source.zip).
55+
56+
To build from the snapshot:
57+
58+
$ wget https://github.com/layus/mozart2/releases/download/v2.0.0-beta.0/mozart2-2.0.0-beta.0-Source.zip
59+
$ unzip mozart2-2.0.0-beta.0-Source.zip
60+
$ cd mozart2-2.0.0-beta.0-Source/
61+
$ cmake .
62+
$ make
63+
$ make install
64+
65+
To change the directory where Mozart 2 is installed add `-DCMAKE_INSTALL_PREFIX:PATH=/path/to/install` to the `cmake` command:
66+
67+
$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/oz2 . && make && make install
68+
69+
If you want to work on developing Mozart 2 itself you'll probably want to regenerate the C++ headers interfacing to Oz objects at some point. In that case you should use the build instructions below.
70+
71+
# Git Build instructions
72+
73+
You will need LLVM and Clang installed to build Mozart 2 from the git repository. Some Linux distros don't seem to ship the required LLVM/Clang cmake support files so the steps below go through building a local version of LLVM and Clang for the Mozart 2 build system to use. The steps below assume you are in an empty directory to build LLVM, Clang and Mozart 2:
74+
75+
$ mkdir oz2
76+
$ cd oz2
77+
78+
## Building LLVM and Clang
79+
80+
To build LLVM following the following steps:
11781

82+
$ git clone --branch release_39 https://github.com/llvm-mirror/llvm
83+
$ cd llvm/tools
84+
$ git clone --branch release_39 https://github.com/llvm-mirror/clang
85+
$ cd ..
86+
$ mkdir build
87+
$ cd build
88+
$ cmake -DCMAKE_BUILD_TYPE=Release \
89+
-DCMAKE_INSTALL_PREFIX:PATH=`pwd`/../../llvm-install \
90+
..
91+
$ make
92+
$ make install
93+
$ cd ../..
94+
$ export PATH=`pwd`/llvm-install/bin:$PATH
95+
96+
You may wish to add `-j n` to the `make` command line with `n` set to the
97+
number of CPUs to perform some of the build steps in parallel to reduce
98+
the build time.
99+
100+
This will install to an `llvm-install` directory off the root directory created previously and add it to the front of the `PATH` so i t can be found in the Mozart 2 build.
101+
118102
## Clone the Mozart repository
119103

120104
As the Mozart repository contains submodules, you should clone recursively:
121105

122-
```
123-
projects$ git clone --recursive git://github.com/mozart/mozart2.git
124-
```
106+
$ git clone --recursive https://github.com/mozart/mozart2
125107

126-
You can also fetch the submodules separately using:
108+
You can also fetch the submodules separately using:
127109

128-
```
129-
mozart2$ git submodule update --init
130-
```
110+
$ git clone https://github.com/mozart/mozart2
111+
$ cd mozart2
112+
$ git submodule update --init
113+
$ cd ..
131114

132115
## Build Mozart
133116

134-
The build process of Mozart is ruled by cmake. You must first configure your
135-
build environment:
117+
Mozart 2 is built with cmake. The following steps will perform the build:
118+
119+
$ mkdir build
120+
$ cd build
121+
$ CXXFLAGS=-I`pwd`/llvm-install/include cmake -DCMAKE_BUILD_TYPE=Release \
122+
-DCMAKE_INSTALL_PREFIX:PATH=/path/to/install \
123+
../mozart2
124+
$ make
125+
$ make install
126+
127+
You may wish to add `-j n` to the `make` command line with `n` set to the
128+
number of CPUs to perform some of the build steps in parallel to reduce
129+
the build time.
130+
131+
Change `/path/to/install` to the location where Mozart 2 should be installed.
136132

137-
```
138-
builds$ mkdir mozart2-release
139-
builds$ cd mozart2-release
140-
mozart2-release$ cmake -DCMAKE_BUILD_TYPE=Release [OtherOptions...] ../../mozart2
141-
```
142133
On distros like Arch Linux and Nixos, Boost static libraries have been removed.
143134
Please add `-DMOZART_BOOST_USE_STATIC_LIBS=OFF` to your cmake command.
144135

145-
Here is a NixOS expression to install the Mozart2 binary:
146-
`nix-env -i mozart-binary`
147-
148-
The options must be given with the form `-DOPTION=Value`. The table below
149-
lists the options you need.
136+
Other cmake options can be given with the form `-DOPTION=Value`. The table below
137+
lists the options you can add.
150138

151139
<table>
152140
<thead>
@@ -201,18 +189,5 @@ lists the options you need.
201189
</tbody>
202190
</table>
203191

204-
To actually build Mozart, use `make`.
205-
206-
The same recommandation about using `-jN` holds. Building Mozart 2 is _very_
207-
long (especially when done from scratch). But beware, each task can be very
208-
demanding in terms of RAM. If you run out of RAM, decrease N.
209-
210-
```
211-
mozart2-release$ make # (optionally with -jN for a given N)
212-
```
213-
214-
Of course you can install with
215-
216-
```
217-
mozart2-release$ make install
218-
```
192+
There is a NixOS expression to install the Mozart2 binary:
193+
`nix-env -i mozart-binary`

0 commit comments

Comments
 (0)