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