Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 include /usr/share/dpkg/default.mk
3
4 built_binaries := $(shell dh_listpackages)
5
6 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
7 export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1
8 export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
9 PKG_CONFIG ?= $(DEB_HOST_GNU_TYPE)-pkgconf
10
11 export GIR_SONAME = 1
12 export GIR_API_VERSION = 1.0
13 export GIR_FORMAT = 1.2
14
15 PERL_MANPAGES := debian/dh_girepository.1
16 $(PERL_MANPAGES): %.1: %
17 pod2man -c "gobject-introspection" -r "$(DEB_VERSION)" $< $@
18
19 POD_MANPAGES := debian/deb-gir-tool.1
20 $(POD_MANPAGES): %.1: %.pod
21 pod2man -c "gobject-introspection" -r "$(DEB_VERSION)" $< $@
22
23 RST_MANPAGES := debian/g-ir-inspect.1
24 $(RST_MANPAGES): %.1: %.rst
25 rst2man $< $@
26
27 MANPAGES := $(PERL_MANPAGES) $(POD_MANPAGES) $(RST_MANPAGES)
28
29 %:
30 dh $@ --builddir=_build
31
32 debian/extra-substvars:
33 dpkg-architecture -c debian/extra-substvars.py > debian/extra-substvars
34
35 debian/libgirepository-1.0-1.symbols: debian/libgirepository-1.0-1.symbols.in debian/extra-substvars
36 set -e; \
37 libffiN=$$(sed -ne 's/^local:libffiN=//p' debian/extra-substvars); \
38 sed -e "s/@libffiN@/$$libffiN/" < $< > $@
39
40 override_dh_clean:
41 dh_clean -Xorg.gtk.test.gschema.xml.orig -Xorg.gtk.test.gschema.override.orig
42
43 configure_options = \
44 -Dgir_dir_prefix=lib/${DEB_HOST_MULTIARCH} \
45 -Dcairo=enabled \
46 -Ddoctool=enabled \
47 -Dpython=python3 \
48 $(NULL)
49
50 ifeq ($(filter %-doc,$(built_binaries)),)
51 configure_options += -Dgtk_doc=false
52 else
53 configure_options += -Dgtk_doc=true
54 endif
55
56 ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
57 configure_options += --cross-file=$(CURDIR)/debian/meson-cross-for-build.ini
58 # This is a bit weird: gobject-introspection uses the build architecture
59 # gobject-introspection to build typelibs for the host architecture.
60 # That should maybe be fixed upstream, but for now force use of our
61 # appropriate $(DEB_HOST_GNU_TYPE)-g-ir-scanner and -compiler, which
62 # in turn will use the appropriate host gcc.
63 configure_options += --native-file=$(CURDIR)/debian/meson-cross-for-build.ini
64 configure_options += -Dgi_cross_binary_wrapper=$(DEB_HOST_GNU_TYPE)-cross-exe-wrapper
65 configure_options += -Dgi_cross_ldd_wrapper=$(CURDIR)/debian/deb-elf-get-needed-for-build
66 configure_options += -Dgi_cross_use_prebuilt_gi=true
67 endif
68
69 ifeq ($(filter gir1.2-%,$(built_binaries)),)
70 configure_options += -Dbuild_introspection_data=false
71 endif
72
73 override_dh_auto_configure:
74 dh_auto_configure -- $(configure_options)
75
76 ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
77 execute_before_dh_auto_build: $(MANPAGES)
78 endif
79
80 execute_before_dh_auto_build: debian/cross-tools/deb-can-run-$(DEB_HOST_ARCH)
81 debian/cross-tools/deb-can-run-$(DEB_HOST_ARCH):
82 mkdir -p debian/cross-tools
83 $(DEB_HOST_GNU_TYPE)-gcc $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o$@ debian/can-run.c
84
85 execute_before_dh_auto_build: debian/deb-gir-tool
86 debian/deb-gir-tool: debian/deb-gir-tool.c debian/rules
87 $(DEB_HOST_GNU_TYPE)-gcc $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
88 -o$@ $< \
89 -Wall -fno-strict-aliasing \
90 -DDEB_HOST_MULTIARCH='"$(DEB_HOST_MULTIARCH)"' \
91 $$(${PKG_CONFIG} --cflags --libs glib-2.0 gio-2.0)
92
93 execute_before_dh_auto_build: debian/deb-elf-get-needed
94 debian/deb-elf-get-needed:
95 $(DEB_HOST_GNU_TYPE)-gcc $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o$@ debian/elf-get-needed.c -lelf
96
97 execute_before_dh_auto_build: debian/deb-elf-get-needed-for-build
98 debian/deb-elf-get-needed-for-build:
99 $(DEB_BUILD_GNU_TYPE)-gcc \
100 $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
101 -o$@ debian/elf-get-needed.c -lelf
102
103 execute_before_dh_auto_configure: debian/$(DEB_HOST_GNU_TYPE)-gobject-introspection.ini
104 debian/$(DEB_HOST_GNU_TYPE)-gobject-introspection.ini: debian/meson-cross-g-i.ini.in debian/rules
105 sed \
106 -e '/^exe_wrapper *=/d' \
107 -e 's|@DEB_HOST_GNU_TYPE@|$(DEB_HOST_GNU_TYPE)|' \
108 -e 's|@bindir@|/usr/bin|' \
109 < $< > [email protected]
110 mv [email protected] $@
111
112 execute_before_dh_auto_configure: debian/meson-cross-for-build.ini
113 debian/meson-cross-for-build.ini: debian/meson-cross-g-i.ini.in debian/rules
114 sed \
115 -e 's|@DEB_HOST_GNU_TYPE@|$(DEB_HOST_GNU_TYPE)|' \
116 -e 's|@bindir@|/usr/bin|' \
117 < $< > [email protected]
118 mv [email protected] $@
119
120 execute_before_dh_auto_configure: cross-tools emulated-cross-tools
121
122 cross_tools = \
123 g-ir-annotation-tool \
124 g-ir-doc-tool \
125 g-ir-scanner \
126 $(NULL)
127 emulated_cross_tools = \
128 g-ir-compiler \
129 g-ir-generate \
130 g-ir-inspect \
131 $(NULL)
132 cross-tools: debian/cross-g-ir-tool.in debian/rules
133 mkdir -p debian/cross-tools
134 set -e; for tool in $(cross_tools); do \
135 sed \
136 -e 's|@CAN_RUN@|/usr/lib/$(DEB_HOST_MULTIARCH)/gobject-introspection/deb-can-run-$(DEB_HOST_ARCH)|' \
137 -e 's|@DEB_HOST_ARCH@|$(DEB_HOST_ARCH)|' \
138 -e 's|@DEB_HOST_GNU_TYPE@|$(DEB_HOST_GNU_TYPE)|' \
139 -e 's|@DEB_HOST_MULTIARCH@|$(DEB_HOST_MULTIARCH)|' \
140 -e 's|@GET_NEEDED@|/usr/libexec/gobject-introspection-bin/deb-elf-get-needed|' \
141 -e 's|@TOOL@|'"$$tool"'|' \
142 -e 's|@TOOL_PATH@|/usr/bin/'"$$tool"'|' \
143 < $< > debian/cross-tool.tmp; \
144 chmod 0755 debian/cross-tool.tmp; \
145 mv debian/cross-tool.tmp debian/cross-tools/$(DEB_HOST_GNU_TYPE)-$$tool; \
146 done
147
148 emulated-cross-tools: debian/emulated-g-ir-tool.in debian/rules
149 mkdir -p debian/cross-tools
150 set -e; for tool in $(emulated_cross_tools); do \
151 sed \
152 -e 's|@CAN_RUN@|/usr/lib/$(DEB_HOST_MULTIARCH)/gobject-introspection/deb-can-run-$(DEB_HOST_ARCH)|' \
153 -e 's|@DEB_HOST_ARCH@|$(DEB_HOST_ARCH)|' \
154 -e 's|@DEB_HOST_GNU_TYPE@|$(DEB_HOST_GNU_TYPE)|' \
155 -e 's|@DEB_HOST_MULTIARCH@|$(DEB_HOST_MULTIARCH)|' \
156 -e 's|@TOOL@|'"$$tool"'|' \
157 -e 's|@TOOL_PATH@|/usr/lib/$(DEB_HOST_MULTIARCH)/gobject-introspection/'"$$tool"'|' \
158 < $< > debian/cross-tool.tmp; \
159 chmod 0755 debian/cross-tool.tmp; \
160 mv debian/cross-tool.tmp debian/cross-tools/$(DEB_HOST_GNU_TYPE)-$$tool; \
161 done
162
163 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
164 execute_before_dh_auto_test:
165 PATH=$(CURDIR)/debian:$$PATH prove -v debian/tests/deb-gir-tool.t
166 endif
167
168 execute_after_dh_auto_install:
169 sed -i \
170 -e 's|^girdir=\(.*\)|girdir=$${datadir}/gir-1.0|' \
171 -e 's|^g_ir_\(.*\)=\(.*\)/g-ir-\(.*\)$$|g_ir_\1=$${bindir}/${DEB_HOST_GNU_TYPE}-g-ir-\3|' \
172 debian/tmp/usr/lib/*/pkgconfig/*.pc
173
174 execute_before_dh_makeshlibs: debian/libgirepository-1.0-1.symbols
175
176 ifneq ($(filter gir1.2-%,$(built_binaries)),)
177 execute_after_dh_shlibdeps:
178 @echo 'blhc: ignore-line-regexp: .*\s-o\s+debian/\S+/girepository-1\.0/.*\.typelib\.so\s.*'
179 perl -w debian/dh_girepository -v -Nlibgirepository1.0-dev
180 endif
181
182 execute_before_dh_python3:
183 dh_python3 /usr/lib/$(DEB_HOST_MULTIARCH)/gobject-introspection/giscanner/
184
185 override_dh_gencontrol: debian/extra-substvars
186 dh_gencontrol -- -Tdebian/extra-substvars
187
188 override_dh_installdocs:
189 dh_installdocs -pgobject-introspection-bin --doc-main-package=gobject-introspection
190 dh_installdocs --remaining-packages
191
192 override_dh_installexamples:
193 dh_installexamples -pgobject-introspection-bin --doc-main-package=gobject-introspection
194 dh_installexamples --remaining-packages