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