Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@ -0,0 +1,3 @@
# Windows line ending
*.sh text eol=lf
*.bat text eol=crlf

View File

@ -0,0 +1,3 @@
builds
out
*.tar.gz

View File

@ -0,0 +1,429 @@
:: --------------------------------------------------
:: Run full LLVM build using msvc toolchain and available cmake generator.
:: Script needs to be run from within a matching build environment, x86|x64.
:: When executed from withing Visual Studio build environment current
:: build environment will be inherited by script.
::
:: %1 LLVM source root directory.
:: %2 LLVM build root directory.
:: %3 LLVM install root directory.
:: %4 Mono distribution root directory.
:: %5 VS CFLAGS.
:: %6 Additional CMake arguments.
:: %7 VS platform (Win32/x64).
:: %8 VS configuration (Debug/Release).
:: %9 VS target.
:: %10 MsBuild bin path, if used.
:: %11 Force MSBuild (true/false), if used.
:: --------------------------------------------------
@echo off
setlocal
set TEMP_PATH=%PATH%
set BUILD_RESULT=1
set CL_BIN_NAME=cl.exe
set LINK_BIN_NAME=link.exe
set GIT_BIN_NAME=git.exe
set CMAKE_BIN_NAME=cmake.exe
set NINJA_BIN_NAME=ninja.exe
set PYTHON_BIN_NAME=python.exe
set LLVM_DIR=%~1
shift
set LLVM_BUILD_DIR=%~1
shift
set LLVM_INSTALL_DIR=%~1
shift
set MONO_DIST_DIR=%~1
shift
set VS_CFLAGS=%~1
shift
set LLVM_ADDITIONAL_CMAKE_ARGS=%~1
shift
set VS_PLATFORM=%~1
shift
set VS_CONFIGURATION=%~1
shift
set VS_TARGET=%~1
shift
set MSBUILD_BIN_PATH=%~1
shift
set FORCE_MSBUILD=%~1
:: Setup toolchain.
:: set GIT=
:: set CMAKE=
:: set NINJA=
set MSBUILD=%MSBUILD_BIN_PATH%msbuild.exe
if "%LLVM_DIR%" == "" (
echo Missing LLVM source directory argument.
goto ECHO_USAGE
)
if "%LLVM_BUILD_DIR%" == "" (
echo Missing LLVM build directory argument.
goto ECHO_USAGE
)
if "%LLVM_INSTALL_DIR%" == "" (
echo Missing LLVM install directory argument.
goto ECHO_USAGE
)
if "%MONO_DIST_DIR%" == "" (
echo Missing Mono dist directory argument.
goto ECHO_USAGE
)
if "%VS_CFLAGS%" == "" (
echo Missing CFLAGS argument.
goto ECHO_USAGE
)
if "%VS_PLATFORM%" == "" (
set VS_PLATFORM=x64
)
if "%VS_CONFIGURATION%" == "" (
set VS_CONFIGURATION=Release
)
if "%VS_TARGET%" == "" (
set VS_TARGET=Build
)
if "%FORCE_MSBUILD%" == "" (
set FORCE_MSBUILD=false
)
if not exist "%LLVM_DIR%" (
echo Could not find "%LLVM_DIR%".
goto ON_ERROR
)
set LLVM_CFLAGS=%VS_CFLAGS%
set LLVM_ARCH=x86_64
if /i "%VS_PLATFORM%" == "win32" (
set LLVM_ARCH=i386
)
:: Check if executed from VS2015/VS2017 build environment.
if "%VisualStudioVersion%" == "14.0" (
goto ON_ENV_OK
)
if "%VisualStudioVersion%" == "15.0" (
goto ON_ENV_OK
)
:: Executed outside VS2015/VS2017 build environment, try to locate Visual Studio C/C++ compiler and linker.
call :FIND_PROGRAM "" "%CL_BIN_NAME%" CL_PATH
if "%CL_PATH%" == "" (
goto ON_ENV_WARNING
)
call :FIND_PROGRAM "" "%LINK_BIN_NAME%" LINK_PATH
if "%LINK_PATH%" == "" (
goto ON_ENV_WARNING
)
goto ON_ENV_OK
:ON_ENV_WARNING
:: VS 2015.
set VC_VARS_ALL_FILE=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
IF EXIST "%VC_VARS_ALL_FILE%" (
echo For VS2015 builds, make sure to run this from within Visual Studio build or using "VS2015 x86|x64 Native Tools Command Prompt" command prompt.
echo Setup a "VS2015 x86|x64 Native Tools Command Prompt" command prompt by using "%VC_VARS_ALL_FILE% x86|amd64".
)
:: VS 2017.
set VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
if exist "%VSWHERE_TOOLS_BIN%" (
echo For VS2017 builds, make sure to run this from within Visual Studio build or using "x86|x64 Native Tools Command Prompt for VS2017" command prompt.
for /f "tokens=*" %%a IN ('"%VSWHERE_TOOLS_BIN%" -latest -property installationPath') do (
echo Setup a "x86|x64 Native Tools Command Prompt for VS2017" command prompt by using "%%a\VC\Auxiliary\Build\vcvars32.bat|vcvars64.bat".
)
)
echo Could not detect Visual Studio build environment. You may experience build problems if wrong toolchain is auto detected.
:ON_ENV_OK
:: Setup all cmake related generator, tools and variables.
call :SETUP_CMAKE_ENVIRONMENT
if "%CMAKE%" == "" (
echo Failed to located working %CMAKE_BIN_NAME%, needs to be accessible in PATH or set using CMAKE environment variable.
goto ON_ERROR
)
if "%CMAKE_GENERATOR%" == "" (
echo Failed to setup cmake generator.
goto ON_ERROR
)
:: Check target.
if /i "%VS_TARGET%" == "build" (
goto ON_BUILD_LLVM
)
if /i "%VS_TARGET%" == "install" (
goto ON_INSTALL_LLVM
)
if /i "%VS_TARGET%" == "clean" (
goto ON_CLEAN_LLVM
)
:ON_BUILD_LLVM
:: If not set by caller, check environment for working git.exe.
call :FIND_PROGRAM "%GIT%" "%GIT_BIN_NAME%" GIT
if "%GIT%" == "" (
echo Failed to located working %GIT_BIN_NAME%, needs to be accessible in PATH or set using GIT environment variable.
goto ON_ERROR
)
:: Make sure llvm submodule is up to date.
pushd
cd "%LLVM_DIR%"
"%GIT%" submodule update --init
if not ERRORLEVEL == 0 (
"%GIT%" submodule init
"%GIT%" submodule update
if not ERRORLEVEL == 0 (
echo Git llvm submodules failed to updated. You may experience compilation problems if some submodules are out of date.
)
)
popd
if not exist "%LLVM_BUILD_DIR%" (
mkdir "%LLVM_BUILD_DIR%"
)
cd "%LLVM_BUILD_DIR%"
:: Make sure cmake pick up msvc toolchain regardless of selected generator (Visual Studio|Ninja)
set CC=%CL_BIN_NAME%
set CXX=%CL_BIN_NAME%
set CMAKE_GENERATOR_ARGS=
if /i "%CMAKE_GENERATOR%" == "ninja" (
set CMAKE_GENERATOR_ARGS=-DCMAKE_BUILD_TYPE=%VS_CONFIGURATION%
) else (
set CMAKE_GENERATOR_ARGS=-Thost=x64
)
:: Run cmake.
"%CMAKE%" ^
-DCMAKE_INSTALL_PREFIX="%LLVM_INSTALL_DIR%" ^
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" ^
-DLLVM_BUILD_TESTS=Off ^
-DLLVM_INCLUDE_TESTS=Off ^
-DLLVM_BUILD_EXAMPLES=Off ^
-DLLVM_INCLUDE_EXAMPLES=Off ^
-DLLVM_TOOLS_TO_BUILD="opt;llc;llvm-config;llvm-dis;llvm-mc;llvm-as" ^
-DLLVM_ENABLE_LIBXML2=Off ^
-DCMAKE_SYSTEM_PROCESSOR="%LLVM_ARCH%" ^
%LLVM_ADDITIONAL_CMAKE_ARGS% ^
%CMAKE_GENERATOR_ARGS% ^
-G "%CMAKE_GENERATOR%" ^
"%LLVM_DIR%"
if not ERRORLEVEL == 0 (
goto ON_ERROR
)
if /i "%CMAKE_GENERATOR%" == "ninja" (
:: Build LLVM using ninja build system.
call "%NINJA%" -j4 || (
goto ON_ERROR
)
) else (
:: Build LLVM using msbuild build system.
call "%MSBUILD%" llvm.sln /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% /t:%VS_TARGET% /v:m /nologo || (
goto ON_ERROR
)
)
:ON_INSTALL_LLVM
:: Make sure build install folder exists.
if not exist "%LLVM_INSTALL_DIR%" (
echo Could not find "%LLVM_INSTALL_DIR%", creating folder for build output.
mkdir "%LLVM_INSTALL_DIR%"
)
:: Make sure Mono dist folder exists.
if not exist "%MONO_DIST_DIR%" (
echo Could not find "%MONO_DIST_DIR%", creating folder for build output.
mkdir "%MONO_DIST_DIR%"
)
if exist "%LLVM_BUILD_DIR%\build.ninja" (
pushd
cd "%LLVM_BUILD_DIR%"
call "%NINJA%" install
popd
)
if exist "%LLVM_BUILD_DIR%\install.vcxproj" (
"%MSBUILD%" "%LLVM_BUILD_DIR%\install.vcxproj" /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% /v:m /nologo
)
if not exist "%LLVM_INSTALL_DIR%\bin\opt.exe" (
echo Missing LLVM build output, "%LLVM_INSTALL_DIR%\bin\opt.exe"
goto ON_ERROR
)
if not exist "%LLVM_INSTALL_DIR%\bin\llc.exe" (
echo Missing LLVM build output, "%LLVM_INSTALL_DIR%\bin\llc.exe"
goto ON_ERROR
)
if not exist "%LLVM_INSTALL_DIR%\bin\llvm-dis.exe" (
echo Missing LLVM build output, "%LLVM_INSTALL_DIR%\bin\llvm-dis.exe"
goto ON_ERROR
)
if not exist "%LLVM_INSTALL_DIR%\bin\llvm-mc.exe" (
echo Missing LLVM build output, "%LLVM_INSTALL_DIR%\bin\llvm-mc.exe"
goto ON_ERROR
)
if not exist "%LLVM_INSTALL_DIR%\bin\llvm-as.exe" (
echo Missing LLVM build output, "%LLVM_INSTALL_DIR%\bin\llvm-as.exe"
goto ON_ERROR
)
copy /Y "%LLVM_INSTALL_DIR%\bin\opt.exe" "%MONO_DIST_DIR%" >nul 2>&1
copy /Y "%LLVM_INSTALL_DIR%\bin\llc.exe" "%MONO_DIST_DIR%" >nul 2>&1
copy /Y "%LLVM_INSTALL_DIR%\bin\llvm-dis.exe" "%MONO_DIST_DIR%" >nul 2>&1
copy /Y "%LLVM_INSTALL_DIR%\bin\llvm-mc.exe" "%MONO_DIST_DIR%" >nul 2>&1
copy /Y "%LLVM_INSTALL_DIR%\bin\llvm-as.exe" "%MONO_DIST_DIR%" >nul 2>&1
goto ON_SUCCESS
:ON_CLEAN_LLVM
if exist "%LLVM_BUILD_DIR%\build.ninja" (
pushd
cd "%LLVM_BUILD_DIR%"
call "%NINJA%" clean
popd
)
if exist "%LLVM_BUILD_DIR%\llvm.sln" (
"%MSBUILD%" "%LLVM_BUILD_DIR%\llvm.sln" /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% /t:Clean /v:m /nologo
)
goto ON_SUCCESS
:ON_SUCCESS
set BUILD_RESULT=0
goto ON_EXIT
:ECHO_USAGE:
ECHO Usage: build-external-llvm.bat [llvm_src_dir] [llvm_build_dir] [llvm_install_dir] [mono_dist_dir] [vs_cflags] [vs_plaform] [vs_configuration].
:ON_ERROR
echo Failed to build LLVM.
goto ON_EXIT
:ON_EXIT
set PATH=%TEMP_PATH%
exit /b %BUILD_RESULT%
:: ##############################################################################################################################
:: Functions
:: --------------------------------------------------
:: Finds a program using environment.
::
:: %1 Existing program to check for.
:: %2 Name of binary to locate.
:: %3 Output, variable to set if found requested program.
:: --------------------------------------------------
:FIND_PROGRAM
:: If not set by caller, check environment for program.
if exist "%~1" (
goto :EOF
)
call where /q "%~2" && (
for /f "delims=" %%a in ('where "%~2"') do (
set "%~3=%%a"
)
) || (
set "%~3="
)
goto :EOF
:: --------------------------------------------------
:: Setup up cmake build environment, including generator, build tools and variables.
:: --------------------------------------------------
:SETUP_CMAKE_ENVIRONMENT
:: If not set by caller, check environment for working cmake.exe.
call :FIND_PROGRAM "%CMAKE%" "%CMAKE_BIN_NAME%" CMAKE
if "%CMAKE%" == "" (
goto _SETUP_CMAKE_ENVIRONMENT_EXIT
)
if /i "%VS_TARGET%" == "build" (
echo Found CMake: "%CMAKE%"
)
if /i "%FORCE_MSBUILD%" == "true" (
goto _SETUP_CMAKE_ENVIRONMENT_VS_GENERATOR
)
:: Check for optional cmake generate and build tools.
call :FIND_PROGRAM "%NINJA%" "%NINJA_BIN_NAME%" NINJA
if not "%NINJA%" == "" (
goto _SETUP_CMAKE_ENVIRONMENT_NINJA_GENERATOR
)
:_SETUP_CMAKE_ENVIRONMENT_VS_GENERATOR
if /i "%VS_TARGET%" == "build" (
echo Using Visual Studio build generator.
)
:: Detect VS version to use right cmake generator.
set CMAKE_GENERATOR=Visual Studio 14 2015
if "%VisualStudioVersion%" == "15.0" (
set CMAKE_GENERATOR=Visual Studio 15 2017
)
if /i "%VS_PLATFORM%" == "x64" (
set CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64
)
set LLVM_BUILD_OUTPUT_DIR=%LLVM_BUILD_DIR%\%VS_CONFIGURATION%
goto _SETUP_CMAKE_ENVIRONMENT_EXIT
:_SETUP_CMAKE_ENVIRONMENT_NINJA_GENERATOR
if /i "%VS_TARGET%" == "build" (
echo Found Ninja: "%NINJA%"
echo Using Ninja build generator.
)
set CMAKE_GENERATOR=Ninja
set LLVM_BUILD_OUTPUT_DIR=%LLVM_BUILD_DIR%
:_SETUP_CMAKE_ENVIRONMENT_EXIT
goto :EOF
@echo on

