Difference between revisions of "Yhc/Building"

From HaskellWiki
< Yhc
Jump to navigation Jump to search
(I found this other link more useful.)
 
(23 intermediate revisions by 8 users not shown)
Line 5: Line 5:
 
You need a C compiler - both gcc and MS Visual C are known to be OK.
 
You need a C compiler - both gcc and MS Visual C are known to be OK.
   
  +
You need [http://www.scons.org/ scons], which in turn requires [http://www.python.org/ Python] to be installed. We require Python 2.3 or later to be installed.
If you want to build the yhc compiler itself (not strictly necessary), you will need a very recent Haskell compiler, e.g. ghc >= 6.4. The supplied configure script will not detect if your compiler version is too old, and will not accept alternative names like ghc-6.4 instead of ghc.
 
   
  +
The process of building Yhc requires [http://haskell.org/ghc/ ghc-6.4] or later and [http://darcs.net/ darcs].
== Getting the Code ==
 
   
 
== Getting the code ==
The first step is to get the source code. There are two branches, stable and development. Stable should always build and give you a working compiler, but development is the one we are putting new things into. We can't generally guarantee that the development branch will always even compile so stable is likely most useful to people. It is hoped that the stable branch will be no more than a week or so behind development.
 
   
The source code is stored in a [http://www.darcs.net/ darcs] repo, to get the stable version do:
+
The source code is stored in a [http://www.darcs.net/ darcs] repo, to get the code do:
   
darcs get http://www.cs.york.ac.uk/fp/darcs/yhc/
+
darcs get --partial http://darcs.haskell.org/york-compiler98/
   
 
{- maybe darcs get --partial http://www.cs.york.ac.uk/fp/darcs/yhc/ is more recent? -}
To get the development version do:
 
   
  +
There is a buildbot script that runs on every change, the results of which are available [http://www.indiegigs.co.uk:8010/ here]. If the build is busted, hopefully the developers will fix it soon. If your build is busted, but the buildbot succeeds, [[Yhc/Buildbot| consider adding your machine as a buildbot slave]] - then it will never get broken again.
darcs get http://www.cs.york.ac.uk/fp/darcs/yhc-devel/
 
   
 
== Building ==
You can browse the code and its history on-line through a [http://www.cs.york.ac.uk/fp/darcs/ darcsweb] interface.
 
   
  +
To build yhc simply type 'scons' into a console Window. This should automatically detect your build environment and place the Yhc binaries into inst/
== Building on Windows ==
 
   
  +
To build parts of Yhc separately the following commands can be used:
Open a console at the root of the yhc tree. There is a file called Makefile.bat, which is used to build the various components. Just typing Makefile should give you a list of the options.
 
  +
* scons configure - Just configure.
  +
* scons build - Don't update dependencies, just build.
  +
* scons build yhi - Only build the interpretor.
 
* scons build yhc - Only build the compiler.
 
* scons build library - Only build the libraries.
   
The modes are:
+
Other commands available are:
  +
* scons clean - Remove temporary files.
  +
* scons fullclean - Completely wipe everything created by the build process.
  +
* scons depends - Download or update the dependencies
  +
* scons help - Show a help message
   
  +
To test Yhc has been build correctly type 'scons test'.
* yhc - build the compiler, requires GHC
 
* yhi - build the runtime, requires Visual Studio 2003 (ask for support for other compilers)
 
* yhe - build the evaluator, requires GHC
 
* gyhe - build the graphic evaluator, requires GHC and Gtk2Hs
 
* doc - build the documentation, requires haddock and GHC
 
* lib - build the base libraries
 
* test - run the standard tests, option 98 is useful to just run the conformance tests
 
   
  +
Please report any problems you have to the mailing list.
The standard options are:
 
   
  +
<small>
* debug - build in debug mode [default]
 
  +
Please also note that these steps do not currently build the Javascript backend; please refer to [[Yhc/Javascript/Users_guide|Yhc/Javascript/Users guide]] for information how to build '''ycr2js'''.
* release - build in release mode
 
  +
</small>
   
  +
== Scons options ==
All compiled binaries will go into \inst\bin. To compile and run the test suite do:
 
   
  +
Options can be given to scons by either passing the flags on the command line 'core=1' or by creating a file called options.txt in the root Yhc directory. The available flags are:
$ Makefile yhc
 
$ Makefile yhi
 
$ Makefile yht
 
$ Makefile test 98
 
   
  +
* core=1 (default=1) - generate Yhc Core files for each file in the libraries
== Building on Linux/Unix ==
 
  +
* arch=X86 (default=calculated) - override the arch, useful for building 32 bit version on a 64 bit kernel.
  +
* type=release/debug/normal (default=normal) - enables debug information or optimisation
  +
* threads=0 (default=1, except on ppc where the default is 0) - disables threading
   
  +
== If something goes wrong ==
The standard unix thing will should get you most of the way.
 
   
  +
If the build fails for any reason, try the following steps:
chmod +x configure # because darcs does't record the executable bit
 
./configure
 
make
 
   
  +
; scons fullclean
There currently isn't a 'make install', but it is fairly trivial: simply copy the contents of the 'inst' directory into where
 
  +
; scons depends
everything should be installed. If it complains about the YHC_BASE_PATH environment variables, set this in by editing /etc/bash.bashrc and add the line
 
   
  +
Then try building again.
export YHC_BASE_PATH=/usr/lib/yhc/
 
   
  +
== Build options ==
(if your system uses bash as the default shell), where /usr/lib/yhc is wherever you put your /inst folder.
 
   
  +
"scons help" shows some options for the build process.
If your Haskell compiler has a name other than ghc, edit the file Makefile.inc in the root, and change <tt>HC=ghc</tt> to <tt>HC=your_compiler</tt>.
 
   
  +
To build with additional library/header paths, e.g. for GMP:
== Building on Mac OS X ==
 
  +
 
  +
CCFLAGS="-I/.../include" LIBPATH=/.../lib scons
You will need to have libraries like GMP (Gnu multi-precision arithmetic) installed. Most people do this with Fink or DarwinPorts, or some such. You need the header files in addition to the library archive, and these are often distributed in a 'devel' version of the package.
 
 
If your packaging system uses a separate directory hierarchy (Fink uses /sw) then you may need to set up some environment variables so that the C compiler can find the includes and libraries:
 
 
LD_LIBRARY_PATH=/sw/lib # for dylibs
 
LIBRARY_PATH=/sw/lib # for static linking
 
CPATH=/sw/include # for header files
 
 
Then just follow the usual unix-like procedure, as above.
 

Latest revision as of 16:33, 22 October 2010

Part of Yhc

(Download)

Requirements

You need a C compiler - both gcc and MS Visual C are known to be OK.

You need scons, which in turn requires Python to be installed. We require Python 2.3 or later to be installed.

The process of building Yhc requires ghc-6.4 or later and darcs.

Getting the code

The source code is stored in a darcs repo, to get the code do:

darcs get --partial http://darcs.haskell.org/york-compiler98/
{- maybe darcs get --partial http://www.cs.york.ac.uk/fp/darcs/yhc/ is more recent? -}

There is a buildbot script that runs on every change, the results of which are available here. If the build is busted, hopefully the developers will fix it soon. If your build is busted, but the buildbot succeeds, consider adding your machine as a buildbot slave - then it will never get broken again.

Building

To build yhc simply type 'scons' into a console Window. This should automatically detect your build environment and place the Yhc binaries into inst/

To build parts of Yhc separately the following commands can be used:

  • scons configure - Just configure.
  • scons build - Don't update dependencies, just build.
  • scons build yhi - Only build the interpretor.
  • scons build yhc - Only build the compiler.
  • scons build library - Only build the libraries.

Other commands available are:

  • scons clean - Remove temporary files.
  • scons fullclean - Completely wipe everything created by the build process.
  • scons depends - Download or update the dependencies
  • scons help - Show a help message

To test Yhc has been build correctly type 'scons test'.

Please report any problems you have to the mailing list.

Please also note that these steps do not currently build the Javascript backend; please refer to Yhc/Javascript/Users guide for information how to build ycr2js.

Scons options

Options can be given to scons by either passing the flags on the command line 'core=1' or by creating a file called options.txt in the root Yhc directory. The available flags are:

  • core=1 (default=1) - generate Yhc Core files for each file in the libraries
  • arch=X86 (default=calculated) - override the arch, useful for building 32 bit version on a 64 bit kernel.
  • type=release/debug/normal (default=normal) - enables debug information or optimisation
  • threads=0 (default=1, except on ppc where the default is 0) - disables threading

If something goes wrong

If the build fails for any reason, try the following steps:

; scons fullclean
; scons depends

Then try building again.

Build options

"scons help" shows some options for the build process.

To build with additional library/header paths, e.g. for GMP:

CCFLAGS="-I/.../include" LIBPATH=/.../lib scons