1 @c -*- coding: utf-8; mode: texinfo; -*-
4 @node Build system notes
5 @chapter Build system notes
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
12 * Build system overview::
13 * Tips for working on the build system::
14 * General build system notes::
17 * Building an Ubuntu distro::
21 @node Build system overview
22 @section Build system overview
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.
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.
35 Fundamentally, a build system does two things:
39 Constructs command-line commands, for example:
43 --tons --of --options \
46 --more --imperial --and --metric --tons --of --options \
51 If there was a previous build, it decides which parts of the
52 system need to be rebuilt.
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
61 @node Tips for working on the build system
62 @section Tips for working on the build system
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.
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
81 $(error Some Text to display)
84 This will stop make running and print the text @code{Some Text to
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
99 @node General build system notes
100 @section General build system notes
103 * How stepmake works::
106 @node How stepmake works
107 @subsection How stepmake works
109 Typing make website runs the file @file{GNUmakefile} from the
110 build directory. This only contains 3 lines:
114 include config$(if $(conf),-$(conf),).make
115 include $(configure-srcdir)/GNUmakefile.in
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. The
121 second runs the file @file{GNUmakefile.in} from the top level
124 This sets another load of variables, and then includes (i.e.
125 immediately runs) @file{stepmake.make} from the @file{make}
126 subdirectory. This sets a load of other variables, does some
127 testing to see if SCONS (another build tool?) is being used, and
128 then runs @file{make/config.make} - which doesn't seem to exist...
130 GP: scons is indeed a different build tool; I think that Jan
131 experimented with it 5 years ago or something. It seems like we
132 still have bits and pieces of it floating around.
134 Next, it runs @file{make/toplevel-version.make}, which sets the
135 version variables for major, minor, patch, stable, development and
136 mypatchlevel (which seems to be used for patch numbers for
137 non-stable versions only?).
139 Next - @file{make/local.make}, which doesn't exist.
141 Then a few more variable and the interesting comment:
144 # Don't try to outsmart us, you puny computer!
145 # Well, UGH. This only removes builtin rules from
148 and then tests to see whether BUILTINS_REMOVED is defined. It
149 appears to be when I run make, and so
150 @file{stepmake/stepmake/no-builtin-rules.make} is run. The
151 comment at the head of this file says:
154 # UGH. GNU make comes with implicit rules.
155 # We don't want any of them, and can't force users to run
159 I've not studied that file at length, but assume it removes all
160 make's build-in rules (e.g. @file{*.c} files are run through the
161 GNU C compiler) - there's a lot of them in here, and a lot of
162 comments, and I'd guess most of it isn't needed.
164 We return to @file{stepmake.make}, where we hit the make rule all:
165 The first line of this is:
168 -include $(addprefix $(depth)/make/,$(addsuffix -inclusions.make, $(LOCALSTEPMAKE_TEMPLATES)))
171 which, when the variables are substituted, gives:
174 ./make/generic-inclusions.make
175 ./make/lilypond-inclusions.make.
178 (Note - according to the make documentation, -include is only
179 different from include in that it doesn't produce any kind of
180 error message when the included file doesn't exist).
182 And the first file doesn't exist. Nor the second. Next:
185 -include $(addprefix $(stepdir)/,$(addsuffix -inclusions.make, $(STEPMAKE_TEMPLATES)))
188 which expands to the following files:
191 /home/phil/lilypond-git/stepmake/stepmake/generic-inclusions.make
192 /home/phil/lilypond-git/stepmake/stepmake/toplevel-inclusions.make
193 /home/phil/lilypond-git/stepmake/stepmake/po-inclusions.make
194 /home/phil/lilypond-git/stepmake/stepmake/install-inclusions.make.
197 One little feature to notice here - these are all absolute file
198 locations - the line prior to this used relative locations. And
199 none of these files exist, either. (Further note - I'm assuming
200 all these lines of make I'm following are autogenerated, but
201 that'll be something else to discover.)
203 Next in @file{stepmake.make}:
206 include $(addprefix $(stepdir)/,$(addsuffix -vars.make, $(STEPMAKE_TEMPLATES)))
212 /home/phil/lilypond-git/stepmake/stepmake/generic-vars.make
213 /home/phil/lilypond-git/stepmake/stepmake/toplevel-vars.make
214 /home/phil/lilypond-git/stepmake/stepmake/po-vars.make
215 /home/phil/lilypond-git/stepmake/stepmake/install-vars.make.
218 Woo. They all exist (they should as there's no - in front of the
219 include). @file{generic-vars.make} sets loads of variables
220 (funnily enough). @file{toplevel-vars.make} is very short - one
221 line commented as @code{# override Generic_vars.make:} and 2 as
226 include $(stepdir)/documentation-vars.make
229 I assume the urg comment refers to the fact that this should
230 really just create more variables, but it actually sends us off to
231 @file{/home/phil/lilypond-git/stepmake/stepmake/documentation-vars.make}.
233 That file is a 3 line variable setting one.
235 @file{po-vars.make} has the one-line comment @code{# empty}, as
236 does @file{install-vars.make}.
238 So now we're back to @file{stepmake.make}.
243 # ugh. need to do this because of PATH :=$(top-src-dir)/..:$(PATH)
244 include $(addprefix $(depth)/make/,$(addsuffix -vars.make, $(LOCALSTEPMAKE_TEMPLATES)))
247 and the include expands to:
250 include ./make/generic-vars.make ./make/lilypond-vars.make.
253 These again set variables, and in some cases export them to allow
254 child @code{make} processes to use them.
256 The final 4 lines of @file{stepmake.make} are:
259 include $(addprefix $(depth)/make/,$(addsuffix -rules.make, $(LOCALSTEPMAKE_TEMPLATES)))
260 include $(addprefix $(stepdir)/,$(addsuffix -rules.make, $(STEPMAKE_TEMPLATES)))
261 include $(addprefix $(depth)/make/,$(addsuffix -targets.make, $(LOCALSTEPMAKE_TEMPLATES)))
262 include $(addprefix $(stepdir)/,$(addsuffix -targets.make, $(STEPMAKE_TEMPLATES)))
265 which expand as follows:
268 include ./make/generic-rules.make ./make/lilypond-rules.make
270 /home/phil/lilypond-git/stepmake/stepmake/generic-rules.make
271 /home/phil/lilypond-git/stepmake/stepmake/toplevel-rules.make
272 /home/phil/lilypond-git/stepmake/stepmake/po-rules.make
273 /home/phil/lilypond-git/stepmake/stepmake/install-rules.make
274 include ./make/generic-targets.make ./make/lilypond-targets.make
276 /home/phil/lilypond-git/stepmake/stepmake/generic-targets.make
277 /home/phil/lilypond-git/stepmake/stepmake/toplevel-targets.make
278 /home/phil/lilypond-git/stepmake/stepmake/po-targets.make
279 /home/phil/lilypond-git/stepmake/stepmake/install-targets.make
282 @file{lilypond-rules.make} is @code{#empty}
284 @file{generic-rules.make} does seem to have 2 rules in it. They
288 $(outdir)/%.ly: %.lym4
289 $(M4) $< | sed "s/\`/,/g" > $@
293 cat $< | sed $(sed-atfiles) | sed $(sed-atvariables) > $@
296 I believe the first rule is for *.ly files, and has a prerequisite
297 that *.lym4 files must be built first. The recipe is @code{m4 |
298 sed "s/\`/,/g" >}. Perhaps someone with more Unix/make knowledge
299 can comment on exactly what the rules mean/do.
301 @file{toplevel-rules.make} is @code{#empty}
303 @file{po-rules.make} is @code{#empty}
305 @file{install-rules.make} is @code{#empty}
307 @file{generic-targets.make} contains 2 lines of comments.
309 @file{lilypond-targets.make} contains only:
312 ## TODO: fail dist or web if no \version present.
314 grep -L version $(LY_FILES)
317 @file{stepmake/generic-targets.make} contains lots of rules - too
318 many to list here - it seems to be the main file for rules. (FWIW
319 I haven't actually found a rule for website: anywhere, although
320 it clearly exists. I have also found that you can display a rule
321 in the terminal by typing, say @code{make -n website}. This is
322 probably common knowledge.
324 @file{stepmake/toplevel-targets.make} adds a load of other (and
325 occasionally the same) rules to the gernric-targets.
327 @file{stepmake/po-targets.make} is rules for po* makes.
329 @file{stepmake/install-targets.make} has rules for local-install*.
331 And that's the end of stepmake.make. Back to
332 @file{GNUmakefile.in}.
334 A bit more info from 27 March. I've put some error traces into
335 @code{GNUmakefile} in the build directory, and it looks like the
336 following lines actually cause the make to run (putting an error
337 call above them - no make; below them - make):
341 # All web targets, except info image symlinks and info docs are
342 # installed in non-recursing target from TOP-SRC-DIR
344 -$(INSTALL) -m 755 -d $(DESTDIR)$(webdir)
345 rsync -rl --exclude='*.signature' $(outdir)/offline-root $(DESTDIR)$(webdir)
346 $(MAKE) -C Documentation omf-local-install
349 I don't currently understand the @code{ifeq}, since @code{$(out)}
350 is empty at this point, but the line starting @code{-$(INSTALL)}
354 -/usr/bin/python /home/phil/lilypond-git/stepmake/bin/install.py -c -m 755 -d /usr/local/share/doc/lilypond/html
357 End of work for Sunday 27th.
359 Another alterative approach to understanding the website build
360 would be to redirect @code{make -n website} and @code{make website}
361 to a text file and work through a) what it does and b) where the
362 errors are occurring.
364 GP: wow, all the above is much more complicated than I've ever
365 looked at stuff -- I tend to do a "back first" approach (where I
366 begin from the command-line that I want to modify, figure out
367 where it's generated, and then figure out how to change the
368 generated command-line), rather than a "front first" (where you
369 begin from the "make" command).
376 * The function of make doc::
377 * Building a bibliography::
380 @node The function of make doc
381 @subsection The function of make doc
383 The following is a set of notes on how make doc functions.
385 Preliminary question to be answered some time: where do all the
386 GNUmakefiles come from. They're in the build directory, but this
387 is not part of source. Must be the configure script. And it
388 looks like this comes from autogen.sh. Must at some point kill
389 the whole git directory, repull and see what is created when.
391 Anyway, here's how make doc progresses:
393 This is the build dependency tree from
394 @file{stepmake/stepmake/generic-targets.make}:
399 $(MAKE) -C $(depth)/scripts/build out=
400 $(MAKE) out=www WWW-1
403 $(MAKE) out=www WWW-2
406 $(MAKE) out=www WWW-post
410 MAKE = make --no-builtin-rules
411 -C = Change to directory before make
414 doc-stage-1 does lots of opening and looking in files, but no
420 + make PACKAGE=LILYPOND package=lilypond -C python
421 && make PACKAGE=LILYPOND package=lilypond -C scripts
422 && make PACKAGE=LILYPOND package=lilypond -C flower
423 && make PACKAGE=LILYPOND package=lilypond -C lily
424 && make PACKAGE=LILYPOND package=lilypond -C mf
425 && make PACKAGE=LILYPOND package=lilypond -C ly
426 && make PACKAGE=LILYPOND package=lilypond -C tex
427 && make PACKAGE=LILYPOND package=lilypond -C ps
428 && make PACKAGE=LILYPOND package=lilypond -C scm
429 && make PACKAGE=LILYPOND package=lilypond -C po
430 && make PACKAGE=LILYPOND package=lilypond -C make
431 && make PACKAGE=LILYPOND package=lilypond -C elisp
432 && make PACKAGE=LILYPOND package=lilypond -C vim
433 && make PACKAGE=LILYPOND package=lilypond -C input
434 && make PACKAGE=LILYPOND package=lilypond -C stepmake
435 && make PACKAGE=LILYPOND package=lilypond -C Documentation
441 stepmake/stepmake/generic-vars.make has this:
444 LOOP=+$(foreach i, $(SUBDIRS), $(MAKE) PACKAGE=$(PACKAGE) package=$(package) -C $(i) $@ &&) true
447 $@ is the name of the target - WWW-1 in this case.
449 In GNUmakefile.in we find:
452 SUBDIRS = python scripts \
459 stepmake $(documentation-dir)
462 So that's how we get the main make loop...
464 That loop expands like this:
467 make PACKAGE=LILYPOND package=lilypond -C python WWW-1 &&
468 make PACKAGE=LILYPOND package=lilypond -C scripts WWW-1 &&
469 make PACKAGE=LILYPOND package=lilypond -C flower WWW-1 &&
470 make PACKAGE=LILYPOND package=lilypond -C lily WWW-1 &&
471 make PACKAGE=LILYPOND package=lilypond -C mf WWW-1 &&
472 make PACKAGE=LILYPOND package=lilypond -C ly WWW-1 &&
473 make PACKAGE=LILYPOND package=lilypond -C tex WWW-1 &&
474 make PACKAGE=LILYPOND package=lilypond -C ps WWW-1 &&
475 make PACKAGE=LILYPOND package=lilypond -C scm WWW-1 &&
476 make PACKAGE=LILYPOND package=lilypond -C po WWW-1 &&
477 make PACKAGE=LILYPOND package=lilypond -C make WWW-1 &&
478 make PACKAGE=LILYPOND package=lilypond -C elisp WWW-1 &&
479 make PACKAGE=LILYPOND package=lilypond -C vim WWW-1 &&
480 make PACKAGE=LILYPOND package=lilypond -C input WWW-1 &&
481 make PACKAGE=LILYPOND package=lilypond -C stepmake WWW-1 &&
482 make PACKAGE=LILYPOND package=lilypond -C Documentation WWW-1 &&
486 The directories up to and including vim produce no effect with
487 make in non-debug mode, although debug does show lots of action.
489 @file{git/build/input/GNUmakefile} is:
493 include $(depth)/config$(if $(conf),-$(conf),).make
494 include $(configure-srcdir)/./input/GNUmakefile
495 MODULE_INCLUDES += $(src-dir)/$(outbase)
498 The first include is:
504 (note the // which is strictly wrong)
506 which has lots of variables to set, but no action occurs.
511 lilypond-git/./input/GNUmakefile
514 which similarly doesn't create any actual action.
516 An error message at the end of build/input/GNUmakefile stops
517 make processing before it moves on to regression - so where does
520 And the answer is - make processes all directories in the
521 directory it's entered (with some exceptions like out and out-www)
522 and so it changes to /regression.
524 It then seems to consider whether it needs to make/remake loads of
525 makefiles. Don't understand this yet. Possibly these are all the
526 makefiles it's processing, and it always checks they're up to date
527 before processing other files?
529 Could be correct - some of this output is:
532 Must remake target `../../make/ly-inclusions.make'.
533 Failed to remake target file `../../make/ly-inclusions.make'.
536 Having decided that, it then leaves the directory and re-executes:
539 make PACKAGE=LILYPOND package=lilypond -C regression WWW-1
542 The top of this make is:
545 This program built for i486-pc-linux-gnu
547 Reading makefile `GNUmakefile'...
548 Reading makefile `../..//config.make' (search path) (no ~ expansion)...
551 which looks like it's re-reading all its known makefiles to check
554 (From the make manual:
556 To this end, after reading in all makefiles, make will consider each as a goal target and
557 attempt to update it. If a makefile has a rule which says how to update it (found either
558 in that very makefile or in another one) or if an implicit rule applies to it (see Chapter 10
559 [Using Implicit Rules], page 103), it will be updated if necessary. After all makefiles have
560 been checked, if any have actually been changed, make starts with a clean slate and reads
561 all the makefiles over again. (It will also attempt to update each of them over again, but
562 normally this will not change them again, since they are already up to date.)
564 So my assumption seems correct)
566 There appear to be about 74 of them. After all the makefile
567 checking, we get this:
570 Updating goal targets....
571 Considering target file `WWW-1'.
572 File `WWW-1' does not exist.
573 Considering target file `local-WWW-1'.
574 File `local-WWW-1' does not exist.
575 Considering target file `out-www/collated-files.texi'.
576 File `out-www/collated-files.texi' does not exist.
577 Looking for an implicit rule for `out-www/collated-files.texi'.
578 Trying pattern rule with stem `collated-files.texi'.
579 Trying implicit prerequisite `collated-files.texi.in'.
580 Trying pattern rule with stem `collated-files.texi'.
581 Trying implicit prerequisite `collated-files.texi.in'.
582 Trying pattern rule with stem `collated-files'.
583 Trying implicit prerequisite `collated-files.tely'.
584 Trying pattern rule with stem `collated-files'.
585 Trying implicit prerequisite `out-www/collated-files.tely'.
586 Trying rule prerequisite `out-www/version.itexi'.
587 Found prerequisite `out-www/version.itexi' as VPATH `/home/phil/lilypond-git/input/regression/out-www/version.itexi'
590 grep finds this if searching for local-WWW-1:
593 make/lysdoc-targets.make:
594 local-WWW-1: $(outdir)/collated-files.texi $(outdir)/collated-files.pdf
597 which means that local-WWW-1 depends on coll*.texi and coll*.pdf
598 and so these will need to be checked to see if they're up to date.
599 So make needs to find rules for both of those and (as it says) it
600 certainly needs to make coll*.texi, since it doesn't exist.
602 In ly-rules.make we have:
605 .SUFFIXES: .doc .tely .texi .ly
608 which I'll work out at some point, and also this rule:
611 $(outdir)/%.texi: $(outdir)/%.tely $(outdir)/version.itexi $(DOCUMENTATION_LOCALE_TARGET) $(INIT_LY_SOURCES) $(SCHEME_SOURCES)
612 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) $<
615 Note that the recipe is a very long line - it could probably
616 benefit from splitting. The same makefile also has:
619 $(outdir)/%.texi: $(outdir)/%.tely $(outdir)/version.itexi $(DOCUMENTATION_LOCALE_TARGET) $(INIT_LY_SOURCES) $(SCHEME_SOURCES)
620 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 which seems to be an almost exact duplicate. Whatever, the first
625 one is executed first. Have not checked if the second executes.
627 The first recipe translates as this:
630 LILYPOND_VERSION=2.15.0 /usr/bin/python --process=' ' --output=./out-www --format= --lily-output-dir /home/phil/lilypond-git/build/out/lybook-db
634 if we stop the build with an $(error), but I think this is because
635 we need to allow it to process the dependencies first. It looks
636 like foo.texi is shown as being dependent on foo.tely, plus a load
640 DOCUMENTATION_LOCALE_TARGET is blank
641 INIT_LY_SOURCES = /home/phil/lilypond-git/scm/auto-beam.scm /home/phil/lilypond-git/scm/autochange.scm
644 plus 10s (100s?) of other .scm files.
647 SCHEME_SOURCES = /home/phil/lilypond-git/ly/Welcome-to-LilyPond-MacOS.ly /home/phil/lilypond-git/ly/Welcome_to_LilyPond.ly
650 ditto .ly files. This does seem a teency bit wrong - it looks like
651 the .ly and .scm files have been interchanged. ly-vars.make has
655 INIT_LY_SOURCES = $(wildcard $(top-src-dir)/scm/*.scm)
656 SCHEME_SOURCES = $(wildcard $(top-src-dir)/ly/*.ly)
659 Looks like a bug.....
661 So it now works its way through all these files, checking if they
662 need to be remade. This is 100s of lines of the debug listing,
663 although none in the normal list. Clearly none has to be made
664 since they're source files. It concludes:
667 Must remake target `out-www/collated-files.tely'
670 @file{lysdoc-rules.make} has this:
673 $(outdir)/collated-files.tely: $(COLLATED_FILES)
674 $(LYS_TO_TELY) --name=$(outdir)/collated-files.tely --title="$(TITLE)" --author="$(AUTHOR)" $^
677 @file{lysdoc-vars.make} has:
680 COLLATED_FILES = $(sort $(TEXINFO_SOURCES) $(LY_FILES) $(OUT_LY_FILES) )
686 TEXINFO_SOURCES = AAA-intro-regression.tely
687 OUT_LY_FILES is empty
690 so LY_FILES has the big long list of all the .ly files in the
691 regression directory.
696 /home/phil/lilypond-git/build/scripts/build/out/lys-to-tely
699 with a list of all the files in the regression test directory. This
700 should (I believe) create the file collated-files.tely.
702 So the next rule in make is for @file{version.itexi}, and make duly
703 checks this. There's a rule in @file{doc-i18n-root-rules.make} that this
704 depends on @file{git/VERSION}:
707 $(outdir)/version.%: $(top-src-dir)/VERSION
708 $(PYTHON) $(top-src-dir)/scripts/build/create-version-itexi.py > $@
711 This causes create-version-itexi.py to run and create
714 Once that's done, all the other *.scm and *.ly files are checked
715 and since they have no rules associated, they aren't remade (just
716 as well for source files, really). Since version.itexi was remade
717 make concludes that collated-files.texi must be remade. To do
718 this, it runs lilypond-book.py on collated-files.tely, as below:
721 LILYPOND_VERSION=2.15.0
723 /home/phil/lilypond-git/scripts/lilypond-book.py
724 -I /home/phil/lilypond-git/input/regression/
725 -I ./out-www -I /home/phil/lilypond-git/input
726 -I /home/phil/lilypond-git/Documentation
727 -I /home/phil/lilypond-git/Documentation/snippets
728 -I /home/phil/lilypond-git/input/regression/
729 -I /home/phil/lilypond-git/Documentation/included/
730 -I /home/phil/lilypond-git/build/mf/out/
731 -I /home/phil/lilypond-git/build/mf/out/
732 -I /home/phil/lilypond-git/Documentation/pictures
733 -I /home/phil/lilypond-git/build/Documentation/pictures/./out-www
734 --process='/home/phil/lilypond-git/build/out/bin/lilypond
735 -I /home/phil/lilypond-git/input/regression/
737 -I /home/phil/lilypond-git/input
738 -I /home/phil/lilypond-git/Documentation
739 -I /home/phil/lilypond-git/Documentation/snippets
740 -I /home/phil/lilypond-git/input/regression/
741 -I /home/phil/lilypond-git/Documentation/included/
742 -I /home/phil/lilypond-git/build/mf/out/
743 -I /home/phil/lilypond-git/build/mf/out/
744 -I /home/phil/lilypond-git/Documentation/pictures
745 -I /home/phil/lilypond-git/build/Documentation/pictures/./out-www
770 -dcheck-internal-types
772 -danti-alias-factor=2'
776 --lily-output-dir /home/phil/lilypond-git/build/out/lybook-db
777 out-www/collated-files.tely
780 So - lilypond-book runs on:
783 input/regression/out-www/collated-files.tely
787 Note the --verbose flag - this is from the make variable
788 LILYPOND_BOOK_VERBOSE which is added to the make variable
791 Now found the invocation to write some of the image files. It's
795 /home/phil/lilypond-git/build/out/bin/lilypond
796 -I /home/phil/lilypond-git/input/regression/
797 -I ./out-www -I /home/phil/lilypond-git/input
798 -I /home/phil/lilypond-git/Documentation
799 -I /home/phil/lilypond-git/Documentation/snippets
800 -I /home/phil/lilypond-git/input/regression/
801 -I /home/phil/lilypond-git/Documentation/included/
802 -I /home/phil/lilypond-git/build/mf/out/
803 -I /home/phil/lilypond-git/build/mf/out/
804 -I /home/phil/lilypond-git/Documentation/pictures
805 -I /home/phil/lilypond-git/build/Documentation/pictures/./out-www
830 -dcheck-internal-types
832 -danti-alias-factor=2
833 -I "/home/phil/lilypond-git/build/out/lybook-db"
834 -I "/home/phil/lilypond-git/build/input/regression"
835 -I "/home/phil/lilypond-git/input/regression"
836 -I "/home/phil/lilypond-git/build/input/regression/out-www"
837 -I "/home/phil/lilypond-git/input"
838 -I "/home/phil/lilypond-git/Documentation"
839 -I "/home/phil/lilypond-git/Documentation/snippets"
840 -I "/home/phil/lilypond-git/input/regression"
841 -I "/home/phil/lilypond-git/Documentation/included"
842 -I "/home/phil/lilypond-git/build/mf/out"
843 -I "/home/phil/lilypond-git/build/mf/out"
844 -I "/home/phil/lilypond-git/Documentation/pictures"
845 -I "/home/phil/lilypond-git/build/Documentation/pictures/out-www"
848 -deps-box-padding=3.000000
850 -dno-strip-output-dir
851 "/home/phil/lilypond-git/build/out/lybook-db/snippet-names--415419468.ly"'
854 Note the --verbose. This causes 100s of lines of Lily debug output.
855 But at present I can't work out where the flag comes from. Later.
858 @node Building a bibliography
859 @subsection Building a bibliography
861 Bibliography files contain a list of citations, like this:
865 author = @{Vinci, Albert C.@},
866 title = @{Fundamentals of Traditional Music Notation@},
867 publisher = @{Kent State University Press@},
872 There are a variety of types of citation (e.g. Book (as above),
873 article, publication). Each cited publication has a list of
874 entries that can be used to identify the publication.
875 Bibliograpies are normally stored as files with a .bib
876 extension. One part of the doc-build process is transforming the
877 bibliography information into @code{texinfo} files. The commands
878 to do this are in the @file{GNUmakefile} in the
879 @file{Documentation} directory.
881 A typical line of the makefile to translate a single bibliography
885 $(outdir)/colorado.itexi:
886 BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \
887 -s $(top-src-dir)/Documentation/lily-bib \
888 -o $(outdir)/colorado.itexi \
889 $(src-dir)/essay/colorado.bib
895 $(outdir)/colorado.itexi:
898 We're making the file @file{colorado.itexi} and so this is the
902 BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \
905 It's in the @file{essay} directory and we want to run the
906 bib2texi.py script against it.
909 -s $(top-src-dir)/Documentation/lily-bib \
912 The style template is @file{lily-bib.bst} and is found in the
913 @file{Documentation} directory.
916 -o $(outdir)/colorado.itexi \
919 The output file in @file{colorado.itexi}.
922 $(src-dir)/essay/colorado.bib
925 The input file is @file{colorado.bib} in the @file{essay}
928 The @code{bib2texi} Python script used to be used with a variety
929 of options, but now is always called using the same options, as
930 above. Its job is to create the file containing the options for
931 @code{bibtex} (the program that actually does the translation),
932 run bibtex, and then clean up some temporary files. Its main
933 "value add" is the creation of the options file, using this code:
936 open (tmpfile + '.aux', 'w').write (r'''
939 \bibstyle@{%(style)s@}
940 \bibdata@{%(files)s@}''' % vars ())
943 The key items are the style file (now always lily-bib for us) and
946 The style file is written in its own specialised language,
947 described to some extent at
950 @uref{http://amath.colorado.edu/documentation/LaTeX/reference/faq/bibtex.pdf}
953 The file @file{lily-bib.bst} also has fairly extensive commenting.
956 @section Website build
958 Start here: @file{make/website.make}
960 The overall build system begins with @ref{How stepmake works}.
961 Summary: when you type @code{make website} this ends up running
962 @file{GNUmakefile.in} in the @file{git} directory. Right at the
963 bottom, this has the lines:
966 # we want this separate for security; see CG 4.2. -gp
968 $(MAKE) config_make=$(config_make) \
969 top-src-dir=$(top-src-dir) \
970 -f $(top-src-dir)/make/website.make \
974 On my system this expands to:
977 make --no-builtin-rules config_make=./config.make \
978 top-src-dir=/home/phil/lilypond-git \
979 -f /home/phil/lilypond-git/make/website.make \
983 We see that the @code{$(MAKE)} expands to
984 @code{make --no-builtin-rules} which is how @code{MAKE} is
985 defined higher up the makefile. The -f switch defines the
986 makefile to be used - in this case
987 @file{git/make/website.make}. That's where all the action
990 We believe that note that *none* of the variables that
991 are loaded (from depth to version numbers to whatever) are used in
992 @file{website.make}. Instead, @file{website.make} sets up its own
993 variables at the top of the file. If you're wondering if there's
994 some smart reason for this, then the answer is "no". It's because
995 I (GP) didn't know/trust the original variables when I was writing
998 Website build includes @ref{Building a bibliography}.
1000 @subsubheading Output from @code{make -n website}
1002 Sorry, including this output directly produces problems in the
1003 build system. Please run:
1006 make -n website &> my-file.txt
1009 to see the full output from the make.
1011 @subsubheading website.make variables
1013 The file begins by setting up some variables. These
1014 may/might/probably mirror existing variables, but lacking any docs
1015 about those variables, I thought it would be simpler to keep
1016 everything in the same file.
1018 Note that for security reasons, we @strong{don't} call scripts in
1019 the git dir when building on the web server. See @ref{Uploading
1020 and security}. So we definitely want to keep those definitions
1021 for the WEBSITE_ONLY_BUILD.
1023 After some split WEBSITE_ONLY_BUILD vs. normal build definitions,
1024 there's another bunch of lines setting up generic variables.
1026 @subsubheading website.make building parts
1028 Parts of @file{website.make}:
1034 this is the "master" rule. It calls the other rules in order,
1035 then copies some extra files around - see below for further
1036 of the process it produces.
1039 @code{website-version}:
1040 this calls the python scripts below:
1045 scripts/build/create-version-itexi.py
1048 This writes a @@version, @@versionStable, and @@versionDevel based
1049 on the top-level VERSIONS file, to
1050 @code{out-website/version.itexi}
1054 scripts/build/create-weblinks-itexi.py
1057 This creates a ton of macros in @code{out-website/weblinks.itexi}.
1058 Stuff like @@downloadStableLinuxNormal, @@downloadStableWidows,
1059 @code{@@stableDocsNotationPdf@{@}}, @@downloadDevelSourch-zh.
1061 It's quite monstrous because it deals with combinations of
1062 stable/devel, source/docs, lang/lang/lang*10, etc.
1068 @code{website-xrefs:}
1069 creates files used for complicated "out-of-build" references to
1070 @code{out-website/*.xref-map}
1072 If you just write @@ref@{@}, then all's groovy and we wouldn't
1073 need this. But if you write @@rlearning@{@}, then our custom
1074 texi2html init file needs to know about our custom xref file
1075 format, which tells our custom texi2html init file how to create
1078 GP: we should have a separate @@node to discuss xrefs. Also, take a
1079 quick look at a generated xref file -- it's basically just a list
1080 of @@node's [sic teenager pluralization rule] from the file.
1084 generates the bibliography texinfo files from the .bib files - in
1085 the case of the website build these are @file{others-did.bib} and
1086 @file{we-wrote.bib}.
1089 @code{website-texinfo:}
1090 this is the main part; it calles texi2html to generate the actual
1091 html. It also has a ton of options to texi2html to pass info to
1092 our custom init file.
1094 The file actually built is called @file{web.texi}, and is either
1095 in the @file{Documentation} directory, or a sub-directory specific
1098 The options file is @file{/Documentation/lilypond-texi2html.init}.
1099 This contains *lots* of option and configuration stuff, and also
1103 print STDERR "Initializing settings for web site: [$Texi2HTML::THISDOC@{current_lang@}]\n";
1106 This is where one of the console messages is generated.
1108 We have somewhere between 2-4 different ways "to pass info to our
1109 custom init file". This is highly Not Good (tm), but that's how
1110 things work at the moment.
1112 After texi2html, it does some black magick to deal with
1113 untranslated nodes in the translations. Despite writing that
1114 part, I can't remember how it works. But in theory, you could
1115 figure it out by copy&pasting each part of the command (by "part",
1116 I mean "stuff before each | pipe"), substituting the variables,
1117 then looking at the text that's output. For example,
1120 ls $(OUT)/$$l/*.html
1123 is going to print a list of all html files, in all languages, in
1124 the build directory. Then more stuff happens to each of those
1125 files (that's what xargs does).
1129 just copies files to the build dir.
1132 @code{website-pictures, website-examples:}
1133 more file copies, with an if statement to handle if you don't have
1134 any generated pictures/examples.
1141 scripts/build/website_post.py
1144 which, it adds the "this page is translated in klingon" to the
1145 bottom of html pages, and adds the google analytics javascript.
1146 It also has hard-coded lilypond version numbers, which is Bad
1151 Here's a summary of what gets called, in what order, when we run
1158 creates version.itexi and weblinks.itexi
1160 runs extract_texi_filenames.py
1162 creates bibliography files, described above
1170 runs website_post.py
1171 Then some file copying
1174 @node Building an Ubuntu distro
1175 @section Building an Ubuntu distro
1178 Here's the short instruction on how to create lilybuntu iso image
1179 (Jonathan Kulp did this on a spare drive,
1180 but he supposes it can be done in a VM too):
1185 Install ubuntu, reboot.
1187 Run all updates, reboot if asked.
1189 Enable src repos, refresh package lists.
1191 Install LilyPond build deps:
1193 sudo apt-get build-dep lilypond
1196 Install git and autoconf:
1198 sudo apt-get install git-core gitk autoconf
1202 Test to see whether everything works fine now:
1205 use @command{lily-git.tcl} to grab source files
1207 go to source dir and do
1209 "./autogen.sh" ; make ; make doc
1212 if all compiles, move on to iso creation...
1216 Download & install "remastersys":
1217 @uref{http://sourceforge.net/projects/remastersys/, http://sourceforge.net/projects/remastersys/}
1219 Copy @command{lily-git.tcl} script file into @file{/etc/skel/}.
1221 Modify @file{/etc/remastersys.conf} as desired (change @code{.iso} name,
1222 default live session username, etc).
1224 Remove non-essential desktop software as desired.
1228 sudo remastersys dist
1230 New iso is in @file{/home/remastersys/remastersys/}.
1232 Test iso by installing in VM and repeating steps above for
1233 getting source files and building lp and docs.