source: grub-pc/trunk/fuentes/debian/rules @ 23

Last change on this file since 23 was 23, checked in by mabarracus, 4 years ago

disable update po files to allow perfect build

  • Property svn:executable set to *
File size: 20.9 KB
Line 
1#!/usr/bin/make -f
2SHELL           := bash
3
4deb_version             := $(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p")
5upstream_version        := $(shell echo $(deb_version) | sed -e "s/-[^-]*$$//")
6
7package         := grub2
8
9DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null)
10DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
11DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null)
12
13HOST_CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
14# -O3 (default on Ubuntu ppc64el) introduces various -Werror failures, and
15# isn't worth it here.
16HOST_CFLAGS := -Wall -Wno-error=unused-result $(shell dpkg-buildflags --get CFLAGS | perl -pe 's/-O3\b/-O2/')
17HOST_LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
18
19unexport CFLAGS
20export HOST_CPPFLAGS
21export HOST_CFLAGS
22export HOST_LDFLAGS
23export TARGET_CPPFLAGS := -Wno-unused-but-set-variable
24
25ifeq (,$(shell which qemu-system-i386 2>/dev/null))
26with_check := no
27else
28with_check := yes
29endif
30
31CC := gcc-5
32
33confflags = \
34        PACKAGE_VERSION="$(deb_version)" PACKAGE_STRING="GRUB $(deb_version)" \
35        CC=$(CC) TARGET_CC=$(CC) \
36        --enable-grub-mkfont \
37        --disable-grub-emu-usb
38substvars =
39
40AUTOGEN_DEB_FILES = config templates preinst postinst postrm dirs install links maintscript
41
42BUILD_PACKAGES := $(strip $(shell dh_listpackages))
43# REAL_PACKAGES build an actual grub variant (and therefore have both configure
44# and build stages). EXTRA_PACKAGES do not build grub but may depend on a
45# REAL_PACKAGE (and therefore only have a build stage)
46REAL_PACKAGES = grub-common grub-emu grub-pc grub-coreboot grub-efi-ia32 grub-efi-amd64 grub-efi-ia64 grub-efi-arm grub-efi-arm64 grub-ieee1275 grub-firmware-qemu grub-uboot grub-xen grub-yeeloong
47EXTRA_PACKAGES = grub-rescue-pc grub-xen-host
48
49ifneq (,$(filter i386 amd64,$(DEB_HOST_ARCH_CPU)))
50COMMON_PLATFORM := pc
51else ifneq (,$(filter powerpc ppc64 ppc64el sparc sparc64,$(DEB_HOST_ARCH_CPU)))
52COMMON_PLATFORM := ieee1275
53else ifeq (mipsel,$(DEB_HOST_ARCH_CPU))
54COMMON_PLATFORM := yeeloong
55else ifeq (ia64,$(DEB_HOST_ARCH_CPU))
56COMMON_PLATFORM := efi-ia64
57else ifeq (arm,$(DEB_HOST_ARCH_CPU))
58COMMON_PLATFORM := uboot
59else ifeq (arm64,$(DEB_HOST_ARCH_CPU))
60COMMON_PLATFORM := efi-arm64
61else
62COMMON_PLATFORM := none
63BUILD_PACKAGES += grub-none
64endif
65
66ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
67DEFAULT_CMDLINE := quiet splash
68DEFAULT_TIMEOUT := 10
69ifeq ($(DEB_HOST_ARCH_CPU),ppc64el)
70FLICKER_FREE_BOOT := no
71else
72FLICKER_FREE_BOOT := yes
73endif
74confflags += --enable-ubuntu-recovery
75else ifeq (yes,$(shell dpkg-vendor --derives-from Tanglu && echo yes))
76DEFAULT_CMDLINE := net.ifnames=0 quiet splash
77DEFAULT_TIMEOUT := 10
78FLICKER_FREE_BOOT := yes
79else
80DEFAULT_CMDLINE := quiet
81DEFAULT_TIMEOUT := 5
82FLICKER_FREE_BOOT := no
83endif
84
85ifeq ($(FLICKER_FREE_BOOT),yes)
86DEFAULT_HIDDEN_TIMEOUT := 0
87DEFAULT_HIDDEN_TIMEOUT_BOOL := true
88confflags += \
89        --enable-quiet-boot \
90        --enable-quick-boot \
91        --enable-gfxpayload-dynamic \
92        --enable-vt-handoff
93substvars += \
94        -Vlsb-base-depends="lsb-base (>= 3.0-6)" \
95        -Vgfxpayload-depends="grub-gfxpayload-lists [any-i386 any-amd64]"
96else
97DEFAULT_HIDDEN_TIMEOUT :=
98DEFAULT_HIDDEN_TIMEOUT_BOOL := false
99endif
100
101SB_PACKAGE :=
102ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
103ifeq ($(DEB_HOST_ARCH),amd64)
104SB_PACKAGE := grub-efi-amd64
105SB_PLATFORM := x86_64-efi
106SB_EFI_NAME := x64
107endif
108ifeq ($(DEB_HOST_ARCH),arm64)
109SB_PACKAGE := grub-efi-arm64
110SB_PLATFORM := arm64-efi
111SB_EFI_NAME := aa64
112endif
113endif
114
115%:
116        dh $@ --parallel
117
118override_dh_auto_configure: $(patsubst %,configure/%,$(BUILD_PACKAGES))
119
120override_dh_auto_build: $(patsubst %,build/%,$(BUILD_PACKAGES))
121
122override_dh_auto_install: $(patsubst %,install/%,$(BUILD_PACKAGES))
123
124$(patsubst %,configure/%,$(REAL_PACKAGES)) :: configure/% : debian/stamps/configure-%
125$(patsubst %,build/%,$(REAL_PACKAGES) $(EXTRA_PACKAGES)) :: build/% : debian/stamps/build-%
126
127debian/stamps/configure-%: package = $(subst debian/stamps/configure-,,$@)
128debian/stamps/configure-%: export DH_OPTIONS = -p$(package) -Bobj/$(package)
129
130debian/stamps/build-%: package = $(subst debian/stamps/build-,,$@)
131debian/stamps/build-%: export DH_OPTIONS = -p$(package) -Bobj/$(package)
132
133install/%: package = $(subst install/,,$@)
134install/%: package_bin = $(package)-bin
135install/%: package_dbg = $(package)-dbg
136install/grub-emu: package_bin = grub-emu
137install/grub-emu: package_dbg = grub-emu-dbg
138install/%: export DH_OPTIONS = -p$(package) -Bobj/$(patsubst grub-common,grub-$(COMMON_PLATFORM),$(package))
139
140debian/stamps/autogen: autogen.sh configure.ac Makefile.util.def grub-core/Makefile.core.def
141        mkdir -p debian/stamps
142        rm -rf debian/grub-extras-enabled
143        mkdir debian/grub-extras-enabled
144        set -e; for extra in 915resolution ntldr-img; do \
145                cp -a debian/grub-extras/$$extra debian/grub-extras-enabled/; \
146        done
147        env -u DH_OPTIONS GRUB_CONTRIB=$(CURDIR)/debian/grub-extras-enabled \
148                dh_autoreconf -- ./autogen.sh
149        touch $@
150
151debian/stamps/configure-grub-common: debian/stamps/configure-grub-$(COMMON_PLATFORM)
152        touch $@
153
154debian/stamps/build-grub-common: debian/stamps/build-grub-$(COMMON_PLATFORM)
155        touch $@
156
157debian/stamps/configure-grub-none debian/stamps/configure-grub-pc debian/stamps/configure-grub-ieee1275 debian/stamps/configure-grub-coreboot debian/stamps/configure-grub-emu debian/stamps/configure-grub-uboot debian/stamps/configure-grub-yeeloong: debian/stamps/autogen
158        mkdir -p debian/stamps obj/$(package)
159        dh_auto_configure -- $(confflags) --with-platform=$(subst grub-,,$(package))
160        touch $@
161
162# This name scheme leaves room for things like amd32 someday
163debian/stamps/configure-grub-efi-ia32: debian/stamps/autogen
164        mkdir -p debian/stamps obj/$(package)
165        dh_auto_configure -- $(confflags) --with-platform=efi --target=i386-pe --program-prefix=""
166        touch $@
167debian/stamps/configure-grub-efi-amd64: debian/stamps/autogen
168        mkdir -p debian/stamps $(subst debian/stamps/configure-,obj/,$@)
169        dh_auto_configure -- $(confflags) --with-platform=efi --target=amd64-pe --program-prefix=""
170        touch $@
171debian/stamps/configure-grub-efi-ia64 debian/stamps/configure-grub-efi-arm debian/stamps/configure-grub-efi-arm64: debian/stamps/autogen
172        mkdir -p debian/stamps $(subst debian/stamps/configure-,obj/,$@)
173        dh_auto_configure -- $(confflags) --with-platform=efi
174        touch $@
175
176debian/stamps/configure-grub-xen-%: debian/stamps/autogen
177        mkdir -p debian/stamps obj/$(package)
178        dh_auto_configure -- $(confflags) --with-platform=xen --target=$(subst debian/stamps/configure-grub-xen-,,$@) --program-prefix=""
179        touch $@
180debian/stamps/configure-grub-xen: debian/stamps/configure-grub-xen-i386 debian/stamps/configure-grub-xen-amd64
181        touch $@
182
183debian/stamps/configure-grub-firmware-qemu: debian/stamps/autogen
184        mkdir -p debian/stamps $(subst debian/stamps/configure-,obj/,$@)
185        dh_auto_configure -- $(confflags) --with-platform=qemu
186        touch $@
187
188debian/stamps/build-grub-none debian/stamps/build-grub-efi-ia32 debian/stamps/build-grub-efi-amd64 debian/stamps/build-grub-efi-ia64 debian/stamps/build-grub-efi-arm debian/stamps/build-grub-efi-arm64 debian/stamps/build-grub-coreboot debian/stamps/build-grub-emu debian/stamps/build-grub-uboot debian/stamps/build-grub-xen-i386 debian/stamps/build-grub-xen-amd64 debian/stamps/build-grub-yeeloong: debian/stamps/build-%: debian/stamps/configure-%
189        dh_auto_build
190        touch $@
191
192debian/stamps/build-grub-xen-host-i386: PVBOOT_ARCH := i386
193debian/stamps/build-grub-xen-host-amd64: PVBOOT_ARCH := x86_64
194debian/stamps/build-grub-xen-host-%: debian/stamps/build-grub-xen-%
195        target=$(subst debian/stamps/build-grub-xen-host-,,$@) ; \
196        obj_dir=$(CURDIR)/obj/grub-xen-$${target} ; \
197        grub_dir=`mktemp -d` ; \
198        grub_memdisk=`mktemp` ; \
199        trap "rm -rf $${grub_dir} $${grub_memdisk}" EXIT HUP INT QUIT TERM ; \
200        mkdir -p $${grub_dir}/boot/grub ; \
201        mkdir -p $(CURDIR)/obj/$(package) ; \
202        sed -e "s/@@PVBOOT_ARCH@@/$(PVBOOT_ARCH)/g" \
203            <debian/grub-xen-host_grub.cfg \
204            >$${grub_dir}/grub.cfg ; \
205        tar -cf - -C $${grub_dir} grub.cfg > $${grub_memdisk} ; \
206        $${obj_dir}/grub-mkimage \
207                -O $(PVBOOT_ARCH)-xen \
208                -c $(CURDIR)/debian/grub-xen-host_grub-bootstrap.cfg \
209                -d $${obj_dir}/grub-core \
210                $${obj_dir}/grub-core/*.mod \
211                -m $${grub_memdisk} \
212                -o $(CURDIR)/obj/$(package)/grub-$(PVBOOT_ARCH)-xen.bin
213        touch $@
214
215debian/stamps/build-grub-xen-host: debian/stamps/build-grub-xen-host-i386 debian/stamps/build-grub-xen-host-amd64
216        touch $@
217
218debian/stamps/build-grub-pc: debian/stamps/configure-grub-pc
219        dh_auto_build
220ifeq ($(with_check), yes)
221        LC_MESSAGES=C.UTF-8 LC_CTYPE=C.UTF-8 PATH="$$PATH:/sbin:/usr/sbin" VERBOSE=1 dh_auto_test --max-parallel=1
222endif
223        touch $@
224
225debian/stamps/build-grub-ieee1275: debian/stamps/configure-grub-ieee1275
226        dh_auto_build
227ifeq ($(DEB_HOST_ARCH_CPU),ppc64el)
228        $(CC) $(HOST_CFLAGS) debian/prep-bootdev.c -o debian/prep-bootdev -lparted
229endif
230        touch $@
231
232debian/stamps/build-grub-xen: debian/stamps/build-grub-xen-i386 debian/stamps/build-grub-xen-amd64
233        touch $@
234
235debian/stamps/build-grub-firmware-qemu: debian/stamps/configure-grub-firmware-qemu
236        dh_auto_build
237        grub_dir=`mktemp -d` ; \
238        grub_memdisk=`mktemp` ; \
239        trap "rm -rf $${grub_dir} $${grub_memdisk}" EXIT HUP INT QUIT TERM ; \
240        mkdir -p $${grub_dir}/boot/grub ; \
241        cp debian/grub-firmware-qemu_grub.cfg $${grub_dir}/boot/grub/grub.cfg ; \
242        tar -cf - -C $${grub_dir} boot > $${grub_memdisk} ; \
243        obj/$(package)/grub-mkimage \
244                -O i386-qemu \
245                -d $(CURDIR)/obj/$(package)/grub-core \
246                $(CURDIR)/obj/$(package)/grub-core/*.mod \
247                -m $${grub_memdisk} \
248                -o $(CURDIR)/obj/$(package)/grub.bin
249        touch $@
250
251debian/stamps/build-grub-rescue-pc: debian/stamps/build-grub-pc
252        mkdir -p obj/grub-rescue-pc/rescue-disk/boot/grub
253        cp docs/grub.cfg obj/grub-rescue-pc/rescue-disk/boot/grub/
254        rm -rf obj/grub-rescue-pc/grub-core
255        cp -a obj/grub-pc/grub-core obj/grub-rescue-pc/grub-core
256        cp -a obj/grub-pc/unicode.pf2 obj/grub-rescue-pc/
257        pkgdatadir=$(CURDIR)/obj/grub-rescue-pc \
258                obj/grub-pc/grub-mkrescue \
259                --directory=$(CURDIR)/obj/grub-rescue-pc/grub-core \
260                --locale-directory=$(CURDIR)/obj/grub-rescue-pc/grub-core/po \
261                --output=$(CURDIR)/obj/grub-rescue-pc/grub-rescue-cdrom.iso \
262                $(CURDIR)/obj/grub-rescue-pc/rescue-disk
263        # save space for floppy image
264        rm -rf obj/grub-rescue-pc/grub-core/po obj/grub-rescue-pc/unicode.pf2
265        pkgdatadir=$(CURDIR)/obj/grub-rescue-pc \
266                obj/grub-pc/grub-mkrescue \
267                --directory=$(CURDIR)/obj/grub-rescue-pc/grub-core \
268                --locale-directory=$(CURDIR)/obj/grub-rescue-pc/grub-core/po \
269                --output=$(CURDIR)/obj/grub-rescue-pc/grub-rescue-floppy.img \
270                --compress=xz \
271                -- -no-pad $(CURDIR)/obj/grub-rescue-pc/rescue-disk
272        touch $@
273
274platform_subst = \
275        if [ -e debian/$(1) ]; then \
276                debian/platform-subst \
277                        PACKAGE="$(2)" \
278                        DEFAULT_CMDLINE="$(DEFAULT_CMDLINE)" \
279                        DEFAULT_TIMEOUT="$(DEFAULT_TIMEOUT)" \
280                        DEFAULT_HIDDEN_TIMEOUT_BOOL="$(DEFAULT_HIDDEN_TIMEOUT_BOOL)" \
281                        debian/$(1) >> debian/$(2).$(3); \
282        fi
283
284install/grub-none:
285        dh_auto_install --destdir=debian/tmp-$(package)
286
287        # Avoid failures later if we're building from a tree with no .po
288        # files.
289        mkdir -p debian/tmp-$(package)/usr/share/locale
290
291install/grub-pc install/grub-efi-ia32 install/grub-efi-amd64 install/grub-efi-ia64 install/grub-efi-arm install/grub-efi-arm64 install/grub-ieee1275 install/grub-coreboot install/grub-emu install/grub-uboot install/grub-xen install/grub-yeeloong:
292        set -e ; \
293        if [ "$@" = "install/grub-xen" ] ; then \
294                dh_auto_install -Bobj/grub-xen-i386 --destdir=debian/tmp-$(package); \
295                dh_auto_install -Bobj/grub-xen-amd64 --destdir=debian/tmp-$(package); \
296        else \
297                dh_auto_install --destdir=debian/tmp-$(package); \
298        fi
299
300        set -e ; \
301        for i in $(AUTOGEN_DEB_FILES) ; do \
302                > debian/$(package).$$i; \
303                if [ "$@" != "install/grub-emu" ] ; then \
304                        $(call platform_subst,$$i.in,$(package),$$i); \
305                fi ; \
306                $(call platform_subst,$(package).$$i.in,$(package),$$i); \
307                $(call platform_subst,$(package).$$i.$(DEB_HOST_ARCH_CPU).in,$(package),$$i); \
308                $(call platform_subst,$(package).$$i.$(DEB_HOST_ARCH_OS).in,$(package),$$i); \
309                $(call platform_subst,$(package).$$i.$(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH_CPU).in,$(package),$$i); \
310                [ -s debian/$(package).$$i ] || rm -f debian/$(package).$$i; \
311                if [ "$@" != "install/grub-emu" ] ; then \
312                        > debian/$(package_bin).$$i; \
313                        $(call platform_subst,$$i-bin.in,$(package_bin),$$i); \
314                        $(call platform_subst,$(package_bin).$$i.in,$(package_bin),$$i); \
315                        $(call platform_subst,$(package_bin).$$i.$(DEB_HOST_ARCH_CPU).in,$(package_bin),$$i); \
316                        $(call platform_subst,$(package_bin).$$i.$(DEB_HOST_ARCH_OS).in,$(package_bin),$$i); \
317                        $(call platform_subst,$(package_bin).$$i.$(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH_CPU).in,$(package_bin),$$i); \
318                        [ -s debian/$(package_bin).$$i ] || rm -f debian/$(package_bin).$$i; \
319                fi ; \
320                > debian/$(package_dbg).$$i; \
321                if [ "$@" != "install/grub-emu" ] ; then \
322                        $(call platform_subst,$$i-dbg.in,$(package_dbg),$$i); \
323                fi ; \
324                $(call platform_subst,$(package_dbg).$$i.in,$(package_dbg),$$i); \
325                $(call platform_subst,$(package_dbg).$$i.$(DEB_HOST_ARCH_CPU).in,$(package_dbg),$$i); \
326                $(call platform_subst,$(package_dbg).$$i.$(DEB_HOST_ARCH_OS).in,$(package_dbg),$$i); \
327                $(call platform_subst,$(package_dbg).$$i.$(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH_CPU).in,$(package_dbg),$$i); \
328                [ -s debian/$(package_dbg).$$i ] || rm -f debian/$(package_dbg).$$i; \
329        done
330
331        find debian/tmp-$(package)/usr/lib/grub -name modinfo.sh -print0 | \
332                xargs -0r chmod +x
333        find debian/tmp-$(package)/usr/lib/grub -name gdb_grub -print0 | \
334                xargs -0r chmod -x
335        find debian/tmp-$(package)/usr/lib/grub -name gmodule.pl -print0 | \
336                xargs -0r chmod -x
337
338        mkdir -p debian/$(package_bin)/usr/share/lintian/overrides
339        echo "$(package_bin): unstripped-binary-or-object *.mod" \
340                >> debian/$(package_bin)/usr/share/lintian/overrides/$(package_bin)
341        cd debian/tmp-$(package) && find usr/lib/grub -name kernel.img \
342                | sed -e "s%.*%$(package_bin): statically-linked-binary &%g" \
343        >> $(CURDIR)/debian/$(package_bin)/usr/share/lintian/overrides/$(package_bin)
344        cd debian/tmp-$(package) && find ./usr/lib/grub -name kernel.img \
345                | sed -e "s%.*%$(package_bin): statically-linked-binary &%g" \
346        >> $(CURDIR)/debian/$(package_bin)/usr/share/lintian/overrides/$(package_bin)
347        cd debian/tmp-$(package) && find usr/lib/grub -name kernel.img \
348                | sed -e "s%.*%$(package_bin): unstripped-binary-or-object &%g" \
349        >> $(CURDIR)/debian/$(package_bin)/usr/share/lintian/overrides/$(package_bin)
350        if ([ "$@" = "install/grub-efi-amd64" ] && [ "$(DEB_HOST_ARCH_CPU)" = "i386" ]) || \
351           ([ "$@" != "install/grub-emu" ] && [ "$(DEB_HOST_ARCH_CPU):$(DEB_HOST_ARCH_BITS)" = "amd64:32" ]) || \
352           [ "$@" = "install/grub-xen" ]; then \
353                echo "$(package_bin): binary-from-other-architecture *.mod" \
354                        >> debian/$(package_bin)/usr/share/lintian/overrides/$(package_bin) ; \
355                cd debian/tmp-$(package) && find usr/lib/grub -name kernel.img \
356                        | sed -e "s%.*%$(package_bin): binary-from-other-architecture &%g" \
357                >> $(CURDIR)/debian/$(package_bin)/usr/share/lintian/overrides/$(package_bin) ; \
358        fi
359        if ([ "$@" = "install/grub-pc" ] || \
360            [ "$@" = "install/grub-ieee1275" ] || \
361            [ "$@" = "install/grub-coreboot" ] || \
362            [ "$@" = "install/grub-xen" ] || \
363            [ "$@" = "install/grub-emu" ]) && \
364           [ "$(DEB_HOST_ARCH_OS)" = "linux" ] && \
365           [ "$(DEB_HOST_ARCH_CPU):$(DEB_HOST_ARCH_BITS)" != "amd64:64" ] ; then \
366                echo "$(package_bin): binary-from-other-architecture *efiemu64.o" \
367                        >> debian/$(package_bin)/usr/share/lintian/overrides/$(package_bin) ; \
368        fi
369
370        mkdir -p debian/$(package_dbg)/usr/share/lintian/overrides
371        echo "$(package_dbg): unstripped-binary-or-object *.module" \
372                >> debian/$(package_dbg)/usr/share/lintian/overrides/$(package_dbg)
373        echo "$(package_dbg): statically-linked-binary *.image" \
374                >> debian/$(package_dbg)/usr/share/lintian/overrides/$(package_dbg)
375        cd debian/tmp-$(package) && find usr/lib/grub -name kernel.exec \
376                | sed -e "s%.*%$(package_dbg): statically-linked-binary &%g" \
377        >> $(CURDIR)/debian/$(package_dbg)/usr/share/lintian/overrides/$(package_dbg)
378        if ([ "$@" = "install/grub-efi-amd64" ] && [ "$(DEB_HOST_ARCH_CPU)" = "i386" ]) || \
379           ([ "$@" != "install/grub-emu" ] && [ "$(DEB_HOST_ARCH_CPU):$(DEB_HOST_ARCH_BITS)" = "amd64:32" ]) || \
380           [ "$@" = "install/grub-xen" ] ; then \
381                echo "$(package_dbg): binary-from-other-architecture *.module" \
382                        >> debian/$(package_dbg)/usr/share/lintian/overrides/$(package_dbg) ; \
383                cd debian/tmp-$(package) && find usr/lib/grub -name kernel.exec \
384                        | sed -e "s%.*%$(package_dbg): binary-from-other-architecture &%g" \
385                >> $(CURDIR)/debian/$(package_dbg)/usr/share/lintian/overrides/$(package_dbg) ; \
386        fi
387
388        # Avoid failures later if we're building from a tree with no .po
389        # files.
390        mkdir -p debian/tmp-$(package)/usr/share/locale
391
392install/grub-common:
393        set -e ; for i in $(AUTOGEN_DEB_FILES) ; do \
394                if [ -e debian/grub-common.$$i.in ] ; then \
395                        cat debian/grub-common.$$i.in \
396                                > debian/grub-common.$$i ; \
397                fi ; \
398                if [ -e debian/grub-common.$$i.$(DEB_HOST_ARCH_CPU).in ] ; then \
399                        cat debian/grub-common.$$i.$(DEB_HOST_ARCH_CPU).in \
400                                >> debian/grub-common.$$i ; \
401                fi ; \
402                if [ -e debian/grub-common.$$i.$(DEB_HOST_ARCH_OS).in ] ; then \
403                        cat debian/grub-common.$$i.$(DEB_HOST_ARCH_OS).in \
404                                >> debian/grub-common.$$i ; \
405                fi ; \
406        done
407ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
408        install -D -m 0755 debian/grub-common.pm-sleep \
409                $(CURDIR)/debian/$(package)/etc/pm/sleep.d/10_grub-common
410endif
411
412NON_PLATFORM_PACKAGES = $(filter grub2 grub-linuxbios grub-efi grub-rescue-pc grub-firmware-qemu grub-xen-host,$(BUILD_PACKAGES))
413COMMON_PLATFORM_PACKAGES = $(filter grub-common grub2-common grub-theme-starfield grub-mount-udeb,$(BUILD_PACKAGES))
414PLATFORM_PACKAGES = $(filter grub-pc grub-efi-ia32 grub-efi-amd64 grub-efi-ia64 grub-efi-arm grub-efi-arm64 grub-ieee1275 grub-coreboot grub-uboot grub-xen grub-yeeloong,$(BUILD_PACKAGES))
415
416override_dh_install:
417ifneq (,$(NON_PLATFORM_PACKAGES))
418        dh_install $(patsubst %,-p%,$(NON_PLATFORM_PACKAGES))
419endif
420        dh_install $(patsubst %,-p%,$(COMMON_PLATFORM_PACKAGES)) --sourcedir=debian/tmp-grub-$(COMMON_PLATFORM)
421        rm -f debian/grub2-common/usr/share/info/dir*
422        rm -f debian/grub-theme-starfield/usr/share/grub/themes/starfield/COPYING.CC-BY-SA-3.0
423ifneq (,$(PLATFORM_PACKAGES))
424        set -e; for package in $(PLATFORM_PACKAGES); do \
425                dh_install -p$$package --sourcedir=debian/tmp-$$package; \
426                dh_install -p$$package-bin --sourcedir=debian/tmp-$$package; \
427                dh_install -p$$package-dbg --sourcedir=debian/tmp-$$package; \
428        done
429endif
430ifneq (,$(filter grub-emu,$(BUILD_PACKAGES)))
431        dh_install -pgrub-emu --sourcedir=debian/tmp-grub-emu
432        dh_install -pgrub-emu-dbg --sourcedir=debian/tmp-grub-emu
433endif
434ifneq (,$(filter grub2-common,$(BUILD_PACKAGES)))
435        sed -i \
436                -e "s/@DEFAULT_CMDLINE@/$(DEFAULT_CMDLINE)/g" \
437                -e "s/@DEFAULT_TIMEOUT@/$(DEFAULT_TIMEOUT)/g" \
438                debian/grub2-common/usr/share/grub/default/grub
439ifneq (,$(DEFAULT_HIDDEN_TIMEOUT))
440        perl -pi -e 's/^GRUB_TIMEOUT=.*/GRUB_HIDDEN_TIMEOUT=0\nGRUB_HIDDEN_TIMEOUT_QUIET=true\n$$&/' \
441                debian/grub2-common/usr/share/grub/default/grub
442endif
443endif
444ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
445ifneq (,$(filter grub-pc,$(BUILD_PACKAGES)))
446        patch debian/grub-pc/usr/lib/grub-legacy/update-grub \
447                < debian/legacy/update-grub.ubuntu.patch
448endif
449endif
450
451override_dh_installdocs:
452        dh_installdocs $(patsubst %,-p%,$(filter grub-common grub-rescue-pc grub-firmware-qemu grub-xen-host,$(BUILD_PACKAGES))) -A AUTHORS NEWS README THANKS TODO
453        dh_installdocs --remaining-packages --link-doc=grub-common
454
455ifeq ($(FLICKER_FREE_BOOT),yes)
456override_dh_installinit:
457        dh_installinit -- start 99 2 3 4 5 .
458else
459override_dh_installinit:
460        :
461endif
462
463override_dh_bugfiles:
464        dh_bugfiles -A
465
466override_dh_strip:
467        dh_strip -X/usr/bin/grub-emu
468
469override_dh_shlibdeps:
470        dh_shlibdeps -X.module
471
472ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
473LEGACY_DOC_BR := grub-doc (<< 0.97-29ubuntu60), grub-legacy-doc (<< 0.97-29ubuntu60)
474else
475LEGACY_DOC_BR := grub-doc (<< 0.97-32), grub-legacy-doc (<< 0.97-59)
476endif
477
478override_dh_gencontrol:
479        dh_gencontrol -- -Vlegacy-doc-br="$(LEGACY_DOC_BR)" $(substvars)
480
481TARNAME := grub2_$(deb_version)_$(DEB_HOST_ARCH).tar.gz
482
483override_dh_builddeb:
484        dh_builddeb -- -Zxz
485ifneq (,$(SB_PACKAGE))
486        debian/build-efi-images \
487                obj/grub-$(COMMON_PLATFORM)/grub-mkimage \
488                obj/$(SB_PACKAGE)/grub-core \
489                debian/grub2-images/$(deb_version) \
490                $(SB_PLATFORM) $(SB_EFI_NAME)
491        echo $(deb_version) \
492                > debian/grub2-images/$(deb_version)/version
493        cd debian/grub2-images && tar czvf ../../../$(TARNAME) .
494        dpkg-distaddfile $(TARNAME) raw-uefi -
495endif
496
497override_dh_auto_clean:
498        -rm -rf debian/grub-extras-enabled debian/stamps obj
499        -rm -f contrib grub-core/contrib
500
501override_dh_clean:
502        dh_autoreconf_clean
503        dh_clean
504
505        chmod +x debian/{bug-script,grub.d/*,legacy/*,kernel/*}
506
507        for i in $(AUTOGEN_DEB_FILES) ; do \
508                rm -f debian/grub-{pc,efi-*,ieee1275,coreboot,uboot,xen,yeeloong,emu}{,-bin,-dbg}.$$i ; \
509        done
510        rm -f debian/grub-common.maintscript
511        rm -rf debian/tmp-*/
512ifneq (,$(SB_PACKAGE))
513        rm -rf debian/grub2-images
514endif
515
516        # make sure PO files are always up-to-date
517        #debconf-updatepo
518
519.PHONY: $(patsubst %,configure/%,$(BUILD_PACKAGES)) $(patsubst %,build/%,$(BUILD_PACKAGES)) $(patsubst %,install/%,$(BUILD_PACKAGES))
Note: See TracBrowser for help on using the repository browser.