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 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
14 CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
15 CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
16 ifneq (,$(filter $(DEB_HOST_ARCH), i386 kfreebsd-i386))
17 config_opt = --disable-optimising
18 CFLAGS := $(filter-out -O%, $(CFLAGS))
19 CXXFLAGS := $(filter-out -O%, $(CXXFLAGS))
21 ifneq (,$(filter $(DEB_BUILD_OPTIONS),noopt))
22 config_opt = --disable-optimising
24 config_opt = --enable-optimising
28 DOC_OPTIONS := WEB_TARGETS="offline"
29 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
30 DOC_OPTIONS := $(DOC_OPTIONS) CPU_COUNT=$(firstword $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))))
31 guile_make_args := -j$(firstword $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))))
34 ########################################################################
35 # START: Definitions from the old guile-1.8 (1.8.8+1-10) package
36 ########################################################################
38 # These are used for cross-compiling and for saving the configure script
39 # from having to guess our platform (since we know it already)
40 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
41 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
43 ifeq (alpha,$(shell dpkg-architecture -qDEB_HOST_ARCH))
44 # The -O2 option breaks make check on alpha right now.
45 guile_deb_cflags := -Os -g
46 else ifeq (sh4,$(shell dpkg-architecture -qDEB_HOST_ARCH))
47 # Renesas SH(sh4) needs -mieee. Without it, test-conversion fails.
49 guile_deb_cflags := -O2 -g -mieee
51 guile_deb_cflags := -O2 -g
54 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
57 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
61 guile_configure_args = \
62 --host=$(DEB_HOST_GNU_TYPE) \
63 --build=$(DEB_BUILD_GNU_TYPE) \
65 --disable-error-on-warning \
68 ifeq (hurd-i386,$(shell dpkg-architecture -qDEB_HOST_ARCH))
69 guile_configure_args += LIBS=-lpthread
72 ########################################################################
73 # END: Definitions from the old guile-1.8 (1.8.8+1-10) package
74 ########################################################################
76 export PATH := $(CURDIR)/out/guile/usr/bin:$(PATH)
77 export LD_LIBRARY_PATH := $(CURDIR)/out/guile/usr/lib:$(LD_LIBRARY_PATH)
78 export GUILE_LOAD_PATH := $(CURDIR)/out/guile/usr/share/guile/1.8
79 export LILYPOND_VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_LEVEL)
83 -e 's!@LILYPOND_VERSION@!$(LILYPOND_VERSION)!g'
87 -e 's!@DEB_HOST_MULTIARCH@!$(DEB_HOST_MULTIARCH)!g' \
88 -e 's!@LILYPOND_VERSION@!$(LILYPOND_VERSION)!g'
91 dh $@ --parallel --with autotools-dev --with python2 --with quilt
93 ## we need to nuke the parser files, because if there is a mismatch
94 ## between upstreams bison and our bison, the build will fail epically
95 override_dh_auto_configure:
96 $(eval unexport GUILE_LOAD_PATH)
97 cd guile18 && ./autogen.sh
98 cd guile18 && CFLAGS="$(guile_deb_cflags)" ./configure ${guile_configure_args}
99 cd guile18 && $(MAKE) ${guile_make_args}
100 $(MAKE) -C guile18 install DESTDIR=$(CURDIR)/out/guile
101 rm -f lily/out/parser.*
102 ./autogen.sh --noconfigure
103 GUILE_LOAD_PATH="$(GUILE_LOAD_PATH)" \
104 dh_auto_configure -- --disable-checking --enable-debugging $(config_opt)
106 override_dh_auto_build-indep:
107 dh_auto_build -i -O--parallel
108 $(MAKE) doc $(DOC_OPTIONS)
110 ## Unfortunately, lilypond is kind of broken, and installs the wrong
111 ## info documentation (missing images) if we call their makefile
112 ## directly. They also don't provide an install rule which doesn't
113 ## install the documentation, which we don't care about for the
114 ## architecture dependent build
115 override_dh_auto_install-arch: debian/lilypond.sh debian/lilypond-invoke-editor.sh
116 for dir in `echo */*makefile|xargs -n 1 dirname|grep -v Documentation`; do \
117 $(MAKE) --no-builtin-rules PACKAGE=LILYPOND package=lilypond -C $$dir install $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/; \
119 sed -i -e '1s!$(CURDIR)/out/guile/usr/bin/guile!/usr/bin/guile!' \
120 debian/tmp/usr/bin/lilypond-invoke-editor
122 ## We need the non-Documentation arch-independent files installed by
123 ## the arch-dependent "$(MAKE) install" too, hence the dependency
124 ## on override_dh_auto_install-arch
125 override_dh_auto_install-indep: override_dh_auto_install-arch debian/guile.reloc
126 $(MAKE) install-doc $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/
127 $(MAKE) install-info $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr
128 rm -rf $(CURDIR)/debian/tmp/usr/share/omf
129 rm -rf $(CURDIR)/debian/tmp/usr/share/doc/lilypond/html/input
130 perl debian/move_info_images_from_html_doc $(CURDIR)/debian/tmp/usr/share/info/ $(CURDIR)/debian/tmp/usr/share/doc/lilypond/html/Documentation/
131 perl debian/symlink_html_images_to_info_images $(CURDIR)/debian/tmp/usr/share/info/lilypond
132 perl debian/remove_w3c_callback $(CURDIR)/debian/tmp/usr/share/doc/lilypond/ $(CURDIR)/debian/tmp/usr/share/info/
134 ## we need to nuke the parser files, because if there is a mismatch
135 ## between upstreams bison and our bison, the build will fail epically
136 override_dh_auto_clean:
137 [ ! -f guile18/Makefile ] || $(MAKE) -C guile18 maintainer-clean
138 rm -f lily/out/parser.*
139 dh_auto_clean --no-parallel
141 override_dh_install-arch:
142 dh_install -a -O--parallel --list-missing
144 ## we need to install only the png, jpg, css, ly and english html
145 ## files into the doc-html package, and only the english pdfs into the
146 ## doc-pdf package. Because dh_install doesn't support regexes, we'll
147 ## use find to replace the contents of the .install file before we
149 override_dh_install-indep:
150 /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.ly\nusr/share/doc/lilypond/html/*/*/*.png' \
151 > $(CURDIR)/debian/lilypond-doc-html.install
152 /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.jpg\nusr/share/doc/lilypond/html/*/*/*.css' \
153 >> $(CURDIR)/debian/lilypond-doc-html.install
154 find $(CURDIR)/debian/tmp/ -type f \
155 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.html' \
156 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-html.install
157 /bin/echo -e ''> $(CURDIR)/debian/lilypond-doc-pdf.install
158 find $(CURDIR)/debian/tmp/ -type f \
159 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.pdf' \
160 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
161 find $(CURDIR)/debian/tmp/ -type f \
162 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.preview.pdf' \
163 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
164 dh_install -i -O--parallel --list-missing
168 dh_python2 --verbose usr/share/lilypond/$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_LEVEL)/python/
170 override_dh_compress:
171 dh_compress -X.ly -X.pdf
173 override_dh_installdocs:
175 for a in $(wildcard $(CURDIR)/debian/*.doc-base-special); do \
176 package=`basename $$a .doc-base-special`; \
177 install -d debian/$$package/usr/share/doc-base; \
178 install -m0644 $$a debian/$$package/usr/share/doc-base/$$package; \
181 override_dh_shlibdeps-arch:
182 $(eval unexport LD_LIBRARY_PATH)
183 dh_shlibdeps -a -O--parallel -lusr/lib/$(DEB_HOST_MULTIARCH)/lilypond/$(LILYPOND_VERSION)/guile
185 # Skip tests for architecture-dependent-only build because
186 # the test would fail without built documentation.
187 override_dh_auto_test-arch:
189 override_dh_auto_test-indep:
190 ifeq (,$(filter $(DEB_BUILD_OPTIONS),nocheck))
191 $(MAKE) test-baseline
195 ## this rule will update debian/control and the per-language install
196 ## files; all of the files it generates/modifies should be included in
197 ## the Debian package and should not need to be regenerated or
200 perl debian/update_doc_packages