]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/contributor/build-notes.itexi
e00cfc7e7eedbad98a0e8b1b860d701f46628494
[lilypond.git] / Documentation / contributor / build-notes.itexi
1 @c -*- coding: utf-8; mode: texinfo; -*-
2
3
4 @node Build system notes
5 @chapter Build system notes
6
7 @warning{This chapter is in high flux, and is being run in a
8 @qq{wiki-like} fashion.  Do not trust anything you read in this
9 chapter.}
10
11 @menu
12 * Build system overview::
13 * Tips for working on the build system::
14 * General build system notes::
15 * Doc build::
16 * Website build::
17 * Building an Ubuntu distro::
18 * Building GUB::
19 @end menu
20
21
22 @node Build system overview
23 @section Build system overview
24
25 Build system is currently GNU make, with an extra "stepmake" layer
26 on top.  Look at files in @file{make/} and @file{stepmake/} and
27 all @file{GNUmakefile}s.
28
29 There is wide-spread dissatisfaction with this system, and we are
30 considering changing.  This would be a huge undertaking (estimated
31 200+ hours).  This change will probably involve not using GNU make
32 any more -- but a discussion about the precise build system will
33 have to wait.  Before we reach that point, we need to figure out
34 (at least approximately) what the current build system does.
35
36 Fundamentally, a build system does two things:
37
38 @enumerate
39 @item
40 Constructs command-line commands, for example:
41
42 @example
43 lilypond-book \
44   --tons --of --options \
45   pitches.itely
46 texi2pdf \
47   --more --imperial --and --metric --tons --of --options \
48   pitches.texi
49 @end example
50
51 @item
52 If there was a previous build, it decides which parts of the
53 system need to be rebuilt.
54
55 @end enumerate
56
57 When I try to do anything in the build system, it helps to remind
58 myself of this.  The "end result" is just a series of command-line
59 commands.  All the black magick is just an attempt to construct
60 those commands.
61
62 @node Tips for working on the build system
63 @section Tips for working on the build system
64
65 @itemize
66 @item
67 Add:
68
69 @example
70 echo "aaa"
71
72 echo "bbb"
73 @end example
74
75 to the build system files in various places.  This will let you
76 track where the program is, in various points of the build.
77
78 PH note.  There are lots of places where Make doesn't let you put
79 echo commands.  My top tip for tracing how make runs is to put
80
81 @example
82 $(error Some Text to display)
83 @end example
84
85 This will stop make running and print the text @code{Some Text to
86 display}.
87
88 End PH note.
89
90 @item
91 First task: understand how @code{make website} works,
92 @emph{without} the translations.  Looking at the english-only
93 website is the best introduction to the build system... it only
94 covers about 5% of the whole thing, but even that will likely take
95 10 hours or more.
96
97 @end itemize
98
99
100 @node General build system notes
101 @section General build system notes
102
103 @menu
104 * How stepmake works::
105 @end menu
106
107 @node How stepmake works
108 @subsection How stepmake works
109
110 Typing make website runs the file @file{GNUmakefile} from the
111 build directory.  This only contains 3 lines:
112
113 @example
114 depth = .
115 include config$(if $(conf),-$(conf),).make
116 include $(configure-srcdir)/GNUmakefile.in
117 @end example
118
119 The variable @code{depth} is used throughout the make system to
120 track how far down the directory structure the make is.  The first
121 include sets lots of variables but doesn't "do" anything.  Default
122 values for these variables are automatically detected at the
123 ./configure step, which creates the file @file{config.make}.
124 The second include runs the file @file{GNUmakefile.in} from
125 the top level source directory.
126
127 This sets another load of variables, and then includes (i.e.
128 immediately runs) @file{stepmake.make} from the @file{make}
129 subdirectory.  This sets a load of other variables, does some
130 testing to see if SCONS (another build tool?) is being used, and
131 then runs @file{make/config.make} - which doesn't seem to exist...
132
133 GP: scons is indeed a different build tool; I think that Jan
134 experimented with it 5 years ago or something.  It seems like we
135 still have bits and pieces of it floating around.
136
137 Next, it runs @file{make/toplevel-version.make}, which sets the
138 version variables for major, minor, patch, stable, development and
139 mypatchlevel (which seems to be used for patch numbers for
140 non-stable versions only?).
141
142 Next - @file{make/local.make}, which doesn't exist.
143
144 Then a few more variable and the interesting comment:
145
146 @example
147 # Don't try to outsmart us, you puny computer!
148 # Well, UGH.  This only removes builtin rules from
149 @end example
150
151 and then tests to see whether BUILTINS_REMOVED is defined.  It
152 appears to be when I run make, and so
153 @file{stepmake/stepmake/no-builtin-rules.make} is run.  The
154 comment at the head of this file says:
155
156 @example
157 # UGH.  GNU make comes with implicit rules.
158 # We don't want any of them, and can't force users to run
159 # --no-builtin-rules
160 @end example
161
162 I've not studied that file at length, but assume it removes all
163 make's build-in rules (e.g. @file{*.c} files are run through the
164 GNU C compiler) - there's a lot of them in here, and a lot of
165 comments, and I'd guess most of it isn't needed.
166
167 We return to @file{stepmake.make}, where we hit the make rule all:
168 The first line of this is:
169
170 @smallexample
171 -include $(addprefix $(depth)/make/,$(addsuffix -inclusions.make, $(LOCALSTEPMAKE_TEMPLATES)))
172 @end smallexample
173
174 which, when the variables are substituted, gives:
175
176 @example
177 ./make/generic-inclusions.make
178 ./make/lilypond-inclusions.make.
179 @end example
180
181 (Note - according to the make documentation, -include is only
182 different from include in that it doesn't produce any kind of
183 error message when the included file doesn't exist).
184
185 And the first file doesn't exist.  Nor the second.  Next:
186
187 @smallexample
188 -include $(addprefix $(stepdir)/,$(addsuffix -inclusions.make, $(STEPMAKE_TEMPLATES)))
189 @end smallexample
190
191 which expands to the following files:
192
193 @example
194 /home/phil/lilypond-git/stepmake/stepmake/generic-inclusions.make
195 /home/phil/lilypond-git/stepmake/stepmake/toplevel-inclusions.make
196 /home/phil/lilypond-git/stepmake/stepmake/po-inclusions.make
197 /home/phil/lilypond-git/stepmake/stepmake/install-inclusions.make.
198 @end example
199
200 One little feature to notice here - these are all absolute file
201 locations - the line prior to this used relative locations.  And
202 none of these files exist, either.
203
204 (Further note - I'm assuming all these lines of make I'm following are
205 autogenerated, but that'll be something else to discover.)
206
207 JM: @emph{``No, these lines are not useful in LilyPond (this is why
208 you think they are autogenerated), but they are part of StepMake,
209 which was meant to be a package to be installed as a build system over
210 autoconf/make in software project source trees.''}
211
212 Next in @file{stepmake.make}:
213
214 @smallexample
215 include $(addprefix $(stepdir)/,$(addsuffix -vars.make, $(STEPMAKE_TEMPLATES)))
216 @end smallexample
217
218 which expands to:
219
220 @example
221 /home/phil/lilypond-git/stepmake/stepmake/generic-vars.make
222 /home/phil/lilypond-git/stepmake/stepmake/toplevel-vars.make
223 /home/phil/lilypond-git/stepmake/stepmake/po-vars.make
224 /home/phil/lilypond-git/stepmake/stepmake/install-vars.make.
225 @end example
226
227 Woo.  They all exist (they should as there's no - in front of the
228 include).  @file{generic-vars.make} sets loads of variables
229 (funnily enough).  @file{toplevel-vars.make} is very short - one
230 line commented as @code{# override Generic_vars.make:} and 2 as
231 follows:
232
233 @example
234 # urg?
235 include $(stepdir)/documentation-vars.make
236 @end example
237
238 I assume the urg comment refers to the fact that this should
239 really just create more variables, but it actually sends us off to
240 @file{/home/phil/lilypond-git/stepmake/stepmake/documentation-vars.make}.
241
242 That file is a 3 line variable setting one.
243
244 @file{po-vars.make} has the one-line comment @code{# empty}, as
245 does @file{install-vars.make}.
246
247 So now we're back to @file{stepmake.make}.
248
249 The next lines are
250 :
251 @smallexample
252 # ugh. need to do this because of PATH :=$(top-src-dir)/..:$(PATH)
253 include $(addprefix $(depth)/make/,$(addsuffix -vars.make, $(LOCALSTEPMAKE_TEMPLATES)))
254 @end smallexample
255
256 and the include expands to:
257
258 @example
259 include ./make/generic-vars.make ./make/lilypond-vars.make.
260 @end example
261
262 These again set variables, and in some cases export them to allow
263 child @code{make} processes to use them.
264
265 The final 4 lines of @file{stepmake.make} are:
266
267 @smallexample
268 include $(addprefix $(depth)/make/,$(addsuffix -rules.make, $(LOCALSTEPMAKE_TEMPLATES)))
269 include $(addprefix $(stepdir)/,$(addsuffix -rules.make, $(STEPMAKE_TEMPLATES)))
270 include $(addprefix $(depth)/make/,$(addsuffix -targets.make, $(LOCALSTEPMAKE_TEMPLATES)))
271 include $(addprefix $(stepdir)/,$(addsuffix -targets.make, $(STEPMAKE_TEMPLATES)))
272 @end smallexample
273
274 which expand as follows:
275
276 @example
277 include ./make/generic-rules.make ./make/lilypond-rules.make
278 include
279   /home/phil/lilypond-git/stepmake/stepmake/generic-rules.make
280   /home/phil/lilypond-git/stepmake/stepmake/toplevel-rules.make
281   /home/phil/lilypond-git/stepmake/stepmake/po-rules.make
282   /home/phil/lilypond-git/stepmake/stepmake/install-rules.make
283 include ./make/generic-targets.make ./make/lilypond-targets.make
284 include
285   /home/phil/lilypond-git/stepmake/stepmake/generic-targets.make
286   /home/phil/lilypond-git/stepmake/stepmake/toplevel-targets.make
287   /home/phil/lilypond-git/stepmake/stepmake/po-targets.make
288   /home/phil/lilypond-git/stepmake/stepmake/install-targets.make
289 @end example
290
291 @file{lilypond-rules.make} is @code{#empty}
292
293 @file{generic-rules.make} does seem to have 2 rules in it.  They
294 are:
295
296 @example
297 $(outdir)/%.ly: %.lym4
298         $(M4) $< | sed "s/\`/,/g" > $@@
299
300 $(outdir)/%: %.in
301         rm -f $@@
302         cat $< | sed $(sed-atfiles) | sed $(sed-atvariables) > $@@
303 @end example
304
305 I believe the first rule is for *.ly files, and has a prerequisite
306 that *.lym4 files must be built first.  The recipe is @code{m4  |
307 sed "s/\`/,/g" >}.  Perhaps someone with more Unix/make knowledge
308 can comment on exactly what the rules mean/do.
309
310 @file{toplevel-rules.make} is @code{#empty}
311
312 @file{po-rules.make} is @code{#empty}
313
314 @file{install-rules.make} is @code{#empty}
315
316 @file{generic-targets.make} contains 2 lines of comments.
317
318 @file{lilypond-targets.make} contains only:
319
320 @example
321 ## TODO: fail dist or web if no \version present.
322 check-version:
323         grep -L version $(LY_FILES)
324 @end example
325
326 @file{stepmake/generic-targets.make} contains lots of rules - too
327 many to list here - it seems to be the main file for rules. (FWIW
328 I haven't actually found a rule for website: anywhere, although
329 it clearly exists.  I have also found that you can display a rule
330 in the terminal by typing, say @code{make -n website}.  This is
331 probably common knowledge.
332
333 @file{stepmake/toplevel-targets.make} adds a load of other (and
334 occasionally the same) rules to the gernric-targets.
335
336 @file{stepmake/po-targets.make} is rules for po* makes.
337
338 @file{stepmake/install-targets.make} has rules for local-install*.
339
340 And that's the end of stepmake.make.  Back to
341 @file{GNUmakefile.in}.
342
343 A bit more info from 27 March.  I've put some error traces into
344 @code{GNUmakefile} in the build directory, and it looks like the
345 following lines actually cause the make to run (putting an error
346 call above them - no make; below them - make):
347
348 @smallexample
349 ifeq ($(out),www)
350 # All web targets, except info image symlinks and info docs are
351 # installed in non-recursing target from TOP-SRC-DIR
352 install-WWW:
353         -$(INSTALL) -m 755 -d $(DESTDIR)$(webdir)
354         rsync -rl --exclude='*.signature' $(outdir)/offline-root $(DESTDIR)$(webdir)
355         $(MAKE) -C Documentation omf-local-install
356 @end smallexample
357
358 I don't currently understand the @code{ifeq}, since @code{$(out)}
359 is empty at this point, but the line starting @w{@code{-$(INSTALL)}}
360 translates to:
361
362 @example
363 -/usr/bin/python /home/phil/lilypond-git/stepmake/bin/install.py \
364   -c -m 755 -d /usr/local/share/doc/lilypond/html
365 @end example
366
367 End of work for Sunday 27th.
368
369 Another alterative approach to understanding the website build
370 would be to redirect @code{make -n website} and @code{make website}
371 to a text file and work through a) what it does and b) where the
372 errors are occurring.
373
374 GP: wow, all the above is much more complicated than I've ever
375 looked at stuff -- I tend to do a "back first" approach (where I
376 begin from the command-line that I want to modify, figure out
377 where it's generated, and then figure out how to change the
378 generated command-line), rather than a "front first" (where you
379 begin from the "make" command).
380
381
382 @node Doc build
383 @section Doc build
384
385 @menu
386 * The function of make doc::
387 * Building a bibliography::
388 @end menu
389
390 @node The function of make doc
391 @subsection The function of make doc
392
393 The following is a set of notes on how make doc functions.
394
395 Preliminary question to be answered some time: where do all the
396 GNUmakefiles come from.  They're in the build directory, but this
397 is not part of source.  Must be the configure script.  And it
398 looks like this comes from autogen.sh.  Must at some point kill
399 the whole git directory, repull and see what is created when.
400
401 Anyway, here's how make doc progresses:
402
403 This is the build dependency tree from
404 @file{stepmake/stepmake/generic-targets.make}:
405
406 @example
407 doc: doc-stage-1
408   doc-stage-1:
409         $(MAKE) -C $(depth)/scripts/build out=
410         $(MAKE) out=www WWW-1
411           WWW-1: local-WWW-1
412         $(LOOP)
413           $(MAKE) out=www WWW-2
414           WWW-2: local-WWW-2
415             $(LOOP)
416           $(MAKE) out=www WWW-post
417 @end example
418
419 @example
420 MAKE = make --no-builtin-rules
421 -C = Change to directory before make
422 @end example
423
424 doc-stage-1 does lots of opening and looking in files, but no
425 processing.
426
427 @example
428 Variable LOOP =
429
430 + make PACKAGE=LILYPOND package=lilypond -C python
431 && make PACKAGE=LILYPOND package=lilypond -C scripts
432 &&  make PACKAGE=LILYPOND package=lilypond -C flower
433 &&  make PACKAGE=LILYPOND package=lilypond -C lily
434 &&  make PACKAGE=LILYPOND package=lilypond -C mf
435 &&  make PACKAGE=LILYPOND package=lilypond -C ly
436 &&  make PACKAGE=LILYPOND package=lilypond -C tex
437 &&  make PACKAGE=LILYPOND package=lilypond -C ps
438 &&  make PACKAGE=LILYPOND package=lilypond -C scm
439 &&  make PACKAGE=LILYPOND package=lilypond -C po
440 &&  make PACKAGE=LILYPOND package=lilypond -C make
441 &&  make PACKAGE=LILYPOND package=lilypond -C elisp
442 &&  make PACKAGE=LILYPOND package=lilypond -C vim
443 &&  make PACKAGE=LILYPOND package=lilypond -C input
444 &&  make PACKAGE=LILYPOND package=lilypond -C stepmake
445 &&  make PACKAGE=LILYPOND package=lilypond -C Documentation
446 && true
447 @end example
448
449 From git grep:
450
451 stepmake/stepmake/generic-vars.make has this:
452
453 @smallexample
454 LOOP=+$(foreach i, $(SUBDIRS), $(MAKE) PACKAGE=$(PACKAGE) package=$(package) -C $(i) $@@ &&) true
455 @end smallexample
456
457 $@@ is the name of the target - WWW-1 in this case.
458
459 In GNUmakefile.in we find:
460
461 @example
462 SUBDIRS = python scripts \
463         flower lily \
464         mf ly \
465         tex ps scm \
466         po make \
467         elisp vim \
468         input \
469         stepmake $(documentation-dir)
470 @end example
471
472 So that's how we get the main make loop...
473
474 That loop expands like this:
475
476 @example
477 make PACKAGE=LILYPOND package=lilypond -C python WWW-1 &&
478 make PACKAGE=LILYPOND package=lilypond -C scripts WWW-1 &&
479 make PACKAGE=LILYPOND package=lilypond -C flower WWW-1 &&
480 make PACKAGE=LILYPOND package=lilypond -C lily WWW-1 &&
481 make PACKAGE=LILYPOND package=lilypond -C mf WWW-1 &&
482 make PACKAGE=LILYPOND package=lilypond -C ly WWW-1 &&
483 make PACKAGE=LILYPOND package=lilypond -C tex WWW-1 &&
484 make PACKAGE=LILYPOND package=lilypond -C ps WWW-1 &&
485 make PACKAGE=LILYPOND package=lilypond -C scm WWW-1 &&
486 make PACKAGE=LILYPOND package=lilypond -C po WWW-1 &&
487 make PACKAGE=LILYPOND package=lilypond -C make WWW-1 &&
488 make PACKAGE=LILYPOND package=lilypond -C elisp WWW-1 &&
489 make PACKAGE=LILYPOND package=lilypond -C vim WWW-1 &&
490 make PACKAGE=LILYPOND package=lilypond -C input WWW-1 &&
491 make PACKAGE=LILYPOND package=lilypond -C stepmake WWW-1 &&
492 make PACKAGE=LILYPOND package=lilypond -C Documentation WWW-1 &&
493 true
494 @end example
495
496 The directories up to and including vim produce no effect with
497 make in non-debug mode, although debug does show lots of action.
498
499 @file{git/build/input/GNUmakefile} is:
500
501 @example
502 depth=../
503 include $(depth)/config$(if $(conf),-$(conf),).make
504 include $(configure-srcdir)/./input/GNUmakefile
505 MODULE_INCLUDES += $(src-dir)/$(outbase)
506 @end example
507
508 The first include is:
509
510 @example
511 ..//config.make
512 @end example
513
514 (note the // which is strictly wrong)
515
516 which has lots of variables to set, but no action occurs.
517
518 The second is:
519
520 @example
521 lilypond-git/./input/GNUmakefile
522 @end example
523
524 which similarly doesn't create any actual action.
525
526 An error message at the end of build/input/GNUmakefile stops
527 make processing before it moves on to regression - so where does
528 that come from?
529
530 And the answer is - make processes all directories in the
531 directory it's entered (with some exceptions like out and out-www)
532 and so it changes to /regression.
533
534 It then seems to consider whether it needs to make/remake loads of
535 makefiles.  Don't understand this yet.  Possibly these are all the
536 makefiles it's processing, and it always checks they're up to date
537 before processing other files?
538
539 Could be correct - some of this output is:
540
541 @example
542 Must remake target `../../make/ly-inclusions.make'.
543 Failed to remake target file `../../make/ly-inclusions.make'.
544 @end example
545
546 Having decided that, it then leaves the directory and re-executes:
547
548 @example
549 make PACKAGE=LILYPOND package=lilypond -C regression WWW-1
550 @end example
551
552 The top of this make is:
553
554 @example
555 This program built for i486-pc-linux-gnu
556 Reading makefiles...
557 Reading makefile `GNUmakefile'...
558 Reading makefile `../..//config.make' (search path) (no ~ expansion)...
559 @end example
560
561 which looks like it's re-reading all its known makefiles to check
562 they're up to date.
563
564 (From the make manual:
565
566 To this end, after reading in all makefiles, make will consider each
567 as a goal target and attempt to update it. If a makefile has a rule
568 which says how to update it (found either in that very makefile or in
569 another one) or if an implicit rule applies to it (see Chapter 10
570 [Using Implicit Rules], page 103), it will be updated if
571 necessary. After all makefiles have been checked, if any have actually
572 been changed, make starts with a clean slate and reads all the
573 makefiles over again. (It will also attempt to update each of them
574 over again, but normally this will not change them again, since they
575 are already up to date.)
576
577 So my assumption seems correct)
578
579 There appear to be about 74 of them.  After all the makefile
580 checking, we get this:
581
582 @smallexample
583 Updating goal targets....
584 Considering target file `WWW-1'.
585 File `WWW-1' does not exist.
586 Considering target file `local-WWW-1'.
587 File `local-WWW-1' does not exist.
588 Considering target file `out-www/collated-files.texi'.
589 File `out-www/collated-files.texi' does not exist.
590 Looking for an implicit rule for `out-www/collated-files.texi'.
591 Trying pattern rule with stem `collated-files.texi'.
592 Trying implicit prerequisite `collated-files.texi.in'.
593 Trying pattern rule with stem `collated-files.texi'.
594 Trying implicit prerequisite `collated-files.texi.in'.
595 Trying pattern rule with stem `collated-files'.
596 Trying implicit prerequisite `collated-files.tely'.
597 Trying pattern rule with stem `collated-files'.
598 Trying implicit prerequisite `out-www/collated-files.tely'.
599 Trying rule prerequisite `out-www/version.itexi'.
600 Found prerequisite `out-www/version.itexi' as VPATH `/home/phil/lilypond-git/input/regression/out-www/version.itexi'
601 @end smallexample
602
603 grep finds this if searching for local-WWW-1:
604
605 @example
606 make/lysdoc-targets.make:
607   local-WWW-1: $(outdir)/collated-files.texi $(outdir)/collated-files.pdf
608 @end example
609
610 which means that local-WWW-1 depends on coll*.texi and coll*.pdf
611 and so these will need to be checked to see if they're up to date.
612 So make needs to find rules for both of those and (as it says) it
613 certainly needs to make coll*.texi, since it doesn't exist.
614
615 In ly-rules.make we have:
616
617 @example
618 .SUFFIXES: .doc .tely .texi .ly
619 @end example
620
621 which I'll work out at some point, and also this rule:
622
623 @smallexample
624 $(outdir)/%.texi: $(outdir)/%.tely $(outdir)/version.itexi $(DOCUMENTATION_LOCALE_TARGET) $(INIT_LY_SOURCES) $(SCHEME_SOURCES)
625   LILYPOND_VERSION=$(TOPLEVEL_VERSION) $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BOOK_PROCESS) $(LILYPOND_BOOK_INCLUDES) $(LILYPOND_BOOK_LILYPOND_FLAGS)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) $(LILYPOND_BOOK_FLAGS) $<
626 @end smallexample
627
628 Note that the recipe is a very long line - it could probably
629 benefit from splitting.  The same makefile also has:
630
631 @smallexample
632 $(outdir)/%.texi: $(outdir)/%.tely $(outdir)/version.itexi $(DOCUMENTATION_LOCALE_TARGET) $(INIT_LY_SOURCES) $(SCHEME_SOURCES)
633   LILYPOND_VERSION=$(TOPLEVEL_VERSION) $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BOOK_PROCESS) $(LILYPOND_BOOK_INCLUDES) $(LILYPOND_BOOK_LILYPOND_FLAGS)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) $(LILYPOND_BOOK_FLAGS) $<
634 @end smallexample
635
636 @noindent
637 which seems to be an almost exact duplicate.  Whatever, the first
638 one is executed first.  Have not checked if the second executes.
639
640 The first recipe translates as this:
641
642 @example
643 LILYPOND_VERSION=2.15.0 /usr/bin/python   --process=' ' \
644   --output=./out-www --format= --lily-output-dir \
645     /home/phil/lilypond-git/build/out/lybook-db
646 @end example
647
648 @noindent
649 if we stop the build with an $(error), but I think this is because
650 we need to allow it to process the dependencies first.  It looks
651 like foo.texi is shown as being dependent on foo.tely, plus a load
652 of other files.
653
654 @example
655 DOCUMENTATION_LOCALE_TARGET is blank
656 INIT_LY_SOURCES = /home/phil/lilypond-git/scm/auto-beam.scm \
657   /home/phil/lilypond-git/scm/autochange.scm
658 @end example
659
660 plus 10s (100s?) of other .scm files.
661
662 @example
663 SCHEME_SOURCES = /home/phil/lilypond-git/ly/Welcome-to-LilyPond-MacOS.ly \
664   /home/phil/lilypond-git/ly/Welcome_to_LilyPond.ly
665 @end example
666
667 ditto .ly files.  This does seem a teency bit wrong - it looks like
668 the .ly and .scm files have been interchanged.  ly-vars.make has
669 these 2 lines:
670
671 @example
672 INIT_LY_SOURCES = $(wildcard $(top-src-dir)/scm/*.scm)
673 SCHEME_SOURCES = $(wildcard $(top-src-dir)/ly/*.ly)
674 @end example
675
676 Looks like a bug.....
677
678 So it now works its way through all these files, checking if they
679 need to be remade.  This is 100s of lines of the debug listing,
680 although none in the normal list.  Clearly none has to be made
681 since they're source files.  It concludes:
682
683 @example
684 Must remake target `out-www/collated-files.tely'
685 @end example
686
687 @file{lysdoc-rules.make} has this:
688
689 @smallexample
690 $(outdir)/collated-files.tely: $(COLLATED_FILES)
691         $(LYS_TO_TELY) --name=$(outdir)/collated-files.tely --title="$(TITLE)" --author="$(AUTHOR)" $^
692 @end smallexample
693
694 @file{lysdoc-vars.make} has:
695
696 @example
697 COLLATED_FILES = $(sort $(TEXINFO_SOURCES) $(LY_FILES) $(OUT_LY_FILES) )
698 @end example
699
700 We find that:
701
702 @example
703 TEXINFO_SOURCES = AAA-intro-regression.tely
704 OUT_LY_FILES is empty
705 @end example
706
707 so LY_FILES has the big long list of all the .ly files in the
708 regression directory.
709
710 This kicks off
711
712 @example
713 /home/phil/lilypond-git/build/scripts/build/out/lys-to-tely
714 @end example
715
716 with a list of all the files in the regression test directory. This
717 should (I believe) create the file collated-files.tely.
718
719 So the next rule in make is for @file{version.itexi}, and make duly
720 checks this.  There's a rule in @file{doc-i18n-root-rules.make} that this
721 depends on @file{git/VERSION}:
722
723 @smallexample
724 $(outdir)/version.%: $(top-src-dir)/VERSION
725         $(PYTHON) $(top-src-dir)/scripts/build/create-version-itexi.py > $@
726 @end smallexample
727
728 This causes create-version-itexi.py to run and create
729 version.itexi.
730
731 Once that's done, all the other *.scm and *.ly files are checked
732 and since they have no rules associated, they aren't remade (just
733 as well for source files, really).  Since version.itexi was remade
734 make concludes that collated-files.texi must be remade.  To do
735 this, it runs lilypond-book.py on collated-files.tely, as below:
736
737 @example
738 LILYPOND_VERSION=2.15.0
739   /usr/bin/python
740   /home/phil/lilypond-git/scripts/lilypond-book.py
741     -I /home/phil/lilypond-git/input/regression/
742     -I ./out-www -I /home/phil/lilypond-git/input
743     -I /home/phil/lilypond-git/Documentation
744     -I /home/phil/lilypond-git/Documentation/snippets
745     -I /home/phil/lilypond-git/input/regression/
746     -I /home/phil/lilypond-git/Documentation/included/
747     -I /home/phil/lilypond-git/build/mf/out/
748     -I /home/phil/lilypond-git/build/mf/out/
749     -I /home/phil/lilypond-git/Documentation/pictures
750     -I /home/phil/lilypond-git/build/Documentation/pictures/./out-www
751     --process='/home/phil/lilypond-git/build/out/bin/lilypond
752     -I /home/phil/lilypond-git/input/regression/
753     -I ./out-www
754     -I /home/phil/lilypond-git/input
755     -I /home/phil/lilypond-git/Documentation
756     -I /home/phil/lilypond-git/Documentation/snippets
757     -I /home/phil/lilypond-git/input/regression/
758     -I /home/phil/lilypond-git/Documentation/included/
759     -I /home/phil/lilypond-git/build/mf/out/
760     -I /home/phil/lilypond-git/build/mf/out/
761     -I /home/phil/lilypond-git/Documentation/pictures
762     -I /home/phil/lilypond-git/build/Documentation/pictures/./out-www
763     -dbackend=eps
764     --formats=ps,png,pdf
765     -dinclude-eps-fonts
766     -dgs-load-fonts
767     --header=doctitle
768     --header=doctitlecs
769     --header=doctitlede
770     --header=doctitlees
771     --header=doctitlefr
772     --header=doctitlehu
773     --header=doctitleit
774     --header=doctitleja
775     --header=doctitlenl
776     --header=doctitlezh
777     --header=texidoc
778     --header=texidoccs
779     --header=texidocde
780     --header=texidoces
781     --header=texidocfr
782     --header=texidochu
783     --header=texidocit
784     --header=texidocja
785     --header=texidocnl
786     --header=texidoczh
787     -dcheck-internal-types
788     -ddump-signatures
789     -danti-alias-factor=2'
790     --output=./out-www
791     --format=texi-html
792     --verbose
793     --lily-output-dir /home/phil/lilypond-git/build/out/lybook-db
794     out-www/collated-files.tely
795 @end example
796
797 So - lilypond-book runs on:
798
799 @example
800 input/regression/out-www/collated-files.tely
801 @end example
802
803
804 Note the --verbose flag - this is from the make variable
805 LILYPOND_BOOK_VERBOSE which is added to the make variable
806 LILYPOND_BOOK_FLAGS.
807
808 Now found the invocation to write some of the image files.  It's
809 like this:
810
811 @example
812 /home/phil/lilypond-git/build/out/bin/lilypond
813   -I /home/phil/lilypond-git/input/regression/
814   -I ./out-www -I /home/phil/lilypond-git/input
815   -I /home/phil/lilypond-git/Documentation
816   -I /home/phil/lilypond-git/Documentation/snippets
817   -I /home/phil/lilypond-git/input/regression/
818   -I /home/phil/lilypond-git/Documentation/included/
819   -I /home/phil/lilypond-git/build/mf/out/
820   -I /home/phil/lilypond-git/build/mf/out/
821   -I /home/phil/lilypond-git/Documentation/pictures
822   -I /home/phil/lilypond-git/build/Documentation/pictures/./out-www
823   -dbackend=eps
824   --formats=ps,png,pdf
825   -dinclude-eps-fonts
826   -dgs-load-fonts
827   --header=doctitle
828   --header=doctitlecs
829   --header=doctitlede
830   --header=doctitlees
831   --header=doctitlefr
832   --header=doctitlehu
833   --header=doctitleit
834   --header=doctitleja
835   --header=doctitlenl
836   --header=doctitlezh
837   --header=texidoc
838   --header=texidoccs
839   --header=texidocde
840   --header=texidoces
841   --header=texidocfr
842   --header=texidochu
843   --header=texidocit
844   --header=texidocja
845   --header=texidocnl
846   --header=texidoczh
847   -dcheck-internal-types
848   -ddump-signatures
849   -danti-alias-factor=2
850   -I  "/home/phil/lilypond-git/build/out/lybook-db"
851   -I  "/home/phil/lilypond-git/build/input/regression"
852   -I  "/home/phil/lilypond-git/input/regression"
853   -I  "/home/phil/lilypond-git/build/input/regression/out-www"
854   -I  "/home/phil/lilypond-git/input"
855   -I  "/home/phil/lilypond-git/Documentation"
856   -I  "/home/phil/lilypond-git/Documentation/snippets"
857   -I  "/home/phil/lilypond-git/input/regression"
858   -I  "/home/phil/lilypond-git/Documentation/included"
859   -I  "/home/phil/lilypond-git/build/mf/out"
860   -I  "/home/phil/lilypond-git/build/mf/out"
861   -I  "/home/phil/lilypond-git/Documentation/pictures"
862   -I  "/home/phil/lilypond-git/build/Documentation/pictures/out-www"
863   --formats=eps
864   --verbose
865   -deps-box-padding=3.000000
866   -dread-file-list
867   -dno-strip-output-dir
868   "/home/phil/lilypond-git/build/out/lybook-db/snippet-names--415419468.ly"'
869 @end example
870
871 Note the --verbose.  This causes 100s of lines of Lily debug output.
872 But at present I can't work out where the flag comes from. Later.
873
874
875 @node Building a bibliography
876 @subsection Building a bibliography
877
878 Bibliography files contain a list of citations, like this:
879
880 @example
881 @@Book@{vinci,
882   author = @{Vinci, Albert C.@},
883   title = @{Fundamentals of Traditional Music Notation@},
884   publisher = @{Kent State University Press@},
885   year = @{1989@}
886 @}
887 @end example
888
889 There are a variety of types of citation (e.g. Book (as above),
890 article, publication).  Each cited publication has a list of
891 entries that can be used to identify the publication.
892 Bibliograpies are normally stored as files with a .bib
893 extension.  One part of the doc-build process is transforming the
894 bibliography information into @code{texinfo} files.  The commands
895 to do this are in the @file{GNUmakefile} in the
896 @file{Documentation} directory.
897
898 A typical line of the makefile to translate a single bibliography
899 is:
900
901 @example
902 $(outdir)/colorado.itexi:
903         BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \
904                 -s $(top-src-dir)/Documentation/lily-bib \
905                 -o $(outdir)/colorado.itexi \
906                 $(src-dir)/essay/colorado.bib
907 @end example
908
909 Line by line:
910
911 @example
912 $(outdir)/colorado.itexi:
913 @end example
914
915 We're making the file @file{colorado.itexi} and so this is the
916 make instruction.
917
918 @example
919         BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \
920 @end example
921
922 It's in the @file{essay} directory and we want to run the
923 bib2texi.py script against it.
924
925 @example
926                 -s $(top-src-dir)/Documentation/lily-bib \
927 @end example
928
929 The style template is @file{lily-bib.bst} and is found in the
930 @file{Documentation} directory.
931
932 @example
933                 -o $(outdir)/colorado.itexi \
934 @end example
935
936 The output file in @file{colorado.itexi}.
937
938 @example
939                 $(src-dir)/essay/colorado.bib
940 @end example
941
942 The input file is @file{colorado.bib} in the @file{essay}
943 directory.
944
945 The @code{bib2texi} Python script used to be used with a variety
946 of options, but now is always called using the same options, as
947 above.  Its job is to create the file containing the options for
948 @code{bibtex} (the program that actually does the translation),
949 run bibtex, and then clean up some temporary files.  Its main
950 "value add" is the creation of the options file, using this code:
951
952 @example
953 open (tmpfile + '.aux', 'w').write (r'''
954 \relax
955 \citation@{*@}
956 \bibstyle@{%(style)s@}
957 \bibdata@{%(files)s@}''' % vars ())
958 @end example
959
960 The key items are the style file (now always lily-bib for us) and
961 the input file.
962
963 The style file is written in its own specialised language,
964 described to some extent at
965
966 @example
967 @uref{http://amath.colorado.edu/documentation/LaTeX/reference/faq/bibtex.pdf}
968 @end example
969
970 The file @file{lily-bib.bst} also has fairly extensive commenting.
971
972
973 @node Website build
974 @section Website build
975
976 @warning{This information applies only to the standard @code{make
977 website} from the normal build directory.  The process is
978 different for @code{dev/website-build}.}
979
980 The rule for make website is found in GNUmakefile.in:
981
982 @example
983 website:
984 $(MAKE) config_make=$(config_make) \
985         top-src-dir=$(top-src-dir) \
986         -f $(top-src-dir)/make/website.make \
987         website
988 @end example
989
990 This translates as:
991
992 @example
993 make --no-builtin-rules config_make=./config.make \
994                 top-src-dir=/home/phil/lilypond-git \
995                 -f /home/phil/lilypond-git/make/website.make \
996                 website
997 @end example
998
999 which has the effect of setting the variables @code{config_make}
1000 and @code{top-src-dir} and then processing the file
1001 @code{git/make/website.make} with the target of website.
1002
1003 @code{website.make} starts with the following:
1004
1005 @example
1006 ifeq ($(WEBSITE_ONLY_BUILD),1)
1007 @end example
1008
1009 which checks to see whether the variable @code{WEBSITE_ONLY_BUILD}
1010 was set to one on the command line.  This is only done for
1011 standalone website builds, not in the normal case.  The result of
1012 the test determines the value of some variables that are set.  A
1013 number of other variables are set, in order to establish locations
1014 of various files.  An example is:
1015
1016 @example
1017 CREATE_VERSION=python $(script-dir)/create-version-itexi.py
1018 @end example
1019
1020 The rule for website is:
1021
1022 @smallexample
1023 website: website-texinfo website-css website-pictures website-examples web-post
1024         cp $(SERVER_FILES)/favicon.ico $(OUT)/website
1025         cp $(SERVER_FILES)/robots.txt $(OUT)/website
1026         cp $(top-htaccess) $(OUT)/.htaccess
1027         cp $(dir-htaccess) $(OUT)/website/.htaccess
1028 @end smallexample
1029
1030 so we see that this starts by running the rules for 5 other
1031 targets, then finishes by copying some files.  We'll cover that
1032 later - first @code{website-texinfo}.  That rule is:
1033
1034 @example
1035 website-texinfo: website-version website-xrefs website-bibs
1036         for l in '' $(WEB_LANGS); do \
1037                 if test -n "$$l"; then \
1038                         langopt=--lang="$$l"; \
1039                         langsuf=.$$l; \
1040                 fi; \
1041                 $(TEXI2HTML) --prefix=index \
1042                         --split=section \
1043                         --I=$(top-src-dir)/Documentation/"$$l" \
1044                         --I=$(top-src-dir)/Documentation \
1045                         --I=$(OUT) \
1046                         $$langopt \
1047                         --init-file=$(texi2html-init-file) \
1048                         -D web_version \
1049                         --output=$(OUT)/"$$l" \
1050                         $(top-src-dir)/Documentation/"$$l"/web.texi ; \
1051                 ls $(OUT)/$$l/*.html | xargs grep -L \
1052                         'UNTRANSLATED NODE: IGNORE ME' | \
1053                         sed 's!$(OUT)/'$$l'/!!g' | xargs \
1054                         $(MASS_LINK) --prepend-suffix="$$langsuf" \
1055                         hard $(OUT)/$$l/ $(OUT)/website/ ; \
1056         done
1057 @end example
1058
1059 which therefore depends on @code{website-version},
1060 @code{website-xrefs} and @code{website-bibs}.
1061
1062 @example
1063 website-version:
1064         mkdir -p $(OUT)
1065         $(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi
1066         $(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi
1067 @end example
1068
1069 which translates as:
1070
1071 @example
1072 mkdir -p out-website
1073 python /home/phil/lilypond-git/scripts/build/create-version-itexi.py
1074         /home/phil/lilypond-git > out-website/version.itexi
1075 python /home/phil/lilypond-git/scripts/build/create-weblinks-itexi.py
1076         /home/phil/lilypond-git > out-website/weblinks.itexi
1077 @end example
1078
1079 So, we make out-website then send the output of
1080 @code{create-version-itexi.py} to @code{out-website/version.itexi}
1081 and @code{create-weblinks-itexi.py} to
1082 @code{out-website/weblinks.itexi}.
1083
1084 @code{create-version-itexi.py} parses the file @code{VERSION} in
1085 the top source dir.  It contains:
1086
1087 @example
1088 PACKAGE_NAME=LilyPond
1089 MAJOR_VERSION=2
1090 MINOR_VERSION=15
1091 PATCH_LEVEL=13
1092 MY_PATCH_LEVEL=
1093 VERSION_STABLE=2.14.2
1094 VERSION_DEVEL=2.15.12
1095 @end example
1096
1097 currently.  @code{c-v-i.py} parses this to:
1098
1099 @example
1100 @@c ************************ Version numbers ************
1101 @@macro version
1102 2.15.13
1103 @@end macro
1104
1105 @@macro versionStable
1106 2.14.2
1107 @@end macro
1108
1109 @@macro versionDevel
1110 2.15.12
1111 @@end macro
1112 @end example
1113
1114 @code{create-weblinks-itexi.py} creates a load of texi macros (of
1115 the order of 1000) similar to:
1116
1117 @example
1118 @@macro manualStableGlossaryPdf
1119 @@uref@{../doc/v2.14/Documentation/music-glossary.pdf,Music glossary.pdf@}
1120 @@end macro.
1121 @end example
1122
1123 It loads its languages from langdefs.py, and therefore outputs the following unhelpful warning:
1124
1125 @code{langdefs.py: warning: lilypond-doc gettext domain not found.}
1126
1127 Next:
1128
1129 @example
1130 website-xrefs: website-version
1131         for l in '' $(WEB_LANGS); do \
1132 @end example
1133
1134 is the start of the rule, truncated for brevity.  This loops
1135 through the languages to be used on the website, processing some
1136 variables which I don't fully understand, to run this command:
1137
1138 @smallexample
1139 python /home/phil/lilypond-git/scripts/build/extract_texi_filenames.py \
1140         -I /home/phil/lilypond-git/Documentation \
1141         -I /home/phil/lilypond-git/Documentation/"$l" \
1142         -I out-website -o out-website --split=node \
1143         --known-missing-files= \
1144                  /home/phil/lilypond-git/scripts/build/website-known-missing-files.txt \
1145         -q \
1146         /home/phil/lilypond-git/Documentation/"$l"/web.texi ;\
1147 @end smallexample
1148
1149 There's a good description of what
1150 @code{extract_texi_filenames.py} does at the top of the script,
1151 but a shortened version is:
1152
1153 @code{If this script is run on a file texifile.texi, it produces
1154 a file texifile[.LANG].xref-map with tab-separated entries
1155 of the form NODE\tFILENAME\tANCHOR.}
1156
1157 An example from
1158 @code{web.nl.xref-map} is:
1159
1160 @example
1161 Inleiding        Introduction        Introduction
1162 @end example
1163
1164 @code{e-t-f.py} follows the includes from document to document.
1165 We know some have not been created yet, and
1166 @code{known-missing-files} option tells @code{e-t-f.py} which
1167 these are.
1168
1169 It then does this:
1170
1171 @example
1172 for m in $(MANUALS); do \
1173 @end example
1174
1175 to run @code{e-t-f.py} against all of the manuals, in each
1176 language. Next:
1177
1178 @example
1179 website-bibs: website-version
1180         BSTINPUTS=$(top-src-dir)/Documentation/web \
1181                 $(WEB_BIBS) -s web \
1182                 -s $(top-src-dir)/Documentation/lily-bib \
1183                 -o $(OUT)/others-did.itexi \
1184                 $(quiet-flag) \
1185                 $(top-src-dir)/Documentation/web/others-did.bib
1186 @end example
1187
1188 This is half the command.  It runs @code{bib2texi.py} on 2
1189 @code{.bib} files - @code{others-did.bib} and @code{we-wrote.bib}.
1190 This converts bibliography files into texi files with
1191 @code{bibtex}.
1192
1193 Next the commands in the @code{website-texinfo} rule are run:
1194
1195 @example
1196 for l in '' $(WEB_LANGS); do \
1197 @end example
1198
1199 run @code{texi2html}.  This is the program that outputs the
1200 progress message (found in
1201 @code{Documentation/lilypond-texi2html.init}):
1202
1203 @code{Processing web site: []}
1204
1205 It also outputs warning messages like:
1206
1207 @code{WARNING: Unable to find node 'ŘeÅ¡ení potíží' in book usage.}
1208
1209 @example
1210 website-css:
1211         cp $(top-src-dir)/Documentation/css/*.css $(OUT)/website
1212 @end example
1213
1214 Copies 3 css files to out-website/website.  Then:
1215
1216 @example
1217 website-pictures:
1218         mkdir -p $(OUT)/website/pictures
1219         if [ -d $(PICTURES) ]; \
1220         then \
1221                 cp $(PICTURES)/* $(OUT)/website/pictures ; \
1222                 ln -sf website/pictures $(OUT)/pictures  ;\
1223         fi
1224 @end example
1225
1226 which translates as:
1227
1228 @smallexample
1229 if [ -d Documentation/pictures/out-www ]; \
1230     then \
1231         cp Documentation/pictures/out-www/* out-website/website/pictures ; \
1232         ln -sf website/pictures out-website/pictures  ;\
1233     fi
1234 @end smallexample
1235
1236 i.e. it copies the contents of
1237 @code{build/Documentation/pictures/out-www/*} to
1238 @code{out-website/website/pictures}.  Unfortunately, the pictures
1239 are only created once @code{make doc} has been run, so an initial
1240 run of @code{make website} copies nothing, and the pictures on the
1241 website (e.g. the logo) do not exist.  Next:
1242
1243 @example
1244 website-examples:
1245         mkdir -p $(OUT)/website/ly-examples
1246         if [ -d $(EXAMPLES) ]; \
1247         then \
1248                 cp $(EXAMPLES)/* $(OUT)/website/ly-examples ; \
1249         fi
1250 @end example
1251
1252 translates to:
1253
1254 @smallexample
1255 mkdir -p out-website/website/ly-examples
1256 if [ -d Documentation/web/ly-examples/out-www ]; \
1257     then \
1258         cp Documentation/web/ly-examples/out-www/* out-website/website/ly-examples ; \
1259     fi
1260 @end smallexample
1261
1262 This does the same with the LilyPond examples (found at
1263 @uref{http://lilypond.org/examples.html}).  Again, these are
1264 actually only created by @code{make doc} (and since they are
1265 generated from LilyPond source files, require a working LilyPond
1266 @code{exe} made with @code{make}).  So this does nothing
1267 initially.  Then:
1268
1269 @example
1270 web-post:
1271         $(WEB_POST) $(OUT)/website
1272 @end example
1273
1274 which is:
1275
1276 @smallexample
1277 python /home/phil/lilypond-git/scripts/build/website_post.py out-website/website
1278 @end smallexample
1279
1280 which describes itself as:
1281
1282 @code{This is web_post.py. This script deals with translations
1283 in the "make website" target.}
1284
1285 It also does a number of other things, including adding the Google
1286 tracker code and the language selection footer.  We're now at
1287 the end of our story.  The final 4 lines of the recipe for website
1288 are:
1289
1290 @example
1291 cp $(SERVER_FILES)/favicon.ico $(OUT)/website
1292 cp $(SERVER_FILES)/robots.txt $(OUT)/website
1293 cp $(top-htaccess) $(OUT)/.htaccess
1294 cp $(dir-htaccess) $(OUT)/website/.htaccess
1295 @end example
1296
1297 The first translates as:
1298
1299 @smallexample
1300 cp /home/phil/lilypond-git/Documentation/web/server/favicon.ico out-website/website
1301 @end smallexample
1302
1303 so we see these are just copying the support files for the web
1304 server.
1305
1306 @subsubheading website.make summary
1307
1308 Recipes in @file{website.make}:
1309
1310 @itemize
1311
1312 @item
1313 @code{website:}
1314 this is the "master" rule.  It calls the other rules in order,
1315 then copies some extra files around - see below for further
1316 of the process it produces.
1317
1318 @item
1319 @code{website-version}:
1320 this calls the python scripts below:
1321 @itemize
1322 @item
1323 @example
1324 scripts/build/create-version-itexi.py
1325 @end example
1326
1327 This writes a @@version, @@versionStable, and @@versionDevel based
1328 on the top-level VERSIONS file, to
1329 @code{out-website/version.itexi}
1330
1331 @item
1332 @example
1333 scripts/build/create-weblinks-itexi.py
1334 @end example
1335
1336 This creates a ton of macros in @code{out-website/weblinks.itexi}.
1337 Stuff like @@downloadStableLinuxNormal, @@downloadStableWidows,
1338 @code{@@stableDocsNotationPdf@{@}}, @@downloadDevelSourch-zh.
1339
1340 It's quite monstrous because it deals with combinations of
1341 stable/devel, source/docs, lang/lang/lang*10, etc.
1342
1343 @end itemize
1344
1345 @item
1346 @code{website-xrefs:}
1347 creates files used for complicated "out-of-build" references to
1348 @code{out-website/*.xref-map}
1349
1350 If you just write @@ref@{@}, then all's groovy and we wouldn't
1351 need this.  But if you write @@rlearning@{@}, then our custom
1352 texi2html init file needs to know about our custom xref file
1353 format, which tells our custom texi2html init file how to create
1354 the link.
1355
1356 GP: we should have a separate @@node to discuss xrefs.  Also, take a
1357 quick look at a generated xref file -- it's basically just a list
1358 of @@node's [sic teenager pluralization rule] from the file.
1359
1360 @item
1361 @code{website-bib:}
1362 generates the bibliography texinfo files from the .bib files - in
1363 the case of the website build these are @file{others-did.bib} and
1364 @file{we-wrote.bib}.
1365
1366 @item
1367 @code{website-texinfo:}
1368 this is the main part; it calles texi2html to generate the actual
1369 html.  It also has a ton of options to texi2html to pass info to
1370 our custom init file.
1371
1372 The file actually built is called @file{web.texi}, and is either
1373 in the @file{Documentation} directory, or a sub-directory specific
1374 to the language.
1375
1376 The options file is @file{/Documentation/lilypond-texi2html.init}.
1377 This contains *lots* of option and configuration stuff, and also
1378 includes the line:
1379
1380 @smallexample
1381 print STDERR "Initializing settings for web site: [$Texi2HTML::THISDOC@{current_lang@}]\n";
1382 @end smallexample
1383
1384 This is where one of the console messages is generated.
1385
1386 We have somewhere between 2-4 different ways "to pass info to our
1387 custom init file".  This is highly Not Good (tm), but that's how
1388 things work at the moment.
1389
1390 After texi2html, it does some black magick to deal with
1391 untranslated nodes in the translations.  Despite writing that
1392 part, I can't remember how it works.  But in theory, you could
1393 figure it out by copy&pasting each part of the command (by "part",
1394 I mean "stuff before each | pipe"), substituting the variables,
1395 then looking at the text that's output.  For example,
1396
1397 @example
1398   ls $(OUT)/$$l/*.html
1399 @end example
1400
1401 is going to print a list of all html files, in all languages, in
1402 the build directory.  Then more stuff happens to each of those
1403 files (that's what xargs does).
1404
1405 @item
1406 @code{website-css:}
1407 just copies files to the build dir.
1408
1409 @item
1410 @code{website-pictures, website-examples:}
1411 more file copies, with an if statement to handle if you don't have
1412 any generated pictures/examples.
1413
1414 @item
1415 @code{web-post:}
1416 runs:
1417
1418 @example
1419 scripts/build/website_post.py
1420 @end example
1421
1422 which, it adds the "this page is translated in klingon" to the
1423 bottom of html pages, and adds the google analytics javascript.
1424 It also has hard-coded lilypond version numbers, which is Bad
1425 (tm).
1426
1427 @end itemize
1428
1429 Here's a summary of what gets called, in what order, when we run
1430 @code{make website}
1431
1432 @example
1433 website:
1434   website-texinfo:
1435     website-version:
1436       creates version.itexi and weblinks.itexi
1437     website-xrefs:
1438       runs extract_texi_filenames.py
1439     website-bibs:
1440       creates bibliography files, described above
1441   website-css:
1442     copies css files
1443   website-pictures:
1444     copies pictures
1445   website-examples:
1446     copies examples
1447   web-post:
1448     runs website_post.py
1449   Then some file copying
1450 @end example
1451
1452 @node Building an Ubuntu distro
1453 @section Building an Ubuntu distro
1454
1455
1456 Here's the short instruction on how to create lilybuntu iso image
1457 (Jonathan Kulp did this on a spare drive,
1458 but he supposes it can be done in a VM too):
1459
1460 @enumerate
1461
1462 @item
1463 Install ubuntu, reboot.
1464 @item
1465 Run all updates, reboot if asked.
1466 @item
1467 Enable src repos, refresh package lists.
1468 @item
1469 Install LilyPond build deps:
1470 @example
1471 sudo apt-get build-dep lilypond
1472 @end example
1473 @item
1474 Install git and autoconf:
1475 @example
1476 sudo apt-get install git-core gitk autoconf
1477 @end example
1478
1479 @item
1480 Test to see whether everything works fine now:
1481 @enumerate
1482 @item
1483 use @command{lily-git.tcl} to grab source files
1484 @item
1485 go to source dir and do
1486 @example
1487 "./autogen.sh" ; make ; make doc
1488 @end example
1489 @item
1490 if all compiles, move on to iso creation...
1491 @end enumerate
1492
1493 @item
1494 Download & install "remastersys":
1495 @uref{http://sourceforge.net/projects/remastersys/, http://sourceforge.net/projects/remastersys/}
1496 @item
1497 Copy @command{lily-git.tcl} script file into @file{/etc/skel/}.
1498 @item
1499 Modify @file{/etc/remastersys.conf} as desired (change @code{.iso} name,
1500 default live session username, etc).
1501 @item
1502 Remove non-essential desktop software as desired.
1503 @item
1504 Create iso:
1505 @example
1506 sudo remastersys dist
1507 @end example
1508 New iso is in @file{/home/remastersys/remastersys/}.
1509 @item
1510 Test iso by installing in VM and repeating steps above for
1511 getting source files and building lp and docs.
1512
1513 @end enumerate
1514
1515 @node Building GUB
1516 @section Building GUB
1517
1518 GUB - the Grand Unified Builder - is used to build the release
1519 versions of LilyPond.  For background information, see
1520 @ref{Grand Unified Builder (GUB)}.  The simplest way to set up a
1521 GUB build environment is to use a virtual machine with LilyDev
1522 (@ref{LilyDev}).  Follow the instructions on that page to set this
1523 up.  Make sure that your virtual machine has enough disk space -
1524 a GUB installation takes over 30 GBytes of disk space, and if you
1525 allocate too little, it will fail during the setting up stage and
1526 you will have to start again.  64 GBytes should be sufficient.
1527
1528 While GUB is being built, any interruptions are likely to make it
1529 almost impossible to restart.  If at all possible, leave the build
1530 to continue uniterrupted.
1531
1532 Download GUB and start the set up:
1533
1534 @example
1535 git clone git://github.com/gperciva/gub/gub.git
1536 cd gub
1537 make bootstrap
1538 @end example
1539
1540 This downloads and installs a number of packages.  You may find
1541 some fail during download and you will need to download them
1542 manually.  For example, the perl archive.  If this happens,
1543 download it from
1544 @uref{http://www.cpan.org/src/5.0/perl-5.10.0.tar.gz}, saving the
1545 archive to @file{gub/downloads/perl/}.  Continue the set up with:
1546
1547 @example
1548 make bootstrap
1549 @end example
1550
1551 Once this has completed successfully, you can build the LilyPond
1552 release package.  However, this uses an archived version of the
1553 regression tests, so it is better to download this first.
1554 Download the test output from lilypond.org:
1555
1556 @smallexample
1557 @uref{http://lilypond.org/download/binaries/test-output/lilypond-2.15.33-1.test-output.tar.bz2}
1558 @end smallexample
1559
1560 Copy the tarball into @file{gub/regtests/}, and tell the build
1561 system that you have done this:
1562
1563 @example
1564 touch regtests/ignore
1565 @end example
1566
1567 Now start the GUB build:
1568
1569 @example
1570 make lilypond
1571 @end example
1572
1573 That's it.  This will build LilyPond from current master.  To build
1574 the current unstable release, run:
1575
1576 @example
1577 make LILYPOND_BRANCH=release/unstable lilypond
1578 @end example