frank-dspeed / v8_bullseye

v8 monolithic library build for just.js
0 stars 1 forks source link

Schould switch to heredoc usage #1

Open frank-dspeed opened 1 year ago

frank-dspeed commented 1 year ago
export IMAGE_NAME="debian:bullseye"
export DOCKER_CONTAINER_NAME="build"
cat <<"EOF" | docker run  -i --name ${DOCKER_CONTAINER_NAME} ${IMAGE_NAME}
 echo "Fully blown $IMAGE_NAME"
EOF
# Note that this is exactly what docker build does for each RUN defined layer
docker commit ${DOCKER_CONTAINER_NAME} ${DOCKER_CONTAINER_NAME}:step && docker rm ${DOCKER_CONTAINER_NAME}

export IMAGE_NAME="build:step"
cat <<"EOF" | docker run --rm -i --name ${DOCKER_CONTAINER_NAME} ${IMAGE_NAME}
 echo "Fully blown $IMAGE_NAME"
EOF

# Note that this is exactly what docker build does for each RUN defined layer
cat <<"EOF" | docker run  -i --name build-depot_tools debian:bullseye-slim
 apt update && apt upgrade -y && apt install -y git curl python lsb-release sudo
 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
 /depot_tools/gclient
EOF
docker commit build-depot_tools build:depot_tools && docker rm build-depot_tools

cat <<"EOF" | docker run  -i --name build-v8-bullseye-x86_64 build:depot_tools
  /depot_tools/fetch v8 && cd v8 && git checkout branch-heads/10.8 
  /depot_tools/gclient sync
  /v8/build/install-build-deps.sh --no-syms --no-chromeos-fonts --no-arm --no-nacl --no-backwards-compatible
  /v8/tools/dev/v8gen.py \
    x64.release \
    -- \
    target_os=\"linux\" \
    target_cpu=\"x64\" \
    v8_target_cpu=\"x64\" \
    v8_use_external_startup_data=false \
    v8_enable_future=true \
    is_official_build=false \
    is_component_build=false \
    is_cfi=false \
    is_asan=false \
    is_clang=false \
    use_custom_libcxx=false \
    use_custom_libcxx_for_host=false \
    use_sysroot=false \
    use_gold=false \
    is_debug=false \
    treat_warnings_as_errors=false \
    v8_enable_i18n_support=false \
    symbol_level=0 \
    v8_static_library=true \
    v8_monolithic=true \
    proprietary_codecs=false \
    toolkit_views=false \
    use_aura=false \
    use_dbus=false \
    use_gio=false \
    use_glib=false \
    use_ozone=false \
    use_udev=false \
    clang_use_chrome_plugins=false \
    v8_deprecation_warnings=false \
    v8_enable_gdbjit=false \
    v8_imminent_deprecation_warnings=false \
    v8_enable_pointer_compression=true \
    v8_scriptormodule_legacy_lifetime=true \
    v8_enable_sandbox=false

/depot_tools/ninja v8_monolith -C out.gn/x64.release/ -j $(getconf _NPROCESSORS_ONLN)
EOF

docker commit build-v8-bullseye-x86_64 v8-bullseye-x86_64:latest 

## Build Cache
docker save v8-bullseye-x86_64:latest | gzip > build/v8-bullseye-x86_64_latest.tar.gz

## Build Result
docker cp build-v8-bullseye-x86_64:/v8/out.gn/x64.release/obj/libv8_monolith.a build/v8/v8-bullseye-x86_64.a
docker cp build-v8-bullseye-x86_64:/v8/include build/v8/include

## clean up if needed: docker rm build-v8-bullseye-x86_64
frank-dspeed commented 1 year ago

Keep a Incremental Cache Volume around pattern

docker create volume is saved on job runner level that means it is even there for later jobs if you restore that volume.

frank-dspeed commented 1 year ago

TODO RE ADD

- name: build-linux-x86_64 - Ninja
      if: steps.v8-bullseye-x86_64.outputs.cache-hit != 'true'
      env:
        PATHS: ${{ env.PATH }}
        DEPOT_TOOLS: ${{ env.DEPOT_TOOLS }}
      run: |
        # Should be only 
        # docker load -i build-deps/v8-bullseye-x86_64_latest.tar.gz
        sudo chown -R 1000:1000 build-deps
        cat <<'EOF' | docker run -v $(pwd)/build-deps:/build -w /build/v8 -i --name build-v8-bullseye-x86_64 v8-deps-bullseye-x86_64:latest
          /build/depot_tools/ninja v8_monolith -C out.gn/x64.release/ -j $(getconf _NPROCESSORS_ONLN)
        EOF
        sudo chown -R 1000:1000 build-deps
        ## Build Result
        # TODO Export the whole obj folder to build distributed build cache.
        mkdir -p dist/v8
        cp build-deps/v8/out.gn/x64.release/obj/libv8_monolith.a dist/v8/v8-bullseye-x86_64.a
        cp -r build-deps/v8/include dist/v8