diff --git a/build_container/build_container_common.sh b/build_container/build_container_common.sh index 85b8236a..80a6c259 100755 --- a/build_container/build_container_common.sh +++ b/build_container/build_container_common.sh @@ -11,21 +11,34 @@ function download_and_check () { function install_gn(){ # Install gn tools which will be used for building wee8 + # amd64 & arm64 install binary, else compile from source case "$(uname -m)" in "x86_64") GN_ARCH=amd64 + wget -O gntool.zip "https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-${GN_ARCH}/+/latest" + unzip gntool.zip -d gntool + cp gntool/gn /usr/local/bin/gn + chmod +x /usr/local/bin/gn + rm -rf gntool* ;; "aarch64") GN_ARCH=arm64 + wget -O gntool.zip "https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-${GN_ARCH}/+/latest" + unzip gntool.zip -d gntool + cp gntool/gn /usr/local/bin/gn + chmod +x /usr/local/bin/gn + rm -rf gntool* + ;; + + "ppc64le") + git clone https://gn.googlesource.com/gn && cd gn + CC=/opt/llvm/bin/clang CXX=/opt/llvm/bin/clang++ python3 build/gen.py && \ + ninja -C out && \ + ln -sf out/gn /usr/local/bin/gn ;; - esac - wget -O gntool.zip "https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-${GN_ARCH}/+/latest" - unzip gntool.zip -d gntool - cp gntool/gn /usr/local/bin/gn - chmod +x /usr/local/bin/gn - rm -rf gntool* + esac } if [[ "$(uname -m)" == "x86_64" ]]; then diff --git a/build_container/build_container_ubuntu.sh b/build_container/build_container_ubuntu.sh index eb844d0e..d8b7f719 100755 --- a/build_container/build_container_ubuntu.sh +++ b/build_container/build_container_ubuntu.sh @@ -20,17 +20,7 @@ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ # docker-ce-cli curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - -case $ARCH in - 'ppc64le' ) - add-apt-repository "deb [arch=ppc64le] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - ;; - 'x86_64' ) - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - ;; - 'aarch64' ) - add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - ;; -esac +add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" # CMake curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - @@ -53,11 +43,11 @@ PACKAGES=( gdb git gnupg2 - google-cloud-sdk graphviz jq libffi-dev libncurses-dev + libtinfo5 libtool make ninja-build @@ -78,6 +68,10 @@ PACKAGES=( xz-utils zip) +if [[ "${ARCH}" == "x86_64" || "${ARCH}" == "aarch64" ]]; then + PACKAGES+=("google-cloud-sdk") +fi + apt-get install -y --no-install-recommends "${PACKAGES[@]}" # Set LLVM version for each cpu architecture. @@ -94,16 +88,15 @@ case $ARCH in 'aarch64' ) LLVM_DISTRO=aarch64-linux-gnu LLVM_SHA256SUM=1792badcd44066c79148ffeb1746058422cc9d838462be07e3cb19a4b724a1ee - apt-get install -y --no-install-recommends libtinfo5 # LLVM dependencies on Ubuntu 20.04 ;; esac # Bazel and related dependencies. case $ARCH in 'ppc64le' ) - BAZEL_LATEST="$(curl https://oplab9.parqtec.unicamp.br/pub/ppc64el/bazel/ubuntu_16.04/latest/ 2>&1 \ + BAZEL_LATEST="$(curl https://oplab9.parqtec.unicamp.br/pub/ppc64el/bazel/ubuntu_$(lsb_release -r | awk '{print $2}')/latest/ 2>&1 \ | sed -n 's/.*href="\([^"]*\).*/\1/p' | grep '^bazel' | head -n 1)" - curl -fSL https://oplab9.parqtec.unicamp.br/pub/ppc64el/bazel/ubuntu_16.04/latest/${BAZEL_LATEST} \ + curl -fSL https://oplab9.parqtec.unicamp.br/pub/ppc64el/bazel/ubuntu_$(lsb_release -r | awk '{print $2}')/latest/${BAZEL_LATEST} \ -o /usr/local/bin/bazel chmod +x /usr/local/bin/bazel ;; @@ -132,6 +125,7 @@ pip3 install -U pyyaml virtualenv source ./build_container_common.sh # Soft link the gcc compiler (required by python env) +ARCH=${ARCH/ppc64le/powerpc64le} # For ppc64le the ARCH variable must be renamed accordingly update-alternatives --install "/usr/bin/${ARCH}-linux-gnu-gcc" "${ARCH}-linux-gnu-gcc" "/usr/bin/${ARCH}-linux-gnu-gcc-9" 1 apt-get clean diff --git a/build_container/docker_build_linux.sh b/build_container/docker_build_linux.sh index bd9094b3..303cd724 100755 --- a/build_container/docker_build_linux.sh +++ b/build_container/docker_build_linux.sh @@ -18,7 +18,7 @@ config_env() { if [[ -z "${BUILD_TOOLS_PLATFORMS}" ]]; then if [[ "${OS_DISTRO}" == "ubuntu" ]]; then - export BUILD_TOOLS_PLATFORMS=linux/arm64,linux/amd64 + export BUILD_TOOLS_PLATFORMS=linux/arm64,linux/amd64,linux/ppc64le else export BUILD_TOOLS_PLATFORMS=linux/amd64 fi