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