]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/contributor/basic-compile.itexi
9a47a9e3584344ad82857f4fb71a0a9589c448f0
[lilypond.git] / Documentation / contributor / basic-compile.itexi
1 @c -*- coding: utf-8; mode: texinfo; -*-
2
3
4 @c DO NOT TRANSLATE THIS FILE
5
6 @c include any node/sections from the higher-level *texi file.
7 @c   @n ode Compiling from source
8 @c   @s ection Compiling from source
9
10 @menu
11 * Downloading source code::
12 * Requirements::
13 * Building LilyPond::
14 * Building documentation::
15 * Testing LilyPond::
16 * Problems::
17 @end menu
18
19 @node Downloading source code
20 @subsection Downloading source code
21
22 Download source
23
24 @itemize
25 @item tarballs from
26 @uref{http://lilypond.org/download/} by HTTP.
27 @item tarballs from
28 @uref{http://download.linuxaudio.org/lilypond/} by HTTP.
29 @item
30 GIT from @uref{http://git.sv.gnu.org/gitweb/?p=lilypond.git;a=summary,git.sv.gnu.org}
31
32 @example
33 git clone git://git.sv.gnu.org/lilypond.git
34 @end example
35
36 The repository does not contain generated files.  To create
37 @file{configure}, run
38 @example
39 ./autogen.sh
40 @end example
41 @end itemize
42
43 For information on packaging, see @uref{http://lilypond.org/devel}.
44
45
46 @node Requirements
47 @subsection Requirements
48
49 @unnumberedsubsubsec Compilation
50
51 In addition to the packages needed for running LilyPond (see below), you
52 need the following extra packages for building.
53
54 Below is a full list of packages needed to build LilyPond.  However, for
55 most common distributions there is an easy way of installing most all
56 build dependencies in one go
57
58 @multitable @columnfractions .5 .5
59 @headitem Distribution
60 @tab Command
61
62 @item Debian, Ubuntu
63 @tab @code{sudo apt-get build-dep lilypond}
64
65 @item Fedora, RHEL
66 @tab @code{sudo yum-builddep lilypond}
67
68 @item openSUSE, SLED
69 @c sorry for the idiosyncratic command, I really asked and argued
70 @c for "zypper build-dep" :-(
71 @tab @code{sudo zypper --build-deps-only source-install lilypond}
72
73 @end multitable
74
75 When installing a binary package FOO, you may need to install the
76 FOO-devel, libFOO-dev or FOO-dev package too.
77
78 @itemize
79
80 @item @uref{http://fontforge.sf.net/,FontForge} 20060125 or newer.
81
82 @item @uref{http://metafont.tutorial.free.fr/,MetaFont} (mf-nowin, mf, mfw or
83 mfont binaries) and @uref{http://cm.bell-labs.com/who/hobby/MetaPost.html,MetaPost}
84 (mpost binary), usually packaged with a @LaTeX{} distribution like
85 tetex or texlive.
86
87 @item @uref{http://www.lcdf.org/~eddietwo/type/#t1utils,t1utils}
88 (version 1.33 or newer recommended).
89
90 @item New Century Schoolbook fonts, as PFB files.  These are shipped with
91 X11 and Ghostscript, and are named @file{c059033l.pfb}
92 @file{c059036l.pfb}, @file{c059013l.pfb} and @file{c059016l.pfb}.
93
94 @item @uref{http://www.gnu.org/software/guile/guile.html,GUILE} (version
95 1.8.2 or newer).  If you are installing binary packages, you may need to
96 install guile-devel or guile-dev or libguile-dev too.
97
98 @item @uref{ftp://ftp.gnu.org/gnu/texinfo/,Texinfo} (version 4.11 or newer).
99
100 @item @uref{http://gcc.gnu.org/, The GNU c++ compiler} (version 3.4 or
101 newer.  4.x is strongly recommended).
102
103 @item @uref{http://www.python.org,Python} (version 2.4 or newer)
104
105 @item @uref{ftp://ftp.gnu.org/gnu/make/,GNU Make} (version 3.78 or newer).
106
107 @item @uref{http://www.gnu.org/software/gettext/gettext.html,gettext}
108 (version 0.17 or newer).
109
110 @item @uref{http://www.gnu.org/software/flex/,Flex}.
111
112 @item @uref{http://www.perl.org/,Perl}.
113
114 @item @uref{http://www.gnu.org/software/bison/,GNU Bison}.
115
116 @item All packages required for running, including development packages with
117 header files and libraries.
118
119 @end itemize
120
121
122 @unnumberedsubsubsec Running requirements
123
124 Running LilyPond requires proper installation of the following software
125
126 @itemize
127
128 @item @uref{http://www.freetype.org/,Freetype} (version 2.1.10 or newer).
129 @item @uref{http://fontconfig.org/,FontConfig} (version 2.2 or newer).
130 @item @uref{http://www.pango.org/,Pango} (version 1.12 or newer).
131 @item @uref{http://www.gnu.org/software/guile/guile.html,GUILE}
132 (version 1.8.2 or newer)
133 @item @uref{http://www.python.org,Python} (version 2.4 or newer).
134 @item @uref{http://www.ghostscript.com,Ghostscript} (version 8.60 or
135 newer).
136 @item Dejaview.  (This is normally installed by default)
137 @end itemize
138
139 International fonts are required to create music with international text
140 or lyrics.
141
142
143 @unnumberedsubsubsec Requirements for building documentation
144
145 You can view the documentation online at
146 @uref{http://lilypond.org/doc/}, but you can also build it locally.
147 This process requires a successful compile of LilyPond, and some
148 additional tools and packages:
149
150 @itemize
151 @item The @uref{http://netpbm.sourceforge.net/,netpbm utilities}
152 @item ImageMagick
153 @item International fonts (see input/regression/utf-8.ly for hints
154 about which font packages are necessary for your platform)
155 @item Ghostscript 8.60 or newer
156 @item @uref{http://www.nongnu.org/texi2html/,Texi2HTML} 1.82
157 @item rsync
158 @end itemize
159
160
161 @node Building LilyPond
162 @subsection Building LilyPond
163
164 @unnumberedsubsubsec Compiling
165
166 To install GNU LilyPond, type
167
168 @example
169 gunzip -c lilypond-x.y.z | tar xf -
170 cd lilypond-x.y.z
171 ./configure             # run with --help for applicable options
172 make
173 su -c 'make install'
174 @end example
175
176 @noindent
177 If you are not root, you should choose a @code{--prefix} argument that
178 points into your home directory, e.g.
179
180 @example
181 ./configure --prefix=$HOME/usr
182 @end example
183
184 If you encounter any problems, please see @ref{Problems}.
185
186
187 @unnumberedsubsubsec Compiling for multiple platforms
188
189 If you want to build multiple versions of LilyPond with different
190 configuration settings, you can use the @code{--enable-config=CONF}
191 option of @command{configure}.  You should use @code{make conf=CONF}
192 to generate the output in @file{out-CONF}.  For example, suppose you
193 want to build with and without profiling, then use the following for
194 the normal build
195
196 @example
197 ./configure --prefix=$HOME/usr/ --enable-checking
198 make
199 make install
200 @end example
201
202 and for the profiling version, specify a different configuration
203
204 @example
205 ./configure --prefix=$HOME/usr/ --enable-profiling --enable-config=prof --disable-checking
206 make conf=prof
207 make conf=prof install
208 @end example
209
210
211 @unnumberedsubsubsec Compiling outside the source tree
212
213 It is possible to compile LilyPond in a build tree different from the
214 source tree, with @code{--srcdir} option of @command{configure}:
215
216 @example
217 mkdir lily-build && cd lily-build
218 @var{sourcedir}/configure --srcdir=@var{sourcedir}
219
220 @end example
221
222
223 @unnumberedsubsubsec Useful @command{make} variables
224
225 If a less verbose build output if desired, the variable
226 @code{QUIET_BUILD} may be set to @code{1} on @command{make} command
227 line, or in @file{local.make} at top of the build tree.
228
229
230 @node Building documentation
231 @subsection Building documentation
232
233 This requires a successful compile of LilyPond, or using an external
234 LilyPond binary.
235
236 @menu
237 * Commands for building documentation:: Compiling and installing the documentation.
238 * Building documentation without compiling LilyPond:: Using a LilyPond binary already installed.
239 @end menu
240
241 @node Commands for building documentation
242 @unnumberedsubsubsec Commands for building documentation
243
244 The documentation is built by issuing
245
246 @example
247 make doc
248 @end example
249
250 After compilation, the HTML documentation tree is available in
251 @file{out-www/offline-root/}, and can be browsed locally.  Various
252 portions of the documentation can be found by looking in
253 @file{out/} and @file{out-www} subdirectories in other places in
254 the source tree, but these are only @emph{portions} of the docs.
255 Please do not complain about anything which is broken in those
256 places; the only complete set of documentation is in
257 @file{out-www/offline-root/} from the top of the source tree.
258
259 The HTML, PDF and if available Info files can be installed into the
260 standard documentation path by issuing
261
262 @example
263 make install-doc
264 @end example
265
266 @noindent
267 This also installs Info documentation with images if the installation
268 prefix is properly set; otherwise, instructions to complete proper
269 installation of Info documentation are printed on standard output.
270
271 Compilation of documentation in Info format with images can be done
272 separately by issuing
273
274 @example
275 make info
276 @end example
277
278 @noindent
279 Separate installation of this documentation is done by issuing
280
281 @example
282 make install-info
283 @end example
284
285 @noindent
286 Note that to get the images in Info documentation, @code{install-doc}
287 target creates symbolic links to HTML and PDF installed documentation
288 tree in @file{@var{prefix}/share/info}, in order to save disk space,
289 whereas @code{install-info} copies images in
290 @file{@var{prefix}/share/info} subdirectories.
291
292 It is possible to build a documentation tree in
293 @file{out-www/online-root/}, with special processing, so it can be
294 used on a website with content negotiation for automatic language
295 selection; this can be achieved by issuing
296
297 @example
298 make WEB_TARGETS=online doc
299 @end example
300
301 @noindent
302 and both @q{offline} and @q{online} targets can be generated by issuing
303
304 @example
305 make WEB_TARGETS="offline online" doc
306 @end example
307
308 Several targets are available to clean the documentation build and
309 help with maintaining documentation; an overview of these targets is
310 available with
311
312 @example
313 make help
314 @end example
315
316 @noindent
317 from every directory in the build tree.  Most targets for
318 documentation maintenance are available from @file{Documentation/};
319 @c FIXME: xref to CG
320 for more information, see the Contributor's Guide, section
321 @emph{Documentation work}.
322
323 The makefile variable @code{QUIET_BUILD} may be set to @code{1} for a
324 less verbose build output, just like for building the programs.
325
326
327 @knownissues
328
329 The most time consuming task for building the documentation is running
330 LilyPond to build images of music, and there cannot be several
331 simultaneously running @command{lilypond-book} instances, so @code{-j}
332 @command{make} option does not significantly speed up the build process.
333 To help speed it up, the makefile variable @var{CPU_COUNT} may be set
334 in @file{local.make} or on the command line to the number of
335 @code{.ly} files that LilyPond should process simultaneously, e.g. on
336 a bi-processor or dual core machine
337
338 @example
339 make -j3 CPU_COUNT=3 doc
340 @end example
341
342 @noindent
343 The recommended value of @var{CPU_COUNT} is one plus the number of
344 cores or processors, but it is advisable to set it to a smaller value
345 if your system has not enough RAM to run that many simultaneous
346 LilyPond instances.
347
348 If source files have changed since last documentation build, output
349 files that need to be rebuilt are normally rebuilt, even if you do not
350 run @code{make doc-clean} first.  However, building dependencies in the
351 documentation are so complex that rebuilding of some targets may not
352 be triggered as they should be; a workaround is to force rebuilding
353 by touching appropriate files, e.g.
354
355 @example
356 touch Documentation/extend.texi
357 touch Documentation/*te??
358 touch Documentation/snippets/*.te??
359 @end example
360
361
362 @node Building documentation without compiling LilyPond
363 @unnumberedsubsubsec Building documentation without compiling LilyPond
364
365 The documentation can be built locally without compiling LilyPond
366 binary, if LilyPond is already installed on your system.
367
368 From a fresh Git checkout, do
369
370 @example
371 ./autogen.sh   # ignore any warning messages
372 cp GNUmakefile.in GNUmakefile
373 make -C scripts && make -C python
374 nice make LILYPOND_EXTERNAL_BINARY=/path/to/bin/lilypond doc
375 @end example
376
377 Please note that this may break sometimes -- for example, if a new
378 feature is added with a test file in input/regression, even the latest
379 development release of LilyPond will fail to build the docs.
380
381 You may build the manual without building all the @file{input/*} stuff
382 (i.e. mostly regression tests): change directory, for example to
383 @file{Documentation/}, issue @code{make doc}, which will build
384 documentation in a subdirectory @file{out-www} from the source files in
385 current directory.  In this case, if you also want to browse the
386 documentation in its post-processed form, change back to top directory
387 and issue
388
389 @example
390 make out=www WWW-post
391 @end example
392
393 @knownissues
394
395 You may also need to create a script for @command{pngtopnm} and
396 @code{pnmtopng}.  On GNU/Linux, I use this:
397
398 @verbatim
399 export LD_LIBRARY_PATH=/usr/lib
400 exec /usr/bin/pngtopnm "$@"
401 @end verbatim
402
403 On MacOS X with fink, I use this:
404
405 @verbatim
406 export DYLD_LIBRARY_PATH=/sw/lib
407 exec /sw/bin/pngtopnm "$@"
408 @end verbatim
409
410 On MacOS X with macports, you should use this:
411
412 @verbatim
413 export DYLD_LIBRARY_PATH=/opt/local/lib
414 exec /opt/local/bin/pngtopnm "$@"
415 @end verbatim
416
417
418
419 @node Testing LilyPond
420 @subsection Testing LilyPond
421
422 @html
423 <a name="testing"></a>
424 @end html
425
426 LilyPond comes with an extensive suite that exercises the entire
427 program.  This suite can be used to automatically check the impact of a
428 change.  This is done as follows
429
430 @example
431 make test-baseline
432 @emph{## apply your changes, compile}
433 make check
434 @end example
435
436 This will leave an HTML page @file{out/test-results/index.html}.  This
437 page shows all the important differences that your change introduced,
438 whether in the layout, MIDI, performance or error reporting.
439
440 To rerun tests, use
441
442 @example
443 make test-redo           @emph{## redo files differing from baseline}
444 make test-clean          @emph{## remove all test results}
445 @end example
446
447 @noindent
448 and then run @code{make check} again.
449
450 For tracking memory usage as part of this test, you will need GUILE
451 CVS; especially the following patch:
452 @uref{http://lilypond.org/vc/gub.darcs/patches/guile-1.9-gcstats.patch}.
453
454 For checking the coverage of the test suite, do the following
455
456 @example
457 ./scripts/auxiliar/build-coverage.sh
458 @emph{# uncovered files, least covered first}
459 ./scripts/auxiliar/coverage.py  --summary out-cov/*.cc
460 @emph{# consecutive uncovered lines, longest first}
461 ./scripts/auxiliar/coverage.py  --uncovered out-cov/*.cc
462 @end example
463
464
465 @node Problems
466 @subsection Problems
467
468 For help and questions use @email{lilypond-user@@gnu.org}.  Send
469 bug reports to @email{bug-lilypond@@gnu.org}.
470
471 Bugs that are not fault of LilyPond are documented here.
472
473 @unnumberedsubsubsec Bison 1.875
474
475 There is a bug in bison-1.875: compilation fails with "parse error
476 before `goto'" in line 4922 due to a bug in bison.  To fix, please
477 recompile bison 1.875 with the following fix
478
479 @example
480 $ cd lily; make out/parser.cc
481 $ vi +4919 out/parser.cc
482 # append a semicolon to the line containing "__attribute__ ((__unused__))
483 # save
484 $ make
485 @end example
486
487
488 @unnumberedsubsubsec Compiling on MacOS@tie{}X
489
490 Here are special instructions for compiling under MacOS@tie{}X.
491 These instructions assume that dependencies are installed using
492 @uref{http://www.macports.org/, MacPorts.} The instructions have
493 been tested using OS X 10.5 (Leopard).
494
495 First, install the relevant dependencies using MacPorts.
496
497 Next, add the following to your relevant shell initialization
498 files. This is @code{~/.profile} by default. You should create
499 this file if it does not exist.
500
501 @example
502 export PATH=/opt/local/bin:/opt/local/sbin:$PATH
503 export DYLD_LIBRARY_PATH=/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources:\
504 /opt/local/lib:$DYLD_LIBRARY_PATH
505 @end example
506
507 Now you must edit the generated @code{config.make} file.  Change
508
509 @example
510 FLEXLEXER_FILE = /usr/include/FlexLexer.h
511 @end example
512
513 @noindent
514 to:
515
516 @example
517 FLEXLEXER_FILE = /opt/local/include/FlexLexer.h
518 @end example
519
520 At this point, you should verify that you have the appropriate
521 fonts installed with your ghostscript installation. Check @code{ls
522 /opt/local/share/ghostscript/fonts} for: 'c0590*' files (.pfb,
523 .pfb and .afm).  If you don't have them, run the following
524 commands to grab them from the ghostscript SVN server and install
525 them in the appropriate location:
526
527 @example
528 svn export http://svn.ghostscript.com/ghostscript/tags/urw-fonts-1.0.7pre44/
529 sudo mv urw-fonts-1.0.7pre44/* /opt/local/share/ghostscript/fonts/
530 rm -rf urw-fonts-1.07pre44
531 @end example
532
533 Now run the @code{./configure} script. To avoid complications with
534 automatic font detection, add
535
536 @example
537 --with-ncsb-dir=/opt/local/share/ghostscript/fonts
538 @end example
539
540
541 @unnumberedsubsubsec Solaris
542
543 Solaris7, ./configure
544
545 @file{./configure} needs a POSIX compliant shell.  On Solaris7,
546 @file{/bin/sh} is not yet POSIX compliant, but @file{/bin/ksh} or bash
547 is.  Run configure like
548
549 @example
550 CONFIG_SHELL=/bin/ksh ksh -c ./configure
551 @end example
552
553 @noindent
554 or
555
556 @example
557 CONFIG_SHELL=/bin/bash bash -c ./configure
558 @end example
559
560 @unnumberedsubsubsec FreeBSD
561
562 To use system fonts, dejaview must be installed.  With the default
563 port, the fonts are installed in @file{usr/X11R6/lib/X11/fonts/dejavu}.
564
565 Open the file @file{$LILYPONDBASE/usr/etc/fonts/local.conf} and add the
566 following line just after the @code{<fontconfig>} line.  (Adjust as necessary
567 for your hierarchy.)
568
569 @example
570 <dir>/usr/X11R6/lib/X11/fonts</dir>
571 @end example
572
573
574 @unnumberedsubsubsec International fonts
575
576 On Mac OS X, all fonts are installed by default.  However, finding all
577 system fonts requires a bit of configuration; see
578 @uref{http://lists.gnu.org/archive/html/lilypond-user/2007-03/msg00472.html,
579 this post} on the @code{lilypond-user} mailing list.
580
581 On Linux, international fonts are installed by different means on
582 every distribution.  We cannot list the exact commands or packages
583 that are necessary, as each distribution is different, and the exact
584 package names within each distribution changes.  Here are some
585 hints, though:
586
587 @verbatim
588 Red Hat Fedora
589
590     taipeifonts fonts-xorg-truetype ttfonts-ja fonts-arabic \
591          ttfonts-zh_CN fonts-ja fonts-hebrew
592
593 Debian GNU/Linux
594
595    apt-get install emacs-intl-fonts xfonts-intl-.* \
596         ttf-kochi-gothic ttf-kochi-mincho \
597         xfonts-bolkhov-75dpi xfonts-cronyx-100dpi xfonts-cronyx-75dpi
598 @end verbatim
599
600
601 @unnumberedsubsubsec Using lilypond python libraries
602
603 If you want to use lilypond's python libraries (either running
604 certain build scripts manually, or using them in other programs),
605 set @code{PYTHONPATH} to @file{python/out} in your build
606 directory, or @file{.../usr/lib/lilypond/current/python} in the
607 installation directory structure.
608
609