]> git.armaanb.net Git - asd-repo.git/blob - extra/chromium/build
chromium: use vaapi
[asd-repo.git] / extra / chromium / build
1 #!/bin/sh -e
2
3 for patch in *.patch; do
4     patch -p1 < "$patch"
5 done
6
7 python ungoogled-chromium/utils/prune_binaries.py \
8     ./ ungoogled-chromium/pruning.list
9
10 # Bypass the Python script and apply patches ourselves to avoid GNU patch
11 while read -r patch; do
12     [ "$patch" ] || continue
13     patch -p1 < "ungoogled-chromium/patches/$patch"
14 done < ungoogled-chromium/patches/series
15
16 python ungoogled-chromium/utils/domain_substitution.py apply \
17     -r ungoogled-chromium/domain_regex.list \
18     -f ungoogled-chromium/domain_substitution.list \
19     -c domainsubcache.tar.gz ./
20
21 # Avoid falling back to preprocessor mode when sources contain time macros
22 kiss list ccache && export CCACHE_SLOPPINESS=time_macros
23
24 # Force script incompatible with Python 3 to use /usr/bin/python2
25 # Remove in next release. How exciting.
26 sed -i "1s|python$|&2|" third_party/dom_distiller_js/protoc_plugins/*.py
27
28 mkdir -p third_party/node/linux/node-linux-x64/bin
29 ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
30
31 export CC="${CC:-cc}"
32 export CXX="${CXX:-c++}"
33 export AR="${AR:-ar}"
34 export NM="${NM:-nm}"
35
36 # Allow building against system libraries in official builds
37 sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
38     tools/generate_shim_headers/generate_shim_headers.py
39
40 # compile gn early, so it can be used to generate gni stuff
41 LDFLAGS="$LDFLAGS -lc++ -lc++abi -lunwind" \
42     ./tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
43
44 system="
45     fontconfig
46     freetype
47     harfbuzz-ng
48     libdrm
49     libwebp
50     libxml
51     opus
52 "
53
54 # remove build scripts for system provided dependencies - basically does the
55 # same as the bundled script to remove bundled libs, but this way we don't
56 # have to list the remaining libs
57 for lib in $system; do
58     find . -type f -path "*third_party/$lib/*" \
59         \! -path "*third_party/$lib/chromium/*" \
60         \! -path "*third_party/$lib/google/*" \
61         \! -path "./base/third_party/icu/*" \
62         \! -path "./third_party/pdfium/third_party/freetype/include/pstables.h" \
63         \! -path "./third_party/harfbuzz-ng/utils/hb_scoped.h" \
64         \! -name "*.gn" \
65         \! -name "*.gni" \
66         \! -name "*.isolate" \
67         \! -name "*.py" \
68         -exec rm -rf {} +
69 done
70
71 # switch to system provided dependencies
72 # shellcheck disable=2086
73 ./build/linux/unbundle/replace_gn_files.py --system-libraries $system
74
75 ./third_party/libaddressinput/chromium/tools/update-strings.py
76
77 conf="
78     google_api_key=\"\"
79     google_default_client_id=\"\"
80     google_default_client_secret=\"\"
81     use_official_google_api_keys=false
82     use_unofficial_version_number=false
83     blink_symbol_level=0
84     safe_browsing_mode=0
85     exclude_unwind_tables=true
86     build_with_tflite_lib=false
87     fatal_linker_warnings=false
88     clang_use_chrome_plugins=false
89     treat_warnings_as_errors=false
90     fieldtrial_testing_like_official_build=true
91     custom_toolchain=\"//build/toolchain/linux/unbundle:default\"
92     host_toolchain=\"//build/toolchain/linux/unbundle:default\"
93     enable_vr=false
94     enable_widevine=false
95     enable_swiftshader=false
96     is_cfi=false
97     is_clang=true
98     is_debug=false
99     use_thin_lto=false
100     is_official_build=true
101     rtc_use_pipewire=false
102     proprietary_codecs=true
103     rtc_build_examples=false
104     ffmpeg_branding=\"Chrome\"
105     link_pulseaudio=false
106     ozone_platform_x11=true
107     ozone_platform_wayland=false
108     symbol_level=0
109     use_allocator=\"none\"
110     use_allocator_shim=false
111     use_atk=false
112     use_gio=false
113     use_gtk=false
114     use_lld=true
115     use_x11=true
116     use_cups=false
117     use_dbus=false
118     use_glib=false
119     use_gold=false
120     use_libpci=false
121     use_sysroot=false
122     use_kerberos=false
123     use_pangocairo=false
124     use_pulseaudio=false
125     use_system_zlib=true
126     use_custom_libcxx=false
127     use_gnome_keyring=false
128     use_system_harfbuzz=true
129     use_vaapi=true
130     chrome_pgo_phase=0
131     enable_mdns=false
132     enable_nacl=false
133     enable_remoting=false
134     enable_reporting=false
135     enable_nacl_nonsfi=false
136     enable_reading_list=false
137     enable_js_type_check=false
138     enable_one_click_signin=false
139     enable_service_discovery=false
140     enable_mse_mpeg2ts_stream_parser=true
141     enable_hangout_services_extension=false
142 "
143
144 out/Release/gn gen out/Release --args="$conf"
145
146 # final link needs lots of file descriptors, almost all shells support the -n flag.
147 # shellcheck disable=2039,3045
148 ulimit -n 4096
149
150 ninja -C out/Release chrome
151
152 # Package the monster.
153 install -Dm755 chromium.sh            "$1/usr/bin/chromium"
154 install -Dm755 out/Release/chrome     "$1/usr/lib/chromium/chromium"
155 install -Dm644 out/Release/icudtl.dat "$1/usr/lib/chromium"
156 install -Dm644 out/Release/locales/*.pak -t "$1/usr/lib/chromium/locales"
157
158 for lib in libEGL.so libGLESv2.so; do
159     install -Dm755 "out/Release/$lib" "$1/usr/lib/chromium"
160 done
161
162 for stuff in bin pak; do
163     install -Dm644 out/Release/*.$stuff "$1/usr/lib/chromium"
164 done
165