]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/included/compile.itexi
Doc: Remove any '@' commands from @node sections
[lilypond.git] / Documentation / included / 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
11 @menu
12 * Overview of compiling::
13 * Requirements::
14 * Getting the source code::
15 * Configuring make::
16 * Compiling LilyPond::
17 * Post-compilation options::
18 * Problems::
19 * Concurrent stable and development versions::
20 * Using a Virtual Machine to Compile LilyPond::
21 * Build system::
22 @end menu
23
24
25 @node Overview of compiling
26 @section Overview of compiling
27
28 Compiling LilyPond from source is an involved process, and is only
29 recommended for developers and packagers.  Typical program users
30 are instead encouraged to obtain the program from a package
31 manager (on Unix) or by downloading a precompiled binary
32 configured for a specific operating system.  Pre-compiled binaries
33 are available on the @rweb{Download} page.
34
35 Compiling LilyPond from source is necessary if you want to build,
36 install, or test your own version of the program.
37
38 A successful compile can also be used to generate and install the
39 documentation, incorporating any changes you may have made.
40 However, a successful compile is not a requirement for generating
41 the documentation.  The documentation can be built using a Git
42 repository in conjunction with a locally installed copy of the
43 program.  For more information, see @ref{Building documentation
44 without compiling}.
45
46 Attempts to compile LilyPond natively on Windows have been
47 unsuccessful, though a workaround is available (see @ref{Using a
48 Virtual Machine to Compile LilyPond}).
49
50
51 @node Requirements
52 @section Requirements
53
54
55 @menu
56 * Requirements for running LilyPond::
57 * Requirements for compiling LilyPond::
58 * Requirements for building documentation::
59 @end menu
60
61
62 @node Requirements for running LilyPond
63 @subsection Requirements for running LilyPond
64
65 Running LilyPond requires proper installation of the following
66 software:
67
68 @itemize
69 @item @uref{http://www.dejavu-fonts.org/, DejaVu fonts} (normally
70 installed by default)
71
72 @item @uref{http://www.fontconfig.org/, FontConfig} (2.4.0 or newer)
73
74 @item @uref{http://www.freetype.org/, Freetype} (2.1.10 or newer)
75
76 @item @uref{http://www.ghostscript.com, Ghostscript} (8.60 or
77 newer)
78
79 @item @uref{http://www.gnu.org/software/guile/guile.html, Guile}
80 (1.8.2 or newer)
81
82 @item @uref{http://www.pango.org/, Pango} (1.12 or newer)
83
84 @item @uref{http://www.python.org, Python} (2.4 or newer)
85 @end itemize
86
87 International fonts are required to create music with
88 international text or lyrics.
89
90
91 @node Requirements for compiling LilyPond
92 @subsection Requirements for compiling LilyPond
93
94 Below is a full list of packages needed to build LilyPond.
95 However, for most common distributions there is an easy way of
96 installing most all build dependencies in one go:
97
98 @multitable @columnfractions .5 .5
99 @headitem Distribution @tab Command
100 @item Debian, Ubuntu
101 @tab @code{sudo apt-get build-dep lilypond}
102
103 @item Fedora, RHEL
104 @tab @code{sudo yum-builddep lilypond}
105
106 @item openSUSE, SLED
107 @c sorry for the idiosyncratic command, I really asked and argued
108 @c for "zypper build-dep" :-(
109 @tab @code{sudo zypper --build-deps-only source-install lilypond}
110 @end multitable
111
112 @itemize
113 @item Everything listed in @ref{Requirements for running
114 LilyPond}
115
116 @item Development packages for the above items (which should
117 include header files and libraries).
118
119 Red Hat Fedora:
120
121 @c ghostscript-devel-[version] isn't needed
122 @example
123 guile-devel-@var{version}
124 fontconfig-devel-@var{version}
125 freetype-devel-@var{version}
126 pango-devel-@var{version}
127 python-devel-@var{version}
128 @end example
129
130 Debian GNU/Linux:
131
132 @c libgs-dev isn't needed
133 @example
134 guile-@var{version}-dev
135 libfontconfig1-dev
136 libfreetype6-dev
137 libpango1.0-dev
138 python@var{version}-dev
139 @end example
140
141 @item @uref{http://flex.sourceforge.net/, Flex}
142
143 @item @uref{http://fontforge.sf.net/, FontForge} (20060125 or
144 newer)
145
146 @item @uref{http://www.gnu.org/software/bison/, GNU Bison}
147
148 @item @uref{http://gcc.gnu.org/, GNU Compiler Collection} (3.4 or
149 newer, 4.@var{x} recommended)
150
151 @item @uref{http://www.gnu.org/software/gettext/gettext.html, GNU
152 gettext} (0.17 or newer)
153
154 @item @uref{http://www.gnu.org/software/make/, GNU Make} (3.78 or
155 newer)
156
157 @item @uref{http://metafont.tutorial.free.fr/, MetaFont}
158 (mf-nowin, mf, mfw or mfont binaries), usually packaged with
159 @uref{http://www.latex-project.org/ftp.html, @TeX{}}.
160
161 @item @uref{http://cm.bell-labs.com/who/hobby/MetaPost.html,
162 MetaPost} (mpost binary), usually packaged with
163 @uref{http://www.latex-project.org/ftp.html, @TeX{}}.
164
165 @item @uref{http://www.perl.org/, Perl}
166
167 @item @uref{http://www.gnu.org/software/texinfo/, Texinfo} (4.11
168 or newer)
169
170 @item @uref{http://www.lcdf.org/~eddietwo/type/#t1utils, Type 1
171 utilities} (1.33 or newer recommended)
172 @end itemize
173
174
175 @node Requirements for building documentation
176 @subsection Requirements for building documentation
177
178 You can view the documentation online at
179 @uref{http://www.lilypond.org/doc/}, but you can also build it
180 locally.  This process requires some additional tools and
181 packages:
182
183 @itemize
184 @item Everything listed in @ref{Requirements for compiling
185 LilyPond}
186
187 @item @uref{http://www.imagemagick.org/, ImageMagick}
188
189 @item @uref{http://netpbm.sourceforge.net/, Netpbm}
190
191 @item @uref{http://rsync.samba.org/, rsync}
192
193 @item @uref{http://www.nongnu.org/texi2html/, Texi2HTML} (1.82)
194
195 @item International fonts
196
197 Red Hat Fedora:
198
199 @example
200 fonts-arabic
201 fonts-hebrew
202 fonts-ja
203 fonts-xorg-truetype
204 taipeifonts
205 ttfonts-ja
206 ttfonts-zh_CN
207 @end example
208
209 Debian GNU/Linux:
210
211 @example
212 emacs-intl-fonts
213 ttf-kochi-gothic
214 ttf-kochi-mincho
215 xfonts-bolkhov-75dpi
216 xfonts-cronyx-75dpi
217 xfonts-cronyx-100dpi
218 xfonts-intl-.*
219 @end example
220 @end itemize
221
222
223 @node Getting the source code
224 @section Getting the source code
225
226
227 @subheading Downloading the Git repository
228
229 In general, developers compile LilyPond from within a local Git
230 repository.  Setting up a local Git repository is explained in
231 @rcontrib{Starting with Git}.
232
233
234 @subheading Downloading a source tarball
235
236 Packagers are encouraged to use source tarballs for compiling.
237
238 The tarball for the latest stable release is available on the
239 @rweb{Source} page.
240
241 @noindent
242 The latest
243 @uref{http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=snapshot, source code snapshot}
244 is also available as a tarball from the GNU Savannah Git server.
245
246 @noindent
247 All tagged releases (including legacy stable
248 versions and the most recent development release) are available
249 here:
250
251 @example
252 @uref{http://download.linuxaudio.org/lilypond/source/}
253 @end example
254
255 Download the tarball to your @file{~/src/} directory, or some
256 other appropriate place.
257
258 @warning{Be careful where you unpack the tarball!  Any
259 subdirectories of the current folder named @file{lilypond/} or
260 @file{lilypond-@var{x.y.z}/} (where @var{x.y.z} is the release
261 number) will be overwritten if there is a name clash with the
262 tarball.}
263
264 Unpack the tarball with this command:
265
266 @example
267 tar -xzf lilypond-@var{x.y.z}.tar.gz
268 @end example
269
270 This creates a subdirectory within the current directory called
271 @file{lilypond-@var{x.y.z}/}.  Once unpacked, the source files
272 occupy about 40 MB of disk space.
273
274 Windows users wanting to look at the source code may have to
275 download and install the free-software
276 @uref{http://www.7-zip.org, 7zip archiver} to extract the tarball.
277
278
279 @node Configuring make
280 @section Configuring @command{make}
281
282
283 @menu
284 * Running ./autogen.sh::
285 * Running ./configure::
286 @end menu
287
288
289 @node Running ./autogen.sh
290 @subsection Running @command{./autogen.sh}
291
292 After you unpack the tarball (or download the Git repository), the
293 contents of your top source directory should be similar to the
294 current source tree listed at
295 @uref{http://git.sv.gnu.org/gitweb/?p=lilypond.git;a=tree}.
296
297 Next, you need to create the generated files; enter the following
298 command from your top source directory:
299
300 @example
301 ./autogen.sh
302 @end example
303
304 This will:
305
306 @enumerate
307 @item generate a number of files and directories to aid
308 configuration, such as @file{configure}, @file{README.txt}, etc.
309
310 @item automatically run the @command{./configure} command.
311 @end enumerate
312
313
314 @node Running ./configure
315 @subsection Running @command{./configure}
316
317 @menu
318 * Configuration options::
319 * Checking build dependencies::
320 * Configuring target directories::
321 * Making an out-of-tree build::
322 @end menu
323
324
325 @node Configuration options
326 @unnumberedsubsubsec Configuration options
327
328 The @command{./configure} command (generated by
329 @command{./autogen.sh}) provides many options for configuring
330 @command{make}.  To see them all, run:
331
332 @example
333 ./configure --help
334 @end example
335
336
337 @node Checking build dependencies
338 @unnumberedsubsubsec Checking build dependencies
339
340 When @command{./configure} is run without any arguments, it will
341 check to make sure your system has everything required for
342 compilation.  This is done automatically when
343 @command{./autogen.sh} is run.  If any build dependency is
344 missing, @command{./configure} will return with:
345
346 @example
347 ERROR: Please install required programs:  @var{foo}
348 @end example
349
350 The following message is issued if you are missing programs that
351 are only needed for building the documentation:
352
353 @example
354 WARNING: Please consider installing optional programs:  @var{bar}
355 @end example
356
357 If you intend to build the documentation locally, you will need to
358 install or update these programs accordingly.
359
360 @warning{@command{./configure} may fail to issue warnings for
361 certain documentation build requirements that are not met.  If you
362 experience problems when building the documentation, you may need
363 to do a manual check of @ref{Requirements for building
364 documentation}.}
365
366
367 @node Configuring target directories
368 @unnumberedsubsubsec Configuring target directories
369
370 If you intend to use your local build to install a local copy of
371 the program, you will probably want to configure the installation
372 directory.  Here are the relevant lines taken from the output of
373 @command{./configure@tie{}--help}:
374
375 @quotation
376 By default, `@command{make@tie{}install}' will install all the
377 files in @file{/usr/local/bin}, @file{/usr/local/lib} etc.  You
378 can specify an installation prefix other than @file{/usr/local}
379 using `@code{--prefix}', for instance `@code{--prefix=$HOME}'.
380 @end quotation
381
382 A typical installation prefix is @file{$HOME/usr}:
383
384 @example
385 ./configure --prefix=$HOME/usr
386 @end example
387
388 Note that if you plan to install a local build on a system where
389 you do not have root privileges, you will need to do something
390 like this anyway---@command{make@tie{}install} will only succeed
391 if the installation prefix points to a directory where you have
392 write permission (such as your home directory).  The installation
393 directory will be automatically created if necessary.
394
395 The location of the @command{lilypond} command installed by this
396 process will be @file{@var{prefix}/bin/lilypond}; you may want to
397 add @file{@var{prefix}/bin/} to your @code{$PATH} if it is not
398 already included.
399
400 It is also possible to specify separate installation directories
401 for different types of program files.  See the full output of
402 @command{./configure@tie{}--help} for more information.
403
404 If you encounter any problems, please see @ref{Problems}.
405
406
407 @node Making an out-of-tree build
408 @unnumberedsubsubsec Making an out-of-tree build
409
410 It is possible to compile LilyPond in a build tree different from
411 the source tree, using the @option{--srcdir} option of
412 @command{configure}.  Note that in some cases you may need to
413 remove the output of a previous @command{configure} command by
414 running @command{make@tie{}distclean} in the main source directory
415 before configuring the out-of-tree build:
416
417 @example
418 make distclean
419 mkdir lily-build && cd lily-build
420 @var{sourcedir}/configure --srcdir=@var{sourcedir}
421 @end example
422
423
424 @node Compiling LilyPond
425 @section Compiling LilyPond
426
427
428 @menu
429 * Using make::
430 * Saving time with the -j option::
431 * Compiling for multiple platforms::
432 * Useful make variables::
433 @end menu
434
435
436 @node Using make
437 @subsection Using @command{make}
438
439 LilyPond is compiled with the @command{make} command.  Assuming
440 @command{make} is configured properly, you can simply run:
441
442 @example
443 make
444 @end example
445
446 @samp{make} is short for @samp{make all}.  To view a list of @command{make}
447 targets, run:
448
449 @example
450 make help
451 @end example
452
453 TODO: Describe what @command{make} actually does.
454
455
456 @node Saving time with the -j option
457 @subsection Saving time with the @option{-j} option
458
459 If your system has multiple CPUs, you can speed up compilation by
460 adding @samp{-j@var{X}} to the @command{make} command, where
461 @samp{@var{X}} is one more than the number of cores you have.  For
462 example, a typical Core2Duo machine would use:
463
464 @example
465 make -j3
466 @end example
467
468 If you get errors using the @option{-j} option, and @samp{make}
469 succeeds without it, try lowering the @code{@var{X}} value.
470
471
472 @node Compiling for multiple platforms
473 @subsection Compiling for multiple platforms
474
475 If you want to build multiple versions of LilyPond with different
476 configuration settings, you can use the
477 @code{--enable-config=@var{CONF}} option of @command{configure}.
478 You should use @code{make@tie{}conf=@var{CONF}} to generate the
479 output in @file{out-@var{CONF}}.  For example, suppose you want to
480 build with and without profiling, then use the following for the
481 normal build
482
483 @example
484 ./configure --prefix=$HOME/usr/ --enable-checking
485 make
486 @end example
487
488 and for the profiling version, specify a different configuration
489
490 @example
491 ./configure --prefix=$HOME/usr/ --enable-profiling \
492   --enable-config=prof --disable-checking
493 make conf=prof
494 @end example
495
496 If you wish to install a copy of the build with profiling, don't
497 forget to use @code{conf=@var{CONF}} when issuing
498 @command{make@tie{}install}:
499
500 @example
501 make conf=prof install
502 @end example
503
504
505 @seealso
506 @ref{Installing LilyPond from a local build}
507
508
509 @node Useful make variables
510 @subsection Useful @command{make} variables
511
512 If a less verbose build output if desired, the variable
513 @code{QUIET_BUILD} may be set to @code{1} on @command{make}
514 command line, or in @file{local.make} at top of the build tree.
515
516
517 @node Post-compilation options
518 @section Post-compilation options
519
520
521 @menu
522 * Installing LilyPond from a local build::
523 * Generating documentation::
524 * Testing LilyPond::
525 @end menu
526
527
528 @node Installing LilyPond from a local build
529 @subsection Installing LilyPond from a local build
530
531 If you configured @command{make} to install your local build in a
532 directory where you normally have write permission (such as your
533 home directory), and you have compiled LilyPond by running
534 @command{make}, you can install the program in your target
535 directory by running:
536
537 @example
538 make install
539 @end example
540
541 If instead, your installation directory is not one that you can
542 normally write to (such as the default @file{/usr/local/}, which
543 typically is only writeable by the superuser), you will need to
544 temporarily become the superuser when running
545 @command{make@tie{}install}:
546
547 @example
548 sudo make install
549 @end example
550
551 @noindent
552 or...
553
554 @example
555 su -c 'make install'
556 @end example
557
558 If you don't have superuser privileges, then you need to configure
559 the installation directory to one that you can write to, and then
560 re-install.  See @ref{Configuring target directories}.
561
562
563 @node Generating documentation
564 @subsection Generating documentation
565
566
567 @menu
568 * Documentation editor's edit/compile cycle::
569 * Building documentation::
570 * Saving time with CPU_COUNT::
571 * AJAX search::
572 * Installing documentation::
573 * Building documentation without compiling::
574 @end menu
575
576
577 @node Documentation editor's edit/compile cycle
578 @unnumberedsubsubsec Documentation editor's edit/compile cycle
579
580 @itemize
581 @item
582 Initial documentation build:
583
584 @example
585 make [-j@var{X}]
586 make [-j@var{X} CPU_COUNT=@var{X}] doc  @emph{## can take an hour or more}
587 @end example
588
589 @item
590 Edit/compile cycle:
591
592 @example
593 @emph{## edit source files, then...}
594
595 make [-j@var{X}]                  @emph{## needed if editing outside}
596                             @emph{##   Documentation/, but useful anyway}
597                             @emph{##   for finding Texinfo errors.}
598 touch Documentation/*te??   @emph{## bug workaround}
599 make [-j@var{X} CPU_COUNT=@var{X}] doc  @emph{## usually faster than initial build.}
600 @end example
601
602 @item
603 Reset:
604
605 @example
606 make doc-clean              @emph{## use only as a last resort.}
607 @end example
608 @end itemize
609
610 @node Building documentation
611 @unnumberedsubsubsec Building documentation
612
613 After a successful compile (using @command{make}), the
614 documentation can be built by issuing:
615
616 @example
617 make doc
618 @end example
619
620 The first time you run @command{make@tie{}doc}, the process can
621 easily take an hour or more.  After that, @command{make@tie{}doc}
622 only makes changes to the pre-built documentation where needed,
623 so it may only take a minute or two to test changes if the
624 documentation is already built.
625
626 If @command{make@tie{}doc} succeeds, the HTML documentation tree
627 is available in @file{out-www/offline-root/}, and can be browsed
628 locally.  Various portions of the documentation can be found by
629 looking in @file{out/} and @file{out-www} subdirectories in other
630 places in the source tree, but these are only @emph{portions} of
631 the docs.  Please do not complain about anything which is broken
632 in those places; the only complete set of documentation is in
633 @file{out-www/offline-root/} from the top of the source tree.
634
635 Compilation of documentation in Info format with images can be
636 done separately by issuing:
637
638 @example
639 make info
640 @end example
641
642 @knownissues
643
644 If source files have changed since the last documentation build,
645 output files that need to be rebuilt are normally rebuilt, even if
646 you do not run @code{make@tie{}doc-clean} first.  However, build
647 dependencies in the documentation are so complex that some
648 newly-edited files may not be rebuilt as they should be; a
649 workaround is to @command{touch} the top source file for any
650 manual you've edited.  For example, if you make changes to a file
651 in @file{notation/}, do:
652
653 @example
654 touch Documentation/notation.tely
655 @end example
656
657 @noindent
658 The top sources possibly affected by this are:
659
660 @example
661 Documentation/extend.texi
662 Documentation/changes.tely
663 Documentation/contributor.texi
664 Documentation/essay.tely
665 Documentation/extending.tely
666 Documentation/learning.tely
667 Documentation/notation.tely
668 Documentation/snippets.tely
669 Documentation/usage.tely
670 Documentation/web.texi
671 @end example
672
673 @noindent
674 You can @command{touch} all of them at once with:
675
676 @example
677 touch Documentation/*te??
678 @end example
679
680 @noindent
681 However, this will rebuild all of the manuals
682 indiscriminately---it is more efficient to @command{touch} only
683 the affected files.
684
685
686 @node Saving time with CPU_COUNT
687 @unnumberedsubsubsec Saving time with @code{CPU_COUNT}
688
689 The most time consuming task for building the documentation is
690 running LilyPond to build images of music, and there cannot be
691 several simultaneously running @command{lilypond-book} instances,
692 so the @option{-j} @command{make} option does not significantly
693 speed up the build process.  To help speed it up, the makefile
694 variable @option{CPU_COUNT} may be set in @file{local.make} or on
695 the command line to the number of @code{.ly} files that LilyPond
696 should process simultaneously, e.g. on a bi-processor or dual core
697 machine:
698
699 @example
700 make -j3 CPU_COUNT=3 doc
701 @end example
702
703 @noindent
704 The recommended value of @option{CPU_COUNT} is one plus the number
705 of cores or processors, but it is advisable to set it to a smaller
706 value unless your system has enough RAM to run that many
707 simultaneous LilyPond instances.  Also, values for the @option{-j}
708 option that pose problems with @samp{make} are less likely to pose
709 problems with @samp{make doc} (this applies to both @option{-j}
710 and @option{CPU_COUNT}).  For example, with a quad-core processor,
711 it is possible for @samp{make -j5 CPU_COUNT=5 doc} to work
712 consistently even if @samp{make -j5} rarely succeeds.
713
714
715 @node AJAX search
716 @unnumberedsubsubsec AJAX search
717
718 To build the documentation with interactive searching, use:
719
720 @example
721 make doc AJAX_SEARCH=1
722 @end example
723
724 This requires PHP, and you must view the docs via a http
725 connection (you cannot view them on your local filesystem).
726
727 @warning{Due to potential security or load issues, this option is
728 not enabled in the official documentation builds.  Enable at your
729 own risk.}
730
731
732 @node Installing documentation
733 @unnumberedsubsubsec Installing documentation
734
735 The HTML, PDF and if available Info files can be installed into
736 the standard documentation path by issuing
737
738 @example
739 make install-doc
740 @end example
741
742 @noindent
743 This also installs Info documentation with images if the
744 installation prefix is properly set; otherwise, instructions to
745 complete proper installation of Info documentation are printed on
746 standard output.
747
748 To install the Info documentation separately, run:
749
750 @example
751 make install-info
752 @end example
753
754 @noindent
755 Note that to get the images in Info documentation, @code{install-doc}
756 target creates symbolic links to HTML and PDF installed documentation
757 tree in @file{@var{prefix}/share/info}, in order to save disk space,
758 whereas @code{install-info} copies images in
759 @file{@var{prefix}/share/info} subdirectories.
760
761 It is possible to build a documentation tree in
762 @file{out-www/online-root/}, with special processing, so it can be
763 used on a website with content negotiation for automatic language
764 selection; this can be achieved by issuing
765
766 @example
767 make WEB_TARGETS=online doc
768 @end example
769
770 @noindent
771 and both @q{offline} and @q{online} targets can be generated by issuing
772
773 @example
774 make WEB_TARGETS="offline online" doc
775 @end example
776
777 Several targets are available to clean the documentation build and
778 help with maintaining documentation; an overview of these targets is
779 available with
780
781 @example
782 make help
783 @end example
784
785 @noindent
786 from every directory in the build tree.  Most targets for
787 documentation maintenance are available from
788 @file{Documentation/}; for more information, see
789 @rcontrib{Documentation work}.
790
791 The makefile variable @code{QUIET_BUILD} may be set to @code{1}
792 for a less verbose build output, just like for building the
793 programs.
794
795
796 @node Building documentation without compiling
797 @unnumberedsubsubsec Building documentation without compiling
798
799
800 The documentation can be built locally without compiling LilyPond
801 binary, if LilyPond is already installed on your system.
802
803 From a fresh Git checkout, do
804
805 @example
806 ./autogen.sh   # ignore any warning messages
807 cp GNUmakefile.in GNUmakefile
808 make -C scripts && make -C python
809 nice make LILYPOND_EXTERNAL_BINARY=/path/to/bin/lilypond doc
810 @end example
811
812 Please note that this may break sometimes -- for example, if a new
813 feature is added with a test file in input/regression, even the latest
814 development release of LilyPond will fail to build the docs.
815
816 You may build the manual without building all the @file{input/*} stuff
817 (i.e. mostly regression tests): change directory, for example to
818 @file{Documentation/}, issue @code{make doc}, which will build
819 documentation in a subdirectory @file{out-www} from the source files in
820 current directory.  In this case, if you also want to browse the
821 documentation in its post-processed form, change back to top directory
822 and issue
823
824 @example
825 make out=www WWW-post
826 @end example
827
828 @knownissues
829
830 You may also need to create a script for @command{pngtopnm} and
831 @code{pnmtopng}.  On GNU/Linux, I use this:
832
833 @verbatim
834 export LD_LIBRARY_PATH=/usr/lib
835 exec /usr/bin/pngtopnm "$@"
836 @end verbatim
837
838 On MacOS X with fink, I use this:
839
840 @verbatim
841 export DYLD_LIBRARY_PATH=/sw/lib
842 exec /sw/bin/pngtopnm "$@"
843 @end verbatim
844
845 On MacOS X with macports, you should use this:
846
847 @verbatim
848 export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib
849 exec /opt/local/bin/pngtopnm "$@"
850 @end verbatim
851
852
853 @node Testing LilyPond
854 @subsection Testing LilyPond
855
856
857 LilyPond comes with an extensive suite that exercises the entire
858 program. This suite can be used to automatically check the impact
859 of a change.
860
861 @menu
862 * Developer's edit/compile/test cycle::
863 * Other tests::
864 @end menu
865
866 @node Developer's edit/compile/test cycle
867 @unnumberedsubsubsec Developer's edit/compile/test cycle
868
869 TODO: is @code{[-j@var{X} CPU_COUNT=@var{X}]} useful for
870 @code{test-baseline}, @code{check}, @code{clean},
871 @code{test-redo}?
872
873 @itemize
874 @item
875 Initial test:
876
877 @example
878 make [-j@var{X}]
879 make test-baseline
880 make [-j@var{X} CPU_COUNT=@var{X}] check
881 @end example
882
883 @item
884 Edit/compile/test cycle:
885
886 @example
887 @emph{## edit source files, then...}
888
889 make clean                    @emph{## only if needed (see below)}
890 make [-j@var{X}]                    @emph{## only if needed (see below)}
891 make test-redo                @emph{## redo files differing from baseline}
892 make [-j@var{X} CPU_COUNT=@var{X}] check  @emph{## CPU_COUNT here?}
893 @end example
894
895 @item
896 Reset:
897
898 @example
899 make test-clean
900 @end example
901 @end itemize
902
903 If you modify any source files that have to be compiled (such as
904 @file{.cc} or @file{.hh} files in @file{flower/} or @file{lily/}),
905 then you must run @command{make} before @command{make test-redo},
906 so @command{make} can compile the modified files and relink all
907 the object files.  If you only modify files which are interpreted,
908 like those in the @file{scm/} and @file{ly/} directories, then
909 @command{make} is not needed before @command{make test-redo}.
910
911 Also, if you modify any font definitions in the @file{mf/}
912 directory then you must run @command{make clean} and
913 @command{make} before running @command{make test-redo}.  This will
914 recompile everything, whether modified or not, and takes a lot
915 longer.
916
917 Running @command{make@tie{}check} will leave an HTML page
918 @file{out/test-results/index.html}.  This page shows all the
919 important differences that your change introduced, whether in the
920 layout, MIDI, performance or error reporting.
921
922
923 @node Other tests
924 @unnumberedsubsubsec Other tests
925
926 For tracking memory usage as part of this test, you will need
927 GUILE CVS; especially the following patch:
928 @uref{http://www.lilypond.org/vc/old/gub.darcs/patches/guile-1.9-gcstats.patch}.
929
930 For checking the coverage of the test suite, do the following
931
932 @example
933 ./scripts/auxiliar/build-coverage.sh
934 @emph{# uncovered files, least covered first}
935 ./scripts/auxiliar/coverage.py  --summary out-cov/*.cc
936 @emph{# consecutive uncovered lines, longest first}
937 ./scripts/auxiliar/coverage.py  --uncovered out-cov/*.cc
938 @end example
939
940
941 @node Problems
942 @section Problems
943
944 For help and questions use @email{lilypond-user@@gnu.org}.  Send
945 bug reports to @email{bug-lilypond@@gnu.org}.
946
947 Bugs that are not fault of LilyPond are documented here.
948
949 @unnumberedsubsubsec Bison 1.875
950
951 There is a bug in bison-1.875: compilation fails with "parse error
952 before `goto'" in line 4922 due to a bug in bison.  To fix, please
953 recompile bison 1.875 with the following fix
954
955 @example
956 $ cd lily; make out/parser.cc
957 $ vi +4919 out/parser.cc
958 # append a semicolon to the line containing "__attribute__ ((__unused__))
959 # save
960 $ make
961 @end example
962
963
964 @unnumberedsubsubsec Compiling on MacOS@tie{}X
965
966 Here are special instructions for compiling under MacOS@tie{}X.
967 These instructions assume that dependencies are installed using
968 @uref{http://www.macports.org/, MacPorts.} The instructions have
969 been tested using OS X 10.5 (Leopard).
970
971 First, install the relevant dependencies using MacPorts.
972
973 Next, add the following to your relevant shell initialization
974 files. This is @code{~/.profile} by default. You should create
975 this file if it does not exist.
976
977 @example
978 export PATH=/opt/local/bin:/opt/local/sbin:$PATH
979 export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib:$DYLD_FALLBACK_LIBRARY_PATH
980 @end example
981
982 Now you must edit the generated @code{config.make} file.  Change
983
984 @example
985 FLEXLEXER_FILE = /usr/include/FlexLexer.h
986 @end example
987
988 @noindent
989 to:
990
991 @example
992 FLEXLEXER_FILE = /opt/local/include/FlexLexer.h
993 @end example
994
995 At this point, you should verify that you have the appropriate
996 fonts installed with your ghostscript installation. Check @code{ls
997 /opt/local/share/ghostscript/fonts} for: 'c0590*' files (.pfb,
998 .pfb and .afm).  If you don't have them, run the following
999 commands to grab them from the ghostscript SVN server and install
1000 them in the appropriate location:
1001
1002 @example
1003 svn export http://svn.ghostscript.com/ghostscript/tags/urw-fonts-1.0.7pre44/
1004 sudo mv urw-fonts-1.0.7pre44/* /opt/local/share/ghostscript/fonts/
1005 rm -rf urw-fonts-1.07pre44
1006 @end example
1007
1008 Now run the @code{./configure} script. To avoid complications with
1009 automatic font detection, add
1010
1011 @example
1012 --with-ncsb-dir=/opt/local/share/ghostscript/fonts
1013 @end example
1014
1015
1016 @unnumberedsubsubsec Solaris
1017
1018 Solaris7, ./configure
1019
1020 @file{./configure} needs a POSIX compliant shell.  On Solaris7,
1021 @file{/bin/sh} is not yet POSIX compliant, but @file{/bin/ksh} or bash
1022 is.  Run configure like
1023
1024 @example
1025 CONFIG_SHELL=/bin/ksh ksh -c ./configure
1026 @end example
1027
1028 @noindent
1029 or
1030
1031 @example
1032 CONFIG_SHELL=/bin/bash bash -c ./configure
1033 @end example
1034
1035 @unnumberedsubsubsec FreeBSD
1036
1037 To use system fonts, dejaview must be installed.  With the default
1038 port, the fonts are installed in @file{usr/X11R6/lib/X11/fonts/dejavu}.
1039
1040 Open the file @file{$LILYPONDBASE/usr/etc/fonts/local.conf} and add the
1041 following line just after the @code{<fontconfig>} line.  (Adjust as necessary
1042 for your hierarchy.)
1043
1044 @example
1045 <dir>/usr/X11R6/lib/X11/fonts</dir>
1046 @end example
1047
1048
1049 @unnumberedsubsubsec International fonts
1050
1051 On Mac OS X, all fonts are installed by default.  However, finding all
1052 system fonts requires a bit of configuration; see
1053 @uref{http://lists.gnu.org/archive/html/lilypond-user/2007-03/msg00472.html,
1054 this post} on the @code{lilypond-user} mailing list.
1055
1056 On Linux, international fonts are installed by different means on
1057 every distribution.  We cannot list the exact commands or packages
1058 that are necessary, as each distribution is different, and the exact
1059 package names within each distribution changes.  Here are some
1060 hints, though:
1061
1062 @verbatim
1063 Red Hat Fedora
1064
1065     taipeifonts fonts-xorg-truetype ttfonts-ja fonts-arabic \
1066          ttfonts-zh_CN fonts-ja fonts-hebrew
1067
1068 Debian GNU/Linux
1069
1070    apt-get install emacs-intl-fonts xfonts-intl-.* \
1071         ttf-kochi-gothic ttf-kochi-mincho \
1072         xfonts-bolkhov-75dpi xfonts-cronyx-100dpi xfonts-cronyx-75dpi
1073 @end verbatim
1074
1075
1076 @unnumberedsubsubsec Using lilypond python libraries
1077
1078 If you want to use lilypond's python libraries (either running
1079 certain build scripts manually, or using them in other programs),
1080 set @code{PYTHONPATH} to @file{python/out} in your build
1081 directory, or @file{.../usr/lib/lilypond/current/python} in the
1082 installation directory structure.
1083
1084
1085
1086
1087 @node Concurrent stable and development versions
1088 @section Concurrent stable and development versions
1089
1090
1091 It can be useful to have both the stable and the development versions
1092 of Lilypond available at once. One way to do this on GNU/Linux is to
1093 install the stable version using the precompiled binary, and run the
1094 development version from the source tree. After running @command{make
1095 all} from the top directory of the Lilypond source files, there will
1096 be a binary called @code{lilypond} in the @code{out} directory:
1097
1098 @example
1099 <@var{path to}>/lilypond/out/bin/lilypond
1100 @end example
1101
1102 This binary can be run without actually doing the @code{make
1103 install} command. The advantage to this is that you can have all
1104 of the latest changes available after pulling from git and running
1105 @code{make all}, without having to uninstall the old version and
1106 reinstall the new.
1107
1108 So, to use the stable version, install it as usual and use the
1109 normal commands:
1110
1111 @example
1112 lilypond foobar.ly
1113 @end example
1114
1115 To use the development version, create a link to the binary in the
1116 source tree by saving the following line in a file somewhere in your
1117 @code{$PATH}:
1118
1119 @example
1120 exec <@var{path to}>/lilypond/out/bin/lilypond "$@@"
1121 @end example
1122
1123 Save it as @code{Lilypond} (with a capital L to distinguish it
1124 from the stable @code{lilypond}), and make it executable:
1125
1126 @example
1127 chmod +x Lilypond
1128 @end example
1129
1130 Then you can invoke the development version this way:
1131
1132 @example
1133 Lilypond foobar.ly
1134 @end example
1135
1136
1137 TODO: ADD
1138
1139 - other compilation tricks for developers
1140
1141
1142 @node Using a Virtual Machine to Compile LilyPond
1143 @section Using a Virtual Machine to Compile LilyPond
1144
1145
1146 TODO: rewrite for lily-git.tcl !!!  do before GOP!  -gp
1147
1148 Since it is not possible to compile Lilypond on Windows, some
1149 developers may find it useful to install a GNU/Linux virtual
1150 machine. A disk image with a special remix of @strong{Ubuntu}
1151 has been created for this purpose. It has all of the Lilypond
1152 build dependencies in place, so that once installed, it is
1153 ready to compile both Lilypond and the Documentation.
1154 The @code{lilybuntu} remix is available for download here:
1155
1156 @example
1157 @uref{http://@/files.lilynet.net/@/lilybuntu.iso}
1158 @end example
1159
1160 We do not necessarily recommend any one virtualization tool,
1161 however the @code{lilybuntu} remix is known to work well on
1162 @uref{http://www.virtualbox.org/wiki/Downloads, Sun VirtualBox},
1163 which is a free download. Consult your virtualization software's
1164 documentation for instructions on setting up the software and
1165 for general instructions on installing a virtual machine.
1166
1167 Steps to setting up @code{lilybuntu} in a virtual machine:
1168
1169 @enumerate
1170 @item Download the @code{lilybuntu} disk image.
1171
1172 @item Install @code{lilybuntu}. You will use the @code{.iso}
1173 file as the boot disk. It should not be necessary to burn it
1174 to a DVD, but consult the documentation for your virtualization
1175 software for specific instructions. If possible, use at least
1176 the recommended amount of RAM for the virtual machine (384 MB on
1177 VirtualBox), and use a dynamically expanding virtual hard drive.
1178 A virtual hard drive with 6 GB will be enough to compile LilyPond,
1179 but if you intend to build the docs and run the regression tests
1180 the virtual hard drive should be at least 10 GB.
1181 The Ubuntu installation should be straightforward, although in the
1182 partitioning stage do not be afraid to select @qq{use entire disk,}
1183 since this is only your @strong{virtual disk} and not your
1184 machine's actual hard drive.
1185
1186 @item After installation is complete, restart the virtual
1187 machine.  If you are using @strong{VirtualBox}, you may wish
1188 to install the @qq{Guest Additions}, which while not essential for
1189 compiling @code{Lilypond} will allow you to use the virtual machine
1190 in full screen, Seamless mode (also known as Unity mode on other
1191 virtualization platforms) and allow you to share clipboards between
1192 the physical and virtual machine.  From the @code{Devices} menu select
1193 @code{Install Guest Additions...}, the @code{VBOXADDITIONS} CDROM device
1194 will appear on the desktop.  Open a @strong{terminal} session.
1195 (@code{Applications > Accessories > Terminal}) and @code{cd} to the
1196 top level of the CDROM.  Run the @code{autorun.sh} script as superuser
1197 (@code{sudo ./autorun.sh }), a console window will open while the
1198 @qq{Guest Additions} are being installed.  Once the script has
1199 been finished, reboot your Virtual Machine to complete the installation
1200 of the @qq{Guest Additions}.
1201
1202 @item Open a @strong{terminal} session.
1203 (@code{Applications > Accessories > Terminal})
1204
1205 @item Open @strong{Firefox} (there's an icon for it on the
1206 panel at the top of the screen) and go to the online Lilypond
1207 @uref{http://lilypond.org/doc/latest/Documentation/contributor/,
1208 Contributor's Guide}.
1209
1210 @item To retrieve the Lilypond source code from @code{git},
1211 copy-and-paste each command from the CG @qq{Main source code}
1212 section into the terminal. (paste into the terminal with keystroke
1213 @code{CTRL+SHIFT+V})
1214
1215 @item Prepare to build Lilypond by running the configuration script.
1216 Type
1217
1218 @example
1219 ./autogen.sh
1220 @end example
1221
1222 When it is finished you should be presented
1223 with the three most common @code{make} options:
1224
1225 @example
1226 Type:
1227     make all       to build LilyPond
1228     make install   to install LilyPond
1229     make help      to see all possible targets
1230
1231 Edit local.make for local Makefile overrides.
1232 @end example
1233
1234 @item First type @code{make all} to build Lilypond. This will take
1235 a while.
1236
1237 @item When Lilypond is finished building, build the documentation
1238 by typing
1239
1240 @example
1241 make doc
1242 @end example
1243
1244 Depending on your system specs it could take from 30-60 minutes
1245 to finish.
1246
1247 @end enumerate
1248
1249 At this point everything has been compiled.
1250 You may install Lilypond using @code{make install}, or you may wish
1251 to set up your system with concurrent stable and development
1252 versions as described in the previous section.
1253
1254
1255 @node Build system
1256 @section Build system
1257
1258
1259 We currently use make and stepmake, which is complicated and only
1260 used by us.  Hopefully this will change in the future.
1261
1262
1263 @subsubheading Version-specific texinfo macors
1264
1265 @itemize
1266
1267 @item
1268 made with @command{scripts/build/create-version-itexi.py} and@*
1269 @command{scripts/build/create-weblinks-itexi.py}
1270
1271 @item
1272 used extensively in the @code{WEBSITE_ONLY_BUILD} version of the
1273 website (made with website.make, used on lilypond.org)
1274
1275 @item
1276 not (?) used in the main docs?
1277
1278 @item
1279 the numbers in VERSION file: MINOR_VERSION should be 1 more than
1280 the last release, VERSION_DEVEL should be the last @strong{online}
1281 release.  Yes, VERSION_DEVEL is less than VERSION.
1282
1283 @end itemize