2 # debian/rules for LilyPond in Debian.
4 # This is free software; see the GNU General Public Licence
5 # version 2 or later for copying conditions. There is NO warranty.
10 export MAILADDRESS = lilypond@packages.debian.org
12 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
13 CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
14 CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
15 ifneq (,$(filter $(DEB_HOST_ARCH), i386 kfreebsd-i386))
16 config_opt = --disable-optimising
17 CFLAGS := $(filter-out -O%, $(CFLAGS))
18 CXXFLAGS := $(filter-out -O%, $(CXXFLAGS))
20 ifneq (,$(filter $(DEB_BUILD_OPTIONS),noopt))
21 config_opt = --disable-optimising
23 config_opt = --enable-optimising
27 DOC_OPTIONS := WEB_TARGETS="offline"
28 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
29 DOC_OPTIONS := $(DOC_OPTIONS) CPU_COUNT=$(firstword $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))))
33 dh $@ --parallel --with autotools-dev --with python2 --with quilt
35 ## we need to nuke the parser files, because if there is a mismatch
36 ## between upstreams bison and our bison, the build will fail epically
37 override_dh_auto_configure:
38 rm -f lily/out/parser.*
39 ./autogen.sh --noconfigure
40 dh_auto_configure -- --disable-checking --enable-debugging --enable-guile2 $(config_opt)
42 override_dh_auto_build-indep:
43 dh_auto_build -i -O--parallel
44 $(MAKE) doc $(DOC_OPTIONS)
46 ## Unfortunately, lilypond is kind of broken, and installs the wrong
47 ## info documentation (missing images) if we call their makefile
48 ## directly. They also don't provide an install rule which doesn't
49 ## install the documentation, which we don't care about for the
50 ## architecture dependent build
51 override_dh_auto_install-arch:
52 for dir in `echo */*makefile|xargs -n 1 dirname|grep -v Documentation`; do \
53 $(MAKE) --no-builtin-rules PACKAGE=LILYPOND package=lilypond -C $$dir install $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/; \
56 ## We need the non-Documentation arch-independent files installed by
57 ## the arch-dependent "$(MAKE) install" too, hence the dependency
58 ## on override_dh_auto_install-arch
59 override_dh_auto_install-indep: override_dh_auto_install-arch
60 $(MAKE) install-doc $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/
61 $(MAKE) install-info $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr
62 rm -rf $(CURDIR)/debian/tmp/usr/share/omf
63 rm -rf $(CURDIR)/debian/tmp/usr/share/doc/lilypond/html/input
64 perl debian/move_info_images_from_html_doc $(CURDIR)/debian/tmp/usr/share/info/ $(CURDIR)/debian/tmp/usr/share/doc/lilypond/html/Documentation/
65 perl debian/symlink_html_images_to_info_images $(CURDIR)/debian/tmp/usr/share/info/lilypond
66 perl debian/remove_w3c_callback $(CURDIR)/debian/tmp/usr/share/doc/lilypond/ $(CURDIR)/debian/tmp/usr/share/info/
68 ## we need to nuke the parser files, because if there is a mismatch
69 ## between upstreams bison and our bison, the build will fail epically
70 override_dh_auto_clean:
71 rm -f lily/out/parser.*
72 dh_auto_clean --no-parallel
74 override_dh_install-arch:
75 dh_install -a -O--parallel --list-missing
77 ## we need to install only the png, jpg, css, ly and english html
78 ## files into the doc-html package, and only the english pdfs into the
79 ## doc-pdf package. Because dh_install doesn't support regexes, we'll
80 ## use find to replace the contents of the .install file before we
82 override_dh_install-indep:
83 /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.ly\nusr/share/doc/lilypond/html/*/*/*.png' \
84 > $(CURDIR)/debian/lilypond-doc-html.install
85 /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.jpg\nusr/share/doc/lilypond/html/*/*/*.css' \
86 >> $(CURDIR)/debian/lilypond-doc-html.install
87 find $(CURDIR)/debian/tmp/ -type f \
88 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.html' \
89 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-html.install
90 /bin/echo -e ''> $(CURDIR)/debian/lilypond-doc-pdf.install
91 find $(CURDIR)/debian/tmp/ -type f \
92 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.pdf' \
93 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
94 find $(CURDIR)/debian/tmp/ -type f \
95 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.preview.pdf' \
96 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
97 dh_install -i -O--parallel --list-missing
101 dh_python2 --verbose usr/share/lilypond/$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_LEVEL)/python/
103 override_dh_compress:
104 dh_compress -X.ly -X.pdf
106 override_dh_installdocs:
108 for a in $(wildcard $(CURDIR)/debian/*.doc-base-special); do \
109 package=`basename $$a .doc-base-special`; \
110 install -d debian/$$package/usr/share/doc-base; \
111 install -m0644 $$a debian/$$package/usr/share/doc-base/$$package; \
114 override_dh_auto_test:
115 ifneq (,$(filter $(DEB_BUILD_OPTIONS),nocheck))
116 $(MAKE) test-baseline
120 ## this rule will update debian/control and the per-language install
121 ## files; all of the files it generates/modifies should be included in
122 ## the Debian package and should not need to be regenerated or
125 perl debian/update_doc_packages