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 GUILE_LOAD_PATH="$(GUILE_LOAD_PATH)" \
103 dh_auto_configure -- --disable-checking --enable-debugging $(config_opt)
105 override_dh_auto_build-indep:
106 dh_auto_build -i -O--parallel
107 $(MAKE) doc $(DOC_OPTIONS)
109 ## Unfortunately, lilypond is kind of broken, and installs the wrong
110 ## info documentation (missing images) if we call their makefile
111 ## directly. They also don't provide an install rule which doesn't
112 ## install the documentation, which we don't care about for the
113 ## architecture dependent build
114 override_dh_auto_install-arch: debian/lilypond.sh debian/lilypond-invoke-editor.sh
115 for dir in `echo */*makefile|xargs -n 1 dirname|grep -v Documentation`; do \
116 $(MAKE) --no-builtin-rules PACKAGE=LILYPOND package=lilypond -C $$dir install $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/; \
118 sed -i -e '1s!$(CURDIR)/out/guile/usr/bin/guile!/usr/bin/guile!' \
119 debian/tmp/usr/bin/lilypond-invoke-editor
121 ## We need the non-Documentation arch-independent files installed by
122 ## the arch-dependent "$(MAKE) install" too, hence the dependency
123 ## on override_dh_auto_install-arch
124 override_dh_auto_install-indep: override_dh_auto_install-arch debian/guile.reloc
125 $(MAKE) install-doc $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr/
126 $(MAKE) install-info $(DOC_OPTIONS) prefix=$(CURDIR)/debian/tmp/usr
127 rm -rf $(CURDIR)/debian/tmp/usr/share/omf
128 rm -rf $(CURDIR)/debian/tmp/usr/share/doc/lilypond/html/input
129 perl debian/move_info_images_from_html_doc $(CURDIR)/debian/tmp/usr/share/info/ $(CURDIR)/debian/tmp/usr/share/doc/lilypond/html/Documentation/
130 perl debian/symlink_html_images_to_info_images $(CURDIR)/debian/tmp/usr/share/info/lilypond
131 perl debian/remove_w3c_callback $(CURDIR)/debian/tmp/usr/share/doc/lilypond/ $(CURDIR)/debian/tmp/usr/share/info/
133 ## we need to nuke the parser files, because if there is a mismatch
134 ## between upstreams bison and our bison, the build will fail epically
135 override_dh_auto_clean:
136 [ ! -f guile18/Makefile ] || $(MAKE) -C guile18 maintainer-clean
137 rm -f lily/out/parser.*
138 dh_auto_clean --no-parallel
140 override_dh_install-arch:
141 dh_install -a -O--parallel --list-missing
143 ## we need to install only the png, jpg, css, ly and english html
144 ## files into the doc-html package, and only the english pdfs into the
145 ## doc-pdf package. Because dh_install doesn't support regexes, we'll
146 ## use find to replace the contents of the .install file before we
148 override_dh_install-indep:
149 /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.ly\nusr/share/doc/lilypond/html/*/*/*.png' \
150 > $(CURDIR)/debian/lilypond-doc-html.install
151 /bin/echo -e 'usr/share/doc/lilypond/html/*/*/*.jpg\nusr/share/doc/lilypond/html/*/*/*.css' \
152 >> $(CURDIR)/debian/lilypond-doc-html.install
153 find $(CURDIR)/debian/tmp/ -type f \
154 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.html' \
155 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-html.install
156 /bin/echo -e ''> $(CURDIR)/debian/lilypond-doc-pdf.install
157 find $(CURDIR)/debian/tmp/ -type f \
158 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.pdf' \
159 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
160 find $(CURDIR)/debian/tmp/ -type f \
161 -regex '.*usr/share/doc/lilypond/.*/[^\.]+.preview.pdf' \
162 -printf '%P\n' >> $(CURDIR)/debian/lilypond-doc-pdf.install
163 dh_install -i -O--parallel --list-missing
167 dh_python2 --verbose usr/share/lilypond/$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_LEVEL)/python/
169 override_dh_compress:
170 dh_compress -X.ly -X.pdf
172 override_dh_installdocs:
174 for a in $(wildcard $(CURDIR)/debian/*.doc-base-special); do \
175 package=`basename $$a .doc-base-special`; \
176 install -d debian/$$package/usr/share/doc-base; \
177 install -m0644 $$a debian/$$package/usr/share/doc-base/$$package; \
180 override_dh_shlibdeps-arch:
181 $(eval unexport LD_LIBRARY_PATH)
182 dh_shlibdeps -a -O--parallel -lusr/lib/$(DEB_HOST_MULTIARCH)/lilypond/$(LILYPOND_VERSION)/guile
184 # Skip tests for architecture-dependent-only build because
185 # the test would fail without built documentation.
186 override_dh_auto_test-arch:
188 override_dh_auto_test-indep:
189 ifeq (,$(filter $(DEB_BUILD_OPTIONS),nocheck))
190 $(MAKE) test-baseline
194 ## this rule will update debian/control and the per-language install
195 ## files; all of the files it generates/modifies should be included in
196 ## the Debian package and should not need to be regenerated or
199 perl debian/update_doc_packages