Initial commit
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
||||
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
||||
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
||||
|
||||
# The prepare function is executed in the root of the temp directory
|
||||
# This function is used for putting downloaded files to the correct location or applying patches
|
||||
prepare() {
|
||||
cd "$BPM_SOURCE"
|
||||
for _patch in "$BPM_WORKDIR"/*.patch; do
|
||||
patch -Np1 -i "$_patch"
|
||||
done
|
||||
|
||||
# Allow building against system libraries in official builds
|
||||
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' tools/generate_shim_headers/generate_shim_headers.py
|
||||
|
||||
# Link to system tools required by the build
|
||||
mkdir -p third_party/node/linux/node-linux-x64/bin third_party/jdk/current/bin
|
||||
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
|
||||
ln -s /usr/bin/java third_party/jdk/current/bin/
|
||||
|
||||
local _system_libs=(
|
||||
brotli
|
||||
flac
|
||||
fontconfig
|
||||
freetype
|
||||
harfbuzz-ng
|
||||
libjpeg
|
||||
libwebp
|
||||
libxml
|
||||
libxslt
|
||||
opus
|
||||
zlib
|
||||
)
|
||||
|
||||
# Remove bundled libraries for which we will use the system copies; this
|
||||
# *should* do what the remove_bundled_libraries.py script does, with the
|
||||
# added benefit of not having to list all the remaining libraries
|
||||
local _lib
|
||||
for _lib in "${_system_libs[@]//libjpeg/libjpeg_turbo}"; do
|
||||
find "third_party/$_lib" -type f \
|
||||
\! -path "third_party/$_lib/chromium/*" \
|
||||
\! -path "third_party/$_lib/google/*" \
|
||||
\! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
|
||||
\! -regex '.*\.\(gn\|gni\|isolate\)' \
|
||||
-delete
|
||||
done
|
||||
|
||||
./build/linux/unbundle/replace_gn_files.py --system-libraries "${_system_libs[@]}"
|
||||
|
||||
# Use correct libadler lib
|
||||
sed -i 's/rustc_nightly_capability = use_chromium_rust_toolchain/rustc_nightly_capability = true/' build/config/rust.gni
|
||||
}
|
||||
|
||||
# The build function is executed in the source directory
|
||||
# This function is used to compile the source code
|
||||
build() {
|
||||
export CC=clang CXX=clang++ AR=ar NM=nm
|
||||
|
||||
local _flags=(
|
||||
'custom_toolchain="//build/toolchain/linux/unbundle:default"'
|
||||
'host_toolchain="//build/toolchain/linux/unbundle:default"'
|
||||
'is_official_build=true' # implies is_cfi=true on x86_64
|
||||
'symbol_level=0' # sufficient for backtraces on x86(_64)
|
||||
'treat_warnings_as_errors=false'
|
||||
'fatal_linker_warnings=false'
|
||||
'disable_fieldtrial_testing_config=true'
|
||||
'blink_enable_generated_code_formatting=false'
|
||||
'ffmpeg_branding="Chrome"'
|
||||
'proprietary_codecs=true'
|
||||
'rtc_use_pipewire=true'
|
||||
'link_pulseaudio=true'
|
||||
'use_custom_libcxx=true' # https://github.com/llvm/llvm-project/issues/61705
|
||||
'use_sysroot=false'
|
||||
'use_system_libffi=true'
|
||||
'enable_hangout_services_extension=true'
|
||||
'enable_widevine=true'
|
||||
'use_qt5=false'
|
||||
'use_qt6=true'
|
||||
'moc_qt6_path="/usr/lib/qt6"'
|
||||
'use_clang_modules=false'
|
||||
'clang_base_path="/usr"'
|
||||
'clang_use_chrome_plugins=false'
|
||||
"clang_version=$(clang --version | grep -m1 version | sed 's/.* \([0-9]\+\).*/\1/')"
|
||||
'chrome_pgo_phase=0'
|
||||
'rust_sysroot_absolute="/usr"'
|
||||
'rust_bindgen_root="/usr"'
|
||||
"rustc_version=\"$(rustc --version)\""
|
||||
)
|
||||
|
||||
export RUSTC_BOOTSTRAP=1
|
||||
|
||||
# Make builds deterministic and ignore unknown option warnings
|
||||
export CFLAGS="${CFLAGS} -Wno-builtin-macro-redefined -Wno-unknown-warning-option"
|
||||
export CXXFLAGS="${CXXFLAGS} -Wno-builtin-macro-redefined -Wno-unknown-warning-option"
|
||||
export CPPFLAGS="${CPPFLAGS} -D__DATE__= -D__TIME__= -D__TIMESTAMP__="
|
||||
|
||||
gn gen out/Release --args="${_flags[*]}"
|
||||
ninja -C out/Release chrome chrome_sandbox chromedriver.unstripped
|
||||
}
|
||||
|
||||
# The package function is executed in the source directory
|
||||
# This function is used to move the compiled files into the output directory
|
||||
package() {
|
||||
install -Dm755 out/Release/chrome "$BPM_OUTPUT"/usr/lib/chromium/chromium
|
||||
install -Dm755 out/Release/chrome_crashpad_handler "$BPM_OUTPUT"/usr/lib/chromium/chrome_crashpad_handler
|
||||
install -Dm755 out/Release/chromedriver.unstripped "$BPM_OUTPUT"/usr/lib/chromium/chromedriver
|
||||
install -Dm755 out/Release/libEGL.so "$BPM_OUTPUT"/usr/lib/chromium/libEGL.so
|
||||
install -Dm755 out/Release/libGLESv2.so "$BPM_OUTPUT"/usr/lib/chromium/libGLESv2.so
|
||||
install -Dm755 out/Release/libvk_swiftshader.so "$BPM_OUTPUT"/usr/lib/chromium/libvk_swiftshader.so
|
||||
install -Dm755 out/Release/libvulkan.so.1 "$BPM_OUTPUT"/usr/lib/chromium/libvulkan.so.1
|
||||
install -Dm755 out/Release/vk_swiftshader_icd.json "$BPM_OUTPUT"/usr/lib/chromium/vk_swiftshader_icd.json
|
||||
install -Dm755 out/Release/libqt6_shim.so "$BPM_OUTPUT"/usr/lib/chromium/libqt6_shim.so
|
||||
install -Dm644 out/Release/icudtl.dat "$BPM_OUTPUT"/usr/lib/chromium/icudtl.dat
|
||||
install -Dm644 out/Release/locales/*.pak -t "$BPM_OUTPUT"/usr/lib/chromium/locales/
|
||||
install -Dm644 out/Release/*.bin -t "$BPM_OUTPUT"/usr/lib/chromium
|
||||
install -Dm644 out/Release/*.pak -t "$BPM_OUTPUT"/usr/lib/chromium
|
||||
|
||||
# Install chromium launcher script
|
||||
install -Dm755 "$BPM_WORKDIR"/chromium.sh "$BPM_OUTPUT"/usr/bin/chromium
|
||||
|
||||
# Create symbolic link to usr/bin
|
||||
ln -sf /usr/lib/chromium/chromedriver "$BPM_OUTPUT"/usr/bin/chromedriver
|
||||
|
||||
# Install desktop icons
|
||||
for size in 24 48 64 128 256; do
|
||||
install -Dm644 chrome/app/theme/chromium/product_logo_${size}.png "$BPM_OUTPUT"/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png
|
||||
done
|
||||
for size in 16 32; do
|
||||
install -Dm644 chrome/app/theme/default_100_percent/chromium/product_logo_${size}.png "$BPM_OUTPUT"/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png
|
||||
done
|
||||
|
||||
# Install desktop file
|
||||
install -Dm644 chrome/installer/linux/common/desktop.template "$BPM_OUTPUT"/usr/share/applications/chromium.desktop
|
||||
|
||||
# Install man page
|
||||
install -Dm644 chrome/app/resources/manpage.1.in "$BPM_OUTPUT"/usr/share/man/man1/chromium.1
|
||||
|
||||
# Replace placeholders in desktop file and man page
|
||||
sed -i \
|
||||
-e 's/@@MENUNAME/Chromium/g' \
|
||||
-e 's/@@PACKAGE/chromium/g' \
|
||||
-e 's/@@usr_bin_symlink_name/chromium/g' \
|
||||
-e 's|@@uri_scheme|x-scheme-handler/chromium;|g' \
|
||||
-e 's/@@extra_desktop_entries//g' \
|
||||
"$BPM_OUTPUT"/usr/share/applications/chromium.desktop \
|
||||
"$BPM_OUTPUT"/usr/share/man/man1/chromium.1
|
||||
|
||||
# Install package license
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/chromium/LICENSE
|
||||
}
|
||||
Reference in New Issue
Block a user