From d08392c0a0a3d5fefea12d8e70f6f2c8d157b143 Mon Sep 17 00:00:00 2001 From: azarzadavila <37216245+azarzadavila@users.noreply.github.com> Date: Thu, 23 Aug 2018 11:08:25 +0200 Subject: [PATCH] Update READMES --- README.CI.md | 23 ++++++ README.Windows.md | 193 +++++++++++++++++++++++++--------------------- README.md | 117 ++++++++++++++++++---------- 3 files changed, 202 insertions(+), 131 deletions(-) create mode 100644 README.CI.md diff --git a/README.CI.md b/README.CI.md new file mode 100644 index 000000000..3552ff876 --- /dev/null +++ b/README.CI.md @@ -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. diff --git a/README.Windows.md b/README.Windows.md index 2d951da6e..9b00055cb 100644 --- a/README.Windows.md +++ b/README.Windows.md @@ -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 ``. -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 ``. +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 `` and ``, respectively. + + + 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 + // 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 `` : +### Tcl - - + 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 `\externals\boost`. -1. In your MinGW terminal, type (`` depends on building 32-bit or 64-bit target) : - - C:> cd \externals\boost\tools\build\src\engine - C:> build.bat mingw - C:> cp bin.nt\*.* ..\..\..\..\ - C:> cd ..\..\..\..\ - C:> bjam --toolset=gcc - -1. From `\externals\boost`, copy `boost` subdirectory in your `\-w64-mingw32\include` directory and merge `stage\lib` subdirectory with your `\-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 `\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 \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 `\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 `\externals\llvm` and the content of Clang source archive in `\externals\llvm\tools\clang`. -1. If you are targeting 64-bit builds, patch the files `\externals\llvm\lib\ExecutionEngine\JIT\JIT.cpp` and `\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__) && \ @@ -90,45 +134,16 @@ Throughout the following instructions, we will assume this layout. 1. In your MinGW terminal, type : - C:> cd \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%;\builds\llvm\bin;\bin;\bin - C:> cd - C:> git clone --recursive https://github.com/mozart/mozart2.git - C:> cd \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=`. 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 `\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. diff --git a/README.md b/README.md index d28ca1137..def1dd697 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,15 @@ system. This main Readme is shamefully biased towards Linux. Side-along Readmes are available for [Mac OS](README.MacOS.md), [Windows](README.Windows.md), and [OpenBSD](README.OpenBSD.md). +We found rather difficult to build and configure correctly CLANG/LLVM for all +supported system. Those tools are required to build pre-generated sources. In +reponse to this, we decided to include in this repository those sources. This +section describes a build with the pre-generated sources included. We do +however check the pre-generated sources at every commit, rebuilding them in a +Travis CI job. The files [.travis.yml(for Linux)](.travis.yml) and [appveyor(for +Windows)](appveyor.yml) can be very helpfull guides to build Mozart2 on your system. You can +find information about our [CI jobs](README.CI.md). + ## Prerequisites In order to build Mozart 2, you need the following tools on your computer: @@ -32,48 +41,64 @@ In order to build Mozart 2, you need the following tools on your computer: * git and Subversion to grab the source code * java >= 1.6.0 * gcc >= 4.7.1 on Windows, Linux and Mac OS < 10.8; - or clang >= 3.1 on Mac OS >= 10.8 * cmake >= 2.8.6 -* Boost >= 1.53.0 (with development files) +* Boost >= 1.53.0 (with development files). We recommend the use of Boost +1.65 as there is some issues with recent version of Boost with cmake. * Tcl/Tk 8.5 or 8.6 (with development files) * emacs -For building CLANG/LLVM: -* LibXML2-dev (tested with version 2.9.3) -* OCaml-findlib -* libCTypes-OCaml-dev (>= 0.4 - available in Debian Unstable as of Jan. 2016) +### Boost + +As mentioned, recent versions of Boost are not currently correctly supported by +cmake. However, if you wish to build Mozart2 with a recent version of Boost(> +1.65), you should include the option `-DCMAKE_CXX_COMPILER_ARCHITECTURE_ID=your +architecture id`(x64 for a 64 bits system) in your cmake command. You may also run the cmake command to +generate Makefile twice, as the second time the cache is used to find Boost. +Should cmake fail to find your Boost you can specify the localation with the +option `-DBOOST_ROOT`. + +## Clone the Mozart Repository + +As the Mozart repository contains submodules, you should clone recursively: + + $ git clone --recursive https://github.com/mozart/mozart2 -On Linux, use your favorite package manager to grab these tools. Refer to the -specialized Readmes for recommendations on Mac OS and Windows. + You can also fetch the submodules separately using: -## Pre-generated source tree + $ git clone https://github.com/mozart/mozart2 + $ cd mozart2 + $ git submodule update --init -The release source snapshots contain pre-generated C++ code that allows you -to build without requiring LLVM or Clang. This is the easiest way to build -a version of Mozart 2 from source. The latest pre-generated source snapshot -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). +## Build Mozart -To build from the snapshot: +Mozart 2 is built with cmake. The following steps will perform the build: - $ wget https://github.com/layus/mozart2/releases/download/v2.0.0-beta.0/mozart2-2.0.0-beta.0-Source.zip - $ unzip mozart2-2.0.0-beta.0-Source.zip - $ cd mozart2-2.0.0-beta.0-Source/ - $ cmake . + $ mkdir build + $ cd build + $ cmake -DCMAKE_BUILD_TYPE=Release .. $ make + +You may wish to add `-j n` to the `make` command line with `n` set to the +number of CPUs to perform some of the build steps in parallel to reduce +the build time. + +Once built, you may run the following to install Mozart + $ make install To change the directory where Mozart 2 is installed add `-DCMAKE_INSTALL_PREFIX:PATH=/path/to/install` to the `cmake` command: $ cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/oz2 . && make && make install -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. +On distros like Arch Linux and Nixos, Boost static libraries have been removed. +Please add `-DMOZART_BOOST_USE_STATIC_LIBS=OFF` to your cmake command. -# Git Build instructions +# Building the pre-generated sources -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: +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. - $ mkdir oz2 - $ cd oz2 +The steps below assume you are in the directory above the mozart2 repository +cloned by git (refer to previous section to see how to clone the repository). ## Building LLVM and Clang @@ -98,41 +123,39 @@ number of CPUs to perform some of the build steps in parallel to reduce the build time. 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. - -## Clone the Mozart repository - -As the Mozart repository contains submodules, you should clone recursively: - - $ git clone --recursive https://github.com/mozart/mozart2 - - You can also fetch the submodules separately using: - - $ git clone https://github.com/mozart/mozart2 - $ cd mozart2 - $ git submodule update --init - $ cd .. -## Build Mozart +## Building the pre-generated targets -Mozart 2 is built with cmake. The following steps will perform the build: +You may want to move the previous pre-generated files located in +mozart2/vm/vm/main/cached and in mozart2/vm/boostenv/main/cached +to be sure they are not used in the new build. +The following steps will perform the build of the pre-generated sources: $ mkdir build $ cd build $ CXXFLAGS=-I`pwd`/../llvm-install/include cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX:PATH=/path/to/install \ + -DMOZART_CACHED_BUILD=OFF \ ../mozart2 + $ make -B gensources genboostsources VERBOSE=1 + +The generated sources are located in build/vm/boostenv/main/generated and in +build/vm/vm/main/generated. You can check if they correspond with the previous +ones and change them accordingly. You could then proceed with the build +containing the pre-generated sources. + +Alternatively, you can complete the build by running the following : + $ make $ make install -You may wish to add `-j n` to the `make` command line with `n` set to the -number of CPUs to perform some of the build steps in parallel to reduce -the build time. - Change `/path/to/install` to the location where Mozart 2 should be installed. On distros like Arch Linux and Nixos, Boost static libraries have been removed. Please add `-DMOZART_BOOST_USE_STATIC_LIBS=OFF` to your cmake command. +# CMake Options + Other cmake options can be given with the form `-DOPTION=Value`. The table below lists the options you can add. @@ -186,6 +209,16 @@ lists the options you can add. Comma-separated list of generators for CPack Optional, see CPack documentation + + BOOST_ROOT + Path to the boost root + May be used if cmake fails to find boost + + + CMAKE_CXX_COMPILER_ARCHITECTURE_ID + Indicates in which architecture the system is compiled + Required with recent version of Boost (due to some incompability with cmake) +