diff --git a/src/SourceBuild/content/.devcontainer/README.md b/src/SourceBuild/content/.devcontainer/README.md index a6a10e334..c525f43a1 100644 --- a/src/SourceBuild/content/.devcontainer/README.md +++ b/src/SourceBuild/content/.devcontainer/README.md @@ -11,12 +11,19 @@ This Codespace can help you debug the source build of .NET. This build takes about 45 minutes and, after completion, produces an archived .NET SDK located in `/workspaces/dotnet/artifacts/x64/Release`. In case you selected the `prebuilt-sdk` -Codespace, the SDK will already be there. +Codespace, the built-from-source SDK will already be there. ## Build the SDK -To build the VMR, run following: +To build the repository, run one of the following: ```bash +# Microsoft based build +./build.sh +``` +or + +```bash +# Building from source only ./prep.sh && ./build.sh -sb ``` diff --git a/src/SourceBuild/content/README.md b/src/SourceBuild/content/README.md index db0ad7d88..84b100319 100644 --- a/src/SourceBuild/content/README.md +++ b/src/SourceBuild/content/README.md @@ -71,51 +71,72 @@ For the latest information about Source-Build support, please watch for announce ### Prerequisites -The dependencies for building .NET from source can be found [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md). +The dependencies for building can be found [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/). In case you don't want to / cannot prepare your environment per the requirements, consider [using Docker](#building-using-docker). -### Building (source-build configuration) +### Building -1. **Clone the VMR** +1. **Clone the repository** ```bash git clone https://github.com/dotnet/dotnet dotnet-dotnet + cd dotnet-dotnet ``` -2. **Prep the source to build on your distro** - This downloads a .NET SDK and a number of .NET packages needed to build .NET from source. +2. **Build the .NET SDK** - ```bash - cd dotnet-dotnet - ./prep.sh - ``` + Choose one of the following build modes: + + - **Microsoft based build** -3. **Build the .NET SDK** + For Unix: + ```bash + ./build.sh --clean-while-building + ``` - ```bash - ./build.sh -sb --clean-while-building - ``` + For Windows: + ```cmd + .\build.cmd -cleanWhileBuilding + ``` - This builds the entire .NET SDK from source. - The resulting SDK is placed at `artifacts/x64/Release/dotnet-sdk-9.0.100-your-RID.tar.gz`. + - **Building from source** + ```bash + # Prep the source to build on your distro. + # This downloads a .NET SDK and a number of .NET packages needed to build .NET from source. + ./prep.sh - Run `./build.sh --help` to see more information about supported build options. + # Build the .NET SDK + ./build.sh -sb --clean-while-building + ``` + + The resulting SDK is placed at `artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].tar.gz` (for Unix) or `artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].zip` (for Windows). 4. *(Optional)* **Unpack and install the .NET SDK** - + + For Unix: ```bash mkdir -p $HOME/dotnet tar zxf artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].tar.gz -C $HOME/dotnet ln -s $HOME/dotnet/dotnet /usr/bin/dotnet ``` + + For Windows: + ```cmd + mkdir %userprofile%\dotnet + tar -xf artifacts//Release/dotnet-sdk-9.0.100-[your RID].zip -C %userprofile%\dotnet + set "PATH=%userprofile%\dotnet;%PATH%" + ``` - To test your source-built SDK, run the following: + To test your built SDK, run the following: ```bash dotnet --info ``` -### Building using Docker (source-build configuration) +> [!NOTE] +> Run `./build.sh --help` (for Unix) or `.\build.cmd -help` (for Windows) to see more information about supported build options. + +### Building using Docker You can also build the repository using a Docker image which has the required prerequisites inside. The example below creates a Docker volume named `vmr` and clones and builds the VMR there. @@ -123,7 +144,13 @@ The example below creates a Docker volume named `vmr` and clones and builds the ```sh docker run --rm -it -v vmr:/vmr -w /vmr mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8 git clone https://github.com/dotnet/dotnet . + +# - Microsoft based build +./build.sh --clean-while-building + +# - Building from source ./prep.sh && ./build.sh -sb --clean-while-building + mkdir -p $HOME/.dotnet tar -zxf artifacts/x64/Release/dotnet-sdk-9.0.100-centos.8-x64.tar.gz -C $HOME/.dotnet ln -s $HOME/.dotnet/dotnet /usr/bin/dotnet @@ -146,7 +173,7 @@ Alternatively, you can also provide a manifest file where this information can b Sometimes you want to make a change in a repository and test that change in the VMR. You could of course make the change in the VMR directly (locally, as the VMR is read-only for now) but in case it's already available in your repository, you can synchronize it into the VMR (again locally). -To do this, you can either start a [dotnet/dotnet](https://github.com/dotnet/dotnet) Codespace - you will see instructions right after it starts. Alternatively, you can clone the repository locally and use the [eng/vmr-sync.sh](../../eng/vmr-sync.sh) script to pull your changes in. Please refer to the documentation in the script for more details. +To do this, you can either start a [dotnet/dotnet](https://github.com/dotnet/dotnet) Codespace - you will see instructions right after it starts. Alternatively, you can clone the repository locally and use the [eng/vmr-sync.sh](../../eng/vmr-sync.sh) or [eng/vmr-sync.ps1](../../eng/vmr-sync.ps1) script to pull your changes in. Please refer to the documentation in the script for more details. ## List of components diff --git a/src/SourceBuild/content/eng/Versions.props b/src/SourceBuild/content/eng/Versions.props index 604b865b5..6f096b470 100644 --- a/src/SourceBuild/content/eng/Versions.props +++ b/src/SourceBuild/content/eng/Versions.props @@ -24,7 +24,6 @@ --> 9.0.100-preview.2.24104.1 9.0.100-preview.2.24104.1 - 0.1.0-9.0.100-9 15.7.179 diff --git a/src/SourceBuild/content/eng/build.sourcebuild.targets b/src/SourceBuild/content/eng/build.sourcebuild.targets index b9786179f..21875b5ea 100644 --- a/src/SourceBuild/content/eng/build.sourcebuild.targets +++ b/src/SourceBuild/content/eng/build.sourcebuild.targets @@ -1,7 +1,6 @@ - true $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'test', 'Microsoft.DotNet.SourceBuild.SmokeTests')) diff --git a/src/SourceBuild/patches/runtime/0002-short-stack-support.patch b/src/SourceBuild/patches/runtime/0002-short-stack-support.patch new file mode 100644 index 000000000..783d86b3c --- /dev/null +++ b/src/SourceBuild/patches/runtime/0002-short-stack-support.patch @@ -0,0 +1,48 @@ +From 6e36330872998c791a2c0d31b688e1bdece2451f Mon Sep 17 00:00:00 2001 +From: Jo Shields +Date: Fri, 2 Feb 2024 06:56:20 -0500 +Subject: [PATCH] Source built short stack support (#97725) + +Backport: https://github.com/dotnet/runtime/pull/97725 + +--- a/eng/SourceBuild.props 2024-02-07 11:01:33.807337902 -0500 ++++ b/eng/SourceBuild.props 2024-02-05 16:48:58.219933758 -0500 +@@ -15,6 +15,7 @@ + + <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-')) + $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) ++ $(TargetRid.Substring(0, $(_targetRidPlatformIndex))) + + <_hostRidPlatformIndex>$(_hostRid.LastIndexOf('-')) + <_hostArch>$(_hostRid.Substring($(_hostRidPlatformIndex)).TrimStart('-')) +@@ -22,6 +23,17 @@ + minimal + + ++ ++ true ++ true ++ true ++ true ++ true ++ true ++ true ++ true ++ ++ + + +@@ -29,9 +41,10 @@ + This allows to build the repository using './build.sh /p:DotNetBuildFromSource=true'. + Properties that control flags from source-build, and the expected output for source-build should be added to this file. --> + $(InnerBuildArgs) $(FlagParameterPrefix)arch $(TargetArch) +- $(InnerBuildArgs) $(FlagParameterPrefix)cross ++ $(InnerBuildArgs) $(FlagParameterPrefix)os $(TargetOS) ++ $(InnerBuildArgs) $(FlagParameterPrefix)cross + $(InnerBuildArgs) $(FlagParameterPrefix)configuration $(Configuration) +- $(InnerBuildArgs) $(FlagParameterPrefix)allconfigurations ++ $(InnerBuildArgs) $(FlagParameterPrefix)allconfigurations + $(InnerBuildArgs) $(FlagParameterPrefix)verbosity $(LogVerbosity) + $(InnerBuildArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg) + $(InnerBuildArgs) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)