]> git.armaanb.net Git - asd-repo.git/blob - extra/chromium/build
mpv: move to junk
[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     libxml
50 "
51
52 # remove build scripts for system provided dependencies - basically does the
53 # same as the bundled script to remove bundled libs, but this way we don't
54 # have to list the remaining libs
55 for lib in $system; do
56     find . -type f -path "*third_party/$lib/*" \
57         \! -path "*third_party/$lib/chromium/*" \
58         \! -path "*third_party/$lib/google/*" \
59         \! -path "./base/third_party/icu/*" \
60         \! -path "./third_party/pdfium/third_party/freetype/include/pstables.h" \
61         \! -path "./third_party/harfbuzz-ng/utils/hb_scoped.h" \
62         \! -name "*.gn" \
63         \! -name "*.gni" \
64         \! -name "*.isolate" \
65         \! -name "*.py" \
66         -exec rm -rf {} +
67 done
68
69 # switch to system provided dependencies
70 # shellcheck disable=2086
71 ./build/linux/unbundle/replace_gn_files.py --system-libraries $system
72
73 ./third_party/libaddressinput/chromium/tools/update-strings.py
74
75 conf="
76     google_api_key=\"\"
77     google_default_client_id=\"\"
78     google_default_client_secret=\"\"
79     use_official_google_api_keys=false
80     use_unofficial_version_number=false
81     blink_symbol_level=0
82     safe_browsing_mode=0
83     exclude_unwind_tables=true
84     build_with_tflite_lib=false
85     fatal_linker_warnings=false
86     clang_use_chrome_plugins=false
87     treat_warnings_as_errors=false
88     fieldtrial_testing_like_official_build=true
89     custom_toolchain=\"//build/toolchain/linux/unbundle:default\"
90     host_toolchain=\"//build/toolchain/linux/unbundle:default\"
91     enable_vr=false
92     enable_widevine=false
93     enable_swiftshader=false
94     is_cfi=false
95     is_clang=true
96     is_debug=false
97     use_thin_lto=false
98     is_official_build=true
99     rtc_use_pipewire=false
100     proprietary_codecs=true
101     rtc_build_examples=false
102     ffmpeg_branding=\"Chrome\"
103     link_pulseaudio=false
104     ozone_platform_x11=true
105     ozone_platform_wayland=false
106     symbol_level=0
107     use_allocator=\"none\"
108     use_allocator_shim=false
109     use_atk=false
110     use_gio=false
111     use_gtk=false
112     use_lld=true
113     use_x11=true
114     use_cups=false
115     use_dbus=false
116     use_glib=false
117     use_gold=false
118     use_libpci=false
119     use_sysroot=false
120     use_kerberos=false
121     use_pangocairo=false
122     use_pulseaudio=false
123     use_system_zlib=true
124     use_custom_libcxx=false
125     use_gnome_keyring=false
126     use_system_harfbuzz=true
127     use_vaapi=true
128     chrome_pgo_phase=0
129     enable_mdns=false
130     enable_nacl=false
131     enable_remoting=false
132     enable_reporting=false
133     enable_nacl_nonsfi=false
134     enable_reading_list=false
135     enable_js_type_check=false
136     enable_one_click_signin=false
137     enable_service_discovery=false
138     enable_mse_mpeg2ts_stream_parser=true
139     enable_hangout_services_extension=false
140 "
141
142 out/Release/gn gen out/Release --args="$conf"
143
144 # final link needs lots of file descriptors, almost all shells support the -n flag.
145 # shellcheck disable=2039,3045
146 ulimit -n 4096
147
148 ninja -C out/Release chrome
149
150 # Package the monster.
151 install -Dm755 chromium.sh            "$1/usr/bin/chromium"
152 install -Dm755 out/Release/chrome     "$1/usr/lib/chromium/chromium"
153 install -Dm644 out/Release/icudtl.dat "$1/usr/lib/chromium"
154 install -Dm644 out/Release/locales/*.pak -t "$1/usr/lib/chromium/locales"
155
156 for lib in libEGL.so libGLESv2.so; do
157     install -Dm755 "out/Release/$lib" "$1/usr/lib/chromium"
158 done
159
160 for stuff in bin pak; do
161     install -Dm644 out/Release/*.$stuff "$1/usr/lib/chromium"
162 done
163