File: rules

package info (click to toggle)
papers 48.3-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 23,096 kB
  • sloc: ansic: 38,478; sh: 195; xml: 127; makefile: 117
file content (122 lines) | stat: -rwxr-xr-x 6,724 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/make -f
include /usr/share/dpkg/buildflags.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,-z,defs
export DPKG_GENSYMBOLS_CHECK_LEVEL = 4

export PATH := /usr/share/cargo/bin:$(PATH)

include /usr/share/dpkg/default.mk
include /usr/share/rustc/architecture.mk
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
export CARGO=/usr/share/cargo/bin/cargo
export CARGO_HOME=$(CURDIR)/debian/cargo_home
export CARGO_REGISTRY=$(CURDIR)/debian/cargo_registry
export DEB_CARGO_CRATE=$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM)
export DEB_SOURCE_DIR=$(CURDIR)

ifeq ($(DEB_HOST_ARCH_BITS),32)
    export DEB_BUILD_OPTIONS += optimize=-lto
endif

%:
	dh $@

execute_after_dh_auto_clean:
	$(CARGO) -C $(CURDIR) -Z unstable-options clean
	rm -rf $(CARGO_HOME)
	rm -rf $(CARGO_REGISTRY)

override_dh_auto_configure:
	$(CARGO) prepare-debian $(CARGO_REGISTRY) --link-from-system
	rm -f .cargo/config Cargo.lock
	dh_auto_configure -- \
		-Dhost_arch="$(DEB_HOST_RUST_TYPE)" \
		-Dauto_features=enabled \
		-Ddocumentation=$(if $(filter nodoc,$(DEB_BUILD_OPTIONS)),false,true)

