]> git.donarmstrong.com Git - lilypond.git/blob - debian/rules
remove lily/out/parser in rules too to avoid bison problems
[lilypond.git] / debian / rules
1 #!/usr/bin/make -f
2 # debian/rules for LilyPond in Debian.
3 #
4 # This is free software; see the GNU General Public Licence
5 # version 2 or later for copying conditions.  There is NO warranty.
6 #
7
8 export MAILADDRESS = lilypond@packages.debian.org
9
10 # fontconfig blows chunks if it can't write to $HOME; and some
11 # buildds set it to a bogus value.
12 export HOME = /tmp
13
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))
21 else
22 ifneq (,$(filter $(DEB_BUILD_OPTIONS),noopt))
23   config_opt = --disable-optimising
24 else
25   config_opt = --enable-optimising
26 endif
27 endif
28
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))))
32 endif
33
34 %:
35         dh $@ --parallel --with autotools-dev --with python2 --with quilt
36
37
38 ## we need to nuke the parser files, because if there is a mistmatch
39 ## between upstreams bison and our bison, the build will fail epically
40 override_dh_auto_configure:
41         rm -f lily/out/parser.*
42         dh_auto_configure -- --disable-checking --enable-debugging $(config_opt)
43
44 override_dh_auto_build-indep:
45         dh_auto_build
46         $(MAKE) doc $(DOC_OPTIONS)
47
48 override_dh_auto_install-indep:
49         $(MAKE) install-doc $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/
50         $(MAKE) install-info $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr
51         rm -rf $(CURDIR)/debian/tmp/usr/share/omf
52         rm -rf $(CURDIR)/debian/tmp/usr/share/doc/lilypond/html/input
53
54 ## Unfortunately, lilypond is kind of broken, and installs the wrong
55 ## info documentation (missing images) if we call their makefile
56 ## directly. They also don't provide an install rule which doesn't
57 ## install the documentation, which we don't care about for the
58 ## architecture dependent build
59 override_dh_auto_install-arch:
60         for dir in `echo */*makefile|xargs -n 1 dirname|grep -v Documentation`; do \
61                 $(MAKE) --no-builtin-rules PACKAGE=LILYPOND package=lilypond -C $$dir install $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/; \
62         done;
63
64 ## we need to nuke the parser files, because if there is a mistmatch
65 ## between upstreams bison and our bison, the build will fail epically
66 override_dh_auto_clean:
67         rm -f lily/out/parser.*
68         dh_auto_clean
69
70 ## we need to install only the png, jpg, css, ly and english html
71 ## files into the doc-html package, and only the english pdfs into the
72 ## doc-pdf package. Because dh_install doesn't support regexes, we'll
73 ## use find to replace the contents of the .install file before we
74 ## call dh_install
75 override_dh_install:
76         /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.ly\nusr/share/doc/lilypond/html/*/*/*.png' \
77                 > $(CURDIR)/debian/lilypond-doc-html.install
78         /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.jpg\nusr/share/doc/lilypond/html/*/*/*.css' \
79                 >> $(CURDIR)/debian/lilypond-doc-html.install
80         find $(CURDIR)/debian/tmp/ -type f \
81                 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.html' \
82                 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-html.install
83         /bin/echo -e ''> $(CURDIR)/debian/lilypond-doc-pdf.install
84         find $(CURDIR)/debian/tmp/ -type f \
85                 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.pdf' \
86                 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
87         find $(CURDIR)/debian/tmp/ -type f \
88                 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.preview.pdf' \
89                 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
90         dh_install --list-missing
91
92 override_dh_python2:
93         dh_python2
94         dh_python2 usr/share/lilypond/*/python/
95
96 override_dh_compress:
97         dh_compress -X.ly
98
99 override_dh_installdocs:
100         dh_installdocs
101         for a in $(wildcard $(CURDIR)/debian/*.doc-base-special); do \
102                 package=`basename $$a .doc-base-special`; \
103                 install -d debian/$$package/usr/share/doc-base; \
104                 install -m0644 $$a debian/$$package/usr/share/doc-base/$$package; \
105         done;
106
107 ## this rule will update debian/control and the per-language install
108 ## files; all of the files it generates/modifies should be included in
109 ## the Debian package and should not need to be regenerated or
110 ## modified.
111 update-doc-packages:
112         perl debian/update_doc_packages