Преглед на файлове

fix: build cli with prebuilt openssl (#2316)

Baptiste Augrain преди 1 месец
родител
ревизия
e45f1ef420

+ 6 - 3
.github/workflows/insider-linux.yml

@@ -74,7 +74,7 @@ jobs:
   compile:
     needs:
       - check
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     env:
       MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
       MS_TAG: ${{ needs.check.outputs.MS_TAG }}
@@ -221,6 +221,9 @@ jobs:
         run: sudo apt-get update -y && sudo apt-get install -y libkrb5-dev
         if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
 
+      - uses: actions-rust-lang/setup-rust-toolchain@v1
+        if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
+
       - name: Download vscode artifact
         uses: actions/download-artifact@v4
         with:
@@ -268,7 +271,7 @@ jobs:
     needs:
       - check
       - compile
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     strategy:
       fail-fast: false
       matrix:
@@ -383,7 +386,7 @@ jobs:
     needs:
       - check
       - compile
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     strategy:
       fail-fast: false
       matrix:

+ 1 - 1
.github/workflows/insider-windows.yml

@@ -72,7 +72,7 @@ jobs:
   compile:
     needs:
       - check
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     env:
       MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
       MS_TAG: ${{ needs.check.outputs.MS_TAG }}

+ 6 - 3
.github/workflows/stable-linux.yml

@@ -73,7 +73,7 @@ jobs:
   compile:
     needs:
       - check
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     env:
       MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
       MS_TAG: ${{ needs.check.outputs.MS_TAG }}
@@ -222,6 +222,9 @@ jobs:
         run: sudo apt-get update -y && sudo apt-get install -y libkrb5-dev
         if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
 
+      - uses: actions-rust-lang/setup-rust-toolchain@v1
+        if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
+
       - name: Download vscode artifact
         uses: actions/download-artifact@v4
         with:
@@ -269,7 +272,7 @@ jobs:
     needs:
       - check
       - compile
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     strategy:
       fail-fast: false
       matrix:
@@ -384,7 +387,7 @@ jobs:
     needs:
       - check
       - compile
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     strategy:
       fail-fast: false
       matrix:

+ 1 - 1
.github/workflows/stable-windows.yml

@@ -71,7 +71,7 @@ jobs:
   compile:
     needs:
       - check
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     env:
       MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
       MS_TAG: ${{ needs.check.outputs.MS_TAG }}

+ 2 - 0
build/linux/package_bin.sh

@@ -136,4 +136,6 @@ fi
 
 find "../VSCode-linux-${VSCODE_ARCH}" -print0 | xargs -0 touch -c
 
+. ../build_cli.sh
+
 cd ..

+ 2 - 0
build/windows/package.sh

@@ -26,6 +26,8 @@ node build/azure-pipelines/distro/mixin-npm
 
 npm run gulp "vscode-win32-${VSCODE_ARCH}-min-ci"
 
+. ../build_cli.sh
+
 if [[ "${VSCODE_ARCH}" == "x64" ]]; then
   if [[ "${SHOULD_BUILD_REH}" != "no" ]]; then
     echo "Building REH"

+ 33 - 7
build_cli.sh

@@ -11,6 +11,10 @@ export VSCODE_CLI_BINARY_NAME="$( node -p "require(\"../product.json\").serverAp
 TUNNEL_APPLICATION_NAME="$( node -p "require(\"../product.json\").tunnelApplicationName" )"
 NAME_SHORT="$( node -p "require(\"../product.json\").nameShort" )"
 
+npm pack @vscode/openssl-prebuilt@0.0.11
+mkdir openssl
+tar -xvzf vscode-openssl-prebuilt-0.0.11.tgz --strip-components=1 --directory=openssl
+
 if [[ "${OS_NAME}" == "osx" ]]; then
   if [[ "${VSCODE_ARCH}" == "arm64" ]]; then
     VSCODE_CLI_TARGET="aarch64-apple-darwin"
@@ -18,6 +22,9 @@ if [[ "${OS_NAME}" == "osx" ]]; then
     VSCODE_CLI_TARGET="x86_64-apple-darwin"
   fi
 
+  export OPENSSL_LIB_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-osx/lib"
+  export OPENSSL_INCLUDE_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-osx/include"
+
   cargo build --release --target "${VSCODE_CLI_TARGET}" --bin=code
 
   cp "target/${VSCODE_CLI_TARGET}/release/code" "../../VSCode-darwin-${VSCODE_ARCH}/${NAME_SHORT}.app/Contents/Resources/app/bin/${TUNNEL_APPLICATION_NAME}"
@@ -29,29 +36,48 @@ elif [[ "${OS_NAME}" == "windows" ]]; then
     VSCODE_CLI_TARGET="x86_64-pc-windows-msvc"
     export VSCODE_CLI_RUSTFLAGS="-Ctarget-feature=+crt-static -Clink-args=/guard:cf -Clink-args=/CETCOMPAT"
   fi
+
   export VSCODE_CLI_CFLAGS="/guard:cf /Qspectre"
+  export OPENSSL_LIB_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-windows-static/lib"
+  export OPENSSL_INCLUDE_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-windows-static/include"
 
-  rustup target add x86_64-pc-windows-msvc
+  rustup target add "${VSCODE_CLI_TARGET}"
 
   cargo build --release --target "${VSCODE_CLI_TARGET}" --bin=code
 
   cp "target/${VSCODE_CLI_TARGET}/release/code.exe" "../../VSCode-win32-${VSCODE_ARCH}/bin/${TUNNEL_APPLICATION_NAME}.exe"
 else
+  export OPENSSL_LIB_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-linux/lib"
+  export OPENSSL_INCLUDE_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-linux/include"
+  export VSCODE_SYSROOT_DIR="../.build/sysroots"
+
   if [[ "${VSCODE_ARCH}" == "arm64" ]]; then
     VSCODE_CLI_TARGET="aarch64-unknown-linux-gnu"
+
+    export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
+    export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
+    export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
+    export PKG_CONFIG_ALLOW_CROSS=1
+
+    sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu crossbuild-essential-arm64
   elif [[ "${VSCODE_ARCH}" == "armhf" ]]; then
     VSCODE_CLI_TARGET="armv7-unknown-linux-gnueabihf"
+
+    export OPENSSL_LIB_DIR="$( pwd )/openssl/out/arm-linux/lib"
+    export OPENSSL_INCLUDE_DIR="$( pwd )/openssl/out/arm-linux/include"
+    export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
+    export CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc
+    export CXX_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++
+    export PKG_CONFIG_ALLOW_CROSS=1
+
+    sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf crossbuild-essential-armhf
   elif [[ "${VSCODE_ARCH}" == "x64" ]]; then
     VSCODE_CLI_TARGET="x86_64-unknown-linux-gnu"
-  elif [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
-    VSCODE_CLI_TARGET="powerpc64-unknown-linux-gnu"
-  elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
-    VSCODE_CLI_TARGET="riscv64-unknown-linux-gnu"
-  elif [[ "${VSCODE_ARCH}" == "loong64" ]]; then
-    VSCODE_CLI_TARGET="loongarch64-unknown-linux-gnu"
   fi
 
   if [[ -n "${VSCODE_CLI_TARGET}" ]]; then
+    rustup target add "${VSCODE_CLI_TARGET}"
+
     cargo build --release --target "${VSCODE_CLI_TARGET}" --bin=code
 
     cp "target/${VSCODE_CLI_TARGET}/release/code" "../../VSCode-linux-${VSCODE_ARCH}/bin/${TUNNEL_APPLICATION_NAME}"