From 2495f263a544ca8b0b345c5b17eec8e6a3a2df8e Mon Sep 17 00:00:00 2001 From: doyle Date: Mon, 6 Mar 2023 00:52:09 +1100 Subject: [PATCH] Add NASM and add LLVM script --- Internal/win_llvm-link-ad01970-2022-08-29.bat | 80 +++++++++++++++++++ app_manifest_dev.py | 28 +++++++ install.py | 21 ++++- 3 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 Internal/win_llvm-link-ad01970-2022-08-29.bat diff --git a/Internal/win_llvm-link-ad01970-2022-08-29.bat b/Internal/win_llvm-link-ad01970-2022-08-29.bat new file mode 100644 index 0000000..8a06eff --- /dev/null +++ b/Internal/win_llvm-link-ad01970-2022-08-29.bat @@ -0,0 +1,80 @@ +@ECHO OFF +@rem LLVM installation path +IF "%dp0%"=="" (SET LLVM=".\bin") ELSE (SET LLVM=%dp0%\bin) +@rem SET LLVM="C:\Program Files\LLVM\bin\" +IF NOT EXIST "%LLVM%" ( + ECHO LLVM not found at %LLVM%\bin + EXIT /b +) + +PUSHD "%LLVM%" + +@rem delete MSVC runtime library +DEL api-ms*.dll +DEL concrt140.dll +DEL msvcp140*.dll +DEL ucrtbase.dll +DEL vcruntime140*.dll + +@rem make symbolic link +DEL clang++.exe +MKLINK clang++.exe clang-cl.exe + +DEL clang.exe +MKLINK clang.exe clang-cl.exe + +DEL clang-cpp.exe +MKLINK clang-cpp.exe clang-cl.exe + +DEL lld-link.exe +MKLINK lld-link.exe lld.exe + +DEL ld.lld.exe +MKLINK ld.lld.exe lld.exe + +DEL ld64.lld.exe +MKLINK ld64.lld.exe lld.exe + +DEL wasm-ld.exe +MKLINK wasm-ld.exe lld.exe + +DEL llvm-lib.exe +MKLINK llvm-lib.exe llvm-ar.exe + +DEL llvm-ranlib.exe +MKLINK llvm-ranlib.exe llvm-ar.exe + +@rem DEL libiomp5md.dll +@rem MKLINK libiomp5md.dll libomp.dll + +POPD + +@rem Python lldb +PUSHD lib\site-packages\lldb + +IF EXIST _lldb.pyd ( + DEL _lldb.pyd + MKLINK _lldb.pyd ..\..\..\bin\liblldb.dll +) +@rem LLVM 14.0.0 +IF EXIST _lldb.cp310-win_amd64.pyd ( + DEL _lldb.cp310-win_amd64.pyd + MKLINK _lldb.cp310-win_amd64.pyd ..\..\..\bin\liblldb.dll +) +IF EXIST _lldb.cp310-win32.pyd ( + DEL _lldb.cp310-win32.pyd + MKLINK _lldb.cp310-win32.pyd ..\..\..\bin\liblldb.dll +) + +DEL lldb-argdumper.exe +MKLINK lldb-argdumper.exe ..\..\..\bin\lldb-argdumper.exe + +POPD + +@rem LLVM 8.0 and later no longer contains this folder +@rem MKDIR msbuild-bin +@rem PUSHD msbuild-bin +@rem +@rem DEL cl.exe +@rem MKLINK cl.exe ..\bin\clang.exe +@rem POPD diff --git a/app_manifest_dev.py b/app_manifest_dev.py index 7854065..43ff8af 100644 --- a/app_manifest_dev.py +++ b/app_manifest_dev.py @@ -1687,4 +1687,32 @@ def get_manifest(is_windows): # -------------------------------------------------------------------------- + if is_windows: + version = "2.16.01" + exe_path = "nasm.exe" + download_url = f"https://www.nasm.us/pub/nasm/releasebuilds/{version}/win64/nasm-{version}-win64.zip" + download_checksum = "029eed31faf0d2c5f95783294432cbea6c15bf633430f254bb3c1f195c67ca3a" + checksum = "edd81d22451246758450f1d5bd7f4c64937ed6cee06f3c2bbbba82401b32c6d4" + symlink = [f"nasm-{version}"] + + result.append({ + "label": "NASM", + "manifests": [ + { + "download_url": download_url, + "download_checksum": download_checksum, + "version": version, + "executables": [ + { + "path": exe_path, + "symlink": symlink, + "add_to_devenv_path": False, + "checksum": checksum, + } + ], + "add_to_devenv_script": [], + } + ], + }) + return result diff --git a/install.py b/install.py index e2ee014..5701325 100644 --- a/install.py +++ b/install.py @@ -392,13 +392,30 @@ pause subprocess.run(args=["chmod", "+x", dev_env_script_path]) subprocess.run(args=["chmod", "+x", user_env_script_path]) + # Use LLVM script to fix up bloated installation + # -------------------------------------------------------------------------- + # See: https://github.com/zufuliu/llvm-utils/blob/main/llvm/llvm-link.bat + internal_dir = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) / "Internal" + if is_windows: + devenver.print_header("Use LLVM utils script to slim installation size") + install_dir_set = set() + for entry in installed_dev_apps["LLVM"]: + install_dir = entry['install_dir'] + install_dir_set.add(install_dir) + + llvm_script_src_path = internal_dir / "win_llvm-link-ad01970-2022-08-29.bat" + for install_dir in install_dir_set: + llvm_script_dest_path = install_dir / "llvm-link.bat" + shutil.copy(llvm_script_src_path, llvm_script_dest_path) + subprocess.run(llvm_script_dest_path, cwd=install_dir) + os.remove(llvm_script_dest_path) + # Install left-overs # -------------------------------------------------------------------------- devenver.print_header("Install configuration files") # Copy init.vim to NVIM directory - internal_dir = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) / "Internal" - nvim_init_dir = "" + nvim_init_dir = "" if is_windows: nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / "AppData" / "Local" / "nvim"