# prepare dependencies so we can regenerate the Rust bindings source code during build
# applying debian patches and upstream xmlstarlet fixes taken from upstream here: https://github.com/gtk-rs/gir-files/blob/master/fix.sh
execute_before_dh_auto_build:
	rm -f $(CURDIR)/rust/pps-girs/*.gir
	cp /usr/share/gir-1.0/GLib-2.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/Gdk-4.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/GdkPixbuf-2.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/GModule-2.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/Gio-2.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/Adw-1.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/GObject-2.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/Pango-1.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/HarfBuzz-0.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/freetype2-2.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/cairo-1.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/PangoCairo-1.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/Gtk-4.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/Gsk-4.0.gir $(CURDIR)/rust/pps-girs
	cp /usr/share/gir-1.0/Graphene-1.0.gir $(CURDIR)/rust/pps-girs
	xmlstarlet ed -L \
	-u '//_:parameter[@name="response_id"]/_:type[@name="gint"]/@c:type' -v "GtkResponseType" \
	-u '//_:parameter[@name="response_id"]/_:type[@name="gint"]/@name' -v "ResponseType" \
	$(CURDIR)/rust/pps-girs/Gtk-4.0.gir
	xmlstarlet ed -L \
	-d '///_:alias[@name="Int32"]' \
	$(CURDIR)/rust/pps-girs/freetype2-2.0.gir
	xmlstarlet ed -L \
	-i '///_:type[not(@name) and @c:type="hb_font_t*"]' -t 'attr' -n 'name' -v "gconstpointer" \
	-u '//_:type[@c:type="hb_font_t*"]/@c:type' -v "gconstpointer" \
	-i '///_:array[not(@name) and @c:type="hb_feature_t*"]' -t 'attr' -n 'name' -v "gconstpointer" \
	-r '///_:array[@c:type="hb_feature_t*"]' -v "type" \
	-d '//_:type[@c:type="hb_feature_t*"]/*' \
	-d '//_:type[@c:type="hb_feature_t*"]/@length' \
	-d '//_:type[@c:type="hb_feature_t*"]/@zero-terminated' \
	-u '//_:type[@c:type="hb_feature_t*"]/@c:type' -v "gconstpointer" \
	-d '//_:record[@c:type="PangoGlyphVisAttr"]/_:field/@bits' \
	-d '//_:record[@c:type="PangoGlyphVisAttr"]/_:field[@name="is_color"]' \
	$(CURDIR)/rust/pps-girs/Pango-1.0.gir
	xmlstarlet ed -L \
	-u '//*[@glib:error-domain="g-option-context-error-quark"]/@glib:error-domain' -v g-option-error-quark \
	-u '//_:record[@name="KeyFile"]/_:method[@name="set_boolean_list"]//_:parameter[@name="list"]/_:array/@c:type' -v "gboolean*" \
	-u '//_:record[@name="KeyFile"]/_:method[@name="set_double_list"]//_:parameter[@name="list"]/_:array/@c:type' -v "gdouble*" \
	-u '//_:record[@name="KeyFile"]/_:method[@name="set_integer_list"]//_:parameter[@name="list"]/_:array/@c:type' -v "gint*" \
	-u '//_:record[@name="KeyFile"]/_:method[@name="set_locale_string_list"]//_:parameter[@name="list"]/_:array/@c:type' -v "const gchar* const*" \
	-u '//_:record[@name="KeyFile"]/_:method[@name="set_string_list"]//_:parameter[@name="list"]/_:array/@c:type' -v "const gchar* const*" \
	$(CURDIR)/rust/pps-girs/GLib-2.0.gir
	xmlstarlet ed -L \
	-u '//_:class[@name="Object"]/_:method[@name="getv"]//_:parameter[@name="names"]/_:array/@c:type' -v "const gchar**" \
	-u '//_:class[@name="Object"]/_:method[@name="getv"]//_:parameter[@name="values"]/_:array/@c:type' -v "GValue*" \
	-u '//_:class[@name="Object"]/_:method[@name="setv"]//_:parameter[@name="names"]/_:array/@c:type' -v "const gchar**" \
	-u '//_:class[@name="Object"]/_:method[@name="setv"]//_:parameter[@name="values"]/_:array/@c:type' -v "const GValue*" \
	-u '//_:class[@name="Object"]/_:constructor[@name="new_with_properties"]//_:parameter[@name="names"]/_:array/@c:type' -v "const char**" \
	-u '//_:class[@name="Object"]/_:constructor[@name="new_with_properties"]//_:parameter[@name="values"]/_:array/@c:type' -v "const GValue*" \
	-i '//_:interface[@name="TypePlugin" and not(@glib:type-struct)]' -t 'attr' -n 'glib:type-struct' -v 'TypePluginClass' \
	-i '//_:record[@name="TypePluginClass" and not(@glib:is-gtype-struct-for)]' -t 'attr' -n 'glib:is-gtype-struct-for' -v 'TypePlugin' \
	$(CURDIR)/rust/pps-girs/GObject-2.0.gir
	xmlstarlet ed -L \
	-u '//_:record[@name="PixbufModule"]/_:field[@name="module"]/_:type/@name' -v "gpointer" \
	-u '//_:record[@name="PixbufModule"]/_:field[@name="module"]/_:type/@c:type' -v "gpointer" \
	$(CURDIR)/rust/pps-girs/GdkPixbuf-2.0.gir
	xmlstarlet ed -L \
	-d '///_:function[@c:identifier="hb_graphite2_face_get_gr_face"]' \
	-d '///_:function[@c:identifier="hb_graphite2_font_get_gr_font"]' \
	-d '///_:function[@c:identifier="hb_ft_face_create"]' \
	-d '///_:function[@c:identifier="hb_ft_face_create_cached"]' \
	-d '///_:function[@c:identifier="hb_ft_face_create_referenced"]' \
	-d '///_:function[@c:identifier="hb_ft_font_create"]' \
	-d '///_:function[@c:identifier="hb_ft_font_create_cached"]' \
	-d '///_:function[@c:identifier="hb_ft_font_create_referenced"]' \
	-d '///_:function[@c:identifier="hb_ft_font_get_face"]' \
	-d '///_:function[@c:identifier="hb_ft_font_lock_face"]' \
	$(CURDIR)/rust/pps-girs/HarfBuzz-0.0.gir

override_dh_makeshlibs:
	dh_makeshlibs \
		-X /usr/lib/$(DEB_HOST_MULTIARCH)/papers/

execute_after_dh_install:
	install -m 0644 -D debian/apparmor-profile debian/papers/etc/apparmor.d/usr.bin.papers
	install -m 0644 -D debian/apparmor-profile.abstraction debian/papers/etc/apparmor.d/abstractions/papers
	install -m 0644 -D debian/papers.apport debian/papers/usr/share/apport/package-hooks/source_papers.py
	dh_apparmor --profile-name=usr.bin.papers -ppapers

override_dh_gnome_clean: