diff options
author | Matt Mitchell <mmitche@microsoft.com> | 2015-02-23 16:34:11 -0800 |
---|---|---|
committer | Matt Mitchell <mmitche@microsoft.com> | 2015-02-23 16:34:52 -0800 |
commit | e0e408cf8f0a9421b1fba4e077629209a3d2d744 (patch) | |
tree | 0e75f9e97278a04c1d5455d965b3ae002f38347d /build.sh | |
parent | b2cdaa918c1b13fc08f04050907734e3822e3a4a (diff) | |
download | coreclr-e0e408cf8f0a9421b1fba4e077629209a3d2d744.tar.gz coreclr-e0e408cf8f0a9421b1fba4e077629209a3d2d744.tar.bz2 coreclr-e0e408cf8f0a9421b1fba4e077629209a3d2d744.zip |
Place binaries and intermediates in folders that include OS
Rework the output paths so that the OS may appear in them. This then follows the same form as corefx. This solves a number of problems:
1) When building unix mscorlib after the regular build, we would use the wrong intermediates for incremental.
2) When testing windows after building unix mscorlib we'd use the wrong outputs and fail.
This change removes our cmake directory and moves cmake generated files into intermediates (under OS/arch paths)
The reason is that the intermediates go under here when actually doing the build, and on unix based systems, we need to generate the cmake files for different builds into different directories for the purpose of preserving incremental builds.
Change clean behavior
Clean should simply delete the root binary. We also should not make assumptions about
whether necessary directories are available when we begin to build and should create them every time if
necessary.
Create directories as needed.
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 74 |
1 files changed, 31 insertions, 43 deletions
@@ -10,41 +10,22 @@ usage() exit 1 } -# Performs "clean build" type actions (deleting and remaking directories) - -clean() +setup_dirs() { - echo Doing a clean build - - # make projects would need a rebuild - MakeCleanArgs=clean - - # Cleanup the binaries drop folder - if [ -d "$__BinDir" ]; then - rm -r "$__BinDir" - fi + echo Setting up directories for build + mkdir -p "$__RootBinDir" mkdir -p "$__BinDir" - - # Cleanup the CMake folder - if [ -d "$__CMakeSlnDir" ]; then - rm -r "$__CMakeSlnDir" - fi - mkdir -p "$__CMakeSlnDir" - - # Cleanup the logs folder - if [ -d "$__LogsDir" ]; then - rm -r "$__LogsDir" - fi - mkdir -p "$__LogsDir" + mkdir -p "$__IntermediatesDir" +} - # Cleanup intermediates folder - if [ -d "$__IntermediatesDir" ]; then - rm -r "$__IntermediatesDir" - fi +# Performs "clean build" type actions (deleting and remaking directories) - mkdir -p "$__IntermediatesDir" +clean() +{ + echo Cleaning binaries directory + rm -rf "$__RootBinDir" } # Check the system to ensure the right pre-reqs are in place @@ -65,8 +46,8 @@ build_coreclr() { # All set to commence the build - echo "Commencing build of native components for $__BuildArch/$__BuildType" - cd "$__CMakeSlnDir" + echo "Commencing build of native components for $__BuildOS.$__BuildArch.$__BuildType" + cd "$__IntermediatesDir" # Regenerate the CMake solution echo "Invoking cmake with arguments: \"$__ProjectRoot\" $__CMakeArgs" @@ -74,7 +55,7 @@ build_coreclr() # Check that the makefiles were created. - if [ ! -f "$__CMakeSlnDir/Makefile" ]; then + if [ ! -f "$__IntermediatesDir/Makefile" ]; then echo "Failed to generate native component build project!" exit 1 fi @@ -106,7 +87,16 @@ echo "Commencing CoreCLR Repo build" # Obtain the location of the bash script to figure out whether the root of the repo is. __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -__BuildArch=amd64 +__BuildArch=x64 +# Use uname to determine what the OS is. +if [ $(uname -o | grep -i Linux) ]; then + __BuildOS=linux +elif [ $(uname -o | grep -i Darwin) ]; then + __BuildOS=mac +else + echo "Unsupported OS detected, assuming linux" + __BuildOS=linux +fi __MSBuildBuildArch=x64 __BuildType=debug __CMakeArgs=DEBUG @@ -117,7 +107,6 @@ __SourceDir="$__ProjectDir/src" __PackagesDir="$__ProjectDir/packages" __RootBinDir="$__ProjectDir/binaries" __LogsDir="$__RootBinDir/Logs" -__CMakeSlnDir="$__RootBinDir/CMake" __UnprocessedBuildArgs= __MSBCleanBuildArgs= __CleanBuild=false @@ -131,7 +120,7 @@ for i in "$@" exit 1 ;; amd64) - __BuildArch=amd64 + __BuildArch=x64 __MSBuildBuildArch=x64 ;; debug) @@ -150,26 +139,25 @@ for i in "$@" done # Set the remaining variables based upon the determined build configuration -__BinDir="$__RootBinDir/Product/$__BuildArch/$__BuildType" +__BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType" __PackagesBinDir="$__BinDir/.nuget" __ToolsDir="$__RootBinDir/tools" -__TestWorkingDir="$__RootBinDir/tests/$__BuildArch/$__BuildType" -__IntermediatesDir="$__RootBinDir/intermediates/$__BuildArch/$__BuildType" +__TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType" +__IntermediatesDir="$__RootBinDir/intermediates/$__BuildOS.$__BuildArch.$__BuildType" # Specify path to be set for CMAKE_INSTALL_PREFIX. # This is where all built CoreClr libraries will copied to. export __CMakeBinDir="$__BinDir" -# Switch to clean build mode if the binaries output folder does not exist -if [ ! -d "$__RootBinDir" ]; then - __CleanBuild=1 -fi - # Configure environment if we are doing a clean build. if [ $__CleanBuild == 1 ]; then clean fi +# Make the directories necessary for build if they don't exist + +setup_dirs + # Check prereqs. check_prereqs |