[llvm] d7d05ff - Introduce options for Windows packaging script

Tobias Hieta via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 05:13:34 PDT 2022


Author: Pierrick Bouvier
Date: 2022-10-20T14:13:28+02:00
New Revision: d7d05ffa747b153a9852cc598331ab9b3036e8d7

URL: https://github.com/llvm/llvm-project/commit/d7d05ffa747b153a9852cc598331ab9b3036e8d7
DIFF: https://github.com/llvm/llvm-project/commit/d7d05ffa747b153a9852cc598331ab9b3036e8d7.diff

LOG: Introduce options for Windows packaging script

Options:
--version: [required] version to build
--help: display this help
--x86: build and test x86 variant
--x64: build and test x64 variant

Note: At least one variant to build is required.

Example: build_llvm_release.bat --version 15.0.0 --x64

Reviewed By: hans, thieta

Differential Revision: https://reviews.llvm.org/D135255

Added: 
    

Modified: 
    llvm/utils/release/build_llvm_release.bat

Removed: 
    


################################################################################
diff  --git a/llvm/utils/release/build_llvm_release.bat b/llvm/utils/release/build_llvm_release.bat
index 792206657ae1f..01502a0c53ece 100755
--- a/llvm/utils/release/build_llvm_release.bat
+++ b/llvm/utils/release/build_llvm_release.bat
@@ -1,28 +1,58 @@
 @echo off
 setlocal enabledelayedexpansion
 
-if "%1"=="" goto usage
 goto begin
 
 :usage
 echo Script for building the LLVM installer on Windows,
 echo used for the releases at https://github.com/llvm/llvm-project/releases
 echo.
-echo Usage: build_llvm_release.bat ^<version^>
+echo Usage: build_llvm_release.bat --version ^<version^> [--x86,--x64]
 echo.
-echo Example: build_llvm_release.bat 14.0.4
+echo Options:
+echo --version: [required] version to build
+echo --help: display this help
+echo --x86: build and test x86 variant
+echo --x64: build and test x64 variant
 echo.
+echo Note: At least one variant to build is required.
+echo.
+echo Example: build_llvm_release.bat --version 15.0.0 --x86 --x64
 exit /b 1
 
 :begin
 
+::==============================================================================
+:: parse args
+set version=
+set help=
+set x86=
+set x64=
+call :parse_args %*
+
+if "%help%" NEQ "" goto usage
+
+if "%version%" == "" (
+    echo --version option is required
+    echo =============================
+    goto usage
+)
+
+if "%x64%" == "" if "%x86%" == "" (
+    echo nothing to build!
+    echo choose one or several variants from: --x86 --x64
+    exit /b 1
+)
+
+::==============================================================================
+:: check prerequisites
 REM Note:
 REM   7zip versions 21.x and higher will try to extract the symlinks in
 REM   llvm's git archive, which requires running as administrator.
 
 REM Check 7-zip version and/or administrator permissions.
-for /f "delims=" %%i in ('7z.exe ^| findstr /r "2[1-9].[0-9][0-9]"') do set version=%%i
-if not "%version%"=="" (
+for /f "delims=" %%i in ('7z.exe ^| findstr /r "2[1-9].[0-9][0-9]"') do set version_7z=%%i
+if not "%version_7z%"=="" (
   REM Unique temporary filename to use by the 'mklink' command.
   set "link_name=%temp%\%username%_%random%_%random%.tmp"
 
@@ -32,7 +62,7 @@ if not "%version%"=="" (
   if errorlevel 1 (
     echo.
     echo Script requires administrator permissions, or a 7-zip version 20.x or older.
-    echo Current version is "%version%"
+    echo Current version is "%version_7z%"
     exit /b 1
   ) else (
     REM Remove the temporary symbolic link.
@@ -50,8 +80,9 @@ REM
 REM
 REM   For LLDB, SWIG version <= 3.0.8 needs to be used to work around
 REM   https://github.com/swig/swig/issues/769
+REM
 
-
+:: Detect Visual Studio
 set vsdevcmd=
 set vs_2019_prefix=C:\Program Files (x86)\Microsoft Visual Studio\2019
 :: try potential activated visual studio, then 2019, with 
diff erent editions
@@ -66,13 +97,15 @@ if not exist "%vsdevcmd%" (
 )
 echo Using VS devcmd: %vsdevcmd%
 
+::==============================================================================
 :: start echoing what we do
 @echo on
+
 set python32_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python310-32
 set python64_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python310
 
-set revision=llvmorg-%1
-set package_version=%1
+set revision=llvmorg-%version%
+set package_version=%version%
 set build_dir=%cd%\llvm_package_%package_version%
 
 echo Revision: %revision%
@@ -118,8 +151,8 @@ REM Preserve original path
 set OLDPATH=%PATH%
 
 REM Build the 32-bits and/or 64-bits binaries.
-call :do_build_32 || exit /b 1
-call :do_build_64 || exit /b 1
+if "%x86%" == "true" call :do_build_32 || exit /b 1
+if "%x64%" == "true" call :do_build_64 || exit /b 1
 exit /b 0
 
 ::==============================================================================


        


More information about the llvm-commits mailing list