diff options
| author | Ângelo Andrade Cirino <[email protected]> | 2021-07-15 23:23:48 -0300 |
|---|---|---|
| committer | Ângelo Andrade Cirino <[email protected]> | 2021-07-15 23:23:48 -0300 |
| commit | 81ad292ea67f82d88d785a37d23b1f1603996da1 (patch) | |
| tree | 817b50173948547f7e4b491da271918c67b8a5ff /scripts | |
| parent | 942c32f448d9b8a850438aa2af1de2415b7ae872 (diff) | |
| parent | 8c1141aba414c07554179cb28687124514f6e770 (diff) | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/get.ps1 | 2 | ||||
| -rwxr-xr-x | scripts/get.sh | 5 | ||||
| -rw-r--r-- | scripts/installer.nsi | 1 | ||||
| -rwxr-xr-x | scripts/makeppa | 5 | ||||
| -rw-r--r-- | scripts/man/xmake.1 | 214 | ||||
| -rw-r--r-- | scripts/man/xrepo.1 | 123 | ||||
| -rw-r--r-- | scripts/rpmbuild/SPECS/xmake.spec | 6 | ||||
| -rwxr-xr-x | scripts/xrepo.bat | 69 | ||||
| -rw-r--r-- | scripts/xrepo.ps1 | 33 |
9 files changed, 449 insertions, 9 deletions
diff --git a/scripts/get.ps1 b/scripts/get.ps1 index 4ec3df140..a189b2ba2 100755 --- a/scripts/get.ps1 +++ b/scripts/get.ps1 @@ -153,7 +153,7 @@ param ( $content = [System.Text.RegularExpressions.Regex]::Replace($content, "\n*(# PowerShell parameter completion shim for xmake)?\s*Register-ArgumentCompleter -Native -CommandName xmake -ScriptBlock\s*{.+?\n}\s*", "`n", [System.Text.RegularExpressions.RegexOptions]::Singleline) } try { - $appendcontent = (Invoke-Webrequest 'https://raw.githubusercontent.com/xmake-io/xmake/master/scripts/register-completions.ps1' -UseBasicParsing).Content + $appendcontent = (Invoke-Webrequest 'https://xmake.io/assets/scripts/pscompletions.text' -UseBasicParsing).Content } catch { writeErrorTip 'Download failed!' writeErrorTip 'Check your network or... the news of S3 break' diff --git a/scripts/get.sh b/scripts/get.sh index 3c0562aba..8363b4499 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -50,7 +50,7 @@ get_host_speed() { if [ `uname` == "Darwin" ]; then ping -c 1 -t 1 $1 2>/dev/null | egrep -o 'time=\d+' | egrep -o "\d+" || echo "65535" else - ping -c 1 -W 1 $1 2>/dev/null | egrep -o 'time=\d+' | egrep -o "\d+" || echo "65535" + ping -c 1 -W 1 $1 2>/dev/null | grep -P -o 'time=\d+' | grep -P -o "\d+" || echo "65535" fi } @@ -153,11 +153,12 @@ install_tools() { yum --version >/dev/null 2>&1 && $sudoprefix yum install -y git readline-devel ccache && $sudoprefix yum groupinstall -y 'Development Tools'; } || { zypper --version >/dev/null 2>&1 && $sudoprefix zypper --non-interactive install git readline-devel ccache && $sudoprefix zypper --non-interactive install -t pattern devel_C_C++; } || { pacman -V >/dev/null 2>&1 && $sudoprefix pacman -S --noconfirm --needed git base-devel ccache; } || + { emerge -V >/dev/null 2>&1 && $sudoprefix emerge -atv dev-vcs/git ccache; } || { pkg list-installed >/dev/null 2>&1 && $sudoprefix pkg install -y git getconf build-essential readline ccache; } || # termux { pkg help >/dev/null 2>&1 && $sudoprefix pkg install -y git readline ccache ncurses; } || # freebsd { apk --version >/dev/null 2>&1 && $sudoprefix apk add git gcc g++ make readline-dev ncurses-dev libc-dev linux-headers; } } -test_tools || { install_tools && test_tools; } || my_exit "$(echo -e 'Dependencies Installation Fail\nThe getter currently only support these package managers\n\t* apt\n\t* yum\n\t* zypper\n\t* pacman\nPlease install following dependencies manually:\n\t* git\n\t* build essential like `make`, `gcc`, etc\n\t* libreadline-dev (readline-devel)\n\t* ccache (optional)')" 1 +test_tools || { install_tools && test_tools; } || my_exit "$(echo -e 'Dependencies Installation Fail\nThe getter currently only support these package managers\n\t* apt\n\t* yum\n\t* zypper\n\t* pacman\n\t* portage\nPlease install following dependencies manually:\n\t* git\n\t* build essential like `make`, `gcc`, etc\n\t* libreadline-dev (readline-devel)\n\t* ccache (optional)')" 1 projectdir=$tmpdir if [ 'x__local__' = "x$branch" ]; then if [ -d '.git' ]; then diff --git a/scripts/installer.nsi b/scripts/installer.nsi index 4f12aebea..a01b6feea 100644 --- a/scripts/installer.nsi +++ b/scripts/installer.nsi @@ -237,6 +237,7 @@ Section "XMake (required)" InstallExeutable File "..\*.md" File "..\core\build\xmake.exe" File "..\scripts\xrepo.bat" + File "..\scripts\xrepo.ps1" File /r /x ".DS_Store" "..\winenv" WriteUninstaller "uninstall.exe" diff --git a/scripts/makeppa b/scripts/makeppa index 0af565bc9..3f447958d 100755 --- a/scripts/makeppa +++ b/scripts/makeppa @@ -67,7 +67,7 @@ cat debian/changelog # build package echo "building package .." -debuild -S -k2C0C68C9 +debuild -S -k02713554FA2CE4AADA20AB23167A22F22C0C68C9 # check package echo "checking package .." @@ -117,3 +117,6 @@ rm -rf xmake-ppa # gpg --keyserver keyserver.ubuntu.com --recv 2C0C68C9 # gpg --export --armor 2C0C68C9 | sudo apt-key add - # +# show long key +# gpg --keyid-format long --list-keys [email protected] +# diff --git a/scripts/man/xmake.1 b/scripts/man/xmake.1 new file mode 100644 index 000000000..eca67ddca --- /dev/null +++ b/scripts/man/xmake.1 @@ -0,0 +1,214 @@ +.TH "xmake" "1" +.SH NAME +xmake \- cross-platform build utility based on Lua + + +.SH SYNOPSIS +.B xmake +.RI [ task "] [" options "] [" target ] + + +.SH DESCRIPTION +.B xmake +is a lightweight cross-platform build utility based on Lua. It uses +.I xmake.lua +to maintain project builds. Compared with +.IR makefile / CMakeLists.txt , +the configuration syntax is more concise and intuitive. It is very friendly to +novices and can quickly get started in a short time. Let users focus more on +actual project development. + + +.SH ACTIONS + +.TP +.B b, build +Build targets if no given tasks. + +.TP +.B u, uninstall +Uninstall the project binary files. + +.TP +.B p, package +Package target. + +.TP +.B r, run +Run the project target. + +.TP +.B g, global +Configure the global options for xmake. + +.TP +.B i, install +Package and install the target binary files. + +.TP +.B c, clean +Remove all binary and temporary files. + +.TP +.B create +Create a new project. + +.TP +.B q, require +Install and update required packages. + +.TP +.B update +Update and uninstall the xmake program. + +.TP +.B f, config +Configure the project. + + +.SH PLUGINS + +.TP +.B plugin +Manage plugins of xmake. + +.TP +.B m, macro +Run the given macro. + +.TP +.B doxygen +Generate the doxygen document. + +.TP +.B l, lua +Run the lua script. + +.TP +.B repo +Manage package repositories. + +.TP +.B service +Start service for remote or distributed compilation and etc. (Experimental, still in development) + +.TP +.B project +Generate the project file. + +.TP +.B show +Show the given project information. + + +.SH OPTIONS + +.TP +.B \-q, \-\-quiet +Quiet operation. + +.TP +.B \-y, \-\-yes +Input yes by default if need user confirm. + +.TP +.BR \-\-confirm =\fICONFIRM +Input the given result if need user confirm. + \- yes + \- no + \- def + +.TP +.B \-v, \-\-verbose +Print lots of verbose information for users. + +.TP +.B \-\-root +Allow to run xmake as root. + +.TP +.B \-D, \-\-diagnosis +Print lots of diagnosis information (backtrace, check info ..) only for developers. +And we can append \fB\-v\fR to get more whole information. + e.g. $ xmake \-vD + +.TP +.B \-\-version +Print the version number and exit. + +.TP +.B \-h, \-\-help +Print this help message and exit. + +.TP +.BI \-F " FILE" ", \-\-file\fR=" FILE +Read a given +.B xmake.lua +file. + +.TP +.BI \-P " PROJECT" ", \-\-project\fR=" PROJECT +Change to the given project directory. +Search priority: + 1. The Given Command Argument + 2. The Envirnoment Variable: \fBXMAKE_PROJECT_DIR\fR + 3. The Current Directory + + +.SH BUILD OPTIONS + +.TP +.B \-b, \-\-build +Build target. This is default building mode and optional. + +.TP +.B \-r, \-\-rebuild +Rebuild the target. + +.TP +.B \-a, \-\-all +Build all targets. + +.TP +.B \-\-dry\-run +Dry run to build target. + +.TP +.BI \-j " JOBS" ", \-\-jobs\fR=" JOBS +Specifies the number of jobs to build simultaneously. (default: 6) + +.TP +.B \-w, \-\-warning +Enable the warnings output. + +.TP +.BI \-\-files= FILES +Build the given source files. + +e.g. +.RS +.EX + \- xmake \-\-files=src/main.c + \- xmake \-\-files='src/*.c' [target] + \- xmake \-\-files='src/**c|excluded_file.c' + \- xmake \-\-files='src/main.c:src/test.c' +.EE +.RE + +.TP +.B target +The target name. It will build all default targets if this parameter is not specified. + + +.SH AUTHOR +.B xmake +is written by +.MT waruqi@\:gmail.com +ruki +.ME . + +This manual page was written by +.MT mmyangfl@\:gmail.com +Yangfl +.ME +for the Debian Project (and may be used by others). diff --git a/scripts/man/xrepo.1 b/scripts/man/xrepo.1 new file mode 100644 index 000000000..7106ea830 --- /dev/null +++ b/scripts/man/xrepo.1 @@ -0,0 +1,123 @@ +.TH "xrepo" "1" +.SH NAME +xrepo \- cross-platform build utility based on Lua + + +.SH SYNOPSIS +.B xrepo +.RI [ action "] [" options ] + + +.SH DESCRIPTION +.B xrepo +is a lightweight cross-platform build utility based on Lua. It uses +.I xrepo.lua +to maintain project builds. Compared with +.IR makefile / CMakeLists.txt , +the configuration syntax is more concise and intuitive. It is very friendly to +novices and can quickly get started in a short time. Let users focus more on +actual project development. + + +.SH ACTIONS + +.TP +.B clean +Clear all package caches and remove all not\-referenced packages. + +.TP +.B env +Set environment and execute command, or print environment. + +.TP +.B export +Export the given packages. + +.TP +.B fetch +Fetch library information of the given installed packages. + +.TP +.B import +Import the given packages. + +.TP +.B info +Show information of the given packages. + +.TP +.B install +Install the given packages. + +.TP +.B remove +Remove the given packages. + +.TP +.B scan +Scan the given or all installed packages. + +.TP +.B search +Search the given packages. + +.TP +.B add\-repo +Add the given remote repository url. + +.TP +.B list\-repo +List all remote repositories. + +.TP +.B rm\-repo +Remove the given remote repository. + +.TP +.B update\-repo +Update all local repositories from remote. + + +.SH OPTIONS + +.TP +.B \-q, \-\-quiet +Quiet operation. + +.TP +.B \-y, \-\-yes +Input yes by default if need user confirm. + +.TP +.B \-\-root +Allow to run xrepo as root. + +.TP +.B \-v, \-\-verbose +Print lots of verbose information for users. + +.TP +.B \-D, \-\-diagnosis +Print lots of diagnosis information. + +.TP +.B \-\-version +Print the version number and exit. + +.TP +.B \-h, \-\-help +Print this help message and exit. + + +.SH AUTHOR +.B xrepo +is written by +.MT waruqi@\:gmail.com +ruki +.ME . + +This manual page was written by +.MT mmyangfl@\:gmail.com +Yangfl +.ME +for the Debian Project (and may be used by others). diff --git a/scripts/rpmbuild/SPECS/xmake.spec b/scripts/rpmbuild/SPECS/xmake.spec index 5dce75406..9887176bc 100644 --- a/scripts/rpmbuild/SPECS/xmake.spec +++ b/scripts/rpmbuild/SPECS/xmake.spec @@ -1,5 +1,5 @@ -%define xmake_revision a1d830ffded196bd9af49376f4b50e374c4470ec -%define tbox_revision d27f2807173dbc787582b6169e8e854a0ef396fc +%define xmake_revision c44aea875ce6bde152a1bd2d92fec3fd9ca6b223 +%define tbox_revision 5ef932750ede0b90867fd4afdcf1deed2464c82b %define sv_revision 9a3cf7c8e589de4f70378824329882c4a047fffc %define lua_cjson_revision 515bab6d6d80b164b94db73af69609ea02f3a798 %define luajit_revision e9af1abec542e6f9851ff2368e7f196b6382a44c @@ -7,7 +7,7 @@ %undefine _disable_source_fetch Name: xmake -Version: 2.3.9 +Version: 2.5.5 Release: 1%{?dist} Summary: A cross-platform build utility based on Lua BuildArch: noarch diff --git a/scripts/xrepo.bat b/scripts/xrepo.bat index ff95b722a..c8714a11c 100755 --- a/scripts/xrepo.bat +++ b/scripts/xrepo.bat @@ -1,2 +1,67 @@ -@echo off -xmake lua private.xrepo %* +@set "XMAKE_EXE=xmake" + +@if [%1]==[env] ( + if [%2]==[quit] ( + if defined XMAKE_PROMPT_BACKUP ( + call %XMAKE_ENV_BACKUP% + setlocal EnableDelayedExpansion + if !errorlevel! neq 0 exit /B !errorlevel! + endlocal + set PROMPT=%XMAKE_PROMPT_BACKUP% + set XMAKE_ENV_BACKUP= + set XMAKE_PROMPT_BACKUP= + ) + goto :ENDXREPO + ) + if [%2]==[shell] ( + if defined XMAKE_PROMPT_BACKUP ( + call %XMAKE_ENV_BACKUP% + setlocal EnableDelayedExpansion + if !errorlevel! neq 0 exit /B !errorlevel! + %XMAKE_EXE% lua private.xrepo.action.env.info config + if !errorlevel! neq 0 ( + exit /B !errorlevel! + ) + @%XMAKE_EXE% lua private.xrepo.action.env.info prompt 1>nul + if !errorlevel! neq 0 ( + echo error: xmake.lua not found^^! + exit /B !errorlevel! + ) + endlocal + set PROMPT=%XMAKE_PROMPT_BACKUP% + set XMAKE_ENV_BACKUP= + set XMAKE_PROMPT_BACKUP= + echo Please rerun `xrepo env shell` to enter the environment. + exit /B 1 + ) else ( + setlocal EnableDelayedExpansion + %XMAKE_EXE% lua private.xrepo.action.env.info config + if !errorlevel! neq 0 ( + exit /B !errorlevel! + ) + @%XMAKE_EXE% lua private.xrepo.action.env.info prompt 1>nul + if !errorlevel! neq 0 ( + echo error: xmake.lua not found^^! + exit /B !errorlevel! + ) + endlocal + for /f %%i in ('@%XMAKE_EXE% lua private.xrepo.action.env.info prompt') do @( + @set "PROMPT=%%i %PROMPT%" + ) + @set XMAKE_PROMPT_BACKUP=%PROMPT% + ) + for /f %%i in ('@%XMAKE_EXE% lua private.xrepo.action.env.info envfile') do @( + @set "XMAKE_ENV_BACKUP=%%i.bat" + @"%XMAKE_EXE%" lua private.xrepo.action.env.info backup.cmd 1>"%%i.bat" + ) + for /f %%i in ('@%XMAKE_EXE% lua private.xrepo.action.env.info envfile') do @( + @"%XMAKE_EXE%" lua private.xrepo.action.env.info script.cmd 1>"%%i.bat" + call "%%i.bat" + ) + goto :ENDXREPO + ) +) + +@call %XMAKE_EXE% lua private.xrepo %* + +:ENDXREPO diff --git a/scripts/xrepo.ps1 b/scripts/xrepo.ps1 new file mode 100644 index 000000000..a821d8057 --- /dev/null +++ b/scripts/xrepo.ps1 @@ -0,0 +1,33 @@ +$script:SCRIPT_PATH = $myinvocation.mycommand.path +$script:BASE_DIR = Split-Path $SCRIPT_PATH -Parent +$Env:XMAKE_EXE = Join-Path $BASE_DIR xmake.exe + + +if ($Args.Count -eq 0) { + # No args, just call the underlying xmake executable. + & $Env:XMAKE_EXE lua private.xrepo; +} else { + $Command = $Args[0]; + if (($Command -eq "env") -and ($Args.Count -ge 2)) { + switch ($Args[1]) { + "shell" { + if (-not (Test-Path 'Env:XMAKE_ROOTDIR')) { + $Env:XMAKE_ROOTDIR = $BASE_DIR; + Import-Module "$Env:XMAKE_ROOTDIR\scripts\xrepo-hook.psm1"; + Add-XrepoEnvironmentToPrompt; + } + if ((Test-Path 'Env:XMAKE_PROMPT_MODIFIER') -and ($Env:XMAKE_PROMPT_MODIFIER -ne "")) { + Exit-XrepoEnvironment; + } + Enter-XrepoEnvironment; + return; + } + "quit" { + Exit-XrepoEnvironment; + return; + } + } + } + + & $Env:XMAKE_EXE lua private.xrepo $Args; +} |
