3
DEBIAN_NAME := $(shell dpkg-parsechangelog | sed -n 's/^Source: *\(.*\)$$/\1/ p')
4
DEBIAN_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\(.*\)$$/\1/ p')
5
DEBIAN_UPSTREAM_VERSION := $(shell echo $(DEBIAN_VERSION) | sed 's/^\(.*\)-[^-]*$$/\1/')
6
DEBIAN_REVISION := $(shell echo $(DEBIAN_VERSION) | sed 's/^.*r\([^-]*\)-.*/\1/')
7
DEBIAN_DIST := $(shell lsb_release -ds | tr -d '()' |sed -e 's/\#/ /g')
3
DEBIAN_NAME := $(shell dpkg-parsechangelog | sed -n 's/^Source: *\(.*\)$$/\1/ p')
4
DEBIAN_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\(.*\)$$/\1/ p')
5
DEBIAN_UPSTREAM_VERSION := $(shell echo $(DEBIAN_VERSION) | sed 's/^\(.*\)-[^-]*$$/\1/')
6
DEBIAN_REVISION := $(shell echo $(DEBIAN_VERSION) | sed 's/^.*r\([^-]*\)-.*/\1/')
7
DEBIAN_DIST := $(shell lsb_release -ds | tr -d '()' |sed -e 's/\#/ /g')
8
8
DEBIAN_DIST_NAME := $(shell lsb_release -si |sed -e 's/\#/ /g')
9
DEBIAN_DIST_VERSION := $(shell lsb_release -sr |sed -e 's/\#/ /g')
11
DEBIAN_CODECS_NAME := $(subst browser,codecs-ffmpeg,$(DEBIAN_NAME))
12
DEBIAN_DRIVER_NAME := $(subst browser,chromedriver,$(DEBIAN_NAME))
14
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
16
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
17
DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
18
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
19
DEB_BUILD_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_BITS)
21
10
DEB_TAR_SRCDIR := .
22
11
SRC_DIR := $(CURDIR)/$(DEB_TAR_SRCDIR)
23
LIB_DIR := usr/lib/$(DEBIAN_NAME)
12
LIB_DIR := usr/lib/chromium-browser
24
13
BINARY_PACKAGE_COMPRESSION ?= xz
25
14
FFMPEG_DIR := third_party/ffmpeg
26
15
FFMPEG_SRC_DIR := $(SRC_DIR)/$(FFMPEG_DIR)
29
# Whitelist LP provided new langs only in release builds, PPAs ship them all
30
WANT_ONLY_WHITELISTED_NEW_LANGS ?= 0
32
18
ifneq (,$(findstring Ubuntu,$(DEBIAN_DIST)))
33
19
DISTRIBUTION=UBUNTU
34
20
UBUNTU_DIST=$(DEBIAN_DIST)
37
ifneq (,$(findstring Debian,$(DEBIAN_DIST)))
43
23
COMPONENT_SHARED_LIB_BUILD := 1
46
25
# Set up Google API keys, see http://www.chromium.org/developers/how-tos/api-keys .
47
26
# Note: these are for Ubuntu use ONLY. For your own distribution,
52
31
GOOGLEAPI_CLIENTID_UBUNTU := 424119844901.apps.googleusercontent.com
53
32
GOOGLEAPI_CLIENTSECRET_UBUNTU := AIienwDlGIIsHoKnNHmWGXyJ
55
GYP_PARAMS := --depth=$(CURDIR) --format=ninja
61
# Build the launchpad translations (already landed upstream)
62
GYP_DEFINES += use_third_party_translations=1
64
# Always add debug symbols, and strip them when we don't want them.
65
#GYP_DEFINES += release_extra_cflags="-g"
67
# Don't fail on compilation warnings.
68
GYP_DEFINES += werror=$(NULL)
70
# We are never using a sysroot-based toolchain; override the wrong
71
# autodetection for arm.
72
GYP_DEFINES += sysroot=
73
GYP_DEFINES += use_sysroot=0
76
GYP_DEFINES += dont_embed_build_metadata=0
78
# NO NO NO, we never want to use bundled binutils. No. Just no.
79
GYP_DEFINES += linux_use_bundled_binutils=0
81
# Link directly to library instead of using dlopen.
82
GYP_DEFINES += linux_link_gsettings=1
84
# Disable NaCl until we figure out what to do with the private toolchain
85
GYP_DEFINES += disable_nacl=1
34
gyp_params := --depth=$(CURDIR) --format=ninja
40
# enable verbose build messages
43
# enable all build hardening flags
44
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
46
# Don't let dh_installinit install *.default in /etc/default
47
DEB_DH_INSTALLINIT_ARGS += --noscripts --onlyscripts
49
# Don't let scour touch the svg files
50
DEB_DH_SCOUR_ARGS += -Xsvg
52
DEB_DH_BUILDDEB_ARGS += -- -Z $(BINARY_PACKAGE_COMPRESSION)
55
# Don't build it as part of chromium. Build it separately twice, once with
56
# the Chrome branding to gain the extra codecs, and once without branding.
57
# The ffmpeg_branding variable controls which codecs are built inside the ffmpeg lib.
58
# By default, ffmpeg_branding equals to "Chromium" and only builds the ogg/vorbis/theora codecs.
59
# When set to "Chrome", it also builds aac/ac3/mpeg4audio/h264/mov/mp3
60
DEB_DH_SHLIBDEPS_ARGS_chromium-codecs-ffmpeg := -l$(CURDIR)/debian/chromium-codecs-ffmpeg/$(LIB_DIR)
61
DEB_DH_SHLIBDEPS_ARGS_chromium-codecs-ffmpeg-extra := -l$(CURDIR)/debian/chromium-codecs-ffmpeg-extra/$(LIB_DIR)
63
### SYNC TO DEBIAN RULES start
65
# linker flags to avoid memory allocation issues on i386
66
export LDFLAGS+=-Wl,--no-keep-memory -Wl,--reduce-memory-overheads -Wl,--hash-size=7919
68
# more verbose linker output
69
export LDFLAGS+=-Wl,--stats
71
# use the gold linker to avoid memory exhaustion issues at link time
72
export CFLAGS+=-fuse-ld=gold
73
export CXXFLAGS+=-fuse-ld=gold
75
# treat all warnings as errors
78
# build with gcc instead of clang
80
defines+=clang_use_chrome_plugins=
83
defines+=use_ozone=0 \
89
linux_use_gold_flags=0 \
90
linux_use_bundled_gold=0 \
91
linux_use_bundled_binutils=0 \
95
enable_remoting_host=0 \
96
enable_prod_wallet_service=0 \
99
defines+=enable_hidpi=1 \
103
use_gnome_keyring=1 \
104
linux_link_libpci=1 \
105
linux_link_gsettings=1 \
106
linux_link_libspeechd=1 \
107
linux_link_gnome_keyring=1 \
109
# system libraries to use
110
defines+=use_system_re2=1 \
116
use_system_libpng=1 \
117
use_system_libxml=1 \
118
use_system_libjpeg=1 \
119
use_system_libwebp=1 \
120
use_system_libxslt=1 \
121
use_system_libsrtp=1 \
122
use_system_jsoncpp=1 \
123
use_system_libevent=1 \
124
use_system_harfbuzz=1 \
125
use_system_xdg_utils=1 \
127
### Debian diversion, not prop on all codecs
128
browser_defines+=proprietary_codecs=1
132
release_extra_cflags=-g \
134
ffmpeg_std_defines := $(NULL)
135
ffmpeg_extra_defines := ffmpeg_branding=Chrome
136
### Debian diversion end
138
# use embedded protobuf for now (bug #764911)
139
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764911
140
defines+=use_system_protobuf=0 \
143
defines+=use_system_icu=0 \
144
#icu_use_data_file_flag=0 \
145
#want_separate_host_toolset=0 \
147
# reduce the size of debugging symbols
148
defines+=remove_webcore_debug_symbols=1
150
# some notes about embedded libraries
151
# use_system_libusb=0 requires modified source that exposes libusb_interrupt_handle_event api
152
# use_system_libvpx=0 need to run unbundler
153
# use_system_sqlite=0 build fails
154
# can't use system nss since net/third_party/nss is heavily patched
155
# can't use system ots (open text *summarizer*) since that's not google's ots (open text *sanitizer*)
157
# make gyp a little more informative
161
### SYNC TO DEBIAN RULES end
163
defines += dont_embed_build_metadata=0
87
165
# do not use third_party/gold as the linker.
88
GYP_DEFINES += linux_use_gold_binary=0 linux_use_gold_flags=0
166
defines += linux_use_gold_binary=0 linux_use_gold_flags=0 linux_use_bundled_gold=0
90
168
# enable features that we want.
91
GYP_DEFINES += enable_webrtc=1
92
GYP_DEFINES += enable_mdns=1
93
GYP_DEFINES += use_nss_verifier=1
95
# get resources for high dpi and touch
96
GYP_DEFINES += use_aura=1
97
GYP_DEFINES += enable_hidpi=1
98
GYP_DEFINES += enable_touch_ui=1
100
GYP_DEFINES += enable_hangout_services_extension=1
169
defines += enable_mdns=1
170
defines += use_nss_verifier=1
171
defines += enable_touch_ui=1
172
defines += enable_hangout_services_extension=1
102
173
# add support and stubbed implementation of widevine (needed for EME)
103
GYP_DEFINES += enable_widevine=1 enable_pepper_cdms=1
105
# Prefer gcc/g++ over clang until clang is better tested in Ubuntu.
106
GYP_DEFINES += clang=0
107
GYP_DEFINES += clang_use_chrome_plugins=0
109
#GYP_DEFINES += use_ozone=1 ozone_auto_platforms=0 ozone_platform_mir=1 ozone_platform_wayland=0
110
#GYP_DEFINES += use_ozone=1
111
#GYP_DEFINES += ozone_platform_mir=1
174
defines += enable_widevine=1 enable_pepper_cdms=1
176
#defines += use_ozone=1 ozone_auto_platforms=0 ozone_platform_mir=1 ozone_platform_wayland=0
177
#defines += use_ozone=1
178
#defines += ozone_platform_mir=1
113
180
# Intentional configuration, not bug work-arounds.
114
181
ifeq (arm,$(DEB_HOST_ARCH_CPU))
118
185
target_arch=arm \
122
189
ifeq (armel,$(DEB_HOST_ARCH))
124
191
v8_use_arm_eabi_hardfloat=false \
125
192
arm_float_abi=soft \
145
212
ifeq (amd64,$(DEB_HOST_ARCH))
146
GYP_DEFINES += target_arch=x64
213
defines += target_arch=x64
148
215
ifeq (i386,$(DEB_HOST_ARCH))
149
GYP_DEFINES += target_arch=ia32
216
defines += target_arch=ia32
150
217
# SEGV on component builds, 2013-05
151
GYP_DEFINES += use_allocator=none
218
defines += use_allocator=none
152
219
# Some mobile CPUs don't support SSE instructions. SIGILL. 2014-08
153
GYP_DEFINES += disable_sse2=1
220
defines += disable_sse2=1
157
224
ifeq (1,$(COMPONENT_SHARED_LIB_BUILD))
158
BROWSER_GYP_DEFINES += component=shared_library
159
FFMPEG_GYP_DEFINES += component=shared_library
225
browser_defines += component=shared_library
226
ffmpeg_defines += component=shared_library
162
229
# Webkit library is enormous. Exclude for now.
163
GYP_DEFINES += remove_webcore_debug_symbols=1
165
# Don't let dh_installinit install *.default in /etc/default
166
DEB_DH_INSTALLINIT_ARGS += --noscripts --onlyscripts
168
# Don't let scour touch the svg files
169
DEB_DH_SCOUR_ARGS += -Xsvg
171
DEB_DH_BUILDDEB_ARGS += -- -Z $(BINARY_PACKAGE_COMPRESSION)
173
ifneq (0,$(WANT_DEBUG))
230
defines += remove_webcore_debug_symbols=1
176
232
BUILD_TYPE := Release
178
GYP_DEFINES += linux_dump_symbols=1
179
GYP_DEFINES += logging_like_official_build=1
234
defines += linux_dump_symbols=1
235
defines += logging_like_official_build=1
182
237
# Shared libraries
183
ifeq (1,$(WANT_SHARED_LIBS))
184
GYP_DEFINES += library=shared_library
238
ifeq (1,$(COMPONENT_SHARED_LIB_BUILD))
239
defines += library=shared_library
188
# sed -i 's^\("/usr/lib/nss"\)^/*REM \1 REM*/"/usr/lib/$(DEB_HOST_MULTIARCH)/nss"/**/^' $(DEB_TAR_SRCDIR)/crypto/nss_util.cc
189
# perl $(CURDIR)/debian/enable-dist-patches.pl $(DEBIAN_DIST_VERSION) $(CURDIR)/debian/patches/series
192
debian/$(DEBIAN_NAME).sh \
196
# Don't build it as part of chromium. Build it separately twice, once with
197
# the Chrome branding to gain the extra codecs, and once without branding.
198
# The ffmpeg_branding variable controls which codecs are built inside the ffmpeg lib.
199
# By default, ffmpeg_branding equals to "Chromium" and only builds the ogg/vorbis/theora codecs.
200
# When set to "Chrome", it also builds aac/ac3/mpeg4audio/h264/mov/mp3
201
DEB_DH_SHLIBDEPS_ARGS_$(DEBIAN_CODECS_NAME) := -l$(CURDIR)/debian/$(DEBIAN_CODECS_NAME)/$(LIB_DIR)
202
DEB_DH_SHLIBDEPS_ARGS_$(DEBIAN_CODECS_NAME)-extra := -l$(CURDIR)/debian/$(DEBIAN_CODECS_NAME)-extra/$(LIB_DIR)
203
BROWSER_GYP_DEFINES += \
204
proprietary_codecs=1 \
206
FFMPEG_GYP_DEFINES += \
208
release_extra_cflags=-g \
210
FFMPEG_STD_GYP_DEFINES = $(NULL)
211
FFMPEG_EXTRA_GYP_DEFINES = ffmpeg_branding=Chrome
243
debian/chromium-browser.sh \
213
246
# Precise doesn't set some settings.
214
247
ifeq (,$(filter 12.04%,$(UBUNTU_DIST)))
215
248
# controlling the use of GConf (the classic GNOME configuration
216
249
# and GIO, which contains GSettings (the new GNOME config system)
217
GYP_DEFINES += use_gconf=1 use_gio=1
250
defines += use_gconf=1 use_gio=1
220
253
# Build chrome and chrome_sandbox, and chromedriver
494
526
# Upstream changes often. Fail when they introduce a config flag we don't know about.
495
527
-diff --ignore-case --suppress-common-lines --unified=0 debian/known_gyp_flags <(sed -e "/: *'<(/{ s,.*'<(,,g; s,).*,,; p; }" -e d build/common.gypi | LC_ALL=C sort -u |grep -v '^\(win_\|mac_\|android_\|.san\|..san\|msvs_\|ios_\|goma_\|windows_\|wix_\|directx_\)') || echo This seems bad.
497
cd $(SRC_DIR) && $(GYP_ENV) $(CROSS_BUILD) build/gyp_chromium build/all.gyp $(GYP_PARAMS)
529
cd $(SRC_DIR) && $(gyp_env) $(CROSS_BUILD) build/gyp_chromium build/all.gyp $(gyp_params)
500
532
while sleep 1200; do echo "# I ATEN'T DEAD"; done& $(BUILD_DEFINES) $(NINJA) $(BUILD_ARGS) $(BUILD_TARGETS) && { kill \%1; sleep 1; echo; true; } || { kill \%1; exit 1; sleep 2; echo; false; }
501
533
mv -v $(DEB_TAR_SRCDIR)/out/$(BUILD_TYPE) $(DEB_TAR_SRCDIR)/out/$(BUILD_TYPE)-chromium
504
build-stamp-ffmpeg-%: GYP_ENV := GYP_GENERATORS=ninja GYP_DEFINES="$(GYP_DEFINES) $(FFMPEG_EXTRA_GYP_DEFINES) $(FFMPEG_GYP_DEFINES)"
536
build-stamp-ffmpeg-%: gyp_env := GYP_GENERATORS=ninja GYP_DEFINES="$(defines) $(ffmpeg_extra_defines) $(ffmpeg_defines)"
505
537
build-stamp-ffmpeg-%: BUILD_ARGS := -v -C $(DEB_TAR_SRCDIR)/out/$(BUILD_TYPE)
506
538
build-stamp-ffmpeg-%: TARGET := lib/libffmpeg.so
507
539
build-stamp-ffmpeg-%:
510
542
test ! -e $(SRC_DIR)/out/$(BUILD_TYPE)-ffmpeg-$*
511
cd $(SRC_DIR) && $(GYP_ENV) $(CROSS_BUILD) build/gyp_chromium build/all.gyp $(GYP_PARAMS)
543
cd $(SRC_DIR) && $(gyp_env) $(CROSS_BUILD) build/gyp_chromium build/all.gyp $(gyp_params)
514
546
$(NINJA) $(BUILD_ARGS) $(TARGET)