View File

@ -0,0 +1,7 @@
The Debian Package mono-llvm
----------------------------
Comments regarding the Package
This package is a build of the mono fork of llvm. The mono project requires a number of patches
in order to use LLVM for some of our backends.

View File

@ -0,0 +1,5 @@
mono-llvm (6.0) unstable; urgency=low
* Initial Release.
-- Alex Kyte <alkyte@microsoft.com> Thu, 16 Jun 2016 17:22:31 -0400

View File

@ -0,0 +1 @@
9

View File

@ -0,0 +1,19 @@
Source: mono-llvm
Priority: optional
Maintainer: Alex Kyte <alkyte@microsoft.com>
Build-Depends: debhelper (>= 7.0.50~), flex, bison, dejagnu, tcl, expect, cmake, perl, libtool, chrpath, texinfo, sharutils, libffi-dev (>= 3.0.9), lsb-release, patchutils, diffstat, xz-utils, python-dev, libedit-dev, swig, python-six, python-sphinx, ocaml-nox, binutils-dev, libjsoncpp-dev, lcov, procps, help2man, dh-ocaml, zlib1g-dev
Standards-Version: 6.0.1
Section: libs
Homepage: https://github.com/mono/llvm.git
Package: mono-llvm
Section: libs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: The mono fork of llvm
This is a fork of llvm which is used by the
llvm backend of mono. This is required for
some backends but not others. In this fork some
mono-specific changes have been made. This package
is set at a specific commit, this is not the release
package of 6.0.

