Compare commits

..

3 Commits

Author SHA1 Message Date
doylet 4c0a59e0a3 linux: Add Go checksum for 1.20.1 2023-10-16 09:34:31 +11:00
doylet 7b53a7b88b Use installed MSVC 2023-10-16 09:34:31 +11:00
doyle 6db4f1c440 Add go 1.20.1 2023-10-16 09:34:31 +11:00
19 changed files with 2060 additions and 1885 deletions
-2
View File
@@ -1,6 +1,4 @@
.stfolder
Downloads
__pycache__
Win
Docs
Linux
-512
View File
@@ -1,512 +0,0 @@
-- ============================================================================
-- Modern Neovim Configuration (lazy.nvim)
-- ============================================================================
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- ============================================================================
-- Plugin Specifications
-- ============================================================================
require("lazy").setup({
-- File tree
{
'scrooloose/nerdtree',
cmd = 'NERDTreeToggle',
},
-- Build/async tools
'tpope/vim-dispatch',
-- Git integration
'tpope/vim-fugitive',
-- Text manipulation
'tpope/vim-abolish',
-- Large file handling
{
'LunarVim/bigfile.nvim',
config = function()
require('bigfile').setup()
end,
},
-- FZF
{ 'junegunn/fzf' },
{
'ibhagwan/fzf-lua',
branch = 'main',
config = function()
require('fzf-lua').setup({
winopts = {
height = 0.95,
width = 0.95
}
})
end,
},
'nvim-tree/nvim-web-devicons',
-- Alignment
{
'junegunn/vim-easy-align',
init = function()
vim.g.easy_align_delimiters = {
['>'] = { pattern = '>>\\|=>\\|>' },
['/'] = {
pattern = '//\\+\\|/\\*\\|\\*/',
delimiter_align = 'l',
ignore_groups = {'!Comment'}
},
[']'] = {
pattern = '[[\\]]',
left_margin = 0,
right_margin = 0,
stick_to_left = 0
},
[')'] = {
pattern = '[)]',
left_margin = 0,
right_margin = 0,
stick_to_left = 0
},
['('] = {
pattern = '[(]',
left_margin = 0,
right_margin = 0,
stick_to_left = 0
},
}
end,
},
-- File picker
{
'dmtrKovalenko/fff.nvim',
build = function()
-- this will download prebuild binary or try to use existing rustup toolchain to build from source
-- (if you are using lazy you can use gb for rebuilding a plugin if needed)
require("fff.download").download_or_build_binary()
end,
-- No need to lazy-load with lazy.nvim.
-- This plugin initializes itself lazily.
lazy = false,
keys = {
{
"<leader>f",
function() require('fff').find_files() end,
desc = 'FFFind files',
},
{
"<leader>r",
function() require('fff').live_grep() end,
desc = 'LiFFFe grep',
},
{
"<leader>R",
function() require('fff').live_grep({ query = vim.fn.expand("<cword>") }) end,
desc = 'Search current word',
},
}
},
-- C++ syntax highlighting
{
'bfrg/vim-cpp-modern',
init = function()
vim.g.cpp_function_highlight = 1
vim.g.cpp_attributes_highlight = 1
vim.g.cpp_member_highlight = 0
vim.g.cpp_simple_highlight = 1
end,
},
-- Motion
{
url = 'https://codeberg.org/andyg/leap.nvim',
lazy = false,
config = function()
vim.keymap.set({'n', 'x', 'o'}, '<tab>', '<Plug>(leap)')
vim.keymap.set({'n', 'x', 'o'}, '<S-tab>', '<Plug>(leap-from-window)')
-- Highly recommended: define a preview filter to reduce visual noise
-- and the blinking effect after the first keypress
-- (see `:h leap.opts.preview`).
-- For example, skip preview if the first character of the match is
-- whitespace or is in the middle of an alphabetic word:
require('leap').opts.preview = function(ch0, ch1, ch2)
return not (
ch1:match('%s')
or (ch0:match('%a') and ch1:match('%a') and ch2:match('%a'))
)
end
-- Define equivalence classes for brackets and quotes, in addition to
-- the default whitespace group:
require('leap').opts.equivalence_classes = { ' \t\r\n', '([{', ')]}', '\'"`' }
-- Use the traversal keys to repeat the previous motion without
-- explicitly invoking Leap:
require('leap.user').set_repeat_keys('<enter>', '<backspace>')
-- Automatic paste after remote yank operations:
vim.api.nvim_create_autocmd('User', {
pattern = 'RemoteOperationDone',
group = vim.api.nvim_create_augroup('LeapRemote', {}),
callback = function(event)
if vim.v.operator == 'y' and event.data.register == '"' then
vim.cmd('normal! p')
end
end,
})
end
},
-- Theme
{
'sainnhe/gruvbox-material',
priority = 1000,
init = function()
vim.g.gruvbox_material_background = 'hard'
vim.g.gruvbox_material_foreground = 'mix'
vim.g.gruvbox_material_disable_italic_comment = 1
vim.g.gruvbox_material_enable_italic = 0
vim.g.gruvbox_material_enable_bold = 0
vim.g.gruvbox_material_diagnostic_virtual_text = 'colored'
vim.g.gruvbox_material_better_performance = 1
end,
config = function()
vim.cmd('colorscheme gruvbox-material')
end,
},
-- Odin syntax
'Tetralux/odin.vim',
-- Treesitter
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
},
-- LSP
{
'williamboman/mason.nvim',
config = function()
require('mason').setup({})
end,
},
{
'williamboman/mason-lspconfig.nvim',
config = function()
require('mason-lspconfig').setup({
ensure_installed = { "clangd" },
automatic_enable = true,
})
end,
},
'neovim/nvim-lspconfig',
-- Completion
{
'hrsh7th/nvim-cmp',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'L3MON4D3/LuaSnip',
},
config = function()
local cmp = require('cmp')
cmp.setup({
sources = {
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'path' },
},
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({ select = false }),
['<Tab>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
['<S-Tab>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
}),
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
})
end,
},
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'L3MON4D3/LuaSnip',
-- Utilities
'nvim-lua/plenary.nvim',
-- Opencode
{
"sudo-tee/opencode.nvim",
config = function()
require("opencode").setup({})
end,
dependencies = {
"nvim-lua/plenary.nvim",
{
"MeanderingProgrammer/render-markdown.nvim",
opts = {
anti_conceal = { enabled = false },
file_types = { 'markdown', 'opencode_output' },
},
ft = { 'markdown', 'Avante', 'copilot-chat', 'opencode_output' },
},
-- Optional, for file mentions and commands completion, pick only one
-- 'saghen/blink.cmp',
'hrsh7th/nvim-cmp',
-- Optional, for file mentions picker, pick only one
-- 'folke/snacks.nvim',
-- 'nvim-telescope/telescope.nvim',
-- 'ibhagwan/fzf-lua',
-- 'nvim_mini/mini.nvim',
},
},
}, {
install = {
colorscheme = { "gruvbox-material" },
},
checker = {
enabled = false,
},
})
-- ============================================================================
-- Options
-- ============================================================================
vim.opt.autowrite = true
vim.opt.colorcolumn = { 80, 100 }
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
vim.opt.cpoptions:append('$')
vim.opt.cursorline = true
vim.opt.expandtab = true
vim.opt.guifont = 'JetBrains_Mono,Consolas:h9'
vim.opt.hlsearch = false
vim.opt.ignorecase = true
vim.opt.linebreak = true
vim.opt.list = true
vim.opt.listchars:append('tab:>-,trail:■,extends:»,precedes:«')
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.shiftwidth = 4
vim.opt.splitright = true
vim.opt.swapfile = false
vim.opt.textwidth = 80
vim.opt.visualbell = true
vim.opt.wrap = false
vim.opt.signcolumn = 'no'
-- Setup undo and backup directories
vim.opt.undofile = true
vim.opt.undodir = vim.fn.stdpath('config') .. '/undo'
vim.opt.backupdir = vim.fn.stdpath('config') .. '/backup'
-- Status line
vim.opt.statusline = '%<%F%h%m%r [%{&ff}] (%{strftime("%H:%M %d/%m/%Y",getftime(expand("%:p")))})%=%l,%c%V %P'
-- Wild ignore
vim.opt.wildignore:append('*.class,*.o,*\\tmp\\*,*.swp,*.zip,*.exe,*.obj,*.vcxproj,*.pdb,*.idb')
-- Mouse support
vim.opt.mouse = 'a'
-- Spelling
vim.opt.spell = true
-- ============================================================================
-- LSP Configuration
-- ============================================================================
local opts = { noremap = true, silent = true }
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<F4>", vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
-- Diagnostic configuration
vim.diagnostic.config({
signs = false,
virtual_text = true,
})
-- Spelling highlight
vim.api.nvim_create_autocmd("LspAttach", {
callback = function()
vim.cmd("highlight SpellBad gui=underline guifg=#d3869b")
end,
})
-- ============================================================================
-- Vim Dispatch Configuration
-- ============================================================================
if vim.fn.has('win64') == 1 or vim.fn.has('win32') == 1 or vim.fn.has('win16') == 1 then
if os.getenv('SHELL') ~= nil then
vim.o.shellcmdflag = '-c'
vim.o.makeprg = "./build.sh"
else
vim.o.makeprg = "build.bat"
end
else
vim.o.makeprg = "./build.sh"
end
-- ============================================================================
-- Autocommands
-- ============================================================================
-- Automatically scroll to bottom of quickfix window when opened
vim.api.nvim_create_autocmd("FileType", {
pattern = "qf",
callback = function()
vim.cmd('normal! G')
end,
})
-- Per-Project Bindings - load project file on buffer enter
vim.api.nvim_create_autocmd("BufEnter", {
callback = function()
local project_file = vim.fn.getcwd() .. '/project_nvim.lua'
if vim.fn.filereadable(project_file) == 1 then
vim.cmd('luafile ' .. vim.fn.fnameescape(project_file))
end
end,
})
-- Formatting options
vim.api.nvim_create_augroup("persistent_settings", { clear = true })
vim.api.nvim_create_autocmd("BufEnter", {
group = "persistent_settings",
pattern = "*",
command = "set formatoptions=q1j",
})
-- ============================================================================
-- Functions
-- ============================================================================
local function raddbg_open_file()
local filepath = vim.fn.expand("%:p"):gsub('\\', '/')
vim.fn.system("dev raddbg --ipc open " .. filepath)
vim.fn.system("dev raddbg --ipc goto_line " .. vim.fn.line("."))
vim.fn.system("powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate('The RAD Debugger')")
end
local function raddbg_start_debugging()
vim.fn.system("dev raddbg --ipc run")
end
local function raddbg_stop_debugging()
vim.fn.system("dev raddbg --ipc kill_all")
end
local function raddbg_run_to_cursor()
local filepath = vim.fn.expand("%:p"):gsub('\\', '/')
vim.fn.system("dev raddbg --ipc open " .. filepath)
vim.fn.system("dev raddbg --ipc goto_line " .. vim.fn.line("."))
vim.fn.system("dev raddbg --ipc run_to_cursor " .. filepath .. ":" .. vim.fn.line("."))
vim.fn.system("powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate('The RAD Debugger')")
end
local function raddbg_add_breakpoint()
local filepath = vim.fn.expand("%:p"):gsub('\\', '/')
vim.fn.system("dev raddbg --ipc open " .. filepath)
vim.fn.system("dev raddbg --ipc goto_line " .. vim.fn.line("."))
vim.fn.system("dev raddbg --ipc toggle_breakpoint " .. filepath .. ":" .. vim.fn.line("."))
vim.fn.system("powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate('The RAD Debugger')")
end
-- ============================================================================
-- Keymaps
-- ============================================================================
local function adjust_fontsize(amount)
-- Get current font and size
local current_font = vim.opt.guifont:get()[1] or "Consolas"
local current_size = tonumber(current_font:match(":h(%d+)")) or 12
-- Extract font name (everything before :h)
local font_name = current_font:match("^(.+):h%d+") or current_font
-- Calculate new size
local new_size = math.max(6, current_size + amount) -- Minimum size of 6
-- Apply new font setting
if vim.g.neovide then
vim.opt.guifont = font_name .. ":h" .. new_size
else
vim.cmd("GuiFont! " .. font_name .. ":h" .. new_size)
end
end
-- Numpad mappings
vim.keymap.set('n', '<C-=>', function() adjust_fontsize(1) end)
vim.keymap.set('n', '<C-->', function() adjust_fontsize(-1) end)
-- FZF Bindings
vim.keymap.set('n', '<leader>h', '<cmd>FzfLua oldfiles<cr>')
vim.keymap.set('n', '<leader>t', '<cmd>FzfLua lsp_live_workspace_symbols<cr>')
vim.keymap.set('n', '<leader>T', '<cmd>FzfLua lsp_finder<cr>')
vim.keymap.set('n', '<leader>b', '<cmd>FzfLua buffers<cr>')
vim.keymap.set('n', '<leader><leader>', '<cmd>FzfLua<cr>')
-- Window navigation
vim.keymap.set('n', '<C-h>', '<C-w>h', { silent = true })
vim.keymap.set('n', '<C-j>', '<C-w>j', { silent = true })
vim.keymap.set('n', '<C-k>', '<C-w>k', { silent = true })
vim.keymap.set('n', '<C-l>', '<C-w>l', { silent = true })
-- Move by wrapped lines
vim.keymap.set('n', 'j', 'gj')
vim.keymap.set('n', 'k', 'gk')
vim.keymap.set('n', 'gj', 'j')
vim.keymap.set('n', 'gk', 'k')
-- NERDTree
vim.keymap.set('n', '<C-n>', ':NERDTreeToggle<CR>')
-- Change to current buffer's directory
vim.keymap.set('n', 'cd', function()
vim.cmd('cd ' .. vim.fn.expand('%:p:h'))
end)
-- Buffer splitting
vim.keymap.set('n', '<leader>s', ':vs<CR>')
-- Quickfix navigation
vim.keymap.set('n', '<A-j>', ':cn<CR>')
vim.keymap.set('n', '<A-k>', ':cp<CR>')
-- Terminal escape
vim.keymap.set('t', '<Esc>', '<C-\\><C-n>')
-- Make (Vim Dispatch)
vim.keymap.set('n', '<C-b>', ':Make<CR>', { noremap = true })
-- Easy-Align
vim.keymap.set('x', '<leader>a', '<Plug>(LiveEasyAlign)')
-- RAD Debugger
vim.keymap.set('n', '<F6>', function() raddbg_open_file() end, { silent = true })
vim.keymap.set('n', '<F5>', function() raddbg_start_debugging() end, { silent = true })
vim.keymap.set('n', '<S-F5>', function() raddbg_stop_debugging() end, { silent = true })
vim.keymap.set('n', '<F9>', function() raddbg_add_breakpoint() end, { silent = true })
vim.keymap.set('n', '<C-F10>', function() raddbg_run_to_cursor() end, { silent = true })
+416
View File
@@ -0,0 +1,416 @@
" Plugins ==========================================================================================
call plug#begin(stdpath('config') . '/plugged')
" nerdtree provides a file tree explorer
" vim-dispatch allows running async jobs in vim (i.e. builds in the background)
Plug 'https://github.com/scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'https://github.com/tpope/vim-dispatch'
Plug 'https://github.com/tpope/vim-fugitive'
Plug 'https://github.com/tpope/vim-abolish'
" TODO: 2022-06-19 Treesitter is too slow on large C++ files
" Plug 'https://github.com/nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'https://github.com/bfrg/vim-cpp-modern'
" FZF
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" FZF for LSP
Plug 'gfanto/fzf-lsp.nvim'
Plug 'nvim-lua/plenary.nvim'
" odin for syntax highlighting
Plug 'https://github.com/Tetralux/odin.vim'
Plug 'https://github.com/sainnhe/gruvbox-material'
" Lua cache to speed up load times
Plug 'https://github.com/lewis6991/impatient.nvim'
Plug 'https://github.com/ggandor/leap.nvim'
" lsp-zero begin
" LSP Support
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
" Autocompletion
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'saadparwaiz1/cmp_luasnip'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-nvim-lua'
" Snippets
Plug 'L3MON4D3/LuaSnip'
" Snippet collection (Optional)
Plug 'rafamadriz/friendly-snippets'
Plug 'VonHeikemen/lsp-zero.nvim'
" lsp-zero end
call plug#end()
" Lua Setup ========================================================================================
lua <<EOF
require('impatient')
local leap = require('leap')
vim.keymap.set({'n', 'x', 'o'}, '<leader>r', '<Plug>(leap-forward-to)')
vim.keymap.set({'n', 'x', 'o'}, '<leader>R', '<Plug>(leap-backward-to)')
-- LSP Setup =====================================================================================
local lsp = require('lsp-zero')
local devenver_root = vim.fn.getenv('devenver_root')
lsp.preset('recommended')
lsp.configure('clangd', {
cmd = {
"clangd",
"-j",
"1",
"--background-index",
"--background-index-priority=background",
"--pch-storage=memory",
"--clang-tidy",
"--header-insertion=iwyu",
"--header-insertion-decorators",
}
})
lsp.setup()
-- Treesitter ====================================================================================
-- TODO: 2022-06-19 Treesitter is too slow on large C++ files
-- require('nvim-treesitter.configs').setup {
-- ensure_installed = { "c", "cpp" }, -- A list of parser names, or "all"
-- sync_install = false, -- Install parsers synchronously (only applied to `ensure_installed`)
-- ignore_install = { }, -- List of parsers to ignore installing (for "all")
-- highlight = {
-- enable = false, -- `false` will disable the whole extension
-- -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- -- the name of the parser)
-- -- list of language that will be disabled
-- disable = { },
-- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- -- Using this option may slow down your editor, and you may see some duplicate highlights.
-- -- Instead of true it can also be a list of languages
-- additional_vim_regex_highlighting = false,
-- },
-- }
-- Vim Options ===================================================================================
vim.opt.autowrite=true -- Automatically save before cmds like :next and :prev
vim.opt.colorcolumn={80, 100} -- Set a 80 and 100 char column ruler
vim.opt.completeopt={'menu', 'menuone', 'noselect'}
vim.opt.cpoptions:append('$') -- $ as end marker for the change operator
vim.opt.cursorline=true -- Highlight current line
vim.opt.expandtab=true -- Replace tabs with spaces
vim.opt.guifont={'JetBrains_Mono:h9',
'Consolas:h9',
'InputMonoCondensed:h9'}
vim.opt.hlsearch=false -- Highlight just the first match on search
vim.opt.ignorecase=true -- Search is not case sensitive
vim.opt.linebreak=true -- On wrapped lines, break on the wrapping word intelligently
vim.opt.list=true -- Show the 'listchar' characters on trailing spaces, tabs e.t.c
vim.opt.listchars:append('tab:>-,trail:■,extends:»,precedes:«')
vim.opt.number=true -- Show line numbers
vim.opt.relativenumber=true -- Show relative line numbers
vim.opt.shiftwidth=4 -- Number of spaces for each autoindent step
vim.opt.splitright=true -- Open new splits to the right of the current one
vim.opt.swapfile=false -- Disable swapfile (stores the things changed in a file)
vim.opt.textwidth=80 -- On format, format to 80 char long lines
vim.opt.visualbell=true -- Flash the screen on error
vim.opt.wrap=false -- Don't wrap lines of text automatically
vim.opt.signcolumn = 'no'
vim.diagnostic.config({
-- Turn off the diagnostics signs on the line number. In LSP mode, editing
-- a C++ buffer constantly toggles the sign column on and off as you change
-- modes which is very visually distracting.
signs = false,
})
-- Check if there were args (i.e. opened file), non-empty buffer, or started in insert mode
if vim.fn.argc() == 0 or vim.fn.line2byte("$") ~= -1 and not opt.insertmode then
local ascii = {
"",
" Useful Bindings (Normal Mode)",
" --------------------------------------------------",
" <Ctrl+n> to open the file tree explorer",
" <Ctrl+i> clang format selected lines",
" <Ctrl+j> jump to next compilation error",
" <Ctrl+k> jump to prev compilation error",
" <cd> change working directory to current file",
" <\\s> split buffer vertically",
"",
" Abolish (Text Substitution in Normal Mode)",
" --------------------------------------------------",
" %S/facilit{y,ies}/building{,s}/g Convert facility->building, facilities->buildings",
" %S/action/sleep/g Convert action to sleep, (preserve case sensitivity ACTION->SLEEP, action->sleep) ",
"",
" FZF (Normal Mode)",
" --------------------------------------------------",
" <\\h> vim command history",
" <\\f> find files",
" <\\g> search for text (via ripgrep)",
" <\\tt> search for tag (global)",
" <\\tb> search for tag (buffer)",
" <\\cc> search for commit (global)",
" <\\cb> search for commit (buffer)",
" <\\b> search for buffer",
"",
" Autocompletion (nvim-cmp in Normal Mode)",
" --------------------------------------------------",
" <Enter> Confirms selection.",
" <Ctrl-y> Confirms selection.",
" <Up> Navigate to previous item on the list.",
" <Down> Navigate to the next item on the list.",
" <Ctrl-p> Navigate to previous item on the list.",
" <Ctrl-n> Navigate to the next item on the list.",
" <Ctrl-u> Scroll up in the item's documentation.",
" <Ctrl-f> Scroll down in the item's documentation.",
" <Ctrl-e> Toggles the completion.",
" <Ctrl-d> Go to the next placeholder in the snippet.",
" <Ctrl-b> Go to the previous placeholder in the snippet.",
" <Tab> Enables completion when the cursor is inside a word. If the completion menu is visible it will navigate to the next item in the list.",
" <Shift-Tab> When the completion menu is visible navigate to the previous item in the list.",
"",
" LSP Bindings (Normal Mode)",
" --------------------------------------------------",
" <Shift-K> Displays hover information about the symbol under the cursor in a floating window. See help vim.lsp.buf.hover().",
" gd Jumps to the definition of the symbol under the cursor. See help vim.lsp.buf.definition().",
" gD Jumps to the declaration of the symbol under the cursor. Some servers don't implement this feature. See help vim.lsp.buf.declaration().",
" gi Lists all the implementations for the symbol under the cursor in the quickfix window. See help vim.lsp.buf.implementation().",
" go Jumps to the definition of the type of the symbol under the cursor. See help vim.lsp.buf.type_definition().",
" gr Lists all the references to the symbol under the cursor in the quickfix window. See help vim.lsp.buf.references().",
" <Ctrl-k> Displays signature information about the symbol under the cursor in a floating window. See help vim.lsp.buf.signature_help(). If a mapping already exists for this key this function is not bound.",
" <F2> Renames all references to the symbol under the cursor. See help vim.lsp.buf.rename().",
" <F4> Selects a code action available at the current cursor position. See help vim.lsp.buf.code_action().",
" gl Show diagnostics in a floating window. See :help vim.diagnostic.open_float().",
" [d Move to the previous diagnostic in the current buffer. See :help vim.diagnostic.goto_prev().",
" ]d Move to the next diagnostic. See :help vim.diagnostic.goto_next()."
}
local height = vim.api.nvim_get_option("lines")
local width = vim.api.nvim_get_option("columns")
local ascii_rows = #ascii
local ascii_cols = #ascii[1]
local win = vim.api.nvim_get_current_win()
local buf = vim.api.nvim_create_buf(true, true)
local function reset_start_screen()
vim.cmd("enew")
local buf = vim.api.nvim_get_current_buf()
local win = vim.api.nvim_get_current_win()
vim.api.nvim_buf_set_option(buf, "modifiable", true)
vim.api.nvim_buf_set_option(buf, "buflisted", true)
vim.api.nvim_buf_set_option(buf, "buflisted", true)
end
vim.api.nvim_buf_set_lines(buf, 0, -1, false, ascii)
vim.api.nvim_buf_set_option(buf, "modified", false)
vim.api.nvim_buf_set_option(buf, "buflisted", false)
vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe")
vim.api.nvim_buf_set_option(buf, "buftype", "nofile")
vim.api.nvim_buf_set_option(buf, "swapfile", false)
vim.api.nvim_set_current_buf(buf)
vim.api.nvim_create_autocmd("InsertEnter,WinEnter", {
pattern = "<buffer>",
callback = reset_start_screen,
})
end
-- Adjust the quick fix window that pops-up on build to size the buffer with
-- the size of the output and at most 10 lines.
function AdjustQuickfixHeight()
local num_lines = vim.fn.line('$')
local max_height = 10
local height = math.min(num_lines, max_height)
vim.cmd(height .. 'wincmd _')
end
vim.cmd[[
autocmd BufWinEnter quickfix lua AdjustQuickfixHeight()
]]
EOF
" Theme ============================================================================================
let g:gruvbox_material_background='hard'
let g:gruvbox_material_foreground='mix'
let g:gruvbox_material_disable_italic_comment=1
let g:gruvbox_material_enable_italic=0
let g:gruvbox_material_enable_bold=0
let g:gruvbox_material_diagnostic_virtual_text='colored'
let g:gruvbox_material_better_performance=1
colorscheme gruvbox-material
" Vim-cpp-modern customisation
" Disable function highlighting (affects both C and C++ files)
let g:cpp_function_highlight = 1
" Enable highlighting of C++11 attributes
let g:cpp_attributes_highlight = 1
" Highlight struct/class member variables (affects both C and C++ files)
let g:cpp_member_highlight = 0
" Put all standard C and C++ keywords under Vim's highlight group 'Statement'
" (affects both C and C++ files)
let g:cpp_simple_highlight = 1
" Options ==========================================================================================
" Show EOL type and last modified timestamp, right after the filename
set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P
" File patterns to ignore in command line auto complete
set wildignore+=*.class,*.o,*\\tmp\\*,*.swp,*.zip,*.exe,*.obj,*.vcxproj,*.pdb,*.idb
" Setup undo file
set undofile
let &undodir=stdpath('config') . '/undo'
" Setup backup directory
let &backupdir=stdpath('config') . '/backup'
" Enable mouse support
if has('mouse')
set mouse=a
endif
" Functions ========================================================================================
" Increase font size using (Ctrl+Up Arrow) or (Ctrl+Down Arrow) if we are using
" gvim Otherwise font size is determined in terminal
nnoremap <C-Up> :silent! let &guifont = substitute(
\ &guifont,
\ ':h\zs\d\+',
\ '\=eval(submatch(0)+1)',
\ 'g')<CR>
nnoremap <C-Down> :silent! let &guifont = substitute(
\ &guifont,
\ ':h\zs\d\+',
\ '\=eval(submatch(0)-1)',
\ 'g')<CR>
" Formatting options (see :h fo-table)
augroup persistent_settings
au!
au bufenter * :set formatoptions=q1j
augroup end
function! RemedyBGOpenFile()
execute("!remedybg open-file " . expand("%:p") . " " . line("."))
execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')")
endfunction
command RemedyBGOpenFile call RemedyBGOpenFile()
function! RemedyBGStartDebugging()
execute("!remedybg start-debugging " . expand("%:p") . " " . line("."))
endfunction
command RemedyBGStartDebugging call RemedyBGStartDebugging()
function! RemedyBGStopDebugging()
execute("!remedybg stop-debugging " . expand("%:p") . " " . line("."))
endfunction
command RemedyBGStopDebugging call RemedyBGStopDebugging()
function! RemedyBGRunToCursor()
execute("!remedybg open-file " . expand("%:p") . " " . line("."))
execute("!remedybg run-to-cursor " . expand("%:p") . " " . line("."))
execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')")
endfunction
command RemedyBGRunToCursor call RemedyBGRunToCursor()
function! RemedyBGAddBreakpointAtFile()
execute("!remedybg open-file " . expand("%:p") . " " . line("."))
execute("!remedybg add-breakpoint-at-file " . expand("%:p") . " " . line("."))
execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')")
endfunction
command RemedyBGAddBreakpointAtFile call RemedyBGAddBreakpointAtFile()
nnoremap <silent> <F6> <cmd>RemedyBGOpenFile<cr><cr>
nnoremap <silent> <F5> <cmd>RemedyBGStartDebugging<cr><cr>
nnoremap <silent> <S-F5> <cmd>RemedyBGStopDebugging<cr><cr>
nnoremap <silent> <F9> <cmd>RemedyBGAddBreakpointAtFile<cr><cr>
nnoremap <silent> <C-F10> <cmd>RemedyBGRunToCursor<cr><cr>
" FZF ==============================================================================================
" Empty value to disable preview window altogether
let g:fzf_preview_window = []
" Prefix all commands with Fzf for discoverability
let g:fzf_command_prefix = 'Fzf'
" - down / up / left / right
let g:fzf_layout = { 'down': '40%' }
command! -nargs=* -bang FzfCustomRG call RipgrepFzf(<q-args>, <bang>0)
" Augment the "FzfCustomFiles" command
command! -bang -nargs=? -complete=dir FzfCustomFiles
\ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline', '--preview', 'cat {}']}, <bang>0)
" General Key Bindings =============================================================================
" FZF Bindings
nnoremap <leader>h <cmd>FzfHistory<cr>
nnoremap <leader>f <cmd>FzfCustomFiles<cr>
nnoremap <leader>g <cmd>FzfRg<cr>
nnoremap <leader>t :FzfWorkspaceSymbols<space>
nnoremap <leader>cc <cmd>FzfCommits<cr>
nnoremap <leader>cb <cmd>FzfBCommits<cr>
nnoremap <leader>b <cmd>FzfBuffers<cr>
function! PadAndTruncateLineFunction()
let line = getline('.')
let line_length = strlen(line)
let padding = 100 - line_length
let padding = max([padding, 0])
let existing_space = line_length == 100 || match(line, ' $') != -1
" Construct the new line with padding and a space before the padding
let new_line = line . (existing_space ? '' : ' ') . repeat('=', padding - 1)
call setline(line('.'), new_line)
endfunction
command! PadAndTruncateLine :call PadAndTruncateLineFunction()<CR>
nnoremap <silent> <F3> :PadAndTruncateLine<cr>
" Map Ctrl+HJKL to navigate buffer window
nmap <silent> <C-h> :wincmd h<CR>
nmap <silent> <C-j> :wincmd j<CR>
nmap <silent> <C-k> :wincmd k<CR>
nmap <silent> <C-l> :wincmd l<CR>
" Move by wrapped lines instead of line numbers
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
" Map NERDTree to Ctrl-N
map <C-n> :NERDTreeToggle<CR>
" Change to current buffer's directory
nmap cd :cd <C-R>=expand("%:p:h")<CR><CR>
" Buffer Splitting
nnoremap <leader>s :vs<CR>
" Go to next error
" Go to previous error
nnoremap <A-j> :cn<CR>
nnoremap <A-k> :cp<CR>
" Vim Dispatch =====================================================================================
let s:running_windows = has("win16") || has("win32") || has("win64")
if s:running_windows
set makeprg=build.bat
else
" Set vim terminal to enter normal mode using escape like normal vim behaviour
tnoremap <Esc> <C-\><C-n>
set makeprg=./build.sh
endif
nnoremap <C-b> :Make<cr>
Executable → Regular
View File
-77
View File
@@ -1,77 +0,0 @@
#!/bin/bash
# Setup ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
script_path=$0
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
root_dir="${devenver_root}"
# Arguments ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
clang_dir="$root_dir/LLVM"
cmake_dir="$root_dir/CMake"
node_dir="$root_dir/NodeJS"
python_dir="$root_dir/Python"
virustotal_url="https://www.virustotal.com/gui/file"
# Argument parsing :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
option="$1"
shift
if [ "$option" = "clang" ]; then exe_dir="$clang_dir/$1/bin" && PATH="$exe_dir:$PATH" && cmd_line="$2" && shift && shift; fi
if [ "$option" = "cmake" ]; then exe_dir="$cmake_dir/$1" && PATH="$exe_dir:$PATH" && cmd_line="$2" && shift && shift; fi
if [ "$option" = "node" ]; then exe_dir="$node_dir/$1/bin" && PATH="$exe_dir:$PATH" && cmd_line="$2" && shift && shift; fi
if [ "$option" = "python" ]; then
python_root=$python_dir/$1/install
# Shit like building UWSGI in Python via PIP with wheel doesn't seem to use
# LD_LIBRARY_PATH but LDFLAGS works. Dependency hell
cmd_prefix="LDFLAGS=${python_root}/lib LD_LIBRARY_PATH=$python_root/lib:$LD_LIBRARY_PATH PYTHONHOME=$python_root"
exe_dir="$python_root/bin"
PATH="$exe_dir:$PATH"
cmd_line="$2"&& shift && shift;
fi
if [ "$option" = "virustotal" ]; then virustotal_hash=$(sha256sum "$1" | awk '{print $1}') && cmd_line="xdg-open $virustotal_url/$virustotal_hash &" && shift; fi
if [ -z "$cmd_line" ]; then option="help"; fi
if [ "$option" = "help" ]; then
clang_versions=$(ls -1 "$clang_dir" 2>/dev/null | tr '\n' ' ')
cmake_versions=$(ls -1 "$cmake_dir" 2>/dev/null | tr '\n' ' ')
node_versions=$(ls -1 "$node_dir" 2>/dev/null | tr '\n' ' ')
python_versions=$(ls -1 "$python_dir" 2>/dev/null | tr '\n' ' ')
cat << EOF
USAGE: dev [option] [args...]
NOTES:
Commands augment the system PATH with the tool's path for the current shell session.
You can chain the commands to augment the PATH, e.g:
dev.sh python 3.12.9+20250317 dev.sh node 20.18.2 yarn build-everything
OPTIONS:
cmake [version] [cmd...] CMake build system: 'PATH=$cmake_dir/[version]:\$PATH [cmd...]'
Versions: $cmake_versions
clang [version] [cmd..] CLANG compiler: 'PATH=$clang_dir/[version]:\$PATH [cmd...]'
Example: 'dev clang 18.1.4 clang++.exe --help'
Versions: $clang_versions
node [version] [cmd...] Node JS: 'PATH=$node_dir/[version]:\$PATH [cmd...]'
Versions: $node_versions
python [version] [cmd...] Python: 'PATH=$python_dir/[version]/install/bin:\$PATH [cmd...]'
Versions: $python_versions
virustotal [file] Lookup file SHA256 hash on VirusTotal: '$virustotal_url/[file]'
EOF
exit 0
fi
# Extract user arguments ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
user_args=""
while [ $# -gt 0 ]; do user_args="$user_args $1"; shift; done
# Trim trailing space ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
while [ "${user_args: -1}" = " " ]; do user_args="${user_args% }"; done
while [ "${cmd_line: -1}" = " " ]; do cmd_line="${cmd_line% }"; done
# Eval ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo "DEV: Running '$script_path' with '$cmd_prefix $cmd_line$user_args'"
eval "$cmd_prefix $cmd_line$user_args"
-544
View File
@@ -1,544 +0,0 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ completion.bash
#
# - $FZF_TMUX (default: 0)
# - $FZF_TMUX_OPTS (default: empty)
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_OPTS (default: empty)
[[ $- =~ i ]] || return 0
# To use custom commands instead of find, override _fzf_compgen_{path,dir}
if ! declare -F _fzf_compgen_path > /dev/null; then
_fzf_compgen_path() {
echo "$1"
command find -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \
-a -not -path "$1" -print 2> /dev/null | command sed 's@^\./@@'
}
fi
if ! declare -F _fzf_compgen_dir > /dev/null; then
_fzf_compgen_dir() {
command find -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \
-a -not -path "$1" -print 2> /dev/null | command sed 's@^\./@@'
}
fi
###########################################################
# To redraw line after fzf closes (printf '\e[5n')
bind '"\e[0n": redraw-current-line' 2> /dev/null
__fzf_comprun() {
if [[ "$(type -t _fzf_comprun 2>&1)" = function ]]; then
_fzf_comprun "$@"
elif [[ -n "${TMUX_PANE-}" ]] && { [[ "${FZF_TMUX:-0}" != 0 ]] || [[ -n "${FZF_TMUX_OPTS-}" ]]; }; then
shift
fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- "$@"
else
shift
fzf "$@"
fi
}
__fzf_orig_completion() {
local l comp f cmd
while read -r l; do
if [[ "$l" =~ ^(.*\ -F)\ *([^ ]*).*\ ([^ ]*)$ ]]; then
comp="${BASH_REMATCH[1]}"
f="${BASH_REMATCH[2]}"
cmd="${BASH_REMATCH[3]}"
[[ "$f" = _fzf_* ]] && continue
printf -v "_fzf_orig_completion_${cmd//[^A-Za-z0-9_]/_}" "%s" "${comp} %s ${cmd} #${f}"
if [[ "$l" = *" -o nospace "* ]] && [[ ! "${__fzf_nospace_commands-}" = *" $cmd "* ]]; then
__fzf_nospace_commands="${__fzf_nospace_commands-} $cmd "
fi
fi
done
}
_fzf_opts_completion() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="
-h --help
-x --extended
-e --exact
--extended-exact
+x --no-extended
+e --no-exact
-q --query
-f --filter
--literal
--no-literal
--algo
--scheme
--expect
--no-expect
--enabled --no-phony
--disabled --phony
--tiebreak
--bind
--color
--toggle-sort
-d --delimiter
-n --nth
--with-nth
-s --sort
+s --no-sort
--track
--no-track
--tac
--no-tac
-i
+i
-m --multi
+m --no-multi
--ansi
--no-ansi
--no-mouse
+c --no-color
+2 --no-256
--black
--no-black
--bold
--no-bold
--layout
--reverse
--no-reverse
--cycle
--no-cycle
--keep-right
--no-keep-right
--hscroll
--no-hscroll
--hscroll-off
--scroll-off
--filepath-word
--no-filepath-word
--info
--no-info
--inline-info
--no-inline-info
--separator
--no-separator
--scrollbar
--no-scrollbar
--jump-labels
-1 --select-1
+1 --no-select-1
-0 --exit-0
+0 --no-exit-0
--read0
--no-read0
--print0
--no-print0
--print-query
--no-print-query
--prompt
--pointer
--marker
--sync
--no-sync
--async
--no-history
--history
--history-size
--no-header
--no-header-lines
--header
--header-lines
--header-first
--no-header-first
--ellipsis
--preview
--no-preview
--preview-window
--height
--min-height
--no-height
--no-margin
--no-padding
--no-border
--border
--no-border-label
--border-label
--border-label-pos
--no-preview-label
--preview-label
--preview-label-pos
--no-unicode
--unicode
--margin
--padding
--tabstop
--listen
--no-listen
--clear
--no-clear
--version
--"
case "${prev}" in
--algo)
COMPREPLY=( $(compgen -W "v1 v2" -- "$cur") )
return 0
;;
--scheme)
COMPREPLY=( $(compgen -W "default path history" -- "$cur") )
return 0
;;
--tiebreak)
COMPREPLY=( $(compgen -W "length chunk begin end index" -- "$cur") )
return 0
;;
--color)
COMPREPLY=( $(compgen -W "dark light 16 bw no" -- "$cur") )
return 0
;;
--layout)
COMPREPLY=( $(compgen -W "default reverse reverse-list" -- "$cur") )
return 0
;;
--info)
COMPREPLY=( $(compgen -W "default right hidden inline inline-right" -- "$cur") )
return 0
;;
--preview-window)
COMPREPLY=( $(compgen -W "
default
hidden
nohidden
wrap
nowrap
cycle
nocycle
up top
down bottom
left
right
rounded border border-rounded
sharp border-sharp
border-bold
border-block
border-thinblock
border-double
noborder border-none
border-horizontal
border-vertical
border-up border-top
border-down border-bottom
border-left
border-right
follow
nofollow" -- "$cur") )
return 0
;;
--border)
COMPREPLY=( $(compgen -W "rounded sharp bold block thinblock double horizontal vertical top bottom left right none" -- "$cur") )
return 0
;;
--border-label-pos|--preview-label-pos)
COMPREPLY=( $(compgen -W "center bottom top" -- "$cur") )
return 0
;;
esac
if [[ "$cur" =~ ^-|\+ ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )
return 0
fi
return 0
}
_fzf_handle_dynamic_completion() {
local cmd orig_var orig ret orig_cmd orig_complete
cmd="$1"
shift
orig_cmd="$1"
orig_var="_fzf_orig_completion_$cmd"
orig="${!orig_var-}"
orig="${orig##*#}"
if [[ -n "$orig" ]] && type "$orig" > /dev/null 2>&1; then
$orig "$@"
elif [[ -n "${_fzf_completion_loader-}" ]]; then
orig_complete=$(complete -p "$orig_cmd" 2> /dev/null)
_completion_loader "$@"
ret=$?
# _completion_loader may not have updated completion for the command
if [[ "$(complete -p "$orig_cmd" 2> /dev/null)" != "$orig_complete" ]]; then
__fzf_orig_completion < <(complete -p "$orig_cmd" 2> /dev/null)
if [[ "${__fzf_nospace_commands-}" = *" $orig_cmd "* ]]; then
eval "${orig_complete/ -F / -o nospace -F }"
else
eval "$orig_complete"
fi
fi
return $ret
fi
}
__fzf_generic_path_completion() {
local cur base dir leftover matches trigger cmd
cmd="${COMP_WORDS[0]}"
if [[ $cmd == \\* ]]; then
cmd="${cmd:1}"
fi
cmd="${cmd//[^A-Za-z0-9_=]/_}"
COMPREPLY=()
trigger=${FZF_COMPLETION_TRIGGER-'**'}
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == *"$trigger" ]] && [[ $cur != *'$('* ]] && [[ $cur != *':='* ]] && [[ $cur != *'`'* ]]; then
base=${cur:0:${#cur}-${#trigger}}
eval "base=$base" 2> /dev/null || return
dir=
[[ $base = *"/"* ]] && dir="$base"
while true; do
if [[ -z "$dir" ]] || [[ -d "$dir" ]]; then
leftover=${base/#"$dir"}
leftover=${leftover/#\/}
[[ -z "$dir" ]] && dir='.'
[[ "$dir" != "/" ]] && dir="${dir/%\//}"
matches=$(eval "$1 $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --scheme=path --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-} $2" __fzf_comprun "$4" -q "$leftover" | while read -r item; do
printf "%q " "${item%$3}$3"
done)
matches=${matches% }
[[ -z "$3" ]] && [[ "${__fzf_nospace_commands-}" = *" ${COMP_WORDS[0]} "* ]] && matches="$matches "
if [[ -n "$matches" ]]; then
COMPREPLY=( "$matches" )
else
COMPREPLY=( "$cur" )
fi
printf '\e[5n'
return 0
fi
dir=$(command dirname "$dir")
[[ "$dir" =~ /$ ]] || dir="$dir"/
done
else
shift
shift
shift
_fzf_handle_dynamic_completion "$cmd" "$@"
fi
}
_fzf_complete() {
# Split arguments around --
local args rest str_arg i sep
args=("$@")
sep=
for i in "${!args[@]}"; do
if [[ "${args[$i]}" = -- ]]; then
sep=$i
break
fi
done
if [[ -n "$sep" ]]; then
str_arg=
rest=("${args[@]:$((sep + 1)):${#args[@]}}")
args=("${args[@]:0:$sep}")
else
str_arg=$1
args=()
shift
rest=("$@")
fi
local cur selected trigger cmd post
post="$(caller 0 | command awk '{print $2}')_post"
type -t "$post" > /dev/null 2>&1 || post='command cat'
cmd="${COMP_WORDS[0]//[^A-Za-z0-9_=]/_}"
trigger=${FZF_COMPLETION_TRIGGER-'**'}
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == *"$trigger" ]] && [[ $cur != *'$('* ]] && [[ $cur != *':='* ]] && [[ $cur != *'`'* ]]; then
cur=${cur:0:${#cur}-${#trigger}}
selected=$(FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-} $str_arg" __fzf_comprun "${rest[0]}" "${args[@]}" -q "$cur" | $post | command tr '\n' ' ')
selected=${selected% } # Strip trailing space not to repeat "-o nospace"
if [[ -n "$selected" ]]; then
COMPREPLY=("$selected")
else
COMPREPLY=("$cur")
fi
printf '\e[5n'
return 0
else
_fzf_handle_dynamic_completion "$cmd" "${rest[@]}"
fi
}
_fzf_path_completion() {
__fzf_generic_path_completion _fzf_compgen_path "-m" "" "$@"
}
# Deprecated. No file only completion.
_fzf_file_completion() {
_fzf_path_completion "$@"
}
_fzf_dir_completion() {
__fzf_generic_path_completion _fzf_compgen_dir "" "/" "$@"
}
_fzf_complete_kill() {
_fzf_proc_completion "$@"
}
_fzf_proc_completion() {
_fzf_complete -m --header-lines=1 --preview 'echo {}' --preview-window down:3:wrap --min-height 15 -- "$@" < <(
command ps -eo user,pid,ppid,start,time,command 2> /dev/null ||
command ps -eo user,pid,ppid,time,args # For BusyBox
)
}
_fzf_proc_completion_post() {
command awk '{print $2}'
}
# To use custom hostname lists, override __fzf_list_hosts.
# The function is expected to print hostnames, one per line as well as in the
# desired sorting and with any duplicates removed, to standard output.
#
# e.g.
# # Use bash-completionss _known_hosts_real() for getting the list of hosts
# __fzf_list_hosts() {
# # Set the local attribute for any non-local variable that is set by _known_hosts_real()
# local COMPREPLY=()
# _known_hosts_real ''
# printf '%s\n' "${COMPREPLY[@]}" | command sort -u --version-sort
# }
if ! declare -F __fzf_list_hosts > /dev/null; then
__fzf_list_hosts() {
command cat <(command tail -n +1 ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | command awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?%]') \
<(command grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts 2> /dev/null | command tr ',' '\n' | command tr -d '[' | command awk '{ print $1 " " $1 }') \
<(command grep -v '^\s*\(#\|$\)' /etc/hosts 2> /dev/null | command grep -Fv '0.0.0.0' | command sed 's/#.*//') |
command awk '{for (i = 2; i <= NF; i++) print $i}' | command sort -u
}
fi
_fzf_host_completion() {
_fzf_complete +m -- "$@" < <(__fzf_list_hosts)
}
# Values for $1 $2 $3 are described here
# https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html
# > the first argument ($1) is the name of the command whose arguments are being completed,
# > the second argument ($2) is the word being completed,
# > and the third argument ($3) is the word preceding the word being completed on the current command line.
_fzf_complete_ssh() {
case $3 in
-i|-F|-E)
_fzf_path_completion "$@"
;;
*)
local user=
[[ "$2" =~ '@' ]] && user="${2%%@*}@"
_fzf_complete +m -- "$@" < <(__fzf_list_hosts | command awk -v user="$user" '{print user $0}')
;;
esac
}
_fzf_var_completion() {
_fzf_complete -m -- "$@" < <(
declare -xp | command sed -En 's|^declare [^ ]+ ([^=]+).*|\1|p'
)
}
_fzf_alias_completion() {
_fzf_complete -m -- "$@" < <(
alias | command sed -En 's|^alias ([^=]+).*|\1|p'
)
}
# fzf options
complete -o default -F _fzf_opts_completion fzf
# fzf-tmux is a thin fzf wrapper that has only a few more options than fzf
# itself. As a quick improvement we take fzf's completion. Adding the few extra
# fzf-tmux specific options (like `-w WIDTH`) are left as a future patch.
complete -o default -F _fzf_opts_completion fzf-tmux
d_cmds="${FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir}"
a_cmds="
awk bat cat diff diff3
emacs emacsclient ex file ftp g++ gcc gvim head hg hx java
javac ld less more mvim nvim patch perl python ruby
sed sftp sort source tail tee uniq vi view vim wc xdg-open
basename bunzip2 bzip2 chmod chown curl cp dirname du
find git grep gunzip gzip hg jar
ln ls mv open rm rsync scp
svn tar unzip zip"
# Preserve existing completion
__fzf_orig_completion < <(complete -p $d_cmds $a_cmds ssh 2> /dev/null)
if type _completion_loader > /dev/null 2>&1; then
_fzf_completion_loader=1
fi
__fzf_defc() {
local cmd func opts orig_var orig def
cmd="$1"
func="$2"
opts="$3"
orig_var="_fzf_orig_completion_${cmd//[^A-Za-z0-9_]/_}"
orig="${!orig_var-}"
if [[ -n "$orig" ]]; then
printf -v def "$orig" "$func"
eval "$def"
else
complete -F "$func" $opts "$cmd"
fi
}
# Anything
for cmd in $a_cmds; do
__fzf_defc "$cmd" _fzf_path_completion "-o default -o bashdefault"
done
# Directory
for cmd in $d_cmds; do
__fzf_defc "$cmd" _fzf_dir_completion "-o nospace -o dirnames"
done
# ssh
__fzf_defc ssh _fzf_complete_ssh "-o default -o bashdefault"
unset cmd d_cmds a_cmds
_fzf_setup_completion() {
local kind fn cmd
kind=$1
fn=_fzf_${1}_completion
if [[ $# -lt 2 ]] || ! type -t "$fn" > /dev/null; then
echo "usage: ${FUNCNAME[0]} path|dir|var|alias|host|proc COMMANDS..."
return 1
fi
shift
__fzf_orig_completion < <(complete -p "$@" 2> /dev/null)
for cmd in "$@"; do
case "$kind" in
dir) __fzf_defc "$cmd" "$fn" "-o nospace -o dirnames" ;;
var) __fzf_defc "$cmd" "$fn" "-o default -o nospace -v" ;;
alias) __fzf_defc "$cmd" "$fn" "-a" ;;
*) __fzf_defc "$cmd" "$fn" "-o default -o bashdefault" ;;
esac
done
}
# Environment variables / Aliases / Hosts / Process
_fzf_setup_completion 'var' export unset printenv
_fzf_setup_completion 'alias' unalias
_fzf_setup_completion 'host' telnet
_fzf_setup_completion 'proc' kill
-133
View File
@@ -1,133 +0,0 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ key-bindings.bash
#
# - $FZF_TMUX_OPTS
# - $FZF_CTRL_T_COMMAND
# - $FZF_CTRL_T_OPTS
# - $FZF_CTRL_R_OPTS
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS
[[ $- =~ i ]] || return 0
# Key bindings
# ------------
__fzf_select__() {
local cmd opts
cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | command cut -b3-"}"
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse --scheme=path ${FZF_DEFAULT_OPTS-} ${FZF_CTRL_T_OPTS-} -m"
eval "$cmd" |
FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) "$@" |
while read -r item; do
printf '%q ' "$item" # escape special chars
done
}
__fzfcmd() {
[[ -n "${TMUX_PANE-}" ]] && { [[ "${FZF_TMUX:-0}" != 0 ]] || [[ -n "${FZF_TMUX_OPTS-}" ]]; } &&
echo "fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- " || echo "fzf"
}
fzf-file-widget() {
local selected="$(__fzf_select__ "$@")"
READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}$selected${READLINE_LINE:$READLINE_POINT}"
READLINE_POINT=$(( READLINE_POINT + ${#selected} ))
}
__fzf_cd__() {
local cmd opts dir
cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type d -print 2> /dev/null | command cut -b3-"}"
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse --scheme=path ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-} +m"
dir=$(set +o pipefail; eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd)) && printf 'builtin cd -- %q' "$dir"
}
if command -v perl > /dev/null; then
__fzf_history__() {
local output opts script
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort ${FZF_CTRL_R_OPTS-} +m --read0"
script='BEGIN { getc; $/ = "\n\t"; $HISTCOUNT = $ENV{last_hist} + 1 } s/^[ *]//; print $HISTCOUNT - $. . "\t$_" if !$seen{$_}++'
output=$(
set +o pipefail
builtin fc -lnr -2147483648 |
last_hist=$(HISTTIMEFORMAT='' builtin history 1) command perl -n -l0 -e "$script" |
FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) --query "$READLINE_LINE"
) || return
READLINE_LINE=${output#*$'\t'}
if [[ -z "$READLINE_POINT" ]]; then
echo "$READLINE_LINE"
else
READLINE_POINT=0x7fffffff
fi
}
else # awk - fallback for POSIX systems
__fzf_history__() {
local output opts script n x y z d
if [[ -z $__fzf_awk ]]; then
__fzf_awk=awk
# choose the faster mawk if: it's installed && build date >= 20230322 && version >= 1.3.4
IFS=' .' read n x y z d <<< $(command mawk -W version 2> /dev/null)
[[ $n == mawk ]] && (( d >= 20230302 && (x *1000 +y) *1000 +z >= 1003004 )) && __fzf_awk=mawk
fi
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort ${FZF_CTRL_R_OPTS-} +m --read0"
[[ $(HISTTIMEFORMAT='' builtin history 1) =~ [[:digit:]]+ ]] # how many history entries
script='function P(b) { ++n; sub(/^[ *]/, "", b); if (!seen[b]++) { printf "%d\t%s%c", '$((BASH_REMATCH + 1))' - n, b, 0 } }
NR==1 { b = substr($0, 2); next }
/^\t/ { P(b); b = substr($0, 2); next }
{ b = b RS $0 }
END { if (NR) P(b) }'
output=$(
set +o pipefail
builtin fc -lnr -2147483648 2> /dev/null | # ( $'\t '<lines>$'\n' )* ; <lines> ::= [^\n]* ( $'\n'<lines> )*
command $__fzf_awk "$script" | # ( <counter>$'\t'<lines>$'\000' )*
FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) --query "$READLINE_LINE"
) || return
READLINE_LINE=${output#*$'\t'}
if [[ -z "$READLINE_POINT" ]]; then
echo "$READLINE_LINE"
else
READLINE_POINT=0x7fffffff
fi
}
fi
# Required to refresh the prompt after fzf
bind -m emacs-standard '"\er": redraw-current-line'
bind -m vi-command '"\C-z": emacs-editing-mode'
bind -m vi-insert '"\C-z": emacs-editing-mode'
bind -m emacs-standard '"\C-z": vi-editing-mode'
if (( BASH_VERSINFO[0] < 4 )); then
# CTRL-T - Paste the selected file path into the command line
bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"'
bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'
# CTRL-R - Paste the selected command from history into the command line
bind -m emacs-standard '"\C-r": "\C-e \C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er"'
bind -m vi-command '"\C-r": "\C-z\C-r\C-z"'
bind -m vi-insert '"\C-r": "\C-z\C-r\C-z"'
else
# CTRL-T - Paste the selected file path into the command line
bind -m emacs-standard -x '"\C-t": fzf-file-widget'
bind -m vi-command -x '"\C-t": fzf-file-widget'
bind -m vi-insert -x '"\C-t": fzf-file-widget'
# CTRL-R - Paste the selected command from history into the command line
bind -m emacs-standard -x '"\C-r": __fzf_history__'
bind -m vi-command -x '"\C-r": __fzf_history__'
bind -m vi-insert -x '"\C-r": __fzf_history__'
fi
# ALT-C - cd into the selected directory
bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
bind -m vi-command '"\ec": "\C-z\ec\C-z"'
bind -m vi-insert '"\ec": "\C-z\ec\C-z"'
Executable → Regular
+9 -22
View File
@@ -1,33 +1,20 @@
#!/bin/bash
# Run script and build GCC versions
# ./unix_gcc_build.sh 13.2.0 12.3.0 11.4.0 10.4.0 9.5.0 8.5.0 7.5.0 6.5.0
# Extract and install the build using
# tar --use-compress-program=zstd -xf gcc-mostlyportable-13.2.0.tar.zst -C ~/Dev/Linux/GCC
for gcc_version in "$@"
do
image_name=mostlyportable-gcc-image
container_name=mostlyportable-gcc
tar_file=gcc-mostlyportable-${gcc_version}.tar
archive_file=${tar_file}.zst
if [ ! -e "${archive_file}" ]; then
docker build -t ${image_name} --build-arg GCC_VERSION=${gcc_version} -f unix_gcc_dockerfile . || exit
docker container rm ${container_name} > /dev/null 2>&1
docker create --name ${container_name} ${image_name} || exit
docker build -t ${image_name} --build-arg GCC_VERSION=${gcc_version} . || exit
docker container rm ${container_name} > /dev/null 2>&1
docker create --name ${container_name} ${image_name} || exit
docker cp ${container_name}:/usr/local/docker/mostlyportable-gcc/mostly-built/gcc-mostlyportable-${gcc_version} . || exit
docker container rm ${container_name} || exit
mkdir --parent build || exit
docker cp ${container_name}:/usr/local/docker/mostlyportable-gcc/mostly-built/gcc-mostlyportable-${gcc_version} . || exit
mv --force gcc-mostlyportable-${gcc_version} ${gcc_version} || exit
tar cf ${tar_file} -p ${gcc_version} || exit
zstd --rm ${tar_file} || exit
rm -rf ./${gcc_version} || exit
fi
docker container rm ${container_name} || exit
done
# if [[ $EUID == 0 ]]; then
# chown --recursive ${USER} gcc-mostlyportable-*
# fi
if [[ $EUID == 0 ]]; then
chown --recursive ${USER} gcc-mostlyportable-*
fi
+2 -4
View File
@@ -17,8 +17,6 @@ RUN set -ex \
libgmp-dev \
libz-dev \
m4 \
file \
bison \
schedtool \
texinfo \
texlive \
@@ -32,8 +30,8 @@ RUN set -ex \
&& cd mostlyportable-gcc \
&& git checkout $MOSTLY_PORTABLE_GIT_BRANCH
ARG GCC_VERSION=13.2.0
ARG BIN_UTILS_VERSION=2.41
ARG GCC_VERSION=11.3.0
ARG BIN_UTILS_VERSION=2.38
RUN set -ex \
&& cd mostlyportable-gcc \
&& sed --in-place "s/^_use_gcc_git=\".*\"$/_use_gcc_git=\"false\"/" mostlyportable-gcc.cfg \
-119
View File
@@ -1,119 +0,0 @@
@echo off
:: Setup :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal enabledelayedexpansion
set script_path=%~dpnx0
set script_dir_backslash=%~dp0
set script_dir=%script_dir_backslash:~0,-1%
set root_dir=%devenver_root%
:: Arguments :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set clang_dir=%root_dir%\LLVM
set cmake_dir=%root_dir%\CMake
set msvc_dir=%root_dir%\msvc
set msvc_vc_dir=%msvc_dir%\msvc_host_x64_target_x64
set msvc_sdk_dir=%msvc_dir%\sdk_host_x64_target_x64
set node_dir=%root_dir%\NodeJS
set raddbg_dir=%root_dir%\raddbg\trunk
set raddbg_args=--user:%raddbg_dir%\..\doylet.raddbg_user
set raddbg_exe=raddbg.exe
set radlink_dir=%root_dir%\raddbg\trunk
set radlink_exe=radlink.exe
set rad_update_dir=%radlink_dir%\..
set rad_update_exe=update_trunk.bat
set remedybg_dir=%root_dir%\RemedyBG
set remedybg_exe=remedybg.exe
set virustotal_url=https://www.virustotal.com/gui/file
set rust_dir=%userprofile%\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin
:: Argument parsing ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Remove the first argument which is the command (e.g. raddbg or radlink)
set option=%1
shift
if "%option%"=="clang" set "exe_dir=%clang_dir%\%1\bin" && set path=%exe_dir%;%path% && set cmd_line=!exe_dir!\%2 && shift && shift
if "%option%"=="cmake" set "exe_dir=%cmake_dir%\%1" && set path=%exe_dir%;%path% && set cmd_line=!exe_dir!\%2 && shift && shift
if "%option%"=="node" set "exe_dir=%node_dir%\%1" && set path=%exe_dir%;%path% && set cmd_line=!exe_dir!\%2 && shift && shift
if "%option%"=="msvc" endlocal && call %msvc_vc_dir%\%1\devcmd.bat && call %msvc_sdk_dir%\%2\devcmd.bat && goto :eof
if "%option%"=="rad_update" set "exe_dir=%rad_update_dir%" && set path=%rad_update_dir%;%path% && set cmd_line=!exe_dir!\update_trunk.bat
if "%option%"=="raddbg" set "exe_dir=%raddbg_dir%" && set path=%exe_dir%;%path% && set cmd_line=start /B !exe_dir!\%raddbg_exe% %raddbg_args%
if "%option%"=="raddbg_env" endlocal && set path=%raddbg_dir%;%path% && goto :eof
if "%option%"=="radlink" set "exe_dir=%radlink_dir%" && set path=%exe_dir%;%path% && set cmd_line=!exe_dir!\%radlink_exe%
if "%option%"=="radlink_env" endlocal && set path=%radlink_dir%;%path% && goto :eof
if "%option%"=="rust_env" endlocal && set path=%rsut_dir%;%path% && goto :eof
if "%option%"=="remedybg" set "exe_dir=%remedybg_dir%\%1" && set path=%exe_dir%;%path% && set cmd_line=start /B !exe_dir!\%remedybg_exe% && shift
if "%option%"=="virustotal" for /f "delims=" %%a in ('powershell -Command "(Get-FileHash \"%1\" -Algorithm SHA256).Hash"') do set virustotal_hash=%%a && shift
if "%option%"=="virustotal" set cmd_line=start /B %virustotal_url%/%virustotal_hash%
if "%cmd_line%"=="" set option=help
if "%option%"=="help" (
for /f "delims=" %%a in ('dir /B %clang_dir%') do set "clang_versions=%%a !clang_versions!"
for /f "delims=" %%a in ('dir /B %cmake_dir%') do set "cmake_versions=%%a !cmake_versions!"
for /f "delims=" %%a in ('dir /B %remedybg_dir%') do set "remedybg_versions=%%a !remedybg_versions!"
for /f "delims=" %%a in ('dir /B %node_dir%') do set "node_versions=%%a !node_versions!"
for /f "delims=" %%a in ('dir /B %msvc_vc_dir%') do set "msvc_vc_versions=%%a !msvc_vc_versions!"
for /f "delims=" %%a in ('dir /B %msvc_sdk_dir%') do set "msvc_sdk_versions=%%a !msvc_sdk_versions!"
echo USAGE: dev [option] [args...]
echo.
echo NOTES:
echo Commands augment the system path with the path to the tool for the current shell session.
echo.
echo OPTIONS:
echo cmake [version] [exe] CMake build system: 'set PATH=%cmake_dir%\[version]\[exe];%%PATH%% %cmake_args%'
echo Versions: !cmake_versions!
echo.
echo clang [version] [exe] CLANG compiler: 'set PATH=%clang_dir%\[version]\[exe];%%PATH%% %clang_args%'
echo Example: 'dev clang 18.1.4 clang++.exe --help'
echo Versions: !clang_versions!
echo.
echo msvc [vc_version] [sdk_version] MSVC build tools: '%msvc_vc_dir%\[vc_version]'
echo '%msvc_sdk_dir%\[sdk_version]'
echo VC Versions: !msvc_vc_versions!
echo SDK Versions: !msvc_sdk_versions!
echo.
echo node [version] [exe] Node JS: '%node_dir%\[version]\[exe]'
echo Versions: !node_versions!
echo.
echo raddbg RAD debugger: '%raddbg_dir%\%raddbg_exe% %raddbg_args%'
echo raddbg_env Add RAD debugger to PATH env: 'set PATH=%raddbg_dir%;%%PATH%%'
echo radlink RAD linker: '%radlink_dir%\%radlink_exe%'
echo radlink_env Add RAD linker to PATH env: 'set PATH=%radlink_dir%;%%PATH%%'
echo rad_update Update the RAD linker and debugger: '%rad_update_dir%\%rad_update_exe%'
echo.
echo remedybg [version] C/C++ debugger: '%remedybg_dir%\%remedybg_exe%'
echo Versions: !remedybg_versions!
echo.
if exist "!rust_dir!\cargo.exe" (
echo rust_env Add Rust to PATH env: 'set PATH=!rust_dir!;%%PATH%%'
echo.
)
echo virustotal [file] Lookup file SHA256 hash on VirusTotal: '%virustotal_url%/[file]'
goto :eof
)
:: Extract user arguments ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:extract_args
if "%~1" neq "" (
set user_args=%user_args% %1
shift
goto :extract_args
)
:trim_user_args_trailing_space
if "!user_args:~-1!"==" " (
set user_args=!user_args:~0,-1!
goto trim_user_args_trailing_space
)
:trim_cmd_line_trailing_space
if "!cmd_line:~-1!"==" " (
set cmd_line=!cmd_line:~0,-1!
goto trim_cmd_line_trailing_space
)
:: Eval ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo DEV: Running "%script_path%" with "%cmd_line%%user_args%"
call %cmd_line%%user_args%
goto :eof
@@ -0,0 +1,14 @@
@echo off
start /B https://brave.com
start /B https://desktop.telegram.org
start /B https://ledger.com/ledger-live
start /B https://getsession.org/windows
start /B https://github.com/kapitainsky/RcloneBrowser/releases
start /B https://mozilla.org/en-US/firefox/new
start /B https://obsidian.md/download
start /B https://protonvpn.com/download
start /B https://signal.org/download
start /B https://safing.io
start /B https://spotify.com/us/download
start /B https://discord.com/download
start /B https://www.gpsoft.com.au/dscripts/download.asp
+12
View File
@@ -0,0 +1,12 @@
@echo off
setlocal
set desired_path=%devenver_root%\..\..\Cryptomator\Dev\Win\RemedyBG\0_3_9_4
set desired_exe=remedybg.exe
set path=%desired_path%;%path%
set exe_to_use=""
for /f "delims=" %%a in ('where "$desired_path:%desired_exe%"') do ( set "exe_to_use=%%a")
echo [DEVENVER] Executing script "%~dpnx0" with "%exe_to_use%"
start /B %desired_exe% %*
endlocal
+12
View File
@@ -0,0 +1,12 @@
@echo off
setlocal
set desired_path=%devenver_root%\NodeJS\16.19.0
set desired_exe=yarn
set path=%desired_path%;%path%
set exe_to_use=""
for /f "delims=" %%a in ('where "$desired_path:%desired_exe%"') do ( set "exe_to_use=%%a")
echo [DEVENVER] Executing script "%~dpnx0" with "%exe_to_use%"
call %desired_exe% %*
endlocal
+145 -293
View File
@@ -3,7 +3,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "20240203-110809-5046fc22"
version = "20221119-145034-49b9839f"
download_url = ""
exe_name = ""
download_checksum = ""
@@ -13,12 +13,12 @@ def get_manifest(is_windows):
if is_windows:
exe_path = f"wezterm-gui.exe"
download_url = f"https://github.com/wez/wezterm/releases/download/{version}/WezTerm-windows-{version}.zip"
download_checksum = "57e5d03b585303d81e8b8e96d1230362852eb39aca92b3b29c7a42cfb82f9ac4"
checksum = "9491ca934f32d008329ae084e88305975b16a89f830af7df5750a6186b59f4ce"
download_checksum = "7041d2c02d226c0c051cc9f6373d51ac9a2de00025e18582077c76e8ad68abe1"
checksum = "e3faa247d69a8a966302a2ab4e655b08b79548707db79a7b724cf18cccf5ae35"
else:
exe_path = f"WezTerm-{version}-Ubuntu20.04.AppImage"
exe_path = f"WezTerm-{version}-Ubuntu18.04.AppImage"
download_url = f"https://github.com/wez/wezterm/releases/download/{version}/{exe_path}"
download_checksum = "34010a07076d2272c4d4f94b5e0dae608a679599e8d729446323f88f956c60f0"
download_checksum = "1611b4d5ba2598587874b3ff51dc0849e7ece7f2e0a0d376e13fbd00f9ae2807"
checksum = download_checksum
result.append({
@@ -79,36 +79,6 @@ def get_manifest(is_windows):
checksum = ""
symlink = []
version = "4.2.4"
if is_windows:
exe_path = f"bin/cmake.exe"
download_url = f"https://github.com/Kitware/CMake/releases/download/v{version}/cmake-{version}-windows-x86_64.zip"
download_checksum = "d0fe635f3ddc748485ab1a144a28553cae31ae598a3c22a1de3c31db31251287"
checksum = "89e096daabce5459bcb0fbebd77b19f6a73f6c499725cf3590e06ec25d71e86f"
symlink = [f"cmake-{version}.exe"]
else:
exe_path = f"bin/cmake"
download_url = f"https://github.com/Kitware/CMake/releases/download/v{version}/cmake-{version}-linux-x86_64.tar.gz"
download_checksum = "2fc22f96b1e79487d258eaaf565aacb808d1ec99ec64168ebd795dff9dcaeb1d"
checksum = "945225d98d1d3e5aa731a9321cb7a1b90ca992e737406373bf976cfba80cd8df"
symlink = [f"cmake-{version}"]
result[-1]['manifests'].append({
"download_checksum": download_checksum,
"download_url": download_url,
"version": version,
"executables": [
{
"path": exe_path,
"symlink": symlink,
"add_to_devenv_path": True,
"checksum": checksum,
}
],
"add_to_devenv_script": [],
})
version = "3.26.4"
if is_windows:
exe_path = f"bin/cmake.exe"
@@ -131,7 +101,7 @@ def get_manifest(is_windows):
{
"path": exe_path,
"symlink": symlink,
"add_to_devenv_path": False,
"add_to_devenv_path": True,
"checksum": checksum,
}
],
@@ -271,12 +241,12 @@ def get_manifest(is_windows):
if is_windows:
label = "Git"
version = "2.50.1"
version = "2.39.1"
result.append({
"label": f"{label}",
"manifests": [
{
"download_checksum": "c45a7dfa2bde34059f6dbd85f49a95d73d5aea29305f51b79595e56e4f323a3d",
"download_checksum": "b898306a44084b5fa13b9a52e06408d97234389d07ae41d9409bdf58cad3d227",
"download_url": f"https://github.com/git-for-windows/git/releases/download/v{version}.windows.1/PortableGit-{version}-64-bit.7z.exe",
"version": version,
"unzip_method": '7zip',
@@ -285,7 +255,7 @@ def get_manifest(is_windows):
"path": "cmd/git.exe",
"symlink": [],
"add_to_devenv_path": True,
"checksum": "c954fcc8e65a38450895ca65d308ecaee63f044d16494b5385faa5e036a3facb",
"checksum": "2fc6d5be237efb6b429d8f40975f1a1cfe3bcac863d9335e24096c8b0ec38105",
}
],
"add_to_devenv_script": [
@@ -545,53 +515,6 @@ def get_manifest(is_windows):
executables = []
unzip_method = "default"
version = "19.1.7"
if is_windows:
download_url = f"https://github.com/llvm/llvm-project/releases/download/llvmorg-{version}/LLVM-{version}-win64.exe"
download_checksum = "f19ae5bc4823ac69ec01dc2ded503ec80a04ad2208dda1595d1f0413c148ef90"
unzip_method = '7zip'
executables = [
{
"path": f"bin/clang++.exe",
"checksum": "56ef1abd0df11a3b1b77822193e927c6345078c24511567ae10b3afd803d03a3",
"symlink": [f"clang++-{version}.exe"],
"add_to_devenv_path": True,
},
{
"path": f"bin/clang.exe",
"checksum": "56ef1abd0df11a3b1b77822193e927c6345078c24511567ae10b3afd803d03a3",
"symlink": [f"clang-{version}.exe"],
"add_to_devenv_path": True,
}
]
else:
download_url = f"https://github.com/llvm/llvm-project/releases/download/llvmorg-{version}/LLVM-{version}-Linux-X64.tar.xz"
download_checksum = "4a5ec53951a584ed36f80240f6fbf8fdd46b4cf6c7ee87cc2d5018dc37caf679"
executables = [
{
"path": f"bin/clang++",
"checksum": "c57e2928bc629e58da157867bb9af550edfc1195e7b003edfcfecd57faf2b71b",
"symlink": [f"clang++-{version}"],
"add_to_devenv_path": True,
},
{
"path": f"bin/clang",
"checksum": "c57e2928bc629e58da157867bb9af550edfc1195e7b003edfcfecd57faf2b71b",
"symlink": [f"clang-{version}"],
"add_to_devenv_path": True,
}
]
result[-1]['manifests'].append({
"download_checksum": download_checksum,
"download_url": download_url,
"version": version,
"unzip_method": unzip_method,
"executables": executables,
"add_to_devenv_script": [],
})
if is_windows:
version = "15.0.7"
download_url = f"https://github.com/llvm/llvm-project/releases/download/llvmorg-{version}/LLVM-{version}-win64.exe"
@@ -602,13 +525,13 @@ def get_manifest(is_windows):
"path": f"bin/clang++.exe",
"checksum": "1f523e33de4ce9d591b4eb9bad102f086e8480488148f8db0d5c87056798ce3e",
"symlink": [f"clang++-{version}.exe"],
"add_to_devenv_path": False,
"add_to_devenv_path": True,
},
{
"path": f"bin/clang.exe",
"checksum": "1f523e33de4ce9d591b4eb9bad102f086e8480488148f8db0d5c87056798ce3e",
"symlink": [f"clang-{version}.exe"],
"add_to_devenv_path": False,
"add_to_devenv_path": True,
}
]
else:
@@ -620,13 +543,13 @@ def get_manifest(is_windows):
"path": f"bin/clang++",
"checksum": "388be41dc565a891ced9e78da2e89a249ca9b9a26f71a3c912e8ba89585be89c",
"symlink": [f"clang++-{version}"],
"add_to_devenv_path": False,
"add_to_devenv_path": True,
},
{
"path": f"bin/clang",
"checksum": "388be41dc565a891ced9e78da2e89a249ca9b9a26f71a3c912e8ba89585be89c",
"symlink": [f"clang-{version}"],
"add_to_devenv_path": False,
"add_to_devenv_path": True,
}
]
@@ -822,7 +745,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "1.31.1"
version = "1.11.1"
download_url = ""
download_checksum = ""
exe_path = ""
@@ -863,7 +786,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
label = "NodeJS"
version = "24.12.0"
version = "16.19.0"
download_url = ""
download_checksum = ""
exe_path = ""
@@ -873,14 +796,16 @@ def get_manifest(is_windows):
if is_windows:
download_url = f"https://nodejs.org/dist/v{version}/node-v{version}-win-x64.7z"
download_checksum = "8d41356abf5cb62404f311f131b7937f45aaeda5c15d060dc281c2ece817cdce"
checksum = "2ffe3acc0458fdde999f50d11809bbe7c9b7ef204dcf17094e325d26ace101d8"
download_checksum = "e07399a4a441091ca0a5506faf7a9236ea1675220146daeea3bee828c2cbda3f"
checksum = "e4e7f389fbec9300275defc749246c62bdbe4f66406eb01e7c9a4101e07352da"
exe_path = "node.exe"
symlink = [f"node-{version}.exe"]
else:
download_url = f"https://nodejs.org/dist/v{version}/node-v{version}-linux-x64.tar.xz"
download_checksum = "bdebee276e58d0ef5448f3d5ac12c67daa963dd5e0a9bb621a53d1cefbc852fd"
checksum = "16143bdaa79716e871d3d9b2f50ce680bca293eba7f0c3fc1d004ed2258fc839"
download_checksum = "c88b52497ab38a3ddf526e5b46a41270320409109c3f74171b241132984fd08f"
checksum = "45afcfc9a45df626e8aa2b883753d1cf7f222ad9243f3003d1aa372696120df6"
exe_path = "bin/node"
symlink = [f"node-{version}"]
result.append({
"label": "NodeJS",
@@ -903,35 +828,24 @@ def get_manifest(is_windows):
],
})
# --------------------------------------------------------------------------
label = "Python"
date = "20250409"
version = f"3.11.12+{date}"
download_url = ""
download_checksum = ""
exe_path = ""
checksum = ""
add_to_devenv_script = []
version = "18.15.0"
if is_windows:
download_url = f"https://github.com/indygreg/python-build-standalone/releases/download/{date}/cpython-{version}-x86_64-pc-windows-msvc-pgo-full.tar.zst"
download_checksum = "2d143dc2c9d5a3bcc9d1e9d4cbae8da1221c94fcc5ac8b73d44c48b878d0d24b"
checksum = "5c1a45180ac4de79f8288afacc6f5021e84659a598f810c07d1e1f62d8d32ab1"
exe_path = "install/python.exe"
download_url = f"https://nodejs.org/dist/v{version}/node-v{version}-win-x64.7z"
download_checksum = "cad3cc0910dc216e8b6dcfc3c5b3be0a619c2d4a4b29f2e674820b70e4f374dd"
checksum = "17fd75d8a41bf9b4c475143e19ff2808afa7a92f7502ede731537d9da674d5e8"
symlink = [f"node-{version}.exe"]
add_to_devenv_script = [
f"set PYTHONHOME=%~dp0{label}\\{version}\\install",
f"set PATH=%~dp0{label}\\{version}\\install\\Scripts;%PATH%",
f"set PATH=%~dp0{label}\\{version}\\node_modules\\corepack\\shims;%PATH%",
]
else:
download_url = f"https://github.com/indygreg/python-build-standalone/releases/download/{date}/cpython-{version}-x86_64_v2-unknown-linux-gnu-pgo+lto-full.tar.zst"
download_checksum = "68a3c1c39e9c69c2c89104eef725024cbf5f46acf955eeb28045c7c80814b124"
checksum = "3d1e6c5de538edcea5237cc2b239306dd8767fda942059888c554dc2baf58efb"
exe_path = "install/bin/python3"
download_url = f"https://nodejs.org/dist/v{version}/node-v{version}-linux-x64.tar.xz"
download_checksum = "c8c5fa53ce0c0f248e45983e86368e0b1daf84b77e88b310f769c3cfc12682ef"
checksum = "a2a40807f57c1c215ddb996e71e4f30b93e375cab2bfb725287b8a1f51fd1e7a"
symlink = [f"node-{version}"]
# TODO: Get ZST somehow on linux
result.append({
"label": label,
"label": "NodeJS",
"manifests": [
{
"download_checksum": download_checksum,
@@ -941,7 +855,7 @@ def get_manifest(is_windows):
"executables": [
{
"path": exe_path,
"symlink": [],
"symlink": symlink,
"add_to_devenv_path": True,
"checksum": checksum,
}
@@ -953,6 +867,55 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
label = "Python"
date = "20230116"
version = f"3.10.9+{date}"
download_url = ""
download_checksum = ""
exe_path = ""
checksum = ""
add_to_devenv_script = []
if is_windows:
download_url = f"https://github.com/indygreg/python-build-standalone/releases/download/{date}/cpython-{version}-x86_64-pc-windows-msvc-shared-pgo-full.tar.zst"
download_checksum = "4cfa6299a78a3959102c461d126e4869616f0a49c60b44220c000fc9aecddd78"
checksum = "6dafb845aba67aba898f5aa8adf6c48061e7ffea1d2ed7d290a1e4386e78f2f0"
exe_path = "install/python.exe"
add_to_devenv_script = [
f"set PYTHONHOME=%~dp0{label}\\{version}\\install",
f"set PATH=%~dp0{label}\\{version}\\install\\Script;%PATH%",
]
else:
download_url = f"https://github.com/indygreg/python-build-standalone/releases/download/{date}/cpython-{version}-x86_64_v2-unknown-linux-gnu-pgo+lto-full.tar.zst"
download_checksum = "49f4a8c02efff2debbb258973b1f6efbd568e4be2e5dca07c7dcd754a7bff9cf"
checksum = "none"
exe_path = "bin/python"
# TODO: Get ZST somehow on linux
if is_windows:
result.append({
"label": label,
"manifests": [
{
"download_checksum": download_checksum,
"download_url": download_url,
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": exe_path,
"symlink": [],
"add_to_devenv_path": True,
"checksum": checksum,
}
],
"add_to_devenv_script": add_to_devenv_script,
}
],
})
# --------------------------------------------------------------------------
version = "1.24"
download_url = ""
download_checksum = ""
@@ -994,13 +957,13 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
if is_windows:
version = "0.7.2"
version = "0.6.1"
result.append({
"label": "Zeal",
"manifests": [
{
"download_url": f"https://github.com/zealdocs/zeal/releases/download/v{version}/zeal-{version}-portable-windows-x64.7z",
"download_checksum": "15d2d1417678a8a035cac58385d540949f8ffc63bceb3379d471a02509e10c32",
"download_url": f"https://github.com/zealdocs/zeal/releases/download/v{version}/zeal-portable-{version}-windows-x64.7z",
"download_checksum": "08e9992f620ba0a5ea348471d8ac9c85059e95eedd950118928be639746e3f94",
"version": version,
"unzip_method": 'default',
"executables": [
@@ -1008,7 +971,7 @@ def get_manifest(is_windows):
"path": "zeal.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "6b266a38290aa5a2fa4f1dce6af874fb46208263c1216d425a7c48eef20e6e70",
"checksum": "d1e687a33e117b6319210f40e2401b4a68ffeb0f33ef82f5fb6a31ce4514a423",
}
],
"add_to_devenv_script": [],
@@ -1018,7 +981,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "0.14.1"
version = "0.10.1"
download_url = ""
download_checksum = ""
exe_path = ""
@@ -1026,15 +989,15 @@ def get_manifest(is_windows):
symlink = []
if is_windows:
download_url = f"https://ziglang.org/download/{version}/zig-x86_64-windows-{version}.zip"
download_checksum = "554f5378228923ffd558eac35e21af020c73789d87afeabf4bfd16f2e6feed2c"
checksum = "1ddf230367e07738c4a769eae66c1db7469e37bd520e81c86356453d0db2b9fd"
download_url = f"https://ziglang.org/download/{version}/zig-windows-x86_64-{version}.zip"
download_checksum = "5768004e5e274c7969c3892e891596e51c5df2b422d798865471e05049988125"
checksum = "607c9928a24f9d2e08df1ee240ebfd15ab1eb3c14b85e02f7dad6f8c8b53fea8"
exe_path = "zig.exe"
symlink = [f"zig-{version}.exe"]
else:
download_url = f"https://ziglang.org/download/{version}/zig-x86_64-linux-{version}.tar.xz"
download_checksum = "24aeeec8af16c381934a6cd7d95c807a8cb2cf7df9fa40d359aa884195c4716c"
checksum = "9df4f1d2eaa7c6ee7649d0e13853ad40deed5d94e643e9ff2a2bab52ffd9feee"
download_url = f"https://ziglang.org/download/{version}/zig-linux-x86_64-{version}.tar.xz"
download_checksum = "6699f0e7293081b42428f32c9d9c983854094bd15fee5489f12c4cf4518cc380"
checksum = "b298cd869e11709b9c7a1313315b5ea2a9d8a0718f555c6990ee209d7c533442"
exe_path = "zig"
symlink = [f"zig-{version}"]
@@ -1062,14 +1025,14 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
if is_windows:
version = "1.7.21"
git_hash = "9f5af8"
version = "1.4.13"
git_hash = "0066c6"
result.append({
"label": "Clink",
"manifests": [
{
"download_url": f"https://github.com/chrisant996/clink/releases/download/v{version}/clink.{version}.{git_hash}.zip",
"download_checksum": "66af7379f77fa443374d105e7525f6f27eee48c8f53266e81227afc0f26e60d9",
"download_checksum": "800f7657d73a00dad40d46c9317bd418172ee40cc8b3958e32fba1f0b596e829",
"version": version,
"unzip_method": 'default',
"executables": [
@@ -1077,7 +1040,7 @@ def get_manifest(is_windows):
"path": "clink_x64.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "63b78394d4e6aa8c4c44a23dcb8f94fdff308581cab245bec91379ff2d8e0490",
"checksum": "331266334f59f2c978ff8e13bbcadb218051e790b61d9cc69e85617276c51298",
}
],
"add_to_devenv_script": [],
@@ -1112,7 +1075,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "0.64.0"
version = "0.37.0"
download_url = ""
download_checksum = ""
exe_path = ""
@@ -1120,15 +1083,15 @@ def get_manifest(is_windows):
symlink = []
if is_windows:
download_url = f"https://github.com/junegunn/fzf/releases/download/v{version}/fzf-{version}-windows_amd64.zip"
download_checksum = "b94fea89d118ffb7f91eb48db05fb4deea689aab7f8ef52c9c10fdc4489adbed"
checksum = "1644ee2bc7981b2e83d77cc13ff0838c848ba46277cf508ead4c7d72d3cf8107"
download_url = f"https://github.com/junegunn/fzf/releases/download/{version}/fzf-{version}-windows_amd64.zip"
download_checksum = "247bffe84ff3294a8c0a7bb96329d5e4152d3d034e13dec59dcc97d8a828000d"
checksum = "c0f4b20d0602977ff3e592cac8eadf86473abed0d24e2def81239bd2e76047e8"
exe_path = "fzf.exe"
symlink = [f"fzf.exe"]
else:
download_url = f"https://github.com/junegunn/fzf/releases/download/v{version}/fzf-{version}-linux_amd64.tar.gz"
download_checksum = "e61bdbb4356ee243d2247c2e0bf990b23eb8b8346557d0f496898c61bc835880"
checksum = "188dd25460aae4d7e02bd0653b270963a3886dfc531710f70251db21710bac08"
download_url = f"https://github.com/junegunn/fzf/releases/download/{version}/fzf-{version}-linux_amd64.tar.gz"
download_checksum = "ffa3220089f2ed6ddbef2d54795e49f46467acfadd4ad0d22c5f07c52dc0d4ab"
checksum = "6475c41e56d949da753782fef56017657b77846f23e71fca88378e3f55c1d6d0"
exe_path = "fzf"
symlink = [f"fzf"]
@@ -1155,7 +1118,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "0.12.1"
version = "0.9.1"
download_url = ""
download_checksum = ""
exe_path = ""
@@ -1164,13 +1127,13 @@ def get_manifest(is_windows):
if is_windows:
download_url = f"https://github.com/neovim/neovim/releases/download/v{version}/nvim-win64.zip"
download_checksum = "75fedc530b3772ca9f177edc7db92560bb9d2d6700ac6d5b2c53eaf5a9317ae3"
checksum = "10ea3c95e5638e88c232fde281043cbd3482f6b4a9fe100d31e6d42f614b4bc1"
download_checksum = "af41890b8c14d4ed214a2ef6c1ab8e0be004eac7094d5df1cc4bc17ccf0a13ef"
checksum = "53d68005bbbf974fe89bf74f14d926d27a7ac29d008c9a5182da82a8b9817719"
exe_path = "bin/nvim.exe"
else:
exe_path = "nvim-linux-x86_64.appimage"
download_url = f"https://github.com/neovim/neovim/releases/download/v{version}/{exe_path}"
download_checksum = "022e6e7eb79939813fa895ad39aa7dcaa10bb9c20ed234d5752fe12845df27db"
exe_path = "nvim.appimage"
download_url = f"https://github.com/neovim/neovim/releases/download/v{version}/nvim.appimage"
download_checksum = "262892176e21da0902c4f0b1e027d54d21b4bcae6b0397afccd8a81b476c3055"
checksum = download_checksum
symlink = ["nvim", "vim"] # Usually use VM with no desktop-environment
@@ -1197,7 +1160,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "0.16.2"
version = "0.11.0"
download_url = ""
download_checksum = ""
exe_path = ""
@@ -1205,13 +1168,13 @@ def get_manifest(is_windows):
if is_windows:
download_url = f"https://github.com/neovide/neovide/releases/download/{version}/neovide.exe.zip"
download_checksum = "d1e071d8bf676a500988820b852843e811fc8355396ce72e8f4c7ed2c744e2e2"
checksum = "b6b20dfc2d4fd7eb584fee46c7f6d4fd64c1ffaa2fcbf668f51e2d1a35d06f6a"
download_checksum = "68c431b4f97e56bc27d937e29a46fb7a677f18645635944c5cef2a7c9b013b45"
checksum = "dc48fc61c65e74ca16e389ac35c524650c3a949e695f91ae4cb9e8b813b07384"
exe_path = "neovide.exe"
else:
download_url = f"https://github.com/neovide/neovide/releases/download/{version}/neovide.AppImage"
download_checksum = "ef617c743d7425267ac3ae2f1761ac8fc801683bd3e013758eb68247a53c6812"
checksum = download_checksum
download_checksum = "9eb3afd5c6abc84cf200219ff494f2a49c5ed0d0366fd510b4aa91d7412a8a50"
checksum = "9eb3afd5c6abc84cf200219ff494f2a49c5ed0d0366fd510b4aa91d7412a8a50"
exe_path = "neovide.AppImage"
result.append({
@@ -1237,21 +1200,21 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "1.37.4"
version = "1.26.2"
download_url = ""
download_checksum = ""
exe_path = ""
checksum = ""
if is_windows:
download_url = f"https://github.com/WerWolv/ImHex/releases/download/v{version}/imhex-{version}-Windows-Portable-x86_64.zip"
download_checksum = "6e9ba9b8671e5b12cb083b65688eca38b5d0ddc03b7970c2da12419cd3194800"
checksum = "d78481860d1e63c02a46066d3d6fa4efd799291667098842c2e5e3e25a2ff789"
download_url = f"https://github.com/WerWolv/ImHex/releases/download/v{version}/imhex-{version}-Windows-Portable.zip"
download_checksum = "4f58097c3ccee88d8dff0d48da0f239af8a9d444903cc19a3369f63caa8d77e6"
checksum = "ddd448c0d8fe71295bbcc5b52c9e9f4b06956a79572b7d634436a49728f5f341"
exe_path = "imhex.exe"
else:
exe_path = f"imhex-{version}-x86_64.AppImage"
exe_path = f"imhex-{version}.AppImage"
download_url = f"https://github.com/WerWolv/ImHex/releases/download/v{version}/{exe_path}"
download_checksum = "3e4ae8003555e190e97c08a2142e3f10003697746b20df199da7c24c0fbd34bf"
download_checksum = "229d7f2f36dca0d4aa2eeb4f637114ffa94db7d67db74b34ed7eda34d72e4bed"
checksum = download_checksum
result.append({
@@ -1277,7 +1240,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "14.1.1"
version = "13.0.0"
download_url = ""
download_checksum = ""
exe_path = ""
@@ -1285,13 +1248,13 @@ def get_manifest(is_windows):
if is_windows:
download_url = f"https://github.com/BurntSushi/ripgrep/releases/download/{version}/ripgrep-{version}-x86_64-pc-windows-msvc.zip"
download_checksum = "d0f534024c42afd6cb4d38907c25cd2b249b79bbe6cc1dbee8e3e37c2b6e25a1"
checksum = "f162b54de2adfc72d78adb1dbada2dedda111ae0a5e2f6e9500f4f909664c5d2"
download_checksum = "a47ace6f654c5ffa236792fc3ee3fefd9c7e88e026928b44da801acb72124aa8"
checksum = "ab5595a4f7a6b918cece0e7e22ebc883ead6163948571419a1dd5cd3c7f37972"
exe_path = "rg.exe"
else:
download_url = f"https://github.com/BurntSushi/ripgrep/releases/download/{version}/ripgrep-{version}-x86_64-unknown-linux-musl.tar.gz"
download_checksum = "4cf9f2741e6c465ffdb7c26f38056a59e2a2544b51f7cc128ef28337eeae4d8e"
checksum = "f401154e2393f9002ac77e419f9ee5521c18f4f8cd3e32293972f493ba06fce7"
download_checksum = "ee4e0751ab108b6da4f47c52da187d5177dc371f0f512a7caaec5434e711c091"
checksum = "4ef156371199b3ddac1bf584e0e52b1828279af82e4ea864b4d9c816adb5db40"
exe_path = "rg"
result.append({
@@ -1315,53 +1278,35 @@ def get_manifest(is_windows):
],
})
# -------------------------------------------------------------------------
# --------------------------------------------------------------------------
version = "10.2.0"
version = "8.7.0"
download_url = ""
download_checksum = ""
exe_path = ""
checksum = ""
add_to_devenv_script = []
fd_args='''fd \
--type file \
--no-ignore-vcs \
--strip-cwd-prefix \
--hidden \
--follow \
--exclude .git \
--exclude .cache \
--exclude .vs \
--exclude "*.dll" \
--exclude "*.exe" \
--exclude "*.lib" \
--exclude "*.obj" \
--exclude "*.pdb" \
--exclude "*.so" \
--exclude "*.tar" \
--exclude "*.zip" \
'''
if is_windows:
download_url = f"https://github.com/sharkdp/fd/releases/download/v{version}/fd-v{version}-x86_64-pc-windows-msvc.zip"
download_checksum = "92ac9e6b0a0c6ecdab638ffe210dc786403fff4c66373604cf70df27be45e4fe"
checksum = "c089c9ee1e412a111d65c917a95c757b4e192041f316a52535bfaa3e9e03429f"
download_checksum = "657cf430a1b349ce2b9cceeaed0b14220a417bbf24a85995aa6fbf8f746f4e03"
checksum = "0fd887ffa5b2f36cb77934072ca60d86c42e5afda90ac7005d7f1ef076ca70c6"
exe_path = "fd.exe"
add_to_devenv_script = [
"set FZF_DEFAULT_OPTS=--multi --layout=reverse",
f"set FZF_DEFAULT_COMMAND={fd_args}"
"set FZF_DEFAULT_COMMAND=fd --type f --strip-cwd-prefix --hidden --follow --exclude .git --exclude .cache --exclude .vs",
]
else:
download_url = f"https://github.com/sharkdp/fd/releases/download/v{version}/fd-v{version}-x86_64-unknown-linux-musl.tar.gz"
download_checksum = "d9bfa25ec28624545c222992e1b00673b7c9ca5eb15393c40369f10b28f9c932"
checksum = "ebcfc522da2a3086435d4e932770ea7eab53609d0377ea1f387e82fae3d447ce"
download_checksum = "ced2541984b765994446958206b3411f3dea761a5e618cb18b4724c523727d68"
checksum = "3533a356ff5dac034b6b37ef72f61a0132ffcd54c1d321bf2676d78c3cb499d8"
exe_path = "fd"
add_to_devenv_script = [
"FZF_DEFAULT_OPTS=\"--multi --layout=reverse\"",
f"FZF_DEFAULT_COMMAND=\"{fd_args}\""
"FZF_DEFAULT_COMMAND=\"fd --type f --strip-cwd-prefix --hidden --follow --exclude .git --exclude .cache --exclude .vs\"",
]
result.append({
"label": "Fd",
"manifests": [
@@ -1416,18 +1361,18 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "3.64.0"
version = "3.52.0"
symlink = []
if is_windows:
exe_path = "losslesscut.exe"
download_url = f"https://github.com/mifi/lossless-cut/releases/download/v{version}/LosslessCut-win-x64.7z"
download_checksum = "158ae74e26790134fe634f3371e2081db54cfffe41836a33204c82e54c66227a"
checksum = "29f50f30b1a29d7cb861aa5eacde82d6a305931625b4f048d84c94a5d64e585f"
download_checksum = "fa554d5f63f7287d6b4b6bf19ac5916c99cabfe9ac22248e7a3c39898c5b56ff"
checksum = "3cae40fa13523e9dfe760521d167174ddfc21105eb20466e905eb39b74e8ed70"
else:
exe_path = f"LosslessCut-linux-x86_64.AppImage"
download_url = f"https://github.com/mifi/lossless-cut/releases/download/v{version}/{exe_path}"
download_checksum = "2bdd1c26e24570890fb8042eb0970e0646793d0f13db9abb205221b662be8f37"
download_checksum = "28daafe9fcd07473f460c0a903164efe93d4e5ce7e682b6f318a5550c34bdb99"
checksum = download_checksum
result.append({
@@ -1453,7 +1398,7 @@ def get_manifest(is_windows):
# --------------------------------------------------------------------------
version = "1.22.3"
version = "1.20.1"
download_url = ""
download_checksum = ""
exe_path = ""
@@ -1462,14 +1407,14 @@ def get_manifest(is_windows):
if is_windows:
exe_path = "bin/go.exe"
download_url = f"https://go.dev/dl/go{version}.windows-amd64.zip"
download_checksum = "cab2af6951a6e2115824263f6df13ff069c47270f5788714fa1d776f7f60cb39"
checksum = "37f24030ec1215a3a8210037f33fda633d28f1cba6f72610d25b6db7cbc7d05c"
download_checksum = "3b493969196a6de8d9762d09f5bc5ae7a3e5814b0cfbf9cc26838c2bc1314f9c"
checksum = "89fc8e2c47f2a2a9138e60159781ce377167cf61e30d8136fbad0d77ac9303ed"
symlink = [f"go-{version}.exe"]
else:
exe_path = f"bin/go"
download_url = f"https://go.dev/dl/go{version}.linux-amd64.tar.gz"
download_checksum = "8920ea521bad8f6b7bc377b4824982e011c19af27df88a815e3586ea895f1b36"
checksum = "030fd1182c711b6a592eb7e1f1788d2808ff47e7b62d31b8f0ae25ed985d4e4c"
download_checksum = "000a5b1fca4f75895f78befeb2eecf10bfff3c428597f3f1e69133b63b911b02"
checksum = "dfaaf2d9212757e0c305c9554f616cac6744de646ef6ef20f5eaf9d9634771c3"
symlink = [f"go-{version}"]
result.append({
@@ -1493,97 +1438,4 @@ def get_manifest(is_windows):
],
})
# --------------------------------------------------------------------------
if is_windows:
version = "1.8.1"
exe_path = "jq-windows-amd64.exe"
download_url = f"https://github.com/jqlang/jq/releases/download/jq-{version}/jq-windows-amd64.exe"
download_checksum = "23cb60a1354eed6bcc8d9b9735e8c7b388cd1fdcb75726b93bc299ef22dd9334"
checksum = download_checksum
symlink = [f"jq.exe", f"jq-{version}.exe"]
result.append({
"label": "jq",
"manifests": [
{
"download_url": download_url,
"download_checksum": download_checksum,
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": exe_path,
"symlink": symlink,
"add_to_devenv_path": True,
"checksum": checksum,
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
if not is_windows:
version = "2.40.2"
exe_path = "bin/mold"
download_url = f"https://github.com/rui314/mold/releases/download/v{version}/mold-{version}-x86_64-linux.tar.gz"
download_checksum = "9f2c16bae380813f4aed34d2ab0534f5e1b82df154923de33e2edf8e5648f9d8"
checksum = "0d6e0a2459051c7af26be7a93dbecda88a04a14c8db16169c4e4603dcfcbe013"
symlink = []
result.append({
"label": "Mold",
"manifests": [
{
"download_url": download_url,
"download_checksum": download_checksum,
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": exe_path,
"symlink": symlink,
"add_to_devenv_path": True,
"checksum": checksum,
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
if not is_windows:
version = "4.11.3"
exe_path = "ccache"
download_url = f"https://github.com/ccache/ccache/releases/download/v{version}/ccache-{version}-linux-x86_64.tar.xz"
download_checksum = "7766991b91b3a5a177ab33fa043fe09e72c68586d5a86d20a563a05b74f119c0"
checksum = "850c37237f086aa4f2d282b7e3bece2b6c5c306f709c13ea7407ba6bfd06b45d"
symlink = []
result.append({
"label": "CCache",
"manifests": [
{
"download_url": download_url,
"download_checksum": download_checksum,
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": exe_path,
"symlink": symlink,
"add_to_devenv_path": True,
"checksum": checksum,
}
],
"add_to_devenv_script": [],
}
],
})
return result
+336
View File
@@ -0,0 +1,336 @@
def get_manifest(is_windows):
result = []
# --------------------------------------------------------------------------
if is_windows:
version = "1.4.1.1024"
result.append({
"label": "Everything",
"manifests": [
{
"download_url": f"https://www.voidtools.com/Everything-{version}.x64.zip",
"download_checksum": "4be0851752e195c9c7f707b1e0905cd01caf6208f4e2bfa2a66e43c0837be8f5",
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": "Everything.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "35cefe4bc4a98ad73dda4444c700aac9f749efde8f9de6a643a57a5b605bd4e7",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
if is_windows:
version = "22.3"
result.append({
"label": "MobaXTerm",
"manifests": [
{
"download_url": f"https://download.mobatek.net/2232022120824733/MobaXterm_Portable_v{version}.zip",
"download_checksum": "c8de508d6731f31a73f061e58942691466d1d24cfa941e642e16e0930be2fad9",
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": f"MobaXterm_Personal_{version}.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "e47cb54645a368411c5d6b6cbfa7e25980a2a674d7d0c082f5137b6e77a2f362",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
if is_windows:
version = "3.0.7039"
result.append({
"label": "SystemInformer",
"manifests": [
{
"download_url": f"https://github.com/winsiderss/si-builds/releases/download/{version}/systeminformer-{version}-bin.zip",
"download_checksum": "4557e58f698048e882515faac89c9c7f654247dbf4bd656ceed5c3f97afef77d",
"version": "3.0.5847",
"unzip_method": 'default',
"executables": [
{
"path": "amd64/SystemInformer.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "8a6e9dfd145e5cb8d03ec3db1b7b0163325be33e5c8fdd4126e9f8df2af2a39c",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
version = "2.0.0"
download_url = ""
download_checksum = ""
exe_path = ""
checksum = ""
if is_windows:
download_url = f"https://github.com/ahrm/sioyek/releases/download/v{version}/sioyek-release-windows-portable.zip"
download_checksum = "1f4fedbb38c0dc46bbba4bb95d0d6fab39fcf3525092ac26d92c891684d2bf8d"
checksum = "6c660f0f7265fabe6d943d15d9b5c7e85f2dbcf7fecb7d2cd0639e7086b1c034"
exe_path = "sioyek.exe"
else:
download_url = f"https://github.com/ahrm/sioyek/releases/download/v{version}/sioyek-release-linux-portable.zip"
download_checksum = "3f90659c1f29705de680b3607ae247582eab8860015c208d364a0f3fc15d3222"
checksum = "7abc12e8fe71b0285e067866bcea2ea0e025e37291f6bce450675a567172e44f"
exe_path = "Sioyek-x86_64.AppImage"
result.append({
"label": "Sioyek",
"manifests": [
{
"download_url": download_url,
"download_checksum": download_checksum,
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": exe_path,
"symlink": [],
"add_to_devenv_path": False,
"checksum": checksum,
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
if is_windows:
version = "4_15"
result.append({
"label": "WizTree",
"manifests": [
{
"download_url": f"https://www.diskanalyzer.com/files/wiztree_{version}_portable.zip",
"download_checksum": "dfa135cf5f87317ebe6112b7c8453f9eed5d93b78e9040a0ec882cbd6b200a95",
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": "WizTree64.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "141d7b51dbef71205f808e87b5e2d85a75eac69d060f678db628be2a0984a929",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
if is_windows:
version = "1.64.0"
result.append({
"label": "RClone",
"manifests": [
{
"download_url": f"https://github.com/rclone/rclone/releases/download/v{version}/rclone-v{version}-windows-amd64.zip",
"download_checksum": "b1251cfdcbc44356e001057524c3e2f7be56d94546273d10143bfa1148c155ab",
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": "rclone.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "64e0322e3bec6fb9fa730b7a14106e1e59fa186096f9a8d433a5324eb6853e01",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
if is_windows:
version = "1.5.3"
result.append({
"label": "Eyes-Thanks",
"manifests": [
{
"download_url": f"https://github.com/yalov/eyes-thanks/releases/download/{version}/EyesThanks_v{version}.zip",
"download_checksum": "6ab2b20730f56aa54263eb942be8849f52f9cba26438aee3c1b01103069411cc",
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": "Eyes' Thanks.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "48d232bd4a302b11378791eee844b42a2e30fe3553acf17a3b9e8ee0fcf27766",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
if is_windows:
version = "15.0.0"
result.append({
"label": "ShareX",
"manifests": [
{
"download_url": f"https://github.com/ShareX/ShareX/releases/download/v{version}/ShareX-{version}-portable.zip",
"download_checksum": "c3bc97e9fb8d107e92cb494b50f842fccafbc9fd810588a1b635aee4dbe90bc1",
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": "ShareX.exe",
"symlink": [],
"add_to_devenv_path": False,
"checksum": "0b679c46c2940edc09cff8ae0b0f4578aeda0346b9c402276b166aee4ec864be",
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
version = "0.12"
download_url = ""
download_checksum = ""
exe_path = ""
checksum = ""
if is_windows:
download_url = f"https://bitbucket.org/heldercorreia/speedcrunch/downloads/SpeedCrunch-{version}-win32.zip"
download_checksum = "024362bccd7908b508192cd90c2f6a716b5aa4fa5c7ff2aea9a1bf49d6580175"
checksum = "c80409586d6b36d315ce9462fd9020a12b07633a569d94a8ee057bcd18ee5647"
exe_path = "speedcrunch.exe"
else:
download_url = f"https://bitbucket.org/heldercorreia/speedcrunch/downloads/SpeedCrunch-{version}-linux64.tar.bz2"
download_checksum = "9347bef2068053ad15c5914ee147bf11a1ccb1d30cb18d63d0178380c327e8fc"
checksum = "06c7e7f68027f133dc7874f663873244b695c8a7d2aec9cde0e40b7a5b9a4db1"
exe_path = "speedcrunch"
result.append({
"label": "SpeedCrunch",
"manifests": [
{
"download_url": download_url,
"download_checksum": download_checksum,
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": exe_path,
"symlink": [],
"add_to_devenv_path": False,
"checksum": checksum,
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
version = "2.7.6"
download_url = ""
download_checksum = ""
exe_path = ""
checksum = ""
if is_windows:
download_url = f"https://github.com/keepassxreboot/keepassxc/releases/download/{version}/KeePassXC-{version}-Win64.zip"
download_checksum = "42aed8fee2b5fbc7ecae4494c274aece35f3de57c4370c1cd0eb365e501fb4c6"
checksum = "915f6879ca20fc7ffd196402e301676c3bd04419ee90486cbd56662dbb7d0b77"
exe_path = "KeePassXC.exe"
else:
exe_path = f"KeePassXC-{version}-x86_64.AppImage"
download_url = f"https://github.com/keepassxreboot/keepassxc/releases/download/{version}/{exe_path}"
download_checksum = "f32f7e7ab4bca789b24bd6a420c1d87dff40982646abef58fca481a7c56ace48"
checksum = download_checksum
result.append({
"label": "KeePassXC",
"manifests": [
{
"download_url": download_url,
"download_checksum": download_checksum,
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": exe_path,
"symlink": [],
"add_to_devenv_path": False,
"checksum": checksum,
}
],
"add_to_devenv_script": [],
}
],
})
# --------------------------------------------------------------------------
version = "3.56.0"
symlink = []
if is_windows:
exe_path = "LosslessCut.exe"
download_url = f"https://github.com/mifi/lossless-cut/releases/download/v{version}/LosslessCut-win-x64.7z"
download_checksum = "4dbbad634a09d16fd2cb53461ca8b7b5e8506fdaf03f811233646493b3fe04c0"
checksum = "14452473962369dd3443976dab7dc15a6fbbb60a6c758e8b95337ed161648a5a"
else:
exe_path = f"LosslessCut-linux-x86_64.AppImage"
download_url = f"https://github.com/mifi/lossless-cut/releases/download/v{version}/{exe_path}"
download_checksum = ""
checksum = download_checksum
result.append({
"label": "LosslessCut",
"manifests": [
{
"download_url": download_url,
"download_checksum": download_checksum,
"version": version,
"unzip_method": 'default',
"executables": [
{
"path": exe_path,
"symlink": symlink,
"add_to_devenv_path": False,
"checksum": checksum,
}
],
"add_to_devenv_script": [],
}
],
})
return result
+44 -43
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
# DEVenver
# ------------------------------------------------------------------------------
# A simple python script to download portable applications and install them by
# unzipping them to a structured directory tree.
@@ -21,8 +22,11 @@ from string import Template
from enum import Enum
# Internal
# ------------------------------------------------------------------------------
DOWNLOAD_CHUNK_SIZE = 1 * 1024 * 1024 # 1 megabyte
# ------------------------------------------------------------------------------
# These variables are set once they are downloaded dynamically and installed
# from the internal app listing!
zstd_exe = ""
@@ -30,6 +34,7 @@ zip7_exe = ""
zip7_bootstrap_exe = ""
# Functions
# ------------------------------------------------------------------------------
def print_header(title):
line = f'> ' + title + ' ';
print(line.ljust(100, '-'))
@@ -47,7 +52,7 @@ def verify_file_sha256(file_path, checksum, label):
result = False
try:
file = open(file_path, 'rb')
file = open(file_path, 'r+b')
hasher = hashlib.sha256()
hasher.update(file.read())
derived_checksum = hasher.hexdigest()
@@ -138,6 +143,9 @@ def get_exe_install_path(install_dir, label, version_label, exe_rel_path):
result = pathlib.Path(install_dir, exe_rel_path)
return result
def get_exe_symlink_dir(install_dir):
result = pathlib.Path(install_dir, "Symlinks")
return result
def download_and_install_archive(download_url,
download_checksum,
@@ -261,11 +269,8 @@ def download_and_install_archive(download_url,
if os.path.exists(next_archive_path) == False:
command = ""
if archive_path.suffix == '.zst':
command = [str(zstd_exe), "-d", "-f", str(archive_path)]
lprint(f'- zstd unzip {label}', level=1)
# zstd extracts to the same directory as the archive
next_archive_path = pathlib.Path(download_dir, archive_without_suffix)
command = [str(zstd_exe), "--output-dir-flat", str(exe_install_dir), "-d", str(archive_path)]
lprint(f'- zstd unzip {label} to: {exe_install_dir}', level=1)
else:
if not is_windows:
linux_used_tar = True
@@ -374,7 +379,7 @@ def download_and_install_archive(download_url,
# Do the symlinks
# --------------------------------------------------------------------------
symlink_dir = install_dir
symlink_dir = get_exe_symlink_dir(install_dir)
paths_to_add_to_devenv_script = set()
for exe_dict in exe_list:
exe_rel_path = exe_dict['path']
@@ -396,11 +401,8 @@ def download_and_install_archive(download_url,
# OS.
use_hardlink = is_windows or os.name == 'nt'
for symlink_entry in exe_dict["symlink"]:
symlink_dest = symlink_dir / symlink_entry
symlink_src = exe_path
symlink_rel_src = pathlib.Path(symlink_src).relative_to(install_dir)
symlink_rel_dest = pathlib.Path(symlink_dest).relative_to(install_dir)
symlink_dest = symlink_dir / symlink_entry
symlink_src = exe_path
skip_link = False;
if os.path.exists(symlink_dest):
# Windows uses hardlinks because symlinks require you to enable "developer" mode
@@ -417,13 +419,11 @@ def download_and_install_archive(download_url,
else:
os.unlink(symlink_dest)
import contextlib
if not skip_link:
if use_hardlink:
os.link(src=symlink_src, dst=symlink_dest)
else:
with contextlib.chdir(install_dir):
os.symlink(src=symlink_rel_src, dst=symlink_dest)
os.symlink(src=symlink_src, dst=symlink_dest)
# Collect paths to add to the devenv script
# ----------------------------------------------------------------------
@@ -513,17 +513,13 @@ internal_app_list = []
devenv_script_buffer = ""
def install_app_list(app_list, download_dir, install_dir, is_windows):
title = "Internal Apps"
title = "Internal Apps" if app_list is internal_app_list else "User Apps"
print_header(title)
result = {}
validate_app_list_result = validate_app_list(app_list)
app_index = 0
global zstd_exe
if not is_windows:
zstd_exe = "/usr/bin/zstd"
for app in app_list:
manifest_list = app['manifests']
for manifest in manifest_list:
@@ -556,6 +552,7 @@ def install_app_list(app_list, download_dir, install_dir, is_windows):
if app_list is internal_app_list:
global zip7_exe
global zip7_bootstrap_exe
global zstd_exe
exe_path = get_exe_install_path(install_dir, label, version, manifest['executables'][0]['path'])
if label == '7zip':
if is_windows or os.name == 'nt':
@@ -682,23 +679,19 @@ def run(user_app_list,
"add_to_devenv_script": [],
})
version = ""
version = "2301"
download_url = ""
download_checksum = ""
checksum = ""
exe_path = ""
if is_windows or os.name == "nt":
sevenz_version = "22.01"
zs_version = "1.5.5-R3"
version = f"{sevenz_version}-{zs_version}"
download_url = f"https://github.com/mcmilk/7-Zip-zstd/releases/download/v{sevenz_version}-v{zs_version}/7z{sevenz_version}-zstd-x64.exe"
download_checksum = "d542d78397bbed8e77c221f36cad461a0d83f1263b993a7048e81df40f403fb8"
checksum = "9d818c7a524ee2e8f81874c6067289c3eaa250887e25ee898937dfc1486bc066"
download_url = f"https://www.7-zip.org/a/7z{version}-x64.exe"
download_checksum = "26cb6e9f56333682122fafe79dbcdfd51e9f47cc7217dccd29ac6fc33b5598cd"
checksum = "8cebb25e240db3b6986fcaed6bc0b900fa09dad763a56fb71273529266c5c525"
exe_path = "7z.exe"
else:
version = "2301"
download_url = f"https://www.7-zip.org/a/7z{version}-linux-x64.tar.xz"
download_checksum = "23babcab045b78016e443f862363e4ab63c77d75bc715c0b3463f6134cbcf318"
checksum = "c7f8769e2bc8df6bcbfba34571ee0340670a52dec824dbac844dd3b5bd1a69e1"
@@ -772,6 +765,7 @@ def run(user_app_list,
# Create the paths requested by the user
os.makedirs(download_dir, exist_ok=True)
os.makedirs(install_dir, exist_ok=True)
os.makedirs(pathlib.Path(install_dir, "Symlinks"), exist_ok=True)
for path in [download_dir, install_dir]:
if not os.path.isdir(path):
@@ -793,10 +787,10 @@ def run(user_app_list,
install_dir=install_dir,
is_windows=is_windows)
user_apps = install_app_list(app_list=user_app_list,
download_dir=download_dir,
install_dir=install_dir,
is_windows=is_windows)
user_apps = install_app_list(app_list=user_app_list,
download_dir=download_dir,
install_dir=install_dir,
is_windows=is_windows)
# Write the devenv script with environment variables
if is_windows:
@@ -804,22 +798,29 @@ def run(user_app_list,
devenv_script_buffer += "set devenver_root=%devenver_root_backslash:~0,-1%\n"
devenv_script_buffer += "set devenver_root_backslash=\n"
devenv_script_buffer += "set path=%~dp0;%PATH%\n"
devenv_script_buffer += "set path=%~dp0Symlinks;%PATH%\n"
devenv_script_buffer += "set path=%~dp0Scripts;%PATH%\n"
else:
devenv_script_buffer += f"export devenver_root=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )\"\n"
devenv_script_buffer += f'PATH="$( cd -- $( dirname -- "${{BASH_SOURCE[0]}}" ) &> /dev/null && pwd )":$PATH\n'
devenv_script_buffer += f"PATH=$(echo $PATH | awk -v RS=: -v ORS=: '/^\/mnt\/c/ {{next}} {{print}}')\n"
devenv_script_buffer += f"source $devenver_root/unix_fzf-completion.bash\n"
devenv_script_buffer += f"source $devenver_root/unix_fzf-key-bindings.bash\n"
devenv_script_buffer += f"PATH=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )/Scripts\":$PATH\n"
devenv_script_buffer += f"PATH=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )/Symlinks\":$PATH\n"
if devenv_script_name:
devenv_script_name = f"{devenv_script_name}.bat" if is_windows else f"{devenv_script_name}.sh"
devenv_script_path = pathlib.Path(install_dir, devenv_script_name)
lprint(f"Writing script to augment the environment with installed applications: {devenv_script_path}")
devenv_script_path.write_text(devenv_script_buffer)
devenv_script_name = f"{devenv_script_name}.bat" if is_windows else f"{devenv_script_name}.sh"
devenv_script_path = pathlib.Path(install_dir, devenv_script_name)
lprint(f"Writing script to augment the environment with installed applications: {devenv_script_path}")
devenv_script_path.write_text(devenv_script_buffer)
if not is_windows:
subprocess.run(args=["chmod", "+x", devenv_script_path])
result = {**internal_apps, **user_apps}
# Merge the install dictionaries, this dictionary contains
# (app label) -> [array of installed versions]
result = internal_apps
for key, value in user_apps.items():
if key not in result:
result.update({key: value})
else:
result[key] += value
return result
+287 -136
View File
@@ -8,7 +8,9 @@ import shutil
import tempfile
import argparse
import urllib.request
import app_manifest_dev
import app_manifest_user
def git_clone(install_dir, git_exe, url, commit_hash):
devenver.lprint(f"Git clone {url} to {install_dir}", level=0)
@@ -44,6 +46,16 @@ arg_parser.add_argument('--install-dir',
default="",
type=pathlib.Path)
arg_parser.add_argument('--with-dev-apps',
help=f'Download and install apps from the developer manifest',
const=True,
action="store_const")
arg_parser.add_argument('--with-user-apps',
help=f'Download and install apps from the user manifest',
const=True,
action="store_const")
arg_parser.add_argument('operating_system',
choices=['win', 'linux'],
help=f'Download and install apps for the specified operating system')
@@ -63,47 +75,147 @@ if install_dir == pathlib.Path(""):
install_dir = devenver.script_dir / 'Linux'
# Install development apps
dev_env_script_name = "dev_env"
app_list = app_manifest_dev.get_manifest(is_windows=is_windows)
installed_dev_apps = devenver.run(user_app_list=app_list,
download_dir=download_dir,
install_dir=install_dir,
devenv_script_name=dev_env_script_name,
is_windows=is_windows)
install_script_path = pathlib.Path(devenver.script_dir, "install.py")
# ------------------------------------------------------------------------------
if args.with_dev_apps:
# Run DEVenver, installing the portable apps
# --------------------------------------------------------------------------
dev_env_script_name = "dev_env"
app_list = app_manifest_dev.get_manifest(is_windows=is_windows)
installed_dev_apps = devenver.run(user_app_list=app_list,
download_dir=download_dir,
install_dir=install_dir,
devenv_script_name=dev_env_script_name,
is_windows=is_windows)
if is_windows:
# Install apps dependent on Git
devenver.print_header("Install apps that rely on Git")
git_exe = installed_dev_apps["Git"][0]['exe_path']
# Clink
clink_install_dir = installed_dev_apps["Clink"][0]['install_dir']
clink_base_dir = clink_install_dir.parent
install_script_path = pathlib.Path(devenver.script_dir, "install.py")
if is_windows:
# Install MSVC
# --------------------------------------------------------------------------
devenver.print_header("Install MSVC & Windows 10 SDK")
msvc_script = devenver.script_dir / "win_portable_msvc.py"
msvc_version = "14.34"
win10_sdk_version = "22621"
# Gizmos
clink_gizmo_git_hash = "fb2edd9"
clink_gizmo_install_dir = clink_base_dir / "clink-gizmos"
git_clone(install_dir=clink_gizmo_install_dir,
git_exe=git_exe,
url="https://github.com/chrisant996/clink-gizmos",
commit_hash=clink_gizmo_git_hash)
msvc_install_dir = install_dir / "msvc"
# Completions
clink_completions_git_hash = "86b6f07"
clink_completions_install_dir = clink_base_dir / "clink-completions"
git_clone(install_dir=clink_completions_install_dir,
git_exe=git_exe,
url="https://github.com/vladimir-kotikov/clink-completions",
commit_hash=clink_completions_git_hash)
# Basic heuristic to see if we"ve already installed the MSVC/SDK version
msvc_installed = False
win10_sdk_installed = False
# Install clink configuration
clink_profile_dir = clink_base_dir / "profile"
clink_settings_path = clink_profile_dir / "clink_settings"
devenver.lprint(f"Installing clink_settings to: {clink_settings_path}")
msvc_find_test_dir = msvc_install_dir / "VC/Tools/MSVC"
win10_sdk_find_test_dir = msvc_install_dir / "Windows Kits/10"
clink_settings_path.parent.mkdir(exist_ok=True)
clink_settings_path.write_text(f"""# When this file is named "default_settings" and is in the binaries
if os.path.exists(msvc_find_test_dir):
for file_name in os.listdir(msvc_find_test_dir):
msvc_installed = file_name.startswith(msvc_version)
if msvc_installed == True:
devenver.lprint(f"MSVC {msvc_version} install detected (skip download) in {msvc_find_test_dir}\\{file_name}")
break
if not msvc_installed:
devenver.lprint(f"MSVC {msvc_version} install not detected (need to download) in {msvc_find_test_dir}")
if os.path.exists(win10_sdk_find_test_dir):
for file_name in os.listdir(win10_sdk_find_test_dir / "bin"):
# Check if directory contains version substring, 22621, e.g. "10.0.22621.0"
win10_sdk_installed = file_name.count(win10_sdk_version) > 0
if win10_sdk_installed == True:
install_locations = f"{win10_sdk_find_test_dir}\\*\\{file_name}"
devenver.lprint(f"Windows 10 SDK {win10_sdk_version} install detected (skip download) in {install_locations}")
break
if not win10_sdk_installed:
devenver.lprint(f"Windows 10 SDK {win10_sdk_version} not detected (need to download) in {win10_sdk_find_test_dir}")
# Install MSVC
if msvc_installed == False or win10_sdk_installed == False:
with tempfile.TemporaryDirectory() as temp_dir:
# Invoke the MSVC script to download MSVC to disk
command = f"\"{sys.executable}\" \"{msvc_script}\" --accept-license"
line = "Invoking MSVC script to install"
if msvc_installed:
command += " --no-msvc"
else:
command += f" --msvc-version {msvc_version}"
line += f" MSVC {msvc_version}"
if win10_sdk_installed:
command += " --no-sdk"
else:
command += f" --sdk-version {win10_sdk_version}"
line += f" Windows 10 SDK {win10_sdk_version}"
devenver.lprint(line)
devenver.lprint(f"Command: {command}")
run_result = subprocess.run(command, cwd=temp_dir, check=True)
# Merge the download MSVC installation to our unified install dir
temp_msvc_dir = pathlib.Path(temp_dir, "msvc")
for src_dir, dirs, files in os.walk(temp_msvc_dir):
msvc_working_dir = src_dir.replace(str(temp_msvc_dir), str(msvc_install_dir), 1)
if not os.path.exists(msvc_working_dir):
os.makedirs(msvc_working_dir)
for file_ in files:
src = os.path.join(src_dir, file_)
dest = os.path.join(msvc_working_dir, file_)
if os.path.exists(dest):
if os.path.samefile(src, dest):
continue
os.remove(dest)
shutil.move(src, msvc_working_dir)
devenver.lprint(f"MSVC {msvc_version} Windows 10 SDK {win10_sdk_version} installed: {msvc_install_dir}")
# Install apps dependent on Git
# --------------------------------------------------------------------------
devenver.print_header("Install apps that rely on Git")
git_exe = installed_dev_apps["Git"][0]['exe_path']
# Clink
# --------------------------------------------------------------------------
clink_install_dir = installed_dev_apps["Clink"][0]['install_dir']
clink_base_dir = clink_install_dir.parent
# Gizmos
clink_gizmo_git_hash = "fb2edd9"
clink_gizmo_install_dir = clink_base_dir / "clink-gizmos"
git_clone(install_dir=clink_gizmo_install_dir,
git_exe=git_exe,
url="https://github.com/chrisant996/clink-gizmos",
commit_hash=clink_gizmo_git_hash)
# Completions
clink_completions_git_hash = "86b6f07"
clink_completions_install_dir = clink_base_dir / "clink-completions"
git_clone(install_dir=clink_completions_install_dir,
git_exe=git_exe,
url="https://github.com/vladimir-kotikov/clink-completions",
commit_hash=clink_completions_git_hash)
# Odin
# --------------------------------------------------------------------------
# odin_git_hash = "9ae1bfb6"
# odin_install_dir = install_dir / "Odin"
# git_clone(install_dir=odin_install_dir,
# git_exe=git_exe,
# url="https://github.com/odin-lang/odin.git",
# commit_hash=odin_git_hash)
# TODO: We can't do this yet because the odin build requires a registry hack so
# that it knows where to find MSVC.
# Build Odin
# subprocess.run(f"{git_exe} checkout {odin_git_hash}",
# cwd=odin_install_dir)
# Install clink configuration
# --------------------------------------------------------------------------
clink_profile_dir = clink_base_dir / "profile"
clink_settings_path = clink_profile_dir / "clink_settings"
devenver.lprint(f"Installing clink_settings to: {clink_settings_path}")
clink_settings_path.parent.mkdir(exist_ok=True)
clink_settings_path.write_text(f"""# When this file is named "default_settings" and is in the binaries
# directory or profile directory, it provides enhanced default settings.
# Override built-in default settings with ones that provide a more
@@ -141,144 +253,183 @@ clink.path = {clink_completions_install_dir};{clink_gizmo
fzf.default_bindings = True
""")
# Install wezterm configuration
wezterm_config_dest_path = installed_dev_apps["WezTerm"][0]["install_dir"] / "wezterm.lua"
devenver.lprint(f"Installing WezTerm config to {wezterm_config_dest_path}")
# Install wezterm configuration
# --------------------------------------------------------------------------
wezterm_config_dest_path = installed_dev_apps["WezTerm"][0]["install_dir"] / "wezterm.lua"
devenver.lprint(f"Installing WezTerm config to {wezterm_config_dest_path}")
clink_exe_path = clink_install_dir.relative_to(install_dir) / "clink_x64.exe"
clink_exe_path_for_wezterm = str(clink_exe_path).replace("\\", "\\\\")
clink_profile_path_for_wezterm = str(clink_profile_dir.relative_to(install_dir)).replace("\\", "\\\\")
clink_exe_path = clink_install_dir.relative_to(install_dir) / "clink_x64.exe"
clink_exe_path_for_wezterm = str(clink_exe_path).replace("\\", "\\\\")
clink_profile_path_for_wezterm = str(clink_profile_dir.relative_to(install_dir)).replace("\\", "\\\\")
wezterm_config_dest_path.write_text(f"""local wezterm = require 'wezterm';
wezterm_config_dest_path.write_text(f"""local wezterm = require 'wezterm';
local default_prog
local set_environment_variables = {{}}
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
clink_exe = string.format("%s\\\\..\\\\..\\\\{clink_exe_path_for_wezterm}", wezterm.executable_dir)
devenv_bat = string.format("%s\\\\..\\\\..\\\\{dev_env_script_name}.bat", wezterm.executable_dir)
clink_profile = string.format("%s\\\\..\\\\..\\\\{clink_profile_path_for_wezterm}", wezterm.executable_dir)
clink_exe = string.format("%s\\\\..\\\\..\\\\{clink_exe_path_for_wezterm}", wezterm.executable_dir)
devenv_bat = string.format("%s\\\\..\\\\..\\\\{dev_env_script_name}.bat", wezterm.executable_dir)
msvc_bat = "C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community\\\\VC\\\\Auxiliary\\\\Build\\\\vcvarsall.bat"
clink_profile = string.format("%s\\\\..\\\\..\\\\{clink_profile_path_for_wezterm}", wezterm.executable_dir)
-- Taken from: https://wezfurlong.org/wezterm/shell-integration.html
-- Use OSC 7 as per the above example
set_environment_variables['prompt'] =
'$E]7;file://localhost/$P$E\\\\$E[32m$T$E[0m $E[35m$P$E[36m$_$G$E[0m '
-- Taken from: https://wezfurlong.org/wezterm/shell-integration.html
-- Use OSC 7 as per the above example
set_environment_variables['prompt'] =
'$E]7;file://localhost/$P$E\\\\$E[32m$T$E[0m $E[35m$P$E[36m$_$G$E[0m '
default_prog = {{"cmd.exe", "/s", "/k",
clink_exe, "inject", "--profile", clink_profile, "-q",
"&&", "call", devenv_bat}}
default_prog = {{"cmd.exe", "/s", "/k",
clink_exe, "inject", "--profile", clink_profile, "-q",
"&&", "call", devenv_bat,
"&&", "call", msvc_bat, "x64"}}
end
return {{
font_size = 10.0,
color_scheme = "Peppermint",
default_prog = default_prog,
set_environment_variables = set_environment_variables,
font_size = 10.0,
color_scheme = "Peppermint",
default_prog = default_prog,
set_environment_variables = set_environment_variables,
}}
""")
# Wezterm super terminal
wezterm_terminal_script_path = install_dir / "dev_terminal.bat"
devenver.lprint(f"Installing WezTerm terminal script to {wezterm_terminal_script_path}")
# Wezterm super terminal
# --------------------------------------------------------------------------
wezterm_terminal_script_path = install_dir / "dev_terminal.bat"
devenver.lprint(f"Installing WezTerm terminal script to {wezterm_terminal_script_path}")
wezterm_terminal_script_path.write_text(f"""@echo off
wezterm_terminal_script_path.write_text(f"""@echo off
setlocal EnableDelayedExpansion
set working_dir=
if "%~1" neq "" (
set working_dir=start --cwd "%~1"
set working_dir=!working_dir:\=/!
set working_dir=start --cwd "%~1"
set working_dir=!working_dir:\=/!
)
start "" /MAX "%~dp0{installed_dev_apps["WezTerm"][0]["exe_path"].relative_to(install_dir)}" !working_dir!
""")
# Python
python_exe_path = pathlib.Path(installed_dev_apps["Python"][0]['exe_path'])
# PyNvim
devenver.lprint(f"Installing PyNVIM")
subprocess.run(f"{python_exe_path} -m pip install pynvim")
# Create Odin work-around scripts
# --------------------------------------------------------------------------
# Odin uses J. Blow's Microsoft craziness SDK locator which relies on the
# registry. Here we inject the registry entry that the SDK locator checks for
# finding our portable MSVC installation.
win10_sdk_find_test_dir_reg_path = str(win10_sdk_find_test_dir).replace("\\", "\\\\")
# 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")
llvm_install_dir_set = set()
for entry in installed_dev_apps["LLVM"]:
llvm_install_dir_set.add(entry['install_dir'])
odin_msvc_install_script_path = install_dir / "odin_msvc_install_workaround.reg"
odin_msvc_uninstall_script_path = install_dir / "odin_msvc_uninstall_workaround.reg"
llvm_script_src_path = internal_dir / "win_llvm-link-ad01970-2022-08-29.bat"
for llvm_install_dir in llvm_install_dir_set:
llvm_script_dest_path = llvm_install_dir / "llvm-link.bat"
shutil.copy(llvm_script_src_path, llvm_script_dest_path)
subprocess.run(llvm_script_dest_path, cwd=llvm_install_dir)
os.remove(llvm_script_dest_path)
devenver.lprint(f"Installing Odin MSVC workaround scripts", level=0)
devenver.lprint(f" - {odin_msvc_install_script_path}", level=1)
devenver.lprint(f" - {odin_msvc_uninstall_script_path}", level=1)
# Install fzf scripts
if not is_windows:
shutil.copy(internal_dir / "unix_fzf-completion.bash", install_dir)
shutil.copy(internal_dir / "unix_fzf-key-bindings.bash", install_dir)
odin_msvc_install_script_path.write_text(f"""Windows Registry Editor Version 5.00
# Install dev scripts
if is_windows:
shutil.copy(internal_dir / "win_dev.bat", install_dir / "dev.bat")
else:
shutil.copy(internal_dir / "unix_dev.sh", install_dir / "dev.sh")
subprocess.run(args=["chmod", "+x", install_dir / "dev.sh"])
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots]
"KitsRoot10"="{win10_sdk_find_test_dir_reg_path}"
""")
# Install left-overs
devenver.print_header("Install configuration files")
odin_msvc_uninstall_script_path.write_text(f"""Windows Registry Editor Version 5.00
# ClangFormat
clang_format_src_path = internal_dir / "os_clang_format_style_file"
clang_format_dest_path = install_dir / "_clang-format"
devenver.lprint(f"Copying clang-format file from {clang_format_src_path} to {clang_format_dest_path}")
shutil.copy(clang_format_src_path, clang_format_dest_path)
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots]
"KitsRoot10"=-
""")
# Copy init.vim to NVIM directory
nvim_init_dir = ""
# Python
# --------------------------------------------------------------------------
# TODO: If I'm using the terminal that this script generates it will lock the
# executable and Python cannot open the file for verifying the SHA256.
if is_windows:
nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / "AppData" / "Local" / "nvim"
else:
nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / ".config" / "nvim"
python_exe_path = pathlib.Path(installed_dev_apps["Python"][0]['exe_path'])
nvim_config_dest_path = nvim_init_dir / "init.lua"
nvim_config_src_path = internal_dir / "os_nvim_init.lua"
# PyNvim
devenver.lprint(f"Installing PyNVIM")
subprocess.run(f"{python_exe_path} -m pip install pynvim")
if os.path.exists(nvim_init_dir / "init.vim"):
pathlib.Path(nvim_init_dir / "init.vim").unlink()
# Add update script
python_rel_exe_path = pathlib.Path(python_exe_path).relative_to(install_dir)
python_install_dir = pathlib.Path(python_exe_path).parent.relative_to(install_dir)
devenver.lprint(f"Installing NVIM config to {nvim_config_dest_path}")
nvim_init_dir.mkdir(parents=True, exist_ok=True)
shutil.copy(nvim_config_src_path, nvim_config_dest_path)
(install_dir / "dev_env_update.bat").write_text(f"""@echo off
setlocal EnableDelayedExpansion
set PYTHONHOME=%~dp0{python_install_dir}
%~dp0{python_rel_exe_path} {install_script_path} --with-dev-apps win
pause
""")
# Download vim.plug to NVIM init directory
nvim_plug_vim_dir = nvim_init_dir / "autoload"
nvim_plug_vim_path = nvim_plug_vim_dir / "plug.vim"
nvim_plug_vim_dir.mkdir(parents=True, exist_ok=True)
if not os.path.exists(nvim_plug_vim_path):
devenver.lprint(f"Installing NVIM plugin manager to {nvim_plug_vim_path}")
urllib.request.urlretrieve("https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim", nvim_plug_vim_path)
(install_dir / "user_env_update.bat").write_text(f"""@echo off
setlocal EnableDelayedExpansion
set PYTHONHOME=%~dp0{python_install_dir}
%~dp0{python_rel_exe_path} {install_script_path} --with-user-apps win
pause
""")
# Source dev_env.sh in ~/.bashrc (Linux only)
if not is_windows:
bashrc_path = pathlib.Path(os.path.expanduser("~/.bashrc"))
devenv_script_path = install_dir / "dev_env.sh"
source_line = f'source "{devenv_script_path}"'
# Check if already present
already_present = False
if bashrc_path.exists():
bashrc_content = bashrc_path.read_text()
if source_line in bashrc_content:
already_present = True
if not already_present:
devenver.lprint(f"Adding dev_env.sh source line to {bashrc_path}")
with open(bashrc_path, "a") as f:
f.write(f"\n{source_line}\n")
else:
devenver.lprint(f"dev_env.sh source line already exists in {bashrc_path}")
dev_env_script_path = (install_dir / "dev_env_update.sh")
user_env_script_path = (install_dir / "user_env_update.sh")
dev_env_script_path.write_text(f"{sys.executable} {install_script_path} --with-dev-apps linux\n")
user_env_script_path.write_text(f"{sys.executable} {install_script_path} --with-user-apps linux\n")
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")
llvm_install_dir_set = set()
for entry in installed_dev_apps["LLVM"]:
llvm_install_dir_set.add(entry['install_dir'])
llvm_script_src_path = internal_dir / "win_llvm-link-ad01970-2022-08-29.bat"
for llvm_install_dir in llvm_install_dir_set:
llvm_script_dest_path = llvm_install_dir / "llvm-link.bat"
shutil.copy(llvm_script_src_path, llvm_script_dest_path)
subprocess.run(llvm_script_dest_path, cwd=llvm_install_dir)
os.remove(llvm_script_dest_path)
# Install left-overs
# --------------------------------------------------------------------------
devenver.print_header("Install configuration files")
# ClangFormat
clang_format_src_path = internal_dir / "os_clang_format_style_file"
clang_format_dest_path = install_dir / "_clang-format"
devenver.lprint(f"Copying clang-format file from {clang_format_src_path} to {clang_format_dest_path}")
shutil.copy(clang_format_src_path, clang_format_dest_path)
# Copy init.vim to NVIM directory
nvim_init_dir = ""
if is_windows:
nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / "AppData" / "Local" / "nvim"
else:
nvim_init_dir = pathlib.Path(os.path.expanduser("~")) / ".config" / "nvim"
nvim_config_dest_path = nvim_init_dir / "init.vim"
nvim_config_src_path = internal_dir / "os_nvim_init.vim"
devenver.lprint(f"Installing NVIM config to {nvim_config_dest_path}")
nvim_init_dir.mkdir(parents=True, exist_ok=True)
shutil.copy(nvim_config_src_path, nvim_config_dest_path)
# Download vim.plug to NVIM init directory
nvim_plug_vim_dir = nvim_init_dir / "autoload"
nvim_plug_vim_path = nvim_plug_vim_dir / "plug.vim"
nvim_plug_vim_dir.mkdir(parents=True, exist_ok=True)
if not os.path.exists(nvim_plug_vim_path):
devenver.lprint(f"Installing NVIM plugin manager to {nvim_plug_vim_path}")
urllib.request.urlretrieve("https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim",
nvim_plug_vim_path)
# Install user apps
# ------------------------------------------------------------------------------
if args.with_user_apps:
app_list = app_manifest_user.get_manifest(is_windows=is_windows)
installed_user_apps = devenver.run(user_app_list=app_list,
download_dir=download_dir,
install_dir=install_dir,
devenv_script_name="user_env",
is_windows=is_windows)
+398
View File
@@ -0,0 +1,398 @@
#!/usr/bin/env bash
# Functions
# ------------------------------------------------------------------------------
DownloadFile()
{
url=$1
dest_file=$2
if [[ -f "${dest_file}" ]]; then
echo "- [DownloadFile/Cached] ${url} to ${dest_file}"
else
echo "- [DownloadFile] ${url} to ${dest_file}"
wget --output-document ${dest_file} ${url}
if [ $? -ne 0 ]; then
echo "- [DownloadFile] Download failed [url=${url}]"
exit
fi
fi
}
FileSHA256Check()
{
file=$1
expected=$2
echo "${expected} ${file}" | sha256sum --check
if [[ $? -ne 0 ]]; then
echo "- [FileSHA256Check] Failed [file=${file}, "
echo " expect=${expected} ${file},"
echo " actual=$(sha256sum ${file})"
echo " ]"
exit
else
echo "- [FileSHA256Check] OK [file=${file}, hash=${expected}]"
fi
}
# Setup
# ------------------------------------------------------------------------------
root_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
home_dir=${root_dir}/Home
installer_dir=${root_dir}/Installer
tools_dir=${root_dir}/Tools
downloads_dir=${root_dir}/Downloads
mkdir --parents ${home_dir}
mkdir --parents ${tools_dir}
mkdir --parents ${downloads_dir}
bin_dir=${tools_dir}/Binaries
mkdir --parents ${bin_dir}
# Tools
# ------------------------------------------------------------------------------
if ! command -v docker &> /dev/null
then
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
fi
# CMake
# ----------------------------------------------------------------------------
cmake_sha256=aaced6f745b86ce853661a595bdac6c5314a60f8181b6912a0a4920acfa32708
cmake_exe_sha256=95b80ba2b97b619abce1ed6fd28fe189cacba48403e9c69256f2f94e3405e645
cmake_version=3.23.2
cmake_download_name=cmake-${cmake_version}-linux-x86_64
cmake_download_file=${cmake_download_name}.tar.gz
cmake_download_path=${downloads_dir}/${cmake_download_file}
cmake_label=cmake_linux64_${cmake_version}
cmake_dir=${tools_dir}/${cmake_label}
cmake_exe=${cmake_dir}/bin/cmake
if [[ ! -f "${cmake_exe}" ]]; then
DownloadFile "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${cmake_download_file}" "${cmake_download_path}" || exit
FileSHA256Check "${cmake_download_path}" "${cmake_sha256}" || exit
mkdir --parents "${cmake_dir}" && tar xf "${cmake_download_path}" --skip-old-files --directory="${cmake_dir}" || exit
mv ${cmake_dir}/cmake-${cmake_version}-linux-x86_64/* "${cmake_dir}" || exit
rm --recursive ${cmake_dir}/cmake-${cmake_version}-linux-x86_64 || exit
fi
FileSHA256Check "${cmake_exe}" "${cmake_exe_sha256}" || exit
cd "${cmake_dir}/bin" && find . -type f,l -exec ln --force --symbolic --relative "{}" "${bin_dir}/{}-${cmake_version}" ';' && cd "${root_dir}"
cd "${cmake_dir}/bin" && find . -type f,l -exec ln --force --symbolic --relative "{}" "${bin_dir}/" ';' && cd "${root_dir}"
# FD
# ------------------------------------------------------------------------------
fd_sha256=a1e72cf4f4fbd1b061387569678f3ab3555ee1cf025280b3ce6b2eee96cd3210
fd_exe_sha256=057bea03a6f17eb99ea3b11c25a110880b012d2d5110988e80b1ce2ee6536342
fd_version=8.4.0
fd_download_name=fd-v${fd_version}-x86_64-unknown-linux-gnu
fd_download_file=${fd_download_name}.tar.gz
fd_download_path=${downloads_dir}/${fd_download_file}
fd_dir=${tools_dir}/fd_linux64_${fd_version}
fd_exe=${fd_dir}/fd
if [[ ! -f "${fd_exe}" ]]; then
DownloadFile "https://github.com/sharkdp/fd/releases/download/v${fd_version}/${fd_download_file}" "${fd_download_path}" || exit
FileSHA256Check "${fd_download_path}" "${fd_sha256}" || exit
mkdir --parents "${fd_dir}" && tar xf "${fd_download_path}" --skip-old-files --directory="${fd_dir}" || exit
mv ${fd_dir}/${fd_download_name}/* "${fd_dir}" || exit
rm --recursive ${fd_dir}/${fd_download_name} || exit
fi
FileSHA256Check "${fd_exe}" "${fd_exe_sha256}" || exit
ln --force --symbolic --relative "${fd_exe}" "${bin_dir}"
# GCC
# ------------------------------------------------------------------------------
gcc_dir=${tools_dir}/gcc-mostlyportable
gcc_version_list=()
gcc_version_list+=(6.5.0)
gcc_version_list+=(7.5.0)
gcc_version_list+=(8.5.0)
gcc_version_list+=(9.5.0)
gcc_version_list+=(10.4.0)
gcc_version_list+=(11.3.0)
gcc_version_list+=(12.1.0)
mkdir --parents "${gcc_dir}"
cp "${installer_dir}/unix_gcc_build.sh" "${gcc_dir}/build.sh"
cp "${installer_dir}/unix_gcc_dockerfile" "${gcc_dir}/Dockerfile"
cd "${gcc_dir}" || exit
for gcc_version in ${gcc_version_list[@]}; do
gcc_root_dir=${gcc_dir}/gcc-mostlyportable-${gcc_version}
gcc_bin_dir=${gcc_root_dir}/bin
if [[ ! -f "${gcc_bin_dir}/g++" ]]; then
./build.sh ${gcc_version} || exit
fi
# Symbolic link the versioned gcc executables
ln --symbolic --force --relative ${gcc_bin_dir}/g++ ${bin_dir}/g++-${gcc_version} || exit
ln --symbolic --force --relative ${gcc_bin_dir}/gcc ${bin_dir}/gcc-${gcc_version} || exit
# Create script that setups the environment path for building with a versioned GCC
gcc_script_name=g++-${gcc_version}-vars.sh
gcc_script_path=${gcc_dir}/${gcc_script_name}
echo "gcc_mostlyportable_dir=\"${gcc_root_dir}\" \\" > ${gcc_script_path}
echo "PATH=\${gcc_mostlyportable_dir}/bin:\${PATH} \\" >> ${gcc_script_path}
echo "LD_LIBRARY_PATH=\${gcc_mostlyportable_dir}/lib:\${LD_LIBRARY_PATH} \\" >> ${gcc_script_path}
echo "LD_LIBRARY_PATH=\${gcc_mostlyportable_dir}/lib64:\${LD_LIBRARY_PATH} \\" >> ${gcc_script_path}
echo "\$@" >> ${gcc_script_path}
chmod +x ${gcc_script_path}
# Symbolic link the script to load the GCC environment
ln --symbolic --force --relative ${gcc_script_path} ${bin_dir}/gcc-${gcc_version}-vars.sh || exit
done
ln --symbolic --force --relative "${gcc_bin_dir}/g++" "${bin_dir}/g++" || exit
ln --symbolic --force --relative "${gcc_bin_dir}/gcc" "${bin_dir}/gcc" || exit
cd "${root_dir}" || exit
# LLVM/Clang
# ------------------------------------------------------------------------------
llvm_version_list=()
llvm_version_list+=(11.1.0)
llvm_version_list+=(12.0.1)
llvm_version_list+=(13.0.1)
llvm_version_list+=(14.0.0)
for llvm_version in ${llvm_version_list[@]}; do
llvm_sha256=none
llvm_exe_sha256=none
if [[ "${llvm_version}" == "14.0.0" ]]; then
llvm_sha256=61582215dafafb7b576ea30cc136be92c877ba1f1c31ddbbd372d6d65622fef5
llvm_exe_sha256=3557c2deadae7e2bc3bffce4afd93ddab6ef50090971c8ce3bf15c80b27134a0
llvm_download_name=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-18.04
elif [[ "${llvm_version}" == "13.0.1" ]]; then
llvm_sha256=84a54c69781ad90615d1b0276a83ff87daaeded99fbc64457c350679df7b4ff0
llvm_exe_sha256=ae47e6cc9f6d95f7a39e4800e511b7bdc3f55464ca79e45cd63cbd8a862a82a1
llvm_download_name=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-18.04
elif [[ "${llvm_version}" == "12.0.1" ]]; then
llvm_sha256=6b3cc55d3ef413be79785c4dc02828ab3bd6b887872b143e3091692fc6acefe7
llvm_exe_sha256=329bba976c0cef38863129233a4b0939688eae971c7a606d41dd0e5a53d53455
llvm_download_name=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-16.04
elif [[ "${llvm_version}" == "11.1.0" ]]; then
llvm_sha256=c691a558967fb7709fb81e0ed80d1f775f4502810236aa968b4406526b43bee1
llvm_exe_sha256=656bfde194276cee81dc8a7a08858313c5b5bdcfa18ac6cd6116297af2f65148
llvm_download_name=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-16.04
fi
llvm_download_file=${llvm_download_name}.tar.xz
llvm_download_path=${downloads_dir}/${llvm_download_name}.tar.xz
llvm_dir=${tools_dir}/llvm_linux64_${llvm_version}
llvm_exe=${llvm_dir}/bin/clang
if [[ ! -f "${llvm_exe}" ]]; then
DownloadFile "https://github.com/llvm/llvm-project/releases/download/llvmorg-${llvm_version}/${llvm_download_file}" "${llvm_download_path}" || exit
FileSHA256Check "${llvm_download_path}" "${llvm_sha256}" || exit
mkdir --parents "${llvm_dir}" && tar xf "${llvm_download_path}" --skip-old-files --directory="${llvm_dir}" || exit
if [[ "${llvm_version}" == "12.0.1" ]]; then
# NOTE: There was a distribution bug in v12.0.1 where the folder was misnamed
mv ${llvm_dir}/clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-/* ${llvm_dir} || exit
rm --recursive ${llvm_dir}/clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu- || exit
else
mv ${llvm_dir}/${llvm_download_name}/* ${llvm_dir} || exit
rm --recursive ${llvm_dir}/${llvm_download_name} || exit
fi
fi
FileSHA256Check "${llvm_exe}" "${llvm_exe_sha256}" || exit
cd "${llvm_dir}/bin" && find . -type f,l -exec ln --force --symbolic --relative "{}" "${bin_dir}/{}-${llvm_version}" ';' && cd "${root_dir}"
done
cd "${llvm_dir}/bin" && find . -type f,l -exec ln --force --symbolic --relative "{}" "${bin_dir}/" ';' && cd "${root_dir}"
# gf
# ------------------------------------------------------------------------------
gf_dir=${tools_dir}/gf
if [[ ! -d "${gf_dir}" ]]; then
git clone https://github.com/nakst/gf "${tools_dir}/gf" || exit
fi
cd "${tools_dir}/gf" || exit
git checkout master
# Use our custom G++ because I typically run Ubuntu 18.04 which uses G++7
# which is too old to compile GF.
#PATH=${gcc_bin_dir}:${PATH} ./build.sh || exit
#ln --force --symbolic --relative "gf2" "${bin_dir}"
cd "${root_dir}"
# Vim Configuration
# ------------------------------------------------------------------------------
cp --force ${installer_dir}/os_vimrc ~/.vimrc || exit
cp --force ${installer_dir}/os_clang_format_style_file ~/_clang-format || exit
# Nvim Config
nvim_init_dir=~/.config/nvim
mkdir --parents "${nvim_init_dir}"
cp --force ${installer_dir}/os_nvim_init.vim ${nvim_init_dir}/init.vim || exit
# Vim Package Manager
vim_plug_dir=${nvim_init_dir}/autoload
vim_plug=${vim_plug_dir}/plug.vim
mkdir --parents ${vim_plug_dir}
DownloadFile "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" "${vim_plug}" || exit
# nodejs
# ----------------------------------------------------------------------------
nodejs_sha256=f0867d7a17a4d0df7dbb7df9ac3f9126c2b58f75450647146749ef296b31b49b
nodejs_exe_sha256=8fdc420e870ef9aa87dc8c1b7764fccb8229b6896f112b699afeeefeb0021714
nodejs_version=16.17.0
nodejs_download_name=node-v${nodejs_version}-linux-x64
nodejs_download_file=${nodejs_download_name}.tar.xz
nodejs_download_path=${downloads_dir}/${nodejs_download_file}
nodejs_dir=${tools_dir}/nodejs_linux64_${nodejs_version}
nodejs_exe=${nodejs_dir}/bin/node
if [[ ! -f "${nodejs_exe}" ]]; then
DownloadFile "https://nodejs.org/dist/v${nodejs_version}/${nodejs_download_file}" ${nodejs_download_path} || exit
FileSHA256Check ${nodejs_download_path} ${nodejs_sha256} || exit
mkdir --parents "${nodejs_dir}" && tar xf "${nodejs_download_path}" --skip-old-files --directory="${nodejs_dir}" || exit
mv ${nodejs_dir}/${nodejs_download_name}/* "${nodejs_dir}" || exit
rm --recursive ${nodejs_dir}/${nodejs_download_name}
fi
FileSHA256Check ${nodejs_exe} ${nodejs_exe_sha256} || exit
ln --force --symbolic --relative "${nodejs_exe}" "${bin_dir}/node" || exit
ln --force --symbolic --relative "${nodejs_dir}/bin/npm" "${bin_dir}/npm" || exit
# Nvim
# ------------------------------------------------------------------------------
nvim_sha256=33b5d020c730b6d1b5185b1306ead83b6b8f8fab0239e0580c72b5224a9658e1
nvim_version=0.7.2
nvim_label=nvim_linux64_${nvim_version}
nvim_exe=${tools_dir}/nvim_linux64_${nvim_version}.AppImage
DownloadFile "https://github.com/neovim/neovim/releases/download/v${nvim_version}/nvim.appimage" "${nvim_exe}" || exit
FileSHA256Check "${nvim_exe}" "${nvim_sha256}" || exit
chmod +x "${nvim_exe}"
ln --force --symbolic --relative "${nvim_exe}" "${bin_dir}/nvim"
ln --force --symbolic --relative "${nvim_exe}" "${bin_dir}/vim"
# Neovide
# ----------------------------------------------------------------------------
neovide_sha256=684cbcaeb2e67f1d95822ef80e03e1475395d537f2032f47b8202fe48c428b08
neovide_exe_sha256=e4fbc8b56af2e25127938ae2974921e25b4df5722086d7e8c3e517e8ee86e2df
neovide_version=0.9.0
neovide_download_name=neovide
neovide_download_file=${neovide_download_name}.tar.gz
neovide_download_path=${downloads_dir}/${neovide_download_name}.tar.gz
neovide_dir=${tools_dir}
neovide_exe=${neovide_dir}/neovide_linux64_${neovide_version}
if [[ ! -f "${neovide_exe}" ]]; then
DownloadFile "https://github.com/neovide/neovide/releases/download/${neovide_version}/${neovide_download_file}" ${neovide_download_path} || exit
FileSHA256Check ${neovide_download_path} ${neovide_sha256} || exit
mkdir --parents ${neovide_dir}/neovide-tmp && tar xf ${neovide_download_path} --skip-old-files --directory=${neovide_dir}/neovide-tmp || exit
mv ${neovide_dir}/neovide-tmp/target/release/neovide "${neovide_exe}" || exit
rm -rf ${neovide_dir}/neovide-tmp
fi
FileSHA256Check ${neovide_exe} ${neovide_exe_sha256} || exit
ln --force --symbolic --relative "${neovide_exe}" "${bin_dir}/neovide"
# Python 3
# ------------------------------------------------------------------------------
python_sha256=460f87a389be28c953c24c6f942f172f9ce7f331367b4daf89cb450baedd51d7
python_exe_sha256=1400cb8f2cf2f606d1c87c1edb69ea1b3479b4c2bfb5c438a4828903a1d6f9f8
python_version=3.10.5
python_download_name=cpython-${python_version}+20220630-x86_64-unknown-linux-gnu-install_only
python_download_file=${python_download_name}.tar.gz
python_download_path=${downloads_dir}/${python_download_file}
python_dir=${tools_dir}/python_linux64_${python_version}
python_exe=${python_dir}/bin/python3
if [[ ! -f "${python_exe}" ]]; then
DownloadFile "https://github.com/indygreg/python-build-standalone/releases/download/20220630/${python_download_file}" "${python_download_path}" || exit
FileSHA256Check "${python_download_path}" "${python_sha256}" || exit
mkdir --parents "${python_dir}" && tar xf "${python_download_path}" --skip-old-files --directory="${python_dir}" || exit
mv --force ${python_dir}/python/* "${python_dir}" || exit
rm --recursive ${python_dir}/python || exit
fi
FileSHA256Check "${python_dir}/bin/python3" "${python_exe_sha256}" || exit
ln --force --symbolic --relative "${python_dir}/bin/python3" "${bin_dir}"
ln --force --symbolic --relative "${python_dir}/bin/python3" "${bin_dir}/python-${python_version}"
ln --force --symbolic --relative "${python_dir}/bin/pip" "${bin_dir}"
ln --force --symbolic --relative "${python_dir}/bin/pip" "${bin_dir}/pip-${python_version}"
${python_dir}/bin/pip install pynvim cmake-language-server
# Ripgrep
# ------------------------------------------------------------------------------
ripgrep_sha256=ee4e0751ab108b6da4f47c52da187d5177dc371f0f512a7caaec5434e711c091
ripgrep_exe_sha256=4ef156371199b3ddac1bf584e0e52b1828279af82e4ea864b4d9c816adb5db40
ripgrep_version=13.0.0
ripgrep_download_name=ripgrep-${ripgrep_version}-x86_64-unknown-linux-musl
ripgrep_download_file=${ripgrep_download_name}.tar.gz
ripgrep_download_path=${downloads_dir}/${ripgrep_download_file}
ripgrep_dir=${tools_dir}/ripgrep_linux64_${ripgrep_version}
ripgrep_exe=${ripgrep_dir}/rg
if [[ ! -f "${ripgrep_exe}" ]]; then
DownloadFile "https://github.com/BurntSushi/ripgrep/releases/download/${ripgrep_version}/${ripgrep_download_file}" "${ripgrep_download_path}" || exit
FileSHA256Check "${ripgrep_download_path}" "${ripgrep_sha256}" || exit
mkdir --parents "${ripgrep_dir}" && tar xf "${ripgrep_download_path}" --skip-old-files --directory="${ripgrep_dir}" || exit
mv ${ripgrep_dir}/${ripgrep_download_name}/* "${ripgrep_dir}" || exit
rm --recursive ${ripgrep_dir}/${ripgrep_download_name} || exit
fi
FileSHA256Check "${ripgrep_exe}" "${ripgrep_exe_sha256}" || exit
ln --force --symbolic --relative "${ripgrep_exe}" "${bin_dir}"
# wezterm
# ------------------------------------------------------------------------------
wezterm_sha256=4de3cd65b7d7ae0c72a691597bd3def57c65f07fe4a7c98b447b8a9dc4d0adf0
wezterm_version=20220624-141144-bd1b7c5d
wezterm_download_name=WezTerm-${wezterm_version}-Ubuntu18.04
wezterm_download_file=${wezterm_download_name}.AppImage
wezterm_exe=${tools_dir}/wezterm_linux64_${wezterm_version}.AppImage
DownloadFile "https://github.com/wez/wezterm/releases/download/${wezterm_version}/${wezterm_download_file}" ${wezterm_exe} || exit
FileSHA256Check "${wezterm_exe}" "${wezterm_sha256}" || exit
chmod +x "${wezterm_exe}"
cp --force ${installer_dir}/os_wezterm.lua ~/.wezterm.lua
# Ctags
# ------------------------------------------------------------------------------
rm --force ${bin_dir}/ctags_cpp.sh
echo ctags --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ \$\@ >> ${bin_dir}/ctags_cpp.sh
chmod +x ${bin_dir}/ctags_cpp.sh
# Linux Terminal
# ------------------------------------------------------------------------------
echo \#!/usr/bin/env bash> ${tools_dir}/linux_terminal.sh
echo PATH=${tools_dir}/Binaries:\$\{PATH\}>> ${tools_dir}/linux_terminal.sh
echo PATH=\$\{PATH\}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin>> ${tools_dir}/linux_terminal.sh
echo [[ -d /usr/lib/wsl/lib ]] \&\& PATH=\$\{PATH\}:/usr/lib/wsl/lib>> ${tools_dir}/linux_terminal.sh
echo [[ -d /snap/bin ]] \&\& PATH=\$\{PATH\}:/snap/bin>> ${tools_dir}/linux_terminal.sh
+385
View File
@@ -0,0 +1,385 @@
#!/usr/bin/env python3
# This script has been gratefully sourced from Martins Mozeiko of HMN
# https://gist.github.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977
#
# Further modifications by https://github.com/doy-lee with the primary purpose
# of facilitating multiple versions to be stored in the same root directory
# ('Redist' in the SDK was unversioned, store it versioned like all other
# folders, skip the downloading of MSVC or the SDK if we only need one of them).
#
# Changelog
# 2023-04-15
# - Fix "msvc-{version}.bat" script generating trailing "\;" on
# VCToolsInstallDir environment variable. clang-cl relies on this variable to
# identify the location of the Visual Studio toolchain or otherwise reports a
# program invocation error during the linking stage.
#
# 2023-01-30
# - Generate the short-hand version of the msvc-{version}.bat and
# win-sdk-{version}.bat using the versions passed as the argument parameter.
# - Fix win-sdk-{version}.bat overwriting the INCLUDE and LIB environment
# variables instead of appending.
#
# 2023-01-28
# - Inital revision from mmozeiko
# https://gist.github.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977/6863f19cb98b933c7535acf3d59ac64268c6bd1b
# - Add individual scripts to source variables for MSVC and Windows 10
# separately "msvc-{version}.bat" and "win-sdk-{version}.bat"
# - Add '--no-sdk' and '--no-msvc' to prevent the download and installation of
# the Windows SDK and MSVC respectively.
# - Installation used to create 'Windows Kit/10/Redist' and unpack a D3D and MBN
# folder without being versioned. These folders are now placed under
# a versioned sub-directory to preserve the binaries and allow subsequent
# side-by-side installation of other versions of the SDK.
import io
import os
import sys
import json
import shutil
import hashlib
import zipfile
import tempfile
import argparse
import subprocess
import urllib.request
from pathlib import Path
OUTPUT = Path("msvc") # output folder
# other architectures may work or may not - not really tested
HOST = "x64" # or x86
TARGET = "x64" # or x86, arm, arm64
MANIFEST_URL = "https://aka.ms/vs/17/release/channel"
def download(url):
with urllib.request.urlopen(url) as res:
return res.read()
def download_progress(url, check, name, f):
data = io.BytesIO()
with urllib.request.urlopen(url) as res:
total = int(res.headers["Content-Length"])
size = 0
while True:
block = res.read(1<<20)
if not block:
break
f.write(block)
data.write(block)
size += len(block)
perc = size * 100 // total
print(f"\r{name} ... {perc}%", end="")
print()
data = data.getvalue()
digest = hashlib.sha256(data).hexdigest()
if check.lower() != digest:
exit(f"Hash mismatch for f{pkg}")
return data
# super crappy msi format parser just to find required .cab files
def get_msi_cabs(msi):
index = 0
while True:
index = msi.find(b".cab", index+4)
if index < 0:
return
yield msi[index-32:index+4].decode("ascii")
def first(items, cond):
return next(item for item in items if cond(item))
### parse command-line arguments
ap = argparse.ArgumentParser()
ap.add_argument("--show-versions", const=True, action="store_const", help="Show available MSVC and Windows SDK versions")
ap.add_argument("--accept-license", const=True, action="store_const", help="Automatically accept license")
ap.add_argument("--msvc-version", help="Get specific MSVC version")
ap.add_argument("--sdk-version", help="Get specific Windows SDK version")
ap.add_argument("--no-msvc", const=True, action="store_const", help="Skip download and installing of msvc")
ap.add_argument("--no-sdk", const=True, action="store_const", help="Skip download and installing of Windows SDK")
args = ap.parse_args()
### get main manifest
manifest = json.loads(download(MANIFEST_URL))
### download VS manifest
vs = first(manifest["channelItems"], lambda x: x["id"] == "Microsoft.VisualStudio.Manifests.VisualStudio")
payload = vs["payloads"][0]["url"]
vsmanifest = json.loads(download(payload))
### find MSVC & WinSDK versions
packages = {}
for p in vsmanifest["packages"]:
packages.setdefault(p["id"].lower(), []).append(p)
msvc = {}
sdk = {}
for pid,p in packages.items():
if pid.startswith("Microsoft.VisualStudio.Component.VC.".lower()) and pid.endswith(".x86.x64".lower()):
pver = ".".join(pid.split(".")[4:6])
if pver[0].isnumeric():
msvc[pver] = pid
elif pid.startswith("Microsoft.VisualStudio.Component.Windows10SDK.".lower()) or \
pid.startswith("Microsoft.VisualStudio.Component.Windows11SDK.".lower()):
pver = pid.split(".")[-1]
if pver.isnumeric():
sdk[pver] = pid
if args.show_versions:
print("MSVC versions:", " ".join(sorted(msvc.keys())))
print("Windows SDK versions:", " ".join(sorted(sdk.keys())))
exit(0)
install_sdk = not args.no_sdk
install_msvc = not args.no_msvc
if args.no_sdk and args.no_msvc:
exit()
msvc_ver = args.msvc_version or max(sorted(msvc.keys()))
sdk_ver = args.sdk_version or max(sorted(sdk.keys()))
info_line = "Downloading"
if install_msvc:
if msvc_ver in msvc:
msvc_pid = msvc[msvc_ver]
msvc_ver = ".".join(msvc_pid.split(".")[4:-2])
else:
exit(f"Unknown MSVC version: f{args.msvc_version}")
info_line += f" MSVC v{msvc_ver}"
if install_sdk:
if sdk_ver in sdk:
sdk_pid = sdk[sdk_ver]
else:
exit(f"Unknown Windows SDK version: f{args.sdk_version}")
info_line += f" Windows SDK v{sdk_ver}"
print(info_line)
### agree to license
tools = first(manifest["channelItems"], lambda x: x["id"] == "Microsoft.VisualStudio.Product.BuildTools")
resource = first(tools["localizedResources"], lambda x: x["language"] == "en-us")
license = resource["license"]
if not args.accept_license:
accept = input(f"Do you accept Visual Studio license at {license} [Y/N] ? ")
if not accept or accept[0].lower() != "y":
exit(0)
OUTPUT.mkdir(exist_ok=True)
total_download = 0
### download MSVC
if install_msvc:
msvc_packages = [
# MSVC binaries
f"microsoft.vc.{msvc_ver}.tools.host{HOST}.target{TARGET}.base",
f"microsoft.vc.{msvc_ver}.tools.host{HOST}.target{TARGET}.res.base",
# MSVC headers
f"microsoft.vc.{msvc_ver}.crt.headers.base",
# MSVC libs
f"microsoft.vc.{msvc_ver}.crt.{TARGET}.desktop.base",
f"microsoft.vc.{msvc_ver}.crt.{TARGET}.store.base",
# MSVC runtime source
f"microsoft.vc.{msvc_ver}.crt.source.base",
# ASAN
f"microsoft.vc.{msvc_ver}.asan.headers.base",
f"microsoft.vc.{msvc_ver}.asan.{TARGET}.base",
# MSVC redist
#f"microsoft.vc.{msvc_ver}.crt.redist.x64.base",
]
for pkg in msvc_packages:
p = first(packages[pkg], lambda p: p.get("language") in (None, "en-US"))
for payload in p["payloads"]:
with tempfile.TemporaryFile() as f:
data = download_progress(payload["url"], payload["sha256"], pkg, f)
total_download += len(data)
with zipfile.ZipFile(f) as z:
for name in z.namelist():
if name.startswith("Contents/"):
out = OUTPUT / Path(name).relative_to("Contents")
out.parent.mkdir(parents=True, exist_ok=True)
out.write_bytes(z.read(name))
### download Windows SDK
if install_sdk:
sdk_packages = [
# Windows SDK tools (like rc.exe & mt.exe)
f"Windows SDK for Windows Store Apps Tools-x86_en-us.msi",
# Windows SDK headers
f"Windows SDK for Windows Store Apps Headers-x86_en-us.msi",
f"Windows SDK Desktop Headers x86-x86_en-us.msi",
# Windows SDK libs
f"Windows SDK for Windows Store Apps Libs-x86_en-us.msi",
f"Windows SDK Desktop Libs {TARGET}-x86_en-us.msi",
# CRT headers & libs
f"Universal CRT Headers Libraries and Sources-x86_en-us.msi",
# CRT redist
#"Universal CRT Redistributable-x86_en-us.msi",
]
with tempfile.TemporaryDirectory() as d:
dst = Path(d)
sdk_pkg = packages[sdk_pid][0]
sdk_pkg = packages[first(sdk_pkg["dependencies"], lambda x: True).lower()][0]
msi = []
cabs = []
# download msi files
for pkg in sdk_packages:
payload = first(sdk_pkg["payloads"], lambda p: p["fileName"] == f"Installers\\{pkg}")
msi.append(dst / pkg)
with open(dst / pkg, "wb") as f:
data = download_progress(payload["url"], payload["sha256"], pkg, f)
total_download += len(data)
cabs += list(get_msi_cabs(data))
# download .cab files
for pkg in cabs:
payload = first(sdk_pkg["payloads"], lambda p: p["fileName"] == f"Installers\\{pkg}")
with open(dst / pkg, "wb") as f:
download_progress(payload["url"], payload["sha256"], pkg, f)
print("Unpacking msi files...")
# run msi installers
for m in msi:
subprocess.check_call(["msiexec.exe", "/a", m, "/quiet", "/qn", f"TARGETDIR={OUTPUT.resolve()}"])
### versions
msvcv = ""
sdkv = ""
if install_msvc:
msvcv = list((OUTPUT / "VC/Tools/MSVC").glob("*"))[0].name
if install_sdk:
sdkv = list((OUTPUT / "Windows Kits/10/bin").glob("*"))[0].name
# place debug CRT runtime into MSVC folder (not what real Visual Studio installer does... but is reasonable)
if install_msvc:
dst = str(OUTPUT / "VC/Tools/MSVC" / msvcv / f"bin/Host{HOST}/{TARGET}")
pkg = "microsoft.visualcpp.runtimedebug.14"
dbg = packages[pkg][0]
payload = first(dbg["payloads"], lambda p: p["fileName"] == "cab1.cab")
try:
with tempfile.TemporaryFile(suffix=".cab", delete=False) as f:
data = download_progress(payload["url"], payload["sha256"], pkg, f)
total_download += len(data)
subprocess.check_call(["expand.exe", f.name, "-F:*", dst], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
finally:
os.unlink(f.name)
# place the folders under the Redist folder in the SDK under a versioned folder to allow other versions to be installed
if install_sdk:
redist_dir = OUTPUT / "Windows Kits/10/Redist"
redist_versioned_dir = redist_dir / f'{sdkv}'
if not os.path.exists(redist_versioned_dir):
os.makedirs(redist_versioned_dir)
for file_name in os.listdir(redist_dir):
if not file_name.startswith('10.0.'): # Simple heuristic
shutil.move((redist_dir / file_name), redist_versioned_dir)
### cleanup
shutil.rmtree(OUTPUT / "Common7", ignore_errors=True)
if install_msvc:
for f in ["Auxiliary", f"lib/{TARGET}/store", f"lib/{TARGET}/uwp"]:
shutil.rmtree(OUTPUT / "VC/Tools/MSVC" / msvcv / f)
for f in OUTPUT.glob("*.msi"):
f.unlink()
if install_sdk:
for f in ["Catalogs", "DesignTime", f"bin/{sdkv}/chpe", f"Lib/{sdkv}/ucrt_enclave"]:
shutil.rmtree(OUTPUT / "Windows Kits/10" / f, ignore_errors=True)
for arch in ["x86", "x64", "arm", "arm64"]:
if arch != TARGET:
if install_msvc:
shutil.rmtree(OUTPUT / "VC/Tools/MSVC" / msvcv / f"bin/Host{arch}", ignore_errors=True)
if install_sdk:
shutil.rmtree(OUTPUT / "Windows Kits/10/bin" / sdkv / arch)
shutil.rmtree(OUTPUT / "Windows Kits/10/Lib" / sdkv / "ucrt" / arch)
shutil.rmtree(OUTPUT / "Windows Kits/10/Lib" / sdkv / "um" / arch)
### setup.bat
if install_msvc and install_sdk:
SETUP = f"""@echo off
set MSVC_VERSION={msvcv}
set MSVC_HOST=Host{HOST}
set MSVC_ARCH={TARGET}
set SDK_VERSION={sdkv}
set SDK_ARCH={TARGET}
set MSVC_ROOT=%~dp0VC\\Tools\\MSVC\\%MSVC_VERSION%
set SDK_INCLUDE=%~dp0Windows Kits\\10\\Include\\%SDK_VERSION%
set SDK_LIBS=%~dp0Windows Kits\\10\\Lib\\%SDK_VERSION%
set VCToolsInstallDir=%MSVC_ROOT%\\
set PATH=%MSVC_ROOT%\\bin\\%MSVC_HOST%\\%MSVC_ARCH%;%~dp0Windows Kits\\10\\bin\\%SDK_VERSION%\\%SDK_ARCH%;%~dp0Windows Kits\\10\\bin\\%SDK_VERSION%\\%SDK_ARCH%\\ucrt;%PATH%
set INCLUDE=%MSVC_ROOT%\\include;%SDK_INCLUDE%\\ucrt;%SDK_INCLUDE%\\shared;%SDK_INCLUDE%\\um;%SDK_INCLUDE%\\winrt;%SDK_INCLUDE%\\cppwinrt
set LIB=%MSVC_ROOT%\\lib\\%MSVC_ARCH%;%SDK_LIBS%\\ucrt\\%SDK_ARCH%;%SDK_LIBS%\\um\\%SDK_ARCH%
"""
(OUTPUT / "setup.bat").write_text(SETUP)
if install_msvc:
MSVC_SCRIPT = f"""@echo off
set MSVC_VERSION={msvcv}
set MSVC_HOST=Host{HOST}
set MSVC_ARCH={TARGET}
set MSVC_ROOT=%~dp0VC\\Tools\\MSVC\\%MSVC_VERSION%
set VCToolsInstallDir=%MSVC_ROOT%
set PATH=%MSVC_ROOT%\\bin\\%MSVC_HOST%\\%MSVC_ARCH%;%PATH%
set INCLUDE=%MSVC_ROOT%\\include;%INCLUDE%
set LIB=%MSVC_ROOT%\\lib\\%MSVC_ARCH%;%LIB%
"""
(OUTPUT / f"msvc-{msvcv}.bat").write_text(MSVC_SCRIPT)
(OUTPUT / f"msvc-{args.msvc_version}.bat").write_text(MSVC_SCRIPT)
if install_sdk:
WIN10_SDK_SCRIPT = f"""@echo off
set SDK_VERSION={sdkv}
set SDK_ARCH={TARGET}
set SDK_INCLUDE=%~dp0Windows Kits\\10\\Include\\%SDK_VERSION%
set SDK_LIBS=%~dp0Windows Kits\\10\\Lib\\%SDK_VERSION%
set PATH=%~dp0Windows Kits\\10\\bin\\%SDK_VERSION%\\%SDK_ARCH%;%~dp0Windows Kits\\10\\bin\\%SDK_VERSION%\\%SDK_ARCH%\\ucrt;%PATH%
set INCLUDE=%SDK_INCLUDE%\\ucrt;%SDK_INCLUDE%\\shared;%SDK_INCLUDE%\\um;%SDK_INCLUDE%\\winrt;%SDK_INCLUDE%\\cppwinrt;%INCLUDE%
set LIB=%SDK_LIBS%\\ucrt\\%SDK_ARCH%;%SDK_LIBS%\\um\\%SDK_ARCH%;%LIB%
"""
(OUTPUT / f"win-sdk-{sdkv}.bat").write_text(WIN10_SDK_SCRIPT)
(OUTPUT / f"win-sdk-{args.sdk_version}.bat").write_text(WIN10_SDK_SCRIPT)
print(f"Total downloaded: {total_download>>20} MB")
print("Done!")