| 1 | Note: To build v6-alpha, see the INSTALL.v6-alpha file instead. |
|---|
| 2 | |
|---|
| 3 | INSTALLING PUGS VIA CABAL |
|---|
| 4 | ------------------------- |
|---|
| 5 | |
|---|
| 6 | The current recommended way to build Pugs is via cabal-install. |
|---|
| 7 | |
|---|
| 8 | Follow these steps: |
|---|
| 9 | |
|---|
| 10 | 1. Make sure you have Cabal, HTTP, zlib and cabal-install installed |
|---|
| 11 | (in this order): |
|---|
| 12 | |
|---|
| 13 | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Cabal |
|---|
| 14 | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HTTP |
|---|
| 15 | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib |
|---|
| 16 | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cabal-install |
|---|
| 17 | |
|---|
| 18 | If you're unsure how to install this, the instructions contained in the README |
|---|
| 19 | file of Cabal will help you get started. Those instructions work for all the |
|---|
| 20 | above packages. |
|---|
| 21 | |
|---|
| 22 | 2. Type the following commands: |
|---|
| 23 | |
|---|
| 24 | cabal update |
|---|
| 25 | cabal install Pugs |
|---|
| 26 | |
|---|
| 27 | ...and you're done. To build an optimized Pugs for benchmarking or smoke |
|---|
| 28 | testing, replace the second command with: |
|---|
| 29 | |
|---|
| 30 | cabal install -O2 Pugs |
|---|
| 31 | |
|---|
| 32 | 3. To upgrade the current Pugs installation to the latest released version, |
|---|
| 33 | simply type the same two lines of commands above: |
|---|
| 34 | |
|---|
| 35 | cabal update |
|---|
| 36 | cabal install Pugs |
|---|
| 37 | |
|---|
| 38 | INSTALLING PUGS ON CYGWIN |
|---|
| 39 | ------------------------- |
|---|
| 40 | For installing pugs on cygwin via cabal, please follow these instructions: |
|---|
| 41 | http://use.perl.org/~rurban/journal/36897 |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | ---8<------8<------8<------8<------8<------8<------8<------8<------8<------8<--- |
|---|
| 46 | Cut here - Instructions below are outdated! |
|---|
| 47 | ---8<------8<------8<------8<------8<------8<------8<------8<------8<------8<--- |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | BUILDING PUGS |
|---|
| 51 | ------------- |
|---|
| 52 | |
|---|
| 53 | Pugs needs the Glasgow Haskell Compiler (GHC), version 6.8.2 or above. |
|---|
| 54 | |
|---|
| 55 | To install GHC, download a binary build from http://haskell.org/ghc/. |
|---|
| 56 | Although source code for GHC is available, it will take a very long time to |
|---|
| 57 | build by yourself. (Several hours) |
|---|
| 58 | |
|---|
| 59 | Additionally, Pugs uses the Cabal framework (http://haskell.org/cabal/), |
|---|
| 60 | which is usually bundled with GHC itself. (The 6.6.1 source code contains it.) |
|---|
| 61 | |
|---|
| 62 | http://jnthn.net/perl6/ has binary builds for Win32. For Mac OS X (PowerPC), |
|---|
| 63 | http://www.unobe.com/packages/ has binary builds too. If you'd like to build |
|---|
| 64 | Pugs by hand, http://wiki.kn.vutbr.cz/mj/?Perl%206%20and%20Parrot has some |
|---|
| 65 | instructions. |
|---|
| 66 | |
|---|
| 67 | Debian Etch's (stable as of 2007) version of GHC is too old to compile pugs, |
|---|
| 68 | see the section below on compiling the version from testing. GHC 6.6.1 debs |
|---|
| 69 | for etch are available (not apt-gettable): |
|---|
| 70 | i386 http://feather.perl6.nl/~diakopter/ |
|---|
| 71 | amd64 http://airen.bcm.umontreal.ca/ghc-pugs-etch/ |
|---|
| 72 | |
|---|
| 73 | Do not use ActivePerl on OS X to run Makefile.PL. ActivePerl is built as a |
|---|
| 74 | Universal binary, and the pugs build system will try to use build |
|---|
| 75 | information from ActivePerl and cause the build to fail. The Perl from |
|---|
| 76 | MacPorts (http://www.macports.org/) seems to work well. |
|---|
| 77 | |
|---|
| 78 | For dynamic loading/inlining of Haskell modules, you should install the |
|---|
| 79 | hs-plugin library, available here: |
|---|
| 80 | |
|---|
| 81 | http://www.cse.unsw.edu.au/~dons/code/hs-plugins |
|---|
| 82 | |
|---|
| 83 | During the build process, the script will try to install HsJudy (a Haskell binding to the Judy array library written in C). If you don't have Judy installed, this step might fail, so you should install Judy. Most distros include that library. |
|---|
| 84 | |
|---|
| 85 | To install Pugs on your system, simply type this in the command line: |
|---|
| 86 | |
|---|
| 87 | cpansign -v # optional; see SIGNATURE for details |
|---|
| 88 | perl Makefile.PL |
|---|
| 89 | make # or 'nmake' on Win32 |
|---|
| 90 | make test |
|---|
| 91 | make install |
|---|
| 92 | |
|---|
| 93 | Both make and make test can take a long time (perhaps hours). |
|---|
| 94 | |
|---|
| 95 | To change the installation location, pass PREFIX=/opt/wherever to |
|---|
| 96 | Makefile.PL like so: |
|---|
| 97 | |
|---|
| 98 | perl Makefile.PL PREFIX=/your/prefix/here |
|---|
| 99 | |
|---|
| 100 | XXX NOTE!!!!!!!! |
|---|
| 101 | PREFIX doesn't actually work right now. So ignore what I just said. But if |
|---|
| 102 | it did work, that's how you would do it. |
|---|
| 103 | |
|---|
| 104 | Do not set PREFIX to your Perl 5 installation dir, as that would overwrite |
|---|
| 105 | some of the files there with their Pugs counterparts. |
|---|
| 106 | |
|---|
| 107 | ENVIRONMENT VARIABLES |
|---|
| 108 | --------------------- |
|---|
| 109 | |
|---|
| 110 | There are several environment variables that control pugs's build process. |
|---|
| 111 | |
|---|
| 112 | You may use the GHC environment variable to set the ghc executable before |
|---|
| 113 | you run "perl Makefile.PL", for example: |
|---|
| 114 | |
|---|
| 115 | export GHC=${HOME}/bin/ghc (bash) |
|---|
| 116 | setenv GHC ${HOME}/bin/ghc (csh) |
|---|
| 117 | |
|---|
| 118 | To control which optional subsystems are embedded in Pugs, set the |
|---|
| 119 | PUGS_EMBED variable. For example: |
|---|
| 120 | |
|---|
| 121 | export PUGS_EMBED="parrot noperl5" (bash) |
|---|
| 122 | setenv PUGS_EMBED "parrot noperl5" (csh) |
|---|
| 123 | |
|---|
| 124 | Perl5 is now embedded by default. Use "noperl5" to disable. |
|---|
| 125 | |
|---|
| 126 | To build with an embedded parrot interpreter, make sure the PUGS_EMBED |
|---|
| 127 | variable contains "parrot", and set the PARROT_PATH variable to point to |
|---|
| 128 | the directory in which you checked out the parrot source tree. For example: |
|---|
| 129 | |
|---|
| 130 | export PARROT_PATH=${HOME}/src/parrot (bash) |
|---|
| 131 | setenv PARROT_PATH ${HOME}/src/parrot (csh) |
|---|
| 132 | |
|---|
| 133 | The HARNESS_PUGS environment may come to handy once you want to limit |
|---|
| 134 | CPU and RAM usage of your smoking (*NIX only): |
|---|
| 135 | |
|---|
| 136 | HARNESS_PUGS=util/limited_pugs make smoke |
|---|
| 137 | |
|---|
| 138 | Modify util/limited_pugs in your local copy if it doesn't fit your needs. |
|---|
| 139 | |
|---|
| 140 | MAKE TARGETS |
|---|
| 141 | ------------ |
|---|
| 142 | |
|---|
| 143 | The default make target builds an optimized Pugs. This means that Pugs will |
|---|
| 144 | be slower to compile, but will run much faster. To disable this, run: |
|---|
| 145 | |
|---|
| 146 | make soon |
|---|
| 147 | |
|---|
| 148 | To run the test suite with a pretty HTML matrix showing test results: |
|---|
| 149 | |
|---|
| 150 | make smoke |
|---|
| 151 | |
|---|
| 152 | (See also the HARNESS_PUGS environment in the previous section.) |
|---|
| 153 | |
|---|
| 154 | To turn on profiling in the GHC compiler: |
|---|
| 155 | |
|---|
| 156 | make prof |
|---|
| 157 | |
|---|
| 158 | To hack on Pugs using the GHC interactive shell: |
|---|
| 159 | |
|---|
| 160 | make ghci |
|---|
| 161 | |
|---|
| 162 | BUILD CONFIGURATION CONSOLIDATION VIA config.yml |
|---|
| 163 | ------------------------------------------------ |
|---|
| 164 | |
|---|
| 165 | To keep the multitude of configuration options and mechanisms under |
|---|
| 166 | control for the build, we're moving over some of the above to a |
|---|
| 167 | centralized file, "config.yml" under the build root. This file is in |
|---|
| 168 | YAML format[1]; if it does not exist, one with defaults will be created |
|---|
| 169 | for you. |
|---|
| 170 | |
|---|
| 171 | The options you can control there include: |
|---|
| 172 | |
|---|
| 173 | - optimization level: whether `make` means `make optimized` or |
|---|
| 174 | `make unoptimized` by default. |
|---|
| 175 | |
|---|
| 176 | - precompilation options: by default, pugs is built with the Standard Prelude |
|---|
| 177 | compiled into it. This makes many Perl 6 builtins available to pugs, and |
|---|
| 178 | loads fast. You can specify additional modules to inline a precompiled |
|---|
| 179 | version of into the executable: Test.pm is a good choice if running the |
|---|
| 180 | test suite. The cost of this is a longer build process which requires much |
|---|
| 181 | more RAM. |
|---|
| 182 | |
|---|
| 183 | - GHC heap size: if precompiling modules other than Prelude.pm into pugs, you |
|---|
| 184 | will probably need to increase the amount of RAM GHC permits itself to use, |
|---|
| 185 | otherwise it will abort the build. And if your machine is low on RAM, and |
|---|
| 186 | itself runs out of memory while building pugs, you can set this to a low |
|---|
| 187 | value (but turn off optimization and precompilation too). |
|---|
| 188 | |
|---|
| 189 | - install_dir: if set, `make install` will put everything under this |
|---|
| 190 | directory. Do not set this to your Perl 5 installation, since that |
|---|
| 191 | will overwrite some of the files there with the Pugs counterparts |
|---|
| 192 | (as will make install PREFIX= as noted above.) |
|---|
| 193 | |
|---|
| 194 | You can override values set in this file temporarily via the single |
|---|
| 195 | PUGS_BUILD_OPTS environment variable. For example, if you normally do |
|---|
| 196 | precompile Prelude.pm but want a faster build just this once: |
|---|
| 197 | |
|---|
| 198 | env PUGS_BUILD_OPTS=precompile_prelude=false make |
|---|
| 199 | |
|---|
| 200 | See `util/config-template.yml` for more information. |
|---|
| 201 | |
|---|
| 202 | [1] See <http://yaml.org/>. Only a subset of the YAML syntax is permitted |
|---|
| 203 | at the moment, to avoid a dependency on the full parser. |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | COMPILING GHC ON DEBIAN ETCH |
|---|
| 207 | ---------------------------- |
|---|
| 208 | |
|---|
| 209 | Note (Aug 2008): Pugs requires ghc 6.8 now. Lenny has this, but you can't |
|---|
| 210 | reasonably build it on Etch - it build-deps Lenny's gcc, which build-deps |
|---|
| 211 | Lenny's dpkg... Just install the binary package from http://www.haskell.org/ghc/ |
|---|
| 212 | |
|---|
| 213 | This is a somewhat tricky procedure at present, because installing a new ghc may |
|---|
| 214 | make old libghc6-* packages uninstallable. The following procedure should work |
|---|
| 215 | around that, but be warned it hasn't been tested in exactly this way. Complain |
|---|
| 216 | on #perl6 if you have trouble. Thanks to moritz++, Aankhen``++, and diakopter++ |
|---|
| 217 | for helping to figure this out. -rhr |
|---|
| 218 | |
|---|
| 219 | 1. Compile the new version of GHC from testing: |
|---|
| 220 | echo 'deb-src ftp://ftp.debian.org/debian/ lenny main contrib non-free' >> /etc/apt/sources.list |
|---|
| 221 | apt-get update |
|---|
| 222 | apt-get build-dep ghc6 |
|---|
| 223 | apt-get source --compile ghc6 |
|---|
| 224 | Don't install the debs yet! |
|---|
| 225 | 2. Remove old GHC packages |
|---|
| 226 | dpkg --get-selections|grep ghc |
|---|
| 227 | Check to see what you'll need to reinstall later |
|---|
| 228 | apt-get remove haddock |
|---|
| 229 | dpkg --get-selections|grep ghc|awk '$2 == "install" {print $1}'|xargs apt-get remove |
|---|
| 230 | dpkg --get-selections|grep libghc |
|---|
| 231 | Make sure no libghc6-* packages are installed |
|---|
| 232 | 3. Install new GHC |
|---|
| 233 | dpkg -i ghc6_6.6.1-*.deb |
|---|
| 234 | This may give a warning about not deleting /usr/lib/ghc-6.6, that seems to be harmless |
|---|
| 235 | 4. Satisfy build-deps for GHC libs |
|---|
| 236 | apt-get build-dep haddock |
|---|
| 237 | apt-get source --compile haddock |
|---|
| 238 | dpkg -i haddock*.deb |
|---|
| 239 | apt-get build-dep haskell-utils |
|---|
| 240 | apt-get source --compile haskell-utils |
|---|
| 241 | dpkg -i haskell-utils*.deb |
|---|
| 242 | dpkg -i ghc6-doc_6.6.1-*.deb |
|---|
| 243 | dpkg -i ghc6-prof_6.6.1-*.deb |
|---|
| 244 | apt-get build-dep libghc6-mtl-dev libghc6-network-dev libghc6-time-dev |
|---|
| 245 | 5. Build and install GHC libs |
|---|
| 246 | apt-get source --compile libghc6-mtl-dev |
|---|
| 247 | dpkg -i libghc6-mtl-dev*.deb |
|---|
| 248 | apt-get source --compile libghc6-network-dev |
|---|
| 249 | dpkg -i libghc6-network-dev*.deb |
|---|
| 250 | apt-get source --compile libghc6-time-dev |
|---|
| 251 | dpkg -i libghc6-time-dev*.deb |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | NOTES FOR GHC 6.6.1 AND REVISION > 19955 |
|---|
| 255 | ---------------------------------------- |
|---|
| 256 | |
|---|
| 257 | This is only a way to get a running pugs with ghc 6.6.1 during the |
|---|
| 258 | migration phase to ghc 6.8.x. It does *NOT* solve any issues. It is tested |
|---|
| 259 | with the following environment (I believe only the ghc part is essential for |
|---|
| 260 | this workaround): |
|---|
| 261 | |
|---|
| 262 | - GNU/Linux 2.6.22-14 |
|---|
| 263 | - libc6 2.6.1-1ubuntu10 |
|---|
| 264 | - gcc-Version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2) |
|---|
| 265 | - perl 5.8.8 |
|---|
| 266 | - Cabal-1.1.6.2, base-2.1.1, filepath-1.0, (ghc-6.6.1), |
|---|
| 267 | haskell98-1.0, mtl-1.0.1, network-2.0.1, parsec-2.0, readline-1.0, |
|---|
| 268 | regex-base-0.72, regex-compat-0.71, regex-posix-0.71, rts-1.0, |
|---|
| 269 | stm-2.0, template-haskell-2.1, time-1.1.1, unix-2.1 |
|---|
| 270 | |
|---|
| 271 | The last revision that builds directly from repository on this environment |
|---|
| 272 | was r19955. |
|---|
| 273 | |
|---|
| 274 | 1. Update to current version |
|---|
| 275 | svn update . |
|---|
| 276 | |
|---|
| 277 | 2. Revert some files to former version |
|---|
| 278 | svn update -r19955 src/Pugs/Meta/Str.hs src/Pugs/Types.hs src/UTF8.hs \ |
|---|
| 279 | Pugs.cabal.in util/build_pugs.pl third_party/ \ |
|---|
| 280 | src/Pugs/Compile/Pugs.hs src/Pugs/Eval.hs |
|---|
| 281 | |
|---|
| 282 | 3. Build it ... |
|---|
| 283 | perl Makefile.PL && make |
|---|
| 284 | |
|---|
| 285 | 4. ..possibly twice, if it failed |
|---|
| 286 | make |
|---|
| 287 | |
|---|
| 288 | 5. Skip building Test.pm.yml |
|---|
| 289 | cp ext/Test/lib/Test.pm blib6/lib/ |
|---|
| 290 | |
|---|
| 291 | Last two steps seems sometimes to be necessary to avoid messages like this |
|---|
| 292 | ./pugs -CParse-YAML ext/Test/lib/Test.pm > blib6/lib/Test.pm.yml |
|---|
| 293 | pugs: user error (Not implemented: asYAML "Sub") |
|---|