View File

@ -0,0 +1,428 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: LLVM/Clang
Source: http://llvm.org/releases/download.html
Files: *
Copyright: 2003-2007 University of Illinois at Urbana-Champaign.
License: U-OF-I-BSD-LIKE
Files: */install-sh
Copyright: 1994 X Consortium
License: LLVM
This script is licensed under the LLVM license, with the following
additional copyrights and restrictions:
.
Copyright 1991 by the Massachusetts Institute of Technology
.
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of M.I.T. not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission. M.I.T. makes no representations about the
suitability of this software for any purpose. It is provided "as is"
without express or implied warranty.
.
==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License
.
Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign.
All rights reserved.
.
Developed by:
.
LLVM Team
.
University of Illinois at Urbana-Champaign
.
http://llvm.org
.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
Files: clang/lib/Headers/*
Copyright: 2003-2007 University of Illinois at Urbana-Champaign
License: Expat
Files: clang/lib/Headers/iso646.h
Copyright: 2008 Eli Friedman
License: Expat
Files: clang/lib/Headers/limits.h
Copyright: 2009 Chris Lattner
License: Expat
Files: clang/lib/Headers/stdarg.h
Copyright: 2008 Eli Friedman
License: Expat
Files: clang/lib/Headers/stdbool.h
Copyright: 2008 Eli Friedman
License: Expat
Files: clang/lib/Headers/stddef.h
Copyright: 2008 Eli Friedman
License: Expat
Files: clang/lib/Headers/stdint.h
Copyright: 2009 Chris Lattner
License: Expat
Files: clang/lib/Headers/tgmath.h
Copyright: 2009 Howard Hinnant
License: Expat
Files: compiler-rt/*
Copyright: 2009-2013 Craig van Vliet
2009-2013 Edward O'Callaghan
2009-2013 Howard Hinnant
License: U-OF-I-BSD-LIKE or MIT
Files: compiler-rt/lib/BlocksRuntime/Block.h
Copyright: 2008-2010 Apple, Inc.
License: MIT
Files: compiler-rt/lib/BlocksRuntime/Block_private.h
Copyright: 2008-2010 Apple, Inc.
License: MIT
Files: compiler-rt/lib/BlocksRuntime/data.c
Copyright: 2008-2010 Apple, Inc.
License: MIT
Files: compiler-rt/lib/BlocksRuntime/runtime.c
Copyright: 2008-2010 Apple, Inc.
License: MIT
Files: include/llvm/Support/*
Copyright: 2003-2013 University of Illinois at Urbana-Champaign.
Copyright (C) 2004 eXtensible Systems, Inc.
License: U-OF-I-BSD-LIKE
Files: lib/Support/reg*
Copyright: 1992, 1993, 1994 Henry Spencer
1992, 1993, 1994 The Regents of the University of California
License: BSD-3-clause
Files: lib/Target/ARM/*
Copyright: ARM Limited
License: ARM
ARM Limited
.
Software Grant License Agreement ("Agreement")
.
Except for the license granted herein to you, ARM Limited ("ARM") reserves all
right, title, and interest in and to the Software (defined below).
.
Definition
.
"Software" means the code and documentation as well as any original work of
authorship, including any modifications or additions to an existing work, that
is intentionally submitted by ARM to llvm.org (http://llvm.org) ("LLVM") for
inclusion in, or documentation of, any of the products owned or managed by LLVM
(the "Work"). For the purposes of this definition, "submitted" means any form of
electronic, verbal, or written communication sent to LLVM or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that are
managed by, or on behalf of, LLVM for the purpose of discussing and improving
the Work, but excluding communication that is conspicuously marked otherwise.
.
1. Grant of Copyright License. Subject to the terms and conditions of this
Agreement, ARM hereby grants to you and to recipients of the Software
distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable copyright license to reproduce, prepare derivative
works of, publicly display, publicly perform, sublicense, and distribute the
Software and such derivative works.
.
2. Grant of Patent License. Subject to the terms and conditions of this
Agreement, ARM hereby grants you and to recipients of the Software
distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent license
to make, have made, use, offer to sell, sell, import, and otherwise transfer
the Work, where such license applies only to those patent claims licensable
by ARM that are necessarily infringed by ARM's Software alone or by
combination of the Software with the Work to which such Software was
submitted. If any entity institutes patent litigation against ARM or any
other entity (including a cross-claim or counterclaim in a lawsuit) alleging
that ARM's Software, or the Work to which ARM has contributed constitutes
direct or contributory patent infringement, then any patent licenses granted
to that entity under this Agreement for the Software or Work shall terminate
as of the date such litigation is filed.
.
Unless required by applicable law or agreed to in writing, the software is
provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied, including, without limitation, any warranties or
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE.
Files: lldb/*
Copyright: 2010, 2012 Apple Inc.
License: NCSA
University of Illinois/NCSA
Open Source License
.
Copyright (c) 2010 Apple Inc.
All rights reserved.
.
Developed by:
.
LLDB Team
.
http://lldb.llvm.org/
.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
.
* Neither the names of the LLDB Team, copyright holders, nor the names of
its contributors may be used to endorse or promote products derived from
this Software without specific prior written permission.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
Files: lldb/test/pexpect-2.4/*
Copyright: 2008 Noah Spurrier
License: Expat
License: Expat
.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
Files: lldb/test/unittest2/*
Copyright: 1999-2003 Steve Purcell
2003-2010 Python Software Foundation
License: Python
This module is free software, and you may redistribute it and/or modify
it under the same terms as Python itself, so long as this copyright message
and disclaimer are retained in their original form.
.
IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
.
THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,
AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Files: polly/*
Copyright: 2009-2013 Polly Team
License: Polly
==============================================================================
Polly Release License
==============================================================================
University of Illinois/NCSA
Open Source License
.
Copyright (c) 2009-2013 Polly Team
All rights reserved.
.
Developed by:
.
Polly Team
.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
.
* Neither the names of the Polly Team, copyright holders, nor the names of
its contributors may be used to endorse or promote products derived from
this Software without specific prior written permission.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
Files: polly/lib/JSON/*
Copyright: Polly Team
License: public-domain
**FIXME**
polly/lib/JSON/LICENSE.txt claims that these files are in the public domain, but
the machine-readable copyright spec requires additional clarification.
Files: polly/tools/GPURuntime/*
Copyright: Polly Team
License: U-OF-I-BSD-LIKE or MIT
Files: test/YAMLParser/*
Copyright: 2006 Kirill Simonov
License: MIT
Files: lldb/tools/debugserver/source/MacOSX/stack_logging.h
Copyright: 1999-2007 Apple Inc.
License: Apple
This file contains Original Code and/or Modifications of Original Code
as defined in and that are subject to the Apple Public Source License
Version 2.0 (the 'License'). You may not use this file except in
compliance with the License. Please obtain a copy of the License at
http://www.opensource.apple.com/apsl/ and read it before using this
file.
.
The Original Code and all software distributed under the License are
distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
Please see the License for the specific language governing rights and
limitations under the License.
Files: utils/unittest/googletest/*
Copyright: 2006-2008, Google Inc.
License: BSD-3-Clause
License: BSD-3-Clause
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
.
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
License: U-OF-I-BSD-LIKE
==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License
.
Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign.
All rights reserved.
.
Developed by:
.
LLVM Team
.
University of Illinois at Urbana-Champaign
.
http://llvm.org
.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,36 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# Note: Expects to be ran out of $(repo)/build/mono-llvm-6.0
DEB_HOST_ARCH_BITS := $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)
ifeq ($(DEB_HOST_ARCH_BITS), 32)
LINUX32 := linux32
endif
Makefile:
@echo "Building package for $(LLVM_TARGET)"
LDFLAGS="-L../../lib -lstdc++" $(LINUX32) cmake ../.. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="-I../../include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" \
-DCMAKE_CXX_FLAGS="-I../../include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM"
override_dh_auto_build: Makefile
dh_auto_build
override_dh_auto_configure:
echo "Skipping auto configure"
override_dh_usrlocal:
echo "Skipping userlocal"
override_dh_auto_test:
echo "Skipping test"
%:
dh $@

View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e
# Requires packages:
# devscripts cmake ninja git
TOP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"
echo "MAKING DEB"
mkdir -p $TOP_DIR/build/mono-llvm-6.0
pushd $TOP_DIR/build/mono-llvm-6.0
cp -r $TOP_DIR/scripts/ci/debian debian
dpkg-buildpackage -d -us -uc
popd # $TOP_DIR/build/mono-llvm-6.0
echo "DONE"

View File

@ -0,0 +1,8 @@
#!/bin/bash -e
RUN_JENKINS_LINUX_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "ENVIRONMENT:"
env
$RUN_JENKINS_LINUX_SCRIPT_DIR/package.sh

View File

@ -0,0 +1,39 @@
#!/bin/bash -e
echo "ENVIRONMENT:"
env
llvm_base_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DLLVM_BUILD_TESTS=Off -DLLVM_INCLUDE_TESTS=Off -DLLVM_TOOLS_TO_BUILD=opt;llc;llvm-config;llvm-dis -G Ninja"
llvm64_CMAKE_FLAGS="$llvm_base_CMAKE_FLAGS"
llvm32_CMAKE_FLAGS="$llvm_base_CMAKE_FLAGS -DLLVM_BUILD_32_BITS=On"
rm -rf build
mkdir -p build
cd build
cmake $llvm64_CMAKE_FLAGS -DCMAKE_INSTALL_PREFIX=$PWD/../usr64 ../llvm/
ninja
ninja install
cd ..
rm -rf build32
mkdir -p build32
cd build32
cmake $llvm32_CMAKE_FLAGS -DCMAKE_INSTALL_PREFIX=$PWD/../usr32 ../llvm/
ninja
ninja install
cd ..
rm -rf tmp-bin
mkdir tmp-bin
cp usr64/bin/{llc,opt,llvm-dis,llvm-config} tmp-bin/
rm usr64/bin/*
cp tmp-bin/* usr64/bin/
rm -rf tmp-bin2
mkdir tmp-bin2
cp usr32/bin/{llc,opt,llvm-dis,llvm-config} tmp-bin2
rm usr32/bin/*
cp tmp-bin2/* usr32/bin/
# Don't need 32 bit binaries
rm -f usr64/lib/libLTO.* usr64/lib/*.dylib usr32/lib/libLTO.* usr32/lib/*.dylib
tar cvzf llvm-osx64-$GIT_COMMIT.tar.gz usr64 usr32

View File

@ -0,0 +1,47 @@
:: Set up build environment and build LLVM using build-external-llvm.bat.
:: Arguments:
:: -------------------------------------------------------
:: -------------------------------------------------------
@echo off
setlocal
set BUILD_RESULT=1
:: Get path for current running script.
set RUN_JENKINS_WINDOWS_SCRIPT_PATH=%~dp0
set MONO_LLVM_SRC_DIR=%RUN_JENKINS_WINDOWS_SCRIPT_PATH%..\..
set MONO_LLVM_BUILD_DIR=%RUN_JENKINS_WINDOWS_SCRIPT_PATH%builds\llvm-llvmwin64-msvc
set MONO_LLVM_INSTALL_DIR=%RUN_JENKINS_WINDOWS_SCRIPT_PATH%out\llvm-llvmwin64-msvc
if exist "%MONO_LLVM_BUILD_DIR%" (
rmdir /S /Q "%MONO_LLVM_BUILD_DIR%"
)
if exist "%MONO_LLVM_INSTALL_DIR%" (
rmdir /S /Q "%MONO_LLVM_INSTALL_DIR%"
)
mkdir "%MONO_LLVM_BUILD_DIR%"
mkdir "%MONO_LLVM_INSTALL_DIR%"
:: Setup Windows environment.
call %RUN_JENKINS_WINDOWS_SCRIPT_PATH%setup-windows-env.bat
:: Setup VS msvc build environment.
call %RUN_JENKINS_WINDOWS_SCRIPT_PATH%setup-vs-msvcbuild-env.bat
:: Run LLVM builds using default argument (similar to how its build from mono.sln)
call %RUN_JENKINS_WINDOWS_SCRIPT_PATH%build-external-llvm.bat "%MONO_LLVM_SRC_DIR%" "%MONO_LLVM_BUILD_DIR%" "%MONO_LLVM_INSTALL_DIR%" "%MONO_LLVM_BUILD_DIR%" "-D__default_codegen__ -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_CONFIG_H -DGC_NOT_DLL -DWIN32_THREADS -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DFD_SETSIZE=1024 -DNVALGRIND" "-DLLVM_ENABLE_ASSERTIONS=Off" "x64" "Release" "Build" "" "false" && (
set BUILD_RESULT=0
) || (
set BUILD_RESULT=1
if not %ERRORLEVEL% == 0 (
set BUILD_RESULT=%ERRORLEVEL%
)
)
exit /b %BUILD_RESULT%
@echo on

View File

@ -0,0 +1,41 @@
#!/bin/bash -e
function win32_format_path {
local formatted_path=$1
local host_win32_wsl=0
local host_win32_cygwin=0
host_uname="$(uname -a)"
case "$host_uname" in
*Microsoft*)
host_win32_wsl=1
;;
CYGWIN*)
host_win32_cygwin=1
;;
esac
if [[ $host_win32_wsl = 1 ]] && [[ $1 == "/mnt/"* ]]; then
formatted_path="$(wslpath -a -w "$1")"
elif [[ $host_win32_cygwin = 1 ]] && [[ $1 == "/cygdrive/"* ]]; then
formatted_path="$(cygpath -a -w "$1")"
fi
echo "$formatted_path"
}
echo "ENVIRONMENT:"
env
RUN_JENKINS_WINDOWS_SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
RUN_JENKINS_WINDOWS_SCRIPT_PATH_WINDOWS=$(win32_format_path "$RUN_JENKINS_WINDOWS_SCRIPT_PATH/run-jenkins-windows.bat")
WINDOWS_CMD=$(which cmd.exe)
if [ ! -f $WINDOWS_CMD ]; then
WINDOWS_CMD=$WINDIR/System32/cmd.exe
fi
"$WINDOWS_CMD" /c "$RUN_JENKINS_WINDOWS_SCRIPT_PATH_WINDOWS"
GIT_COMMIT=$(git rev-parse HEAD)
tar cvzf llvm-llvmwin64-msvc-$GIT_COMMIT-Windows.tar.gz -C $RUN_JENKINS_WINDOWS_SCRIPT_PATH/out/llvm-llvmwin64-msvc .

View File

@ -0,0 +1,24 @@
#!/bin/bash -e
RUN_JENKINS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
host_uname="$(uname)"
case "$host_uname" in
CYGWIN*)
$RUN_JENKINS_SCRIPT_DIR/run-jenkins-windows.sh
;;
Linux)
host_uname="$(uname -a)"
case "$host_uname" in
*Microsoft*)
$RUN_JENKINS_SCRIPT_DIR/run-jenkins-windows.sh
;;
*)
$RUN_JENKINS_SCRIPT_DIR/run-jenkins-linux.sh
;;
esac
;;
Darwin)
$RUN_JENKINS_SCRIPT_DIR/run-jenkins-osx.sh
;;
esac

View File

@ -0,0 +1,155 @@
:: Set up VS MSVC environment depending on installed VS versions.
:: Script will setup environment variables directly in callers environment.
:: Make sure we can restore current working directory after setting up environment.
:: Some of the VS scripts can change the current working directory.
set CALLER_WD=%CD%
:: Get path for current running script.
set RUN_SETUP_VS_MSVCBUILD_ENV_SCRIPT_PATH=%~dp0
:: NOTE, MSVC build Mono full AOT tooling currently support 64-bit AMD codegen. Below will only setup
:: amd64 versions of VS MSVC build environment and corresponding ClangC2 compiler.
set VS_2015_TOOLCHAIN_ARCH=amd64
set VS_2015_VCVARS_ARCH=%VS_2015_TOOLCHAIN_ARCH%\vcvars64.bat
set VS_2015_CLANGC2_ARCH=%VS_2015_TOOLCHAIN_ARCH%
set VS_2017_VCVARS_ARCH=vcvars64.bat
set VS_2017_CLANGC2_ARCH=HostX64
:: 32-bit AOT toolchains for MSVC build mono-sgen.exe is currently not supported.
:: set VS_2015_TOOLCHAIN_ARCH=x86
:: set VS_2015_VCVARS_ARCH=vcvars32.bat
:: set VS_2015_CLANGC2_ARCH=%VS_2015_TOOLCHAIN_ARCH%
:: set VS_2017_VCVARS_ARCH=vcvars32.bat
:: set VS_2017_CLANGC2_ARCH=HostX86
set VS_CLANGC2_TOOLS_BIN_PATH=
:: Visual Studio 2015 == 14.0
if "%VisualStudioVersion%" == "14.0" (
goto SETUP_VS_2015
)
:: Visual Studio 2017 == 15.0
if "%VisualStudioVersion%" == "15.0" (
goto SETUP_VS_2017
)
:SETUP_VS_2015
set VS_2015_VCINSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\
:: Try to locate installed VS2015 Clang/C2.
SET VS_2015_CLANGC2_TOOLS_BIN_PATH=%VS_2015_VCINSTALL_DIR%ClangC2\bin\%VS_2015_CLANGC2_ARCH%\
SET VS_2015_CLANGC2_TOOLS_BIN=%VS_2015_CLANGC2_TOOLS_BIN_PATH%clang.exe
if not exist "%VS_2015_CLANGC2_TOOLS_BIN%" (
goto SETUP_VS_2017
)
:SETUP_VS_2015_BUILD_TOOLS
:: Try to locate VS2015 build tools installation.
set VS_2015_BUILD_TOOLS_INSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual C++ Build Tools\
set VS_2015_BUILD_TOOLS_CMD=%VS_2015_BUILD_TOOLS_INSTALL_DIR%vcbuildtools.bat
:: Setup VS2015 VC development environment using build tools installation.
call :setup_build_env "%VS_2015_BUILD_TOOLS_CMD%" "%VS_2015_TOOLCHAIN_ARCH%" "%CALLER_WD%" && (
set "VS_CLANGC2_TOOLS_BIN_PATH=%VS_2015_CLANGC2_TOOLS_BIN_PATH%"
goto ON_EXIT
)
:SETUP_VS_2015_VC
:: Try to locate installed VS2015 VC environment.
set VS_2015_DEV_CMD=%VS_2015_VCINSTALL_DIR%bin\%VS_2015_VCVARS_ARCH%
call :setup_build_env "%VS_2015_DEV_CMD%" "" "%CALLER_WD%" && (
set "VS_CLANGC2_TOOLS_BIN_PATH=%VS_2015_CLANGC2_TOOLS_BIN_PATH%"
goto ON_EXIT
)
:SETUP_VS_2017
:: VS2017 includes vswhere.exe that can be used to locate current VS2017 installation.
set VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
set VS_2017_VCINSTALL_DIR=
:: Try to locate installed VS2017 VC environment.
if exist "%VSWHERE_TOOLS_BIN%" (
for /f "tokens=*" %%a in ('"%VSWHERE_TOOLS_BIN%" -latest -property installationPath') do (
set VS_2017_VCINSTALL_DIR=%%a\VC\
)
)
:: Try to locate installed VS2017 Clang/C2.
SET VS_2017_CLANGC2_VERSION_FILE=%VS_2017_VCINSTALL_DIR%Auxiliary/Build/Microsoft.ClangC2Version.default.txt
if not exist "%VS_2017_CLANGC2_VERSION_FILE%" (
goto ON_ENV_ERROR
)
set /p VS_2017_CLANGC2_VERSION=<"%VS_2017_CLANGC2_VERSION_FILE%"
set VS_2017_CLANGC2_TOOLS_BIN_PATH=%VS_2017_VCINSTALL_DIR%Tools\ClangC2\%VS_2017_CLANGC2_VERSION%\bin\%VS_2017_CLANGC2_ARCH%\
set VS_2017_CLANGC2_TOOLS_BIN=%VS_2017_CLANGC2_TOOLS_BIN_PATH%clang.exe
if not exist "%VS_2017_CLANGC2_TOOLS_BIN%" (
goto ON_ENV_ERROR
)
:SETUP_VS_2017_BUILD_TOOLS
:: Try to locate VS2017 build tools installation.
set VS_2017_BUILD_TOOLS_INSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\
set VS_2017_BUILD_TOOLS_CMD=%VS_2017_BUILD_TOOLS_INSTALL_DIR%VC\Auxiliary\Build\%VS_2017_VCVARS_ARCH%
:: Setup VS2017 VC development environment using build tools installation.
call :setup_build_env "%VS_2017_BUILD_TOOLS_CMD%" "" "%CALLER_WD%" && (
set "VS_CLANGC2_TOOLS_BIN_PATH=%VS_2017_CLANGC2_TOOLS_BIN_PATH%"
goto ON_EXIT
)
:SETUP_VS_2017_VC
:: Try to locate installed VS2017 VC environment.
set VS_2017_DEV_CMD=%VS_2017_VCINSTALL_DIR%Auxiliary\Build\%VS_2017_VCVARS_ARCH%
:: Setup VS2017 VC development environment using VS installation.
call :setup_build_env "%VS_2017_DEV_CMD%" "" "%CALLER_WD%" && (
set "VS_CLANGC2_TOOLS_BIN_PATH=%VS_2017_CLANGC2_TOOLS_BIN_PATH%"
goto ON_EXIT
)
:ON_ENV_ERROR
echo Warning, failed to setup VS build environment needed by VS tooling.
echo Incomplete build environment can cause build error's due to missing compiler,
echo linker and platform libraries.
exit /b 1
:ON_EXIT
:: Add ClangC2 folders to PATH
set "PATH=%VS_CLANGC2_TOOLS_BIN_PATH%;%PATH%"
exit /b 0
:setup_build_env
:: Check if VS build environment script exists.
if not exist "%~1" (
goto setup_build_env_error
)
:: Run VS build environment script.
call "%~1" %~2 > NUL
:: Restore callers working directory in case it has been changed by VS scripts.
cd /d "%~3"
goto setup_build_env_exit
:setup_build_env_error
exit /b 1
:setup_build_env_exit
goto :EOF

View File

@ -0,0 +1,64 @@
:: Script will setup environment variables directly in callers environment.
:: If we are running from none Windows shell we will need to restore a clean PATH
:: before setting up VS MSVC build environment. If not there is a risk we will pick up
:: for example cygwin binaries when running toolchain commands not explicitly setup by
:: VS MSVC build environment.
set HKCU_ENV_PATH=
set HKLM_ENV_PATH=
if "%SHELL%" == "/bin/bash" (
for /f "tokens=2,*" %%a in ('%WINDIR%\System32\reg.exe query "HKCU\Environment" /v "Path" ^| %WINDIR%\System32\find.exe /i "REG_"') do (
SET HKCU_ENV_PATH=%%b
)
for /f "tokens=2,*" %%a in ('%WINDIR%\System32\reg.exe query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "Path" ^| %WINDIR%\System32\find.exe /i "REG_"') do (
SET HKLM_ENV_PATH=%%b
)
)
:: Restore default path, if we are running from none Windows shell.
if "%SHELL%" == "/bin/bash" (
call :restore_default_path "%HKCU_ENV_PATH%" "%HKLM_ENV_PATH%"
)
:: There is still a scenario where the default path can include cygwin\bin folder. If that's the case
:: there is still a big risk that build tools will be incorrectly resolved towards cygwin bin folder.
:: Make sure to adjust path and drop all cygwin paths.
set NEW_PATH=
call where /Q "cygpath.exe" && (
echo Warning, PATH includes cygwin bin folders. This can cause build errors due to incorrectly
echo located build tools. Build script will drop all cygwin folders from used PATH.
for %%a in ("%PATH:;=";"%") do (
if not exist "%%~a\cygpath.exe" (
call :add_to_new_path "%%~a"
)
)
)
if not "%NEW_PATH%" == "" (
set "PATH=%NEW_PATH%"
)
exit /b 0
:restore_default_path
:: Restore default PATH.
if not "%~2" == "" (
if not "%~1" == "" (
set "PATH=%~2;%~1"
) else (
set "PATH=%~2"
)
)
goto :EOF
:add_to_new_path
if "%NEW_PATH%" == "" (
set "NEW_PATH=%~1"
) else (
SET "NEW_PATH=%NEW_PATH%;%~1"
)
goto :EOF