Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 # See debhelper(7) (uncomment to enable)
4 # output every command that modifies files on the build system.
5 #export DH_VERBOSE = 1
6
7 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
8
9 # Build logic.
10 CXX := c++
11
12 # Output directory for the build
13 BUILD := debbuild
14
15 # Install directory, as understood by dh_install.
16 DESTDIR := debian/tmp
17
18 # Grab the number of threads that are desired.
19 PARALLEL := $(or $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))), "1")
20
21 # Get variables with information about the package.
22 # (debhelper depends on the dpkg-dev package that contains this file, so no extra build-deps)
23 include /usr/share/dpkg/pkg-info.mk
24
25 # Skia version, for .so names.
26 export FULL_VERSION := $(shell echo "$(DEB_VERSION_UPSTREAM)" | sed -E 's/^([0-9.]+).*$$/\1/')
27 export MAJOR_VERSION := $(shell echo "$(DEB_VERSION_UPSTREAM)" | sed -E 's/^([0-9]+).*$$/\1/')
28
29 # GCC fails to do tail- or sibling calls on ppc64el, so use the version
30 # that don't depend on tail calls for ppc64el, even though the attribute
31 # clang::musttail is available in the compiler!
32 ifeq ($(DEB_HOST_ARCH),ppc64el)
33 export CXXFLAGS := $(CXXFLAGS) -DSKCMS_HAS_MUSTTAIL=0
34 endif
35
36 # Flags to GN, needed to respect CXXFLAGS, CFLAGS, etc.
37 ALL_ARGS := is_official_build=true \
38 extra_cflags_cc=string_split(getenv("CXXFLAGS")) \
39 extra_cflags_c=string_split(getenv("CFLAGS")) \
40 skia_use_system_expat=true \
41 skia_use_system_harfbuzz=true \
42 skia_use_system_icu=true \
43 skia_use_system_libjpeg_turbo=true \
44 skia_use_system_libpng=true \
45 skia_use_system_libwebp=true \
46 skia_use_system_zlib=true \
47 skia_use_dng_sdk=false \
48 skia_use_wuffs=false \
49 skia_enable_spirv_validation=false
50
51 # Note: We can't set LDFLAGS here, the GN build system sets them for us.
52 # So, tell it to respect them for us.
53 SHARED_ARGS := is_component_build=true \
54 extra_ldflags=string_split(getenv("LDFLAGS")) \
55 skia_so_version=$(MAJOR_VERSION)
56
57 # Flags to GN, for the static build. Don't enable -fPIC as per 10.2 in debian policy.
58 STATIC_ARGS := skia_no_pic=true
59
60 # Headers to be removed (= not installed) because we have disabled
61 # the underlying functionality:
62 REMOVE_HEADERS := \
63 include/codec/SkRawDecoder.h \
64 include/codec/SkJpegxlDecoder.h \
65 include/codec/SkAvifDecocer.h
66
67 # Main build target. Just build the two versions in sequence, we don't win
68 # much in parallelism anyway (we might be able to re-use the first compilation
69 # for the second one though...)
70 override_dh_auto_build:
71 mkdir -p $(BUILD)/shared/
72 gn gen $(BUILD)/shared --args='$(ALL_ARGS) $(SHARED_ARGS)'
73 ninja -C $(BUILD)/shared -j $(PARALLEL) --verbose skia
74
75 mkdir -p $(BUILD)/static/
76 gn gen $(BUILD)/static --args='$(ALL_ARGS) $(STATIC_ARGS)'
77 ninja -C $(BUILD)/static -j $(PARALLEL) --verbose skia
78
79 # Custom clean target.
80 override_dh_auto_clean:
81 rm -rf $(BUILD)
82
83 # Custom installation.
84 override_dh_auto_install:
85 install -D -m 0755 $(BUILD)/shared/libskia.so $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libskia.so.$(FULL_VERSION)
86 ln -s libskia.so.$(FULL_VERSION) $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libskia.so.$(MAJOR_VERSION)
87 ln -s libskia.so.$(MAJOR_VERSION) $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libskia.so
88 install -D -m 0644 $(BUILD)/static/libskia.a $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libskia.a
89 python3 bin/install-headers.py --src include/ --dest $(DESTDIR)/usr/include/skia --ignore '.*/android/.*' $(addprefix --ignore ,$(REMOVE_HEADERS))
90 cp modules/skcms/src/skcms_public.h $(DESTDIR)/usr/include/skia/skcms.h
91 python3 bin/install-pc.py $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/skia.pc
92
93
94 # Default rule.
95 %:
96 dh $@
97