summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2015-04-28 18:20:48 +0800
committerruki <[email protected]>2015-04-28 18:20:48 +0800
commit3dfa09ba04c127a68d47b6144b586006a95b6820 (patch)
tree0e22df47217df9d98f51276a6a7be143d0dde338
parent43e612143df1333bc3e5d0d86c6c21619b9031d0 (diff)
impl install.bat
-rwxr-xr-x.gitignore1
-rwxr-xr-xinstall8
-rw-r--r--install.bat50
-rwxr-xr-xtools/dtreg.exebin0 -> 73728 bytes
4 files changed, 49 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 92f7560bd..f9537cc25 100755
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@ gmon.out
other
tags
doc
+install.log
core/bin
core/pre
core/tool/msys
diff --git a/install b/install
index ca8537bf3..1a936d3db 100755
--- a/install
+++ b/install
@@ -35,13 +35,14 @@ if [ $plat = "linux" ] || [ $plat = "mac" ]; then
fi
# compile xmake-core
+echo compiling xmake-core...
cd ./core
if [ -f .config.mak ]; then
rm .config.mak
fi
-make f DEBUG=$debug
+make f DEBUG=$debug > ../install.log
if [ $? -ne 0 ]; then exit; fi
-make r
+make r >> ../install.log
if [ $? -ne 0 ]; then exit; fi
cd ..
@@ -75,3 +76,6 @@ xmake_loader_install=/usr/local/bin/xmake
sudo mv $xmake_loader $xmake_loader_install
sudo chmod 777 $xmake_loader_install
if [ $? -ne 0 ]; then exit; fi
+
+# ok
+echo ok!
diff --git a/install.bat b/install.bat
index 208290cbc..e4e0d4db6 100644
--- a/install.bat
+++ b/install.bat
@@ -1,5 +1,24 @@
@echo off
+rem get the admin permissions
+>nul 2>&1 "%systemroot%\system32\cacls.exe" "%systemroot%\system32\config\system"
+if '%errorlevel%' neq '0' (
+ echo requesting administrative privileges...
+ goto uac_prompt
+) else ( goto got_admin )
+
+:uac_prompt
+ echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
+ echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
+
+ "%temp%\getadmin.vbs"
+ exit -B
+
+:got_admin
+ if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
+ pushd "%cd%"
+ cd /D "%~dp0"
+
rem create the xmake install directory
if %PROCESSOR_ARCHITECTURE%==x86_64 (
set xmake_dir_install_default=C:\Program Files (x86^)\xmake
@@ -11,19 +30,34 @@ set /p xmake_dir_install=(default: %xmake_dir_install_default%):
if "%xmake_dir_install%"=="" set xmake_dir_install=%xmake_dir_install_default%
if not exist "%xmake_dir_install%" mkdir "%xmake_dir_install%"
+rem compile xmake-core
+echo compiling xmake-core...
+cd core
+cmd /K build.bat > ..\install.log
+cd ..
+
rem install the xmake core file
set xmake_core=core\bin\demo.pkg\bin\msvc\x86\demo.exe
-set xmake_core_install=%xmake_dir_install%\xmake.exe
-copy /Y "%xmake_core%" "%xmake_core_install%"
+set xmake_core_install=%xmake_dir_install%\xmake_core.exe
+copy /Y "%xmake_core%" "%xmake_core_install%" >> install.log
rem install the xmake directory
-xcopy "xmake\" "%xmake_dir_install%"
+xcopy /S /Q /Y "xmake" "%xmake_dir_install%" >> install.log
-rem compile xmake-core
-echo compiling xmake-core...
-cd core
-cmd /K build.bat
-cd ..
+rem make the xmake loader
+set xmake_loader=%temp%\xmake_loader
+echo @echo off > %xmake_loader%
+echo set XMAKE_PROGRAM_DIR=%xmake_dir_install%>> %xmake_loader%
+echo "%xmake_core_install%" >> %xmake_loader%
+
+rem install the xmake loader
+set xmake_loader_install=%xmake_dir_install%\xmake.bat
+copy /Y "%xmake_loader%" "%xmake_loader_install%" >> install.log
+
+rem set global PATH=%xmake_dir_install%
+echo %path% | findstr /i /C:"%xmake_dir_install%" >> nul && (goto set_path_ok)
+tools\dtreg.exe -MachineEnvSet path="%path%;%xmake_dir_install%" >> install.log
+:set_path_ok
rem ok
echo ok!
diff --git a/tools/dtreg.exe b/tools/dtreg.exe
new file mode 100755
index 000000000..627878604
--- /dev/null
+++ b/tools/dtreg.exe
Binary files differ