File: rules

package info (click to toggle)
chromium-browser 70.0.3538.110-1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,619,476 kB
  • sloc: cpp: 13,024,755; ansic: 1,349,823; python: 916,672; xml: 314,489; java: 280,047; asm: 276,936; perl: 75,771; objc: 66,634; sh: 45,860; cs: 28,354; php: 11,064; makefile: 10,911; yacc: 9,109; tcl: 8,403; ruby: 4,065; lex: 1,779; pascal: 1,411; lisp: 1,055; awk: 41; jsp: 39; sed: 17; sql: 3
file content (174 lines) | stat: -rwxr-xr-x 6,207 bytes parent folder | download
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/make -f

# enable verbose build messages
export DH_VERBOSE=1

# enable all build hardening flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# needed to avoid build system choosing clang as the compiler
export CC=gcc
export CXX=g++

# build with gcc instead of clang
defines=is_clang=false clang_use_chrome_plugins=false

# more verbose linker output
export LDFLAGS+=-Wl,--stats

# avoid error in v8's garbage collector (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=68853)
export CXXFLAGS+=-fno-delete-null-pointer-checks

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# set the appropriate cpu architecture
ifeq (i386,$(DEB_HOST_ARCH))
defines+=host_cpu=\"x86\"
endif
ifeq (amd64,$(DEB_HOST_ARCH))
defines+=host_cpu=\"x64\"
endif
ifeq (arm64,$(DEB_HOST_ARCH))
defines+=host_cpu=\"arm64\"
endif
ifeq (armhf,$(DEB_HOST_ARCH))
defines+=host_cpu=\"arm\" arm_use_neon=false symbol_level=0
endif

# disabled features
defines+=gtk_version=2 \
         is_debug=false \
         use_allocator=\"none\" \
         use_ozone=false \
         use_sysroot=false \
         use_openh264=false \
         use_jumbo_build=false \
         use_custom_libcxx=false \
         use_gnome_keyring=false \
         use_system_harfbuzz=false \
         rtc_libvpx_build_vp9=false \
         treat_warnings_as_errors=false \
         remove_webcore_debug_symbols=true \
         optimize_webui=false \
         enable_swiftshader=false \
         enable_nacl=false \
         enable_nacl_nonsfi=false \
         enable_one_click_signin=false \
         enable_hangout_services_extension=false \
         enable_iterator_debugging=false \
         goma_dir=\"\" \
         gold_path=\"\" \
         linux_use_bundled_binutils=false \

# enabled features
defines+=use_gio=true \
         use_gold=true \
         use_pulseaudio=true \
         link_pulseaudio=true \
         enable_widevine=true \
         use_libjpeg_turbo=true \
         use_system_libjpeg=true \
         use_system_freetype=true \
         concurrent_links=1 \
         use_jumbo_build=true \
         jumbo_file_merge_limit=16 \
         proprietary_codecs=true \
         ffmpeg_branding=\"Chrome\" \
         fieldtrial_testing_like_official_build=true \

# some notes about embedded libraries
#  can't use system nss since net/third_party/nss is heavily patched
#  can't use system ots (open text *summarizer*) since that's not google's ots (open text *sanitizer*)

# handle parallel build options
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
njobs=-j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif

# paths to files needed by flot
flotpaths=/usr/share/javascript/jquery/*min.js \
          /usr/share/javascript/jquery-flot/*min.js \

%:
	dh $@ --parallel

override_dh_auto_configure:
	# output compiler information
	$(CXX) --version
	# use system flot
	for file in $(flotpaths); do ln -sf $$file third_party/flot; done
	# use polymer from chromium's top level third_party directory
	ln -sf ../../../../third_party/polymer/v1_0/components-chromium third_party/catapult/third_party/polymer/components
	# put yasm script in the location expected by gn
	ln -sf ../pdfium/third_party/yasm/run_yasm.py third_party/yasm
	# strip out system third_party libraries
	rm -f build/config/freetype/freetype.gni
	mkdir -p base/third_party/libevent
	./debian/scripts/unbundle
	# build gn
	cp base/numerics/safe_conversions_arm_impl.h base/numerics/safe_math_arm_impl.h tools/gn/base/numerics
	./tools/gn/bootstrap/bootstrap.py -s $(njobs)
	# configure
	./out/Release/gn gen out/Release --args="$(defines)"

override_dh_auto_build-arch:
	./out/Release/gn gen out/Release --args="$(defines)"
	ninja $(njobs) -C out/Release chrome chrome_sandbox content_shell chromedriver
	mv out/Release/chrome out/Release/chromium || true
	mv out/Release/content_shell out/Release/chromium-shell || true
	mv out/Release/chrome_sandbox out/Release/chrome-sandbox || true
	mv out/Release/locales/en-US.pak out/Release/resources || true
	chmod 4755 out/Release/chrome-sandbox # suid sandbox
	sed -e s/@@PACKAGE@@/chromium/g -e s/@@MENUNAME@@/chromium/g \
	    < chrome/app/resources/manpage.1.in > out/Release/chromium.1

override_dh_auto_build-indep:
	ninja $(njobs) -C out/Release packed_resources
	rm -f out/Release/locales/en-US.pak

override_dh_auto_install-arch:
	dh_auto_install
	# create /etc/chromium.d README file
	echo "Any files placed in this directory will be sourced prior to executing chromium." \
	    > debian/chromium/etc/chromium.d/README
	# update launcher script with build information
	sed 's|@BUILD_DIST@|$(shell cat /etc/debian_version)|' \
	    < debian/scripts/chromium > debian/chromium/usr/bin/chromium
	# move icons into /usr/share
	for file in $(shell find chrome/app/theme/chromium -name product_logo_[0-9]* -a ! -name *mono*); do \
	    ext=$$(echo $$file | cut -d\. -f2); \
	    siz=$$(echo $$file | cut -d_ -f3 | sed s/\.$$ext//); \
	    dst=debian/chromium/usr/share/icons/hicolor/$$siz\x$$siz/apps; \
	    mkdir -p $$dst; \
	    cp $$file $$dst/chromium.$$ext; \
	    done

override_dh_fixperms:
	dh_fixperms --exclude chrome-sandbox

override_dh_strip:
	# this line can be removed once stretch is released
	dh_strip --remaining-packages --ddeb-migration='chromium-dbg (<< 47.0.2526.80-4~)'

override_dh_gencontrol:
	dh_gencontrol -- -VBuilt-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libjs-jquery libjs-jquery-flot)"

override_dh_auto_clean:
	rm -rf out
	find . -name \*.pyc -execdir rm -f {} \;
	dh_auto_clean

###################### upstream source downloading ############################

url=https://gsdview.appspot.com/chromium-browser-official
version=$(shell dpkg-parsechangelog -S Version | sed s/-.*//)
tarball=chromium-$(version).tar.xz
removed=chromium-browser_$(version).files-removed

get-orig-source:
	wget -nv --show-progress -c $(url)/$(tarball) -O ../$(tarball)
	mk-origtargz ../$(tarball) | tee ../$(removed)
	echo >> ../$(removed)
	tar tf ../$(tarball) | sort > ../chromium.upstream
	tar tf ../chromium-browser_$(version).orig.tar.xz | sort > ../chromium.orig
	diff -u ../chromium.upstream ../chromium.orig >> ../$(removed) || true