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.
8 export MAILADDRESS = lilypond@packages.debian.org
10 # fontconfig blows chunks if it can't write to $HOME; and some
11 # buildds set it to a bogus value.
14 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
15 CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
16 CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
17 ifneq (,$(filter $(DEB_HOST_ARCH), i386 kfreebsd-i386))
18 config_opt = --disable-optimising
19 CFLAGS := $(filter-out -O%, $(CFLAGS))
20 CXXFLAGS := $(filter-out -O%, $(CXXFLAGS))
22 ifneq (,$(filter $(DEB_BUILD_OPTIONS),noopt))
23 config_opt = --disable-optimising
25 config_opt = --enable-optimising
29 DOC_OPTIONS := WEB_TARGETS="offline"
30 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
31 DOC_OPTIONS := $(DOC_OPTIONS) CPU_COUNT=$(firstword $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))))
35 dh $@ --parallel --with autotools-dev --with python2
38 override_dh_auto_configure:
39 dh_auto_configure -- --disable-checking --enable-debugging $(config_opt)
41 override_dh_auto_build-indep:
43 $(MAKE) doc $(DOC_OPTIONS)
45 override_dh_auto_install-indep:
46 $(MAKE) install-doc $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/
47 $(MAKE) install-info $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr
48 rm -rf $(CURDIR)/debian/tmp/usr/share/omf
49 rm -rf $(CURDIR)/debian/tmp/usr/share/doc/lilypond/html/input
51 ## Unfortunately, lilypond is kind of broken, and installs the wrong
52 ## info documentation (missing images) if we call their makefile
53 ## directly. They also don't provide an install rule which doesn't
54 ## install the documentation, which we don't care about for the
55 ## architecture dependent build
56 override_dh_auto_install-arch:
57 for dir in `echo */*makefile|xargs -n 1 dirname|grep -v Documentation`; do \
58 $(MAKE) --no-builtin-rules PACKAGE=LILYPOND package=lilypond -C $$dir install $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/; \
62 ## we need to install only the png, jpg, css, ly and english html
63 ## files into the doc-html package, and only the english pdfs into the
64 ## doc-pdf package. Because dh_install doesn't support regexes, we'll
65 ## use find to replace the contents of the .install file before we
68 /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.ly\nusr/share/doc/lilypond/html/*/*/*.png' \
69 > $(CURDIR)/debian/lilypond-doc-html.install
70 /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.jpg\nusr/share/doc/lilypond/html/*/*/*.css' \
71 >> $(CURDIR)/debian/lilypond-doc-html.install
72 find $(CURDIR)/debian/tmp/ -type f \
73 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.html' \
74 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-html.install
75 /bin/echo -e ''> $(CURDIR)/debian/lilypond-doc-pdf.install
76 find $(CURDIR)/debian/tmp/ -type f \
77 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.pdf' \
78 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
79 find $(CURDIR)/debian/tmp/ -type f \
80 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.preview.pdf' \
81 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
82 dh_install --list-missing
86 dh_python2 usr/share/lilypond/*/python/
91 override_dh_installdocs:
93 for a in $(wildcard $(CURDIR)/debian/*.doc-base-special); do \
94 package=`basename $$a .doc-base-special`; \
95 install -d debian/$$package/usr/share/doc-base; \
96 install -m0644 $$a debian/$$package/usr/share/doc-base/$$package; \
99 ## this rule will update debian/control and the per-language install
100 ## files; all of the files it generates/modifies should be included in
101 ## the Debian package and should not need to be regenerated or
104 perl debian/update_doc_packages