Skip to content

Commit

Permalink
Update READMES
Browse files Browse the repository at this point in the history
  • Loading branch information
azarzadavila committed Aug 24, 2018
1 parent 0a91307 commit d08392c
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 131 deletions.
23 changes: 23 additions & 0 deletions README.CI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Mozart2 Continuous Integration

We use a continuous integration system for Mozart2. This means that at every
change made in source code, we check if it did not break the build.
More specifically, every commit sent to this repository triggers two builds. We
use [Travis CI](https://travis-ci.org/) to build the pre-generated sources and Mozart2 on Linux. We also use
[Appveyor](https://www.appveyor.com/) to build on Windows. If you wish to use those tools, you can fork this
repository and active both Appveyor and Travis to your fork. The Travis CI job is probably
the easiest way to rebuild the pre-generated sources.

## Travis CI

The build process is written in [.travis.yml](.travis.yml). Specifically, we use the
[trusty](https://docs.travis-ci.com/user/reference/overview/#virtualisation-environment-vs-operating-system) environnement. Currently, we implement a build on
Linux. We create two jobs. The first one, builds the pre-generated sources
with LLVM and CLANG. It then compares the generated sources with those already
in the repository. If this job succeed, a second one is started to build
Mozart2.

## Appveyor

The build process is written in [appveyor.yml](appveyor.yml). It uses mainly MingW to build.
The build uploads a Windows installer as an artifact.
193 changes: 104 additions & 89 deletions README.Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,116 @@
General information can be found in the [main Readme](README.md). Unless
otherwise specified here, instructions found in the main Readme apply.

## Global configuration
### Development tools
Download and install the following tools:

* Java (required for building the boot compiler)
* Python (required for building LLVM)
* Git for Windows
* CMake >= 2.8.6
## Prerequisites
In addition to what is specified in the main README download and install the following tools:

* [Inno Setup](http://www.jrsoftware.org/isdl.php) (with preprocessor, required for building setup files)
* A recent 32-bit (i686) or 64-bit (x86_64) targeting [MinGW-64 distro](http://mingw-w64.sourceforge.net/download.php#mingw-builds) with gcc >= 4.7.1.
* A recent 32-bit (i686) or 64-bit (x86_64) targeting [MinGW-64 distro](http://mingw-w64.sourceforge.net/download.php#mingw-builds) with gcc >= 4.7.1.

These tools won't be needed at run time. We will refer to the installation directory of MinGW (in which the first `bin` subdirectory is found) by `<mingw>`.
All commands in this file are to be done in the MinGW terminal (shortcut available from the start menu).
These tools won't be needed at run time. We will refer to the installation directory of MinGW (in which the first `bin` subdirectory is found) by `<mingw>`.
Unless specified, all commands in this file are to be done in the MinGW terminal (shortcut available from the start menu).

### Mozart requirements
Download and install :
## Specific tools

* Emacs for Windows
* 32-bit or 64-bit (depending on MinGW) [Active Tcl](http://www.activestate.com/activetcl/downloads) or self-compiled Tcl/Tk >= 8.5
We will assume for that you use the following directory layout, starting from
the root :

We will refer to the installation directory of Emacs and Tcl/Tk by `<emacs>` and `<tcl>`, respectively.
<projects>
+ mozart2 // cloned from this repo
+ build // build of Mozart
+ tcl-release // source of tcl (see below)
+ tk-release // source of tk (see below)
+ boost // boost downloaded
<tcltk> // directory in which we install tcl and tk

### Suggested directory layout
We recommend to use a self-compiled Tcl/Tk. You can however use [Active Tcl](http://www.activestate.com/activetcl/downloads)

We suggest that you use the following directory layout, starting from a
directory `<projects>` :
### Tcl

<projects>
+ mozart2 // cloned from this repo
+ externals
+ boost // source of Boost (see below)
+ gtest // source of GTest (see below)
+ llvm // source of LLVM (see below)
+ builds
+ gtest // build of GTest
+ llvm // build of LLVM
+ mozart2 // build of Mozart
+ redist // export dir of Mozart (see below)

Throughout the following instructions, we will assume this layout.

## Compilation of Boost
1. Download [Boost **>= 1.53**](http://www.boost.org/users/download/) and extract the archive in `<projects>\externals\boost`.
1. In your MinGW terminal, type (`<arch>` depends on building 32-bit or 64-bit target) :

C:> cd <projects>\externals\boost\tools\build\src\engine
C:> build.bat mingw
C:> cp bin.nt<arch>\*.* ..\..\..\..\
C:> cd ..\..\..\..\
C:> bjam --toolset=gcc

1. From `<projects>\externals\boost`, copy `boost` subdirectory in your `<mingw>\<arch>-w64-mingw32\include` directory and merge `stage\lib` subdirectory with your `<mingw>\<arch>-w64-mingw32\lib` directory.
C:> cd C:\projects
C:> wget -O tcl-release.tar.gz https://github.com/tcltk/tcl/archive/release.tar.gz
C:> tar xf tcl-release.tar.gz
C:> cd tcl-release/win/
C:> bash configure --enable-threads --enable-64bit --prefix=C:/tcltk/
C:> make
C:> make install

## Compilation of GTest
### Tk

1. Download [GTest](https://code.google.com/p/googletest/downloads/list) and extract the archive in `<projects>\externals\gtest`.
1. In your MinGW terminal, type :
C:> cd C:\projects
C:> wget -O tk-release.tar.gz https://github.com/tcltk/tk/archive/release.tar.gz
C:> tar xf tk-release.tar.gz
C:> cd tk-release/win/
C:> bash configure --enable-64bit --prefix=C:/tcltk/ --with-tcl=../../tcl-release/win/
C:> make
C:> make install

C:> cd <projects>\builds\gtest
C:> cmake -G"MinGW Makefiles" ..\..\externals\gtest
C:> mingw32-make
### Boost

Once you downloaded boost, you need to install different modules.

C:> cd C:\projects\boost
C:> call bootstrap.bat gcc
C:> .\b2 toolset=gcc variant=release --with-thread --with-system --with-random --with-filesystem --with-program_options

### Emacs

The packaging manager we use, installs all the program used to install Emacs in
its package. Which means, if you use MingW to install Emacs directly with
pacman, you will include all MingW in your package. As a consequence, we
decided to install Emacs with a lighter package manager :
[chocolatey](https://chocolatey.org/). You can
just run the following in a classic Windows prompt, in PowerShell :

C:> choco install emacs64

You can install emacs with MingW, it will just make your package heavy.

## Build

Mozart 2 is built with cmake. We add two CMake options to prepare the package :

* `-DISS_INCLUDE_EMACS=ON` will include your Emacs files in the package.
* `-DISS_INCLUDE_TCL=ON` will include your Tcl/Tk files in the package.

The following steps will perform the build :

C:> mkdir C:\projects\mozart2\build
C:> cd C:\projects\mozart2\build
C:> cmake -DCMAKE_BUILD_TYPE=Release -G"MSYS Makefiles" -DCMAKE_PREFIX_PATH=C:\tcltk -DBOOST_ROOT=C:\projects\boost -DISS_INCLUDE_TCL=ON -DISS_INCLUDE_EMACS=ON C:\projects\mozart2
C:> make install

### Installer

You can create an installer with the following command :

C:> cmake --build . --target installer -- VERBOSE=1

The installer can be found in C:\projects\mozart2\build.

## Running Mozart 2

For Mozart to run properly, you need to ensure :

* Tcl/Tk is in your PATH or its `lib` and `bin` subfolders are merged with
Mozart ones
* An environment variable `OZEMACS` is set to `<emacs>\bin\runemacs.exe`

Both should be set automatically with the created installer.

## Compilation of LLVM
1. Download [LLVM and Clang **3.3**](http://llvm.org/releases/download.html#3.3) source code.
1. Extract the content of LLVM source archive in `<projects>\externals\llvm` and the content of Clang source archive in `<projects>\externals\llvm\tools\clang`.
1. If you are targeting 64-bit builds, patch the files `<projects>\externals\llvm\lib\ExecutionEngine\JIT\JIT.cpp` and `<projects>\externals\llvm\lib\ExecutionEngine\MCJIT\SectionMemoryManager.cpp` by replacing :
If you want to build the pre-generated sources, you will need to install LLVM.
To do so, you can follow the instructions below and then check the main README
for information on how to build the pre-generated sources.
1. Download [LLVM and Clang
**3.3**](http://llvm.org/releases/download.html#3.3) source code.
1. Extract the content of LLVM source archive in `C:\projects\externals\llvm`
and the content of Clang source archive in
`C:\projects\externals\llvm\tools\clang`.
1. If you are targeting 64-bit builds, patch the files
`C:\projects\externals\llvm\lib\ExecutionEngine\JIT\JIT.cpp` and
`C:\projects\externals\llvm\lib\ExecutionEngine\MCJIT\SectionMemoryManager.cpp`
by replacing :

// Determine whether we can register EH tables.
#if (defined(__GNUC__) && !defined(__ARM_EABI__) && \
Expand All @@ -90,45 +134,16 @@ Throughout the following instructions, we will assume this layout.

1. In your MinGW terminal, type :

C:> cd <projects>\builds\llvm
C:> cd C:\projects\builds\llvm
C:> cmake -G"MinGW Makefiles" -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_BUILD_TYPE=Release ..\..\externals\llvm
C:> mingw32-make

## Compilation of Mozart 2
## Compilation of GTest

1. Download [GTest](https://code.google.com/p/googletest/downloads/list) and
extract the archive in `C:\projects\externals\gtest`.
1. In your MinGW terminal, type :

C:> set PATH=%PATH%;<projects>\builds\llvm\bin;<emacs>\bin;<tcl>\bin
C:> cd <projects>
C:> git clone --recursive https://github.com/mozart/mozart2.git
C:> cd <projects>\builds\mozart2
C:> cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_DIR=..\llvm -DGTEST_BUILD_DIR=..\gtest -DGTEST_SRC_DIR=..\..\externals\gtest -DLLVM_SRC_DIR=..\..\externals\llvm -DBOOST_ROOT=..\..\externals\boost\ -DCMAKE_INSTALL_PREFIX=..\..\redist\ ..\..\mozart2
C:> cd C:\projects\builds\gtest
C:> cmake -G"MinGW Makefiles" ..\..\externals\gtest
C:> mingw32-make

If the script does not detect correctly where MinGW is installed, you can tell
it using the option `-DMINGW_ROOT=<mingw>`. Similarly, if the version of GCC in
your MinGW is not 4.9.1, you can tell it with
`-DMINGW_COMPILER_VERSION=4.8.2`, e.g.

1. To copy all the binaries in the `redist` folder, type :

C:> mingw32-make install

## Running Mozart 2

For Mozart to run properly, you need to ensure :

* Tcl/Tk is in your PATH or its `lib` and `bin` subfolders are merged with Mozart ones
* An environment variable `OZEMACS` is set to `<emacs>\bin\runemacs.exe`

## Making Mozart 2 packages

If you want to build setup files for Mozart, just type in your terminal :

C:> mingw32-make installer

The new setup file will be located in your build directory. Two more CMake options are then available :

* `-DISS_INCLUDE_EMACS=ON` will include your Emacs files in the package.
* `-DISS_INCLUDE_TCL=ON` will include your Tcl/Tk files in the package.

Please note that ActiveTcl is not redistributable without an OEM license.
Loading

0 comments on commit d08392c

Please sign in to comment.