build: Add sysroot creator script

This commit is contained in:
klzgrad 2019-10-05 15:52:34 +08:00
parent 874cd1b7a4
commit e1ab530f2c
4 changed files with 29 additions and 433 deletions

View File

@ -9,8 +9,14 @@ set -o errexit
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
KEYS=(
# Debian Ports Archive Automatic Signing Key (2023)
"B523E5F3FC4E5F2C"
# Debian Ports Archive Automatic Signing Key (2024)
"8D69674688B6CB36"
# Debian Archive Automatic Signing Key (12/bookworm)
"6ED0E7B82643E131"
"B7C5D7D6350947F8"
# Debian Security Archive Automatic Signing Key (12/bookworm)
"254CF3B5AEC0A8F0"
# Debian Stable Release Key (12/bookworm)
"F8D2585B8783D481"
# Debian Archive Automatic Signing Key (11/bullseye)

View File

@ -35,7 +35,7 @@ from urllib.request import urlopen
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(SCRIPT_DIR)))
VALID_ARCHS = ('amd64', 'i386', 'armhf', 'arm64', 'armel', 'mipsel', 'mips64el')
VALID_ARCHS = ('amd64', 'i386', 'armhf', 'arm64', 'armel', 'mipsel', 'mips64el', 'riscv64')
ARCH_TRANSLATIONS = {
'x64': 'amd64',

View File

@ -32,11 +32,6 @@ ARCHIVE_TIMESTAMP=20230611T210420Z
ARCHIVE_URL="https://snapshot.debian.org/archive/debian/$ARCHIVE_TIMESTAMP/"
APT_SOURCES_LIST=(
# Debian 12 (Bookworm) is needed for GTK4. It should be kept before bullseye
# so that bullseye takes precedence.
"${ARCHIVE_URL} bookworm main"
"${ARCHIVE_URL} bookworm-updates main"
# This mimics a sources.list from bullseye.
"${ARCHIVE_URL} bullseye main contrib non-free"
"${ARCHIVE_URL} bullseye-updates main contrib non-free"
@ -48,460 +43,50 @@ KEYRING_FILE="${SCRIPT_DIR}/keyring.gpg"
# Sysroot packages: these are the packages needed to build chrome.
DEBIAN_PACKAGES="\
comerr-dev
krb5-multidev
libasound2
libasound2-dev
libasyncns0
libatk-bridge2.0-0
libatk-bridge2.0-dev
libatk1.0-0
libatk1.0-dev
libatomic1
libatspi2.0-0
libatspi2.0-dev
libattr1
libaudit1
libavahi-client3
libavahi-common3
libb2-1
libblkid-dev
libblkid1
libbluetooth-dev
libbluetooth3
libbrotli-dev
libbrotli1
libbsd0
libc6
libc6-dev
libcairo-gobject2
libcairo-script-interpreter2
libcairo2
libcairo2-dev
libcap-dev
libcap-ng0
libcap2
libcloudproviders0
libcolord2
libcom-err2
libcrypt-dev
libcrypt1
libcups2
libcups2-dev
libcupsimage2
libcupsimage2-dev
libcurl3-gnutls
libcurl4-gnutls-dev
libdatrie-dev
libdatrie1
libdb5.3
libdbus-1-3
libdbus-1-dev
libdbus-glib-1-2
libdbusmenu-glib-dev
libdbusmenu-glib4
libdbusmenu-gtk3-4
libdbusmenu-gtk4
libdeflate-dev
libdeflate0
libdouble-conversion3
libdrm-amdgpu1
libdrm-dev
libdrm-nouveau2
libdrm-radeon1
libdrm2
libegl-dev
libegl1
libegl1-mesa
libegl1-mesa-dev
libelf-dev
libelf1
libepoxy-dev
libepoxy0
libevdev-dev
libevdev2
libevent-2.1-7
libexpat1
libexpat1-dev
libffi-dev
libffi7
libflac-dev
libflac8
libfontconfig-dev
libfontconfig1
libfreetype-dev
libfreetype6
libfribidi-dev
libfribidi0
libgbm-dev
libgbm1
libgcc-10-dev
libgcc-s1
libgcrypt20
libgcrypt20-dev
libgdk-pixbuf-2.0-0
libgdk-pixbuf-2.0-dev
libgl-dev
libgl1
libgl1-mesa-dev
libgl1-mesa-glx
libglapi-mesa
libgles-dev
libgles1
libgles2
libglib2.0-0
libglib2.0-dev
libglvnd-dev
libglvnd0
libglx-dev
libglx0
libgmp10
libgnutls-dane0
libgnutls-openssl27
libgnutls28-dev
libgnutls30
libgnutlsxx28
libgomp1
libgpg-error-dev
libgpg-error0
libgraphene-1.0-0
libgraphene-1.0-dev
libgraphite2-3
libgraphite2-dev
libgssapi-krb5-2
libgssrpc4
libgtk-3-0
libgtk-3-dev
libgtk-4-1
libgtk-4-dev
libgtk2.0-0
libgudev-1.0-0
libharfbuzz-dev
libharfbuzz-gobject0
libharfbuzz-icu0
libharfbuzz0b
libhogweed6
libice6
libicu-le-hb0
libicu67
libidl-2-0
libidn11
libidn2-0
libinput-dev
libinput10
libjbig-dev
libjbig0
libjpeg62-turbo
libjpeg62-turbo-dev
libjson-glib-1.0-0
libjsoncpp-dev
libjsoncpp24
libk5crypto3
libkadm5clnt-mit12
libkadm5srv-mit12
libkdb5-10
libkeyutils1
libkrb5-3
libkrb5-dev
libkrb5support0
liblcms2-2
libldap-2.4-2
liblerc4
libltdl7
liblz4-1
liblzma5
liblzo2-2
libmd0
libmd4c0
libminizip-dev
libminizip1
libmount-dev
libmount1
libmtdev1
libncurses-dev
libncurses6
libncursesw6
libnettle8
libnghttp2-14
libnsl2
libnspr4
libnspr4-dev
libnss-db
libnss3
libnss3-dev
libogg-dev
libogg0
libopengl0
libopus-dev
libopus0
libp11-kit0
libpam0g
libpam0g-dev
libpango-1.0-0
libpango1.0-dev
libpangocairo-1.0-0
libpangoft2-1.0-0
libpangox-1.0-0
libpangoxft-1.0-0
libpci-dev
libpci3
libpciaccess0
libpcre16-3
libpcre2-16-0
libpcre2-32-0
libpcre2-8-0
libpcre2-dev
libpcre2-posix2
libpcre3
libpcre3-dev
libpcre32-3
libpcrecpp0v5
libpipewire-0.3-0
libpipewire-0.3-dev
libpixman-1-0
libpixman-1-dev
libpng-dev
libpng16-16
libproxy1v5
libpsl5
libpthread-stubs0-dev
libpulse-dev
libpulse-mainloop-glib0
libpulse0
libqt5concurrent5
libqt5core5a
libqt5dbus5
libqt5gui5
libqt5network5
libqt5printsupport5
libqt5sql5
libqt5test5
libqt5widgets5
libqt5xml5
libqt6concurrent6
libqt6core6
libqt6dbus6
libqt6gui6
libqt6network6
libqt6opengl6
libqt6openglwidgets6
libqt6printsupport6
libqt6sql6
libqt6test6
libqt6widgets6
libqt6xml6
libre2-9
libre2-dev
librest-0.7-0
librtmp1
libsasl2-2
libselinux1
libselinux1-dev
libsepol1
libsepol1-dev
libsm6
libsnappy-dev
libsnappy1v5
libsndfile1
libsoup-gnome2.4-1
libsoup2.4-1
libspa-0.2-dev
libspeechd-dev
libspeechd2
libsqlite3-0
libssh2-1
libssl-dev
libssl1.1
libstdc++-10-dev
libstdc++6
libsystemd-dev
libsystemd0
libtasn1-6
libthai-dev
libthai0
libtiff-dev
libtiff5
libtiff6
libtiffxx5
libtinfo6
libtirpc3
libts0
libudev-dev
libudev1
libunbound8
libunistring2
libutempter-dev
libutempter0
libuuid1
libva-dev
libva-drm2
libva-glx2
libva-wayland2
libva-x11-2
libva2
libvorbis0a
libvorbisenc2
libvulkan-dev
libvulkan1
libwacom2
libwayland-bin
libwayland-client0
libwayland-cursor0
libwayland-dev
libwayland-egl-backend-dev
libwayland-egl1
libwayland-egl1-mesa
libwayland-server0
libwebp-dev
libwebp6
libwebp7
libwebpdemux2
libwebpmux3
libwrap0
libx11-6
libx11-dev
libx11-xcb-dev
libx11-xcb1
libxau-dev
libxau6
libxcb-dri2-0
libxcb-dri2-0-dev
libxcb-dri3-0
libxcb-dri3-dev
libxcb-glx0
libxcb-glx0-dev
libxcb-icccm4
libxcb-image0
libxcb-image0-dev
libxcb-keysyms1
libxcb-present-dev
libxcb-present0
libxcb-randr0
libxcb-randr0-dev
libxcb-render-util0
libxcb-render-util0-dev
libxcb-render0
libxcb-render0-dev
libxcb-shape0
libxcb-shape0-dev
libxcb-shm0
libxcb-shm0-dev
libxcb-sync-dev
libxcb-sync1
libxcb-util-dev
libxcb-util1
libxcb-xfixes0
libxcb-xfixes0-dev
libxcb-xinerama0
libxcb-xinput0
libxcb-xkb1
libxcb1
libxcb1-dev
libxcomposite-dev
libxcomposite1
libxcursor-dev
libxcursor1
libxdamage-dev
libxdamage1
libxdmcp-dev
libxdmcp6
libxext-dev
libxext6
libxfixes-dev
libxfixes3
libxft-dev
libxft2
libxi-dev
libxi6
libxinerama-dev
libxinerama1
libxkbcommon-dev
libxkbcommon-x11-0
libxkbcommon0
libxml2
libxml2-dev
libxrandr-dev
libxrandr2
libxrender-dev
libxrender1
libxshmfence-dev
libxshmfence1
libxslt1-dev
libxslt1.1
libxss-dev
libxss1
libxt-dev
libxt6
libxtst-dev
libxtst6
libxxf86vm-dev
libxxf86vm1
libzstd1
linux-libc-dev
mesa-common-dev
qt6-base-dev
qt6-base-dev-tools
qtbase5-dev
qtbase5-dev-tools
shared-mime-info
uuid-dev
wayland-protocols
x11proto-dev
zlib1g
zlib1g-dev
"
DEBIAN_PACKAGES_AMD64="
libasan6
libdrm-intel1
libitm1
liblsan0
libquadmath0
libtsan0
libubsan1
valgrind
"
DEBIAN_PACKAGES_I386="
libasan6
libdrm-intel1
libitm1
libquadmath0
libubsan1
valgrind
"
DEBIAN_PACKAGES_ARMHF="
libasan6
libdrm-etnaviv1
libdrm-exynos1
libdrm-freedreno1
libdrm-omap1
libdrm-tegra0
libubsan1
valgrind
"
DEBIAN_PACKAGES_ARM64="
libasan6
libdrm-etnaviv1
libdrm-freedreno1
libdrm-tegra0
libgmp10
libitm1
liblsan0
libthai0
libtsan0
libubsan1
valgrind
"
DEBIAN_PACKAGES_ARMEL="
libasan6
libdrm-exynos1
libdrm-freedreno1
libdrm-omap1
libdrm-tegra0
libubsan1
"
@ -509,7 +94,9 @@ DEBIAN_PACKAGES_MIPSEL="
"
DEBIAN_PACKAGES_MIPS64EL="
valgrind
"
DEBIAN_PACKAGES_RISCV64="
"
readonly REQUIRED_TOOLS="curl xzcat"
@ -628,6 +215,12 @@ SetEnvironmentVariables() {
TRIPLE=mips64el-linux-gnuabi64
DEBIAN_PACKAGES_ARCH="${DEBIAN_PACKAGES_MIPS64EL}"
;;
riscv64)
TRIPLE=riscv64-linux-gnu
DEBIAN_PACKAGES_ARCH="${DEBIAN_PACKAGES_RISCV64}"
# RISCV64 has no support in bookworm
APT_SOURCES_LIST=("https://snapshot.debian.org/archive/debian-ports/20230724T141507Z/ sid main")
;;
*)
echo "ERROR: Unsupported architecture: $ARCH"
Usage
@ -747,13 +340,6 @@ StripChecksumsFromPackageList() {
HacksAndPatches() {
Banner "Misc Hacks & Patches"
# Remove an unnecessary dependency on qtchooser.
rm "${INSTALL_ROOT}/usr/lib/${TRIPLE}/qt-default/qtchooser/default.conf"
# libxcomposite1 is missing a symbols file.
cp "${SCRIPT_DIR}/libxcomposite1-symbols" \
"${INSTALL_ROOT}/debian/libxcomposite1/DEBIAN/symbols"
# __GLIBC_MINOR__ is used as a feature test macro. Replace it with the
# earliest supported version of glibc (2.26, obtained from the oldest glibc
# version in //chrome/installer/linux/debian/dist_packag_versions.json and
@ -777,12 +363,11 @@ HacksAndPatches() {
local stdlib_h="${usr_include}/stdlib.h"
sed -i '/#include <stddef.h>/a #include <limits.h>' "${stdlib_h}"
# This is for chrome's ./build/linux/pkg-config-wrapper
# which overwrites PKG_CONFIG_LIBDIR internally
SubBanner "Move pkgconfig scripts"
mkdir -p ${INSTALL_ROOT}/usr/lib/pkgconfig
mv ${INSTALL_ROOT}/usr/lib/${TRIPLE}/pkgconfig/* \
${INSTALL_ROOT}/usr/lib/pkgconfig
# RISCV64 is new and has no backward compatibility.
# Reversioning would remove necessary symbols and cause linking failures.
if [ "$ARCH" = "riscv64" ]; then
return
fi
# Avoid requiring unsupported glibc versions.
"${SCRIPT_DIR}/reversion_glibc.py" \
@ -903,7 +488,6 @@ BuildSysroot() {
HacksAndPatches
CleanupJailSymlinks
VerifyLibraryDeps
CreateTarBall
}
UploadSysroot() {
@ -982,7 +566,7 @@ GeneratePackageListImpl() {
local failed=0
for pkg in $@ ; do
local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \
egrep "pool/.*" | sed 's/.*Filename: //')
egrep "/pool" | sed 's/.*Filename: //')
if [ -z "${pkg_full}" ]; then
echo "ERROR: missing package: $pkg"
local failed=1

View File

@ -47,5 +47,11 @@
"SysrootDir": "debian_bullseye_mipsel-sysroot",
"Tarball": "debian_bullseye_mipsel_sysroot.tar.xz",
"URL": "https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain"
},
"bullseye_riscv64": {
"Key": "",
"Sha1Sum": "",
"SysrootDir": "debian_bullseye_riscv64-sysroot",
"Tarball": "debian_bullseye_riscv64_sysroot.tar.xz"
}
}