mirror of https://github.com/CGAL/cgal
Normalize line endings
This commit is contained in:
parent
c7a2712c98
commit
f46a56242c
|
|
@ -1,47 +1,47 @@
|
|||
#
|
||||
# From: http://nsis.sourceforge.net/Dump_log_to_file
|
||||
#
|
||||
|
||||
!define LVM_GETITEMCOUNT 0x1004
|
||||
!define LVM_GETITEMTEXT 0x102D
|
||||
|
||||
Function DumpLog
|
||||
Exch $5
|
||||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $6
|
||||
|
||||
FindWindow $0 "#32770" "" $HWNDPARENT
|
||||
GetDlgItem $0 $0 1016
|
||||
StrCmp $0 0 exit
|
||||
FileOpen $5 $5 "w"
|
||||
StrCmp $5 "" exit
|
||||
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
|
||||
System::Alloc ${NSIS_MAX_STRLEN}
|
||||
Pop $3
|
||||
StrCpy $2 0
|
||||
System::Call "*(i, i, i, i, i, i, i, i, i) i \
|
||||
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
|
||||
loop: StrCmp $2 $6 done
|
||||
System::Call "User32::SendMessageA(i, i, i, i) i \
|
||||
($0, ${LVM_GETITEMTEXT}, $2, r1)"
|
||||
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
|
||||
FileWrite $5 "$4$\r$\n"
|
||||
IntOp $2 $2 + 1
|
||||
Goto loop
|
||||
done:
|
||||
FileClose $5
|
||||
System::Free $1
|
||||
System::Free $3
|
||||
exit:
|
||||
Pop $6
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
Exch $5
|
||||
#
|
||||
# From: http://nsis.sourceforge.net/Dump_log_to_file
|
||||
#
|
||||
|
||||
!define LVM_GETITEMCOUNT 0x1004
|
||||
!define LVM_GETITEMTEXT 0x102D
|
||||
|
||||
Function DumpLog
|
||||
Exch $5
|
||||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $6
|
||||
|
||||
FindWindow $0 "#32770" "" $HWNDPARENT
|
||||
GetDlgItem $0 $0 1016
|
||||
StrCmp $0 0 exit
|
||||
FileOpen $5 $5 "w"
|
||||
StrCmp $5 "" exit
|
||||
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
|
||||
System::Alloc ${NSIS_MAX_STRLEN}
|
||||
Pop $3
|
||||
StrCpy $2 0
|
||||
System::Call "*(i, i, i, i, i, i, i, i, i) i \
|
||||
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
|
||||
loop: StrCmp $2 $6 done
|
||||
System::Call "User32::SendMessageA(i, i, i, i) i \
|
||||
($0, ${LVM_GETITEMTEXT}, $2, r1)"
|
||||
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
|
||||
FileWrite $5 "$4$\r$\n"
|
||||
IntOp $2 $2 + 1
|
||||
Goto loop
|
||||
done:
|
||||
FileClose $5
|
||||
System::Free $1
|
||||
System::Free $3
|
||||
exit:
|
||||
Pop $6
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
Exch $5
|
||||
FunctionEnd
|
||||
|
|
@ -1,327 +1,327 @@
|
|||
/**
|
||||
* EnvVarUpdate.nsh
|
||||
* : Environmental Variables: append, prepend, and remove entries
|
||||
*
|
||||
* WARNING: If you use StrFunc.nsh header then include it before this file
|
||||
* with all required definitions. This is to avoid conflicts
|
||||
*
|
||||
* Usage:
|
||||
* ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
|
||||
*
|
||||
* Credits:
|
||||
* Version 1.0
|
||||
* * Cal Turney (turnec2)
|
||||
* * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
|
||||
* function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
|
||||
* WriteEnvStr, and un.DeleteEnvStr
|
||||
* * Diego Pedroso (deguix) for StrTok
|
||||
* * Kevin English (kenglish_hi) for StrContains
|
||||
* * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry
|
||||
* (dandaman32) for StrReplace
|
||||
*
|
||||
* Version 1.1 (compatibility with StrFunc.nsh)
|
||||
* * techtonik
|
||||
*
|
||||
* http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
!ifndef ENVVARUPDATE_FUNCTION
|
||||
!define ENVVARUPDATE_FUNCTION
|
||||
!verbose push
|
||||
!verbose 3
|
||||
!include "LogicLib.nsh"
|
||||
!include "WinMessages.NSH"
|
||||
!include "StrFunc.nsh"
|
||||
|
||||
; ---- Fix for conflict if StrFunc.nsh is already includes in main file -----------------------
|
||||
!macro _IncludeStrFunction StrFuncName
|
||||
!ifndef ${StrFuncName}_INCLUDED
|
||||
${${StrFuncName}}
|
||||
!endif
|
||||
!ifndef Un${StrFuncName}_INCLUDED
|
||||
${Un${StrFuncName}}
|
||||
!endif
|
||||
!define un.${StrFuncName} "${Un${StrFuncName}}"
|
||||
!macroend
|
||||
|
||||
!insertmacro _IncludeStrFunction StrTok
|
||||
!insertmacro _IncludeStrFunction StrStr
|
||||
!insertmacro _IncludeStrFunction StrRep
|
||||
|
||||
; ---------------------------------- Macro Definitions ----------------------------------------
|
||||
!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
|
||||
Push "${EnvVarName}"
|
||||
Push "${Action}"
|
||||
Push "${RegLoc}"
|
||||
Push "${PathString}"
|
||||
Call EnvVarUpdate
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
|
||||
|
||||
!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
|
||||
Push "${EnvVarName}"
|
||||
Push "${Action}"
|
||||
Push "${RegLoc}"
|
||||
Push "${PathString}"
|
||||
Call un.EnvVarUpdate
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
|
||||
; ---------------------------------- Macro Definitions end-------------------------------------
|
||||
|
||||
;----------------------------------- EnvVarUpdate start----------------------------------------
|
||||
!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
!define hkcu_current_user 'HKCU "Environment"'
|
||||
|
||||
!macro EnvVarUpdate UN
|
||||
|
||||
Function ${UN}EnvVarUpdate
|
||||
|
||||
Push $0
|
||||
Exch 4
|
||||
Exch $1
|
||||
Exch 3
|
||||
Exch $2
|
||||
Exch 2
|
||||
Exch $3
|
||||
Exch
|
||||
Exch $4
|
||||
Push $5
|
||||
Push $6
|
||||
Push $7
|
||||
Push $8
|
||||
Push $9
|
||||
Push $R0
|
||||
|
||||
/* After this point:
|
||||
-------------------------
|
||||
$0 = ResultVar (returned)
|
||||
$1 = EnvVarName (input)
|
||||
$2 = Action (input)
|
||||
$3 = RegLoc (input)
|
||||
$4 = PathString (input)
|
||||
$5 = Orig EnvVar (read from registry)
|
||||
$6 = Len of $0 (temp)
|
||||
$7 = tempstr1 (temp)
|
||||
$8 = Entry counter (temp)
|
||||
$9 = tempstr2 (temp)
|
||||
$R0 = tempChar (temp) */
|
||||
|
||||
; Step 1: Read contents of EnvVarName from RegLoc
|
||||
;
|
||||
; Check for empty EnvVarName
|
||||
${If} $1 == ""
|
||||
SetErrors
|
||||
DetailPrint "ERROR: EnvVarName is blank"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Check for valid Action
|
||||
${If} $2 != "A"
|
||||
${AndIf} $2 != "P"
|
||||
${AndIf} $2 != "R"
|
||||
SetErrors
|
||||
DetailPrint "ERROR: Invalid Action - must be A, P, or R"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
${If} $3 == HKLM
|
||||
ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users into $5
|
||||
${ElseIf} $3 == HKCU
|
||||
ReadRegStr $5 ${hkcu_current_user} $1 ; Read EnvVarName from current user into $5
|
||||
${Else}
|
||||
SetErrors
|
||||
DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Check for empty PathString
|
||||
${If} $4 == ""
|
||||
SetErrors
|
||||
DetailPrint "ERROR: PathString is blank"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Make sure we've got some work to do
|
||||
${If} $5 == ""
|
||||
${AndIf} $2 == "R"
|
||||
SetErrors
|
||||
DetailPrint "$1 is empty - Nothing to remove"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Step 2: Scrub EnvVar
|
||||
;
|
||||
StrCpy $0 $5 ; Copy the contents to $0
|
||||
; Remove spaces around semicolons (NOTE: spaces before the 1st entry or
|
||||
; after the last one are not removed here but instead in Step 3)
|
||||
${If} $0 != "" ; If EnvVar is not empty ...
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 " ;"
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 " ;" ";" ; Remove '<space>;'
|
||||
${Loop}
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 "; "
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 "; " ";" ; Remove ';<space>'
|
||||
${Loop}
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 ";;"
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 ";;" ";"
|
||||
${Loop}
|
||||
|
||||
; Remove a leading or trailing semicolon from EnvVar
|
||||
StrCpy $7 $0 1 0
|
||||
${If} $7 == ";"
|
||||
StrCpy $0 $0 "" 1 ; Change ';<EnvVar>' to '<EnvVar>'
|
||||
${EndIf}
|
||||
StrLen $6 $0
|
||||
IntOp $6 $6 - 1
|
||||
StrCpy $7 $0 1 $6
|
||||
${If} $7 == ";"
|
||||
StrCpy $0 $0 $6 ; Change ';<EnvVar>' to '<EnvVar>'
|
||||
${EndIf}
|
||||
; DetailPrint "Scrubbed $1: [$0]" ; Uncomment to debug
|
||||
${EndIf}
|
||||
|
||||
/* Step 3. Remove all instances of the target path/string (even if "A" or "P")
|
||||
$6 = bool flag (1 = found and removed PathString)
|
||||
$7 = a string (e.g. path) delimited by semicolon(s)
|
||||
$8 = entry counter starting at 0
|
||||
$9 = copy of $0
|
||||
$R0 = tempChar */
|
||||
|
||||
${If} $5 != "" ; If EnvVar is not empty ...
|
||||
StrCpy $9 $0
|
||||
StrCpy $0 ""
|
||||
StrCpy $8 0
|
||||
StrCpy $6 0
|
||||
|
||||
${Do}
|
||||
${${UN}StrTok} $7 $9 ";" $8 "0" ; $7 = next entry, $8 = entry counter
|
||||
|
||||
${If} $7 == "" ; If we've run out of entries,
|
||||
${ExitDo} ; were done
|
||||
${EndIf} ;
|
||||
|
||||
; Remove leading and trailing spaces from this entry (critical step for Action=Remove)
|
||||
${Do}
|
||||
StrCpy $R0 $7 1
|
||||
${If} $R0 != " "
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
StrCpy $7 $7 "" 1 ; Remove leading space
|
||||
${Loop}
|
||||
${Do}
|
||||
StrCpy $R0 $7 1 -1
|
||||
${If} $R0 != " "
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
StrCpy $7 $7 -1 ; Remove trailing space
|
||||
${Loop}
|
||||
${If} $7 == $4 ; If string matches, remove it by not appending it
|
||||
StrCpy $6 1 ; Set 'found' flag
|
||||
${ElseIf} $7 != $4 ; If string does NOT match
|
||||
${AndIf} $0 == "" ; and the 1st string being added to $0,
|
||||
StrCpy $0 $7 ; copy it to $0 without a prepended semicolon
|
||||
${ElseIf} $7 != $4 ; If string does NOT match
|
||||
${AndIf} $0 != "" ; and this is NOT the 1st string to be added to $0,
|
||||
StrCpy $0 $0;$7 ; append path to $0 with a prepended semicolon
|
||||
${EndIf} ;
|
||||
|
||||
IntOp $8 $8 + 1 ; Bump counter
|
||||
${Loop} ; Check for duplicates until we run out of paths
|
||||
${EndIf}
|
||||
|
||||
; Step 4: Perform the requested Action
|
||||
;
|
||||
${If} $2 != "R" ; If Append or Prepend
|
||||
${If} $6 == 1 ; And if we found the target
|
||||
DetailPrint "Target is already present in $1. It will be removed and"
|
||||
${EndIf}
|
||||
${If} $0 == "" ; If EnvVar is (now) empty
|
||||
StrCpy $0 $4 ; just copy PathString to EnvVar
|
||||
${If} $6 == 0 ; If found flag is either 0
|
||||
${OrIf} $6 == "" ; or blank (if EnvVarName is empty)
|
||||
DetailPrint "$1 was empty and has been updated with the target"
|
||||
${EndIf}
|
||||
${ElseIf} $2 == "A" ; If Append (and EnvVar is not empty),
|
||||
StrCpy $0 $0;$4 ; append PathString
|
||||
${If} $6 == 1
|
||||
DetailPrint "appended to $1"
|
||||
${Else}
|
||||
DetailPrint "Target was appended to $1"
|
||||
${EndIf}
|
||||
${Else} ; If Prepend (and EnvVar is not empty),
|
||||
StrCpy $0 $4;$0 ; prepend PathString
|
||||
${If} $6 == 1
|
||||
DetailPrint "prepended to $1"
|
||||
${Else}
|
||||
DetailPrint "Target was prepended to $1"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${Else} ; If Action = Remove
|
||||
${If} $6 == 1 ; and we found the target
|
||||
DetailPrint "Target was found and removed from $1"
|
||||
${Else}
|
||||
DetailPrint "Target was NOT found in $1 (nothing to remove)"
|
||||
${EndIf}
|
||||
${If} $0 == ""
|
||||
DetailPrint "$1 is now empty"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
; Step 5: Update the registry at RegLoc with the updated EnvVar and announce the change
|
||||
;
|
||||
ClearErrors
|
||||
${If} $3 == HKLM
|
||||
WriteRegExpandStr ${hklm_all_users} $1 $0 ; Write it in all users section
|
||||
${ElseIf} $3 == HKCU
|
||||
WriteRegExpandStr ${hkcu_current_user} $1 $0 ; Write it to current user section
|
||||
${EndIf}
|
||||
|
||||
IfErrors 0 +4
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3"
|
||||
DetailPrint "Could not write updated $1 to $3"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
|
||||
; "Export" our change
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
EnvVarUpdate_Restore_Vars:
|
||||
;
|
||||
; Restore the user's variables and return ResultVar
|
||||
Pop $R0
|
||||
Pop $9
|
||||
Pop $8
|
||||
Pop $7
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Push $0 ; Push my $0 (ResultVar)
|
||||
Exch
|
||||
Pop $0 ; Restore his $0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!macroend ; EnvVarUpdate UN
|
||||
!insertmacro EnvVarUpdate ""
|
||||
!insertmacro EnvVarUpdate "un."
|
||||
;----------------------------------- EnvVarUpdate end----------------------------------------
|
||||
|
||||
!verbose pop
|
||||
!endif
|
||||
/**
|
||||
* EnvVarUpdate.nsh
|
||||
* : Environmental Variables: append, prepend, and remove entries
|
||||
*
|
||||
* WARNING: If you use StrFunc.nsh header then include it before this file
|
||||
* with all required definitions. This is to avoid conflicts
|
||||
*
|
||||
* Usage:
|
||||
* ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
|
||||
*
|
||||
* Credits:
|
||||
* Version 1.0
|
||||
* * Cal Turney (turnec2)
|
||||
* * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
|
||||
* function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
|
||||
* WriteEnvStr, and un.DeleteEnvStr
|
||||
* * Diego Pedroso (deguix) for StrTok
|
||||
* * Kevin English (kenglish_hi) for StrContains
|
||||
* * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry
|
||||
* (dandaman32) for StrReplace
|
||||
*
|
||||
* Version 1.1 (compatibility with StrFunc.nsh)
|
||||
* * techtonik
|
||||
*
|
||||
* http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
!ifndef ENVVARUPDATE_FUNCTION
|
||||
!define ENVVARUPDATE_FUNCTION
|
||||
!verbose push
|
||||
!verbose 3
|
||||
!include "LogicLib.nsh"
|
||||
!include "WinMessages.NSH"
|
||||
!include "StrFunc.nsh"
|
||||
|
||||
; ---- Fix for conflict if StrFunc.nsh is already includes in main file -----------------------
|
||||
!macro _IncludeStrFunction StrFuncName
|
||||
!ifndef ${StrFuncName}_INCLUDED
|
||||
${${StrFuncName}}
|
||||
!endif
|
||||
!ifndef Un${StrFuncName}_INCLUDED
|
||||
${Un${StrFuncName}}
|
||||
!endif
|
||||
!define un.${StrFuncName} "${Un${StrFuncName}}"
|
||||
!macroend
|
||||
|
||||
!insertmacro _IncludeStrFunction StrTok
|
||||
!insertmacro _IncludeStrFunction StrStr
|
||||
!insertmacro _IncludeStrFunction StrRep
|
||||
|
||||
; ---------------------------------- Macro Definitions ----------------------------------------
|
||||
!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
|
||||
Push "${EnvVarName}"
|
||||
Push "${Action}"
|
||||
Push "${RegLoc}"
|
||||
Push "${PathString}"
|
||||
Call EnvVarUpdate
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
|
||||
|
||||
!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
|
||||
Push "${EnvVarName}"
|
||||
Push "${Action}"
|
||||
Push "${RegLoc}"
|
||||
Push "${PathString}"
|
||||
Call un.EnvVarUpdate
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
|
||||
; ---------------------------------- Macro Definitions end-------------------------------------
|
||||
|
||||
;----------------------------------- EnvVarUpdate start----------------------------------------
|
||||
!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
!define hkcu_current_user 'HKCU "Environment"'
|
||||
|
||||
!macro EnvVarUpdate UN
|
||||
|
||||
Function ${UN}EnvVarUpdate
|
||||
|
||||
Push $0
|
||||
Exch 4
|
||||
Exch $1
|
||||
Exch 3
|
||||
Exch $2
|
||||
Exch 2
|
||||
Exch $3
|
||||
Exch
|
||||
Exch $4
|
||||
Push $5
|
||||
Push $6
|
||||
Push $7
|
||||
Push $8
|
||||
Push $9
|
||||
Push $R0
|
||||
|
||||
/* After this point:
|
||||
-------------------------
|
||||
$0 = ResultVar (returned)
|
||||
$1 = EnvVarName (input)
|
||||
$2 = Action (input)
|
||||
$3 = RegLoc (input)
|
||||
$4 = PathString (input)
|
||||
$5 = Orig EnvVar (read from registry)
|
||||
$6 = Len of $0 (temp)
|
||||
$7 = tempstr1 (temp)
|
||||
$8 = Entry counter (temp)
|
||||
$9 = tempstr2 (temp)
|
||||
$R0 = tempChar (temp) */
|
||||
|
||||
; Step 1: Read contents of EnvVarName from RegLoc
|
||||
;
|
||||
; Check for empty EnvVarName
|
||||
${If} $1 == ""
|
||||
SetErrors
|
||||
DetailPrint "ERROR: EnvVarName is blank"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Check for valid Action
|
||||
${If} $2 != "A"
|
||||
${AndIf} $2 != "P"
|
||||
${AndIf} $2 != "R"
|
||||
SetErrors
|
||||
DetailPrint "ERROR: Invalid Action - must be A, P, or R"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
${If} $3 == HKLM
|
||||
ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users into $5
|
||||
${ElseIf} $3 == HKCU
|
||||
ReadRegStr $5 ${hkcu_current_user} $1 ; Read EnvVarName from current user into $5
|
||||
${Else}
|
||||
SetErrors
|
||||
DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Check for empty PathString
|
||||
${If} $4 == ""
|
||||
SetErrors
|
||||
DetailPrint "ERROR: PathString is blank"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Make sure we've got some work to do
|
||||
${If} $5 == ""
|
||||
${AndIf} $2 == "R"
|
||||
SetErrors
|
||||
DetailPrint "$1 is empty - Nothing to remove"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Step 2: Scrub EnvVar
|
||||
;
|
||||
StrCpy $0 $5 ; Copy the contents to $0
|
||||
; Remove spaces around semicolons (NOTE: spaces before the 1st entry or
|
||||
; after the last one are not removed here but instead in Step 3)
|
||||
${If} $0 != "" ; If EnvVar is not empty ...
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 " ;"
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 " ;" ";" ; Remove '<space>;'
|
||||
${Loop}
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 "; "
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 "; " ";" ; Remove ';<space>'
|
||||
${Loop}
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 ";;"
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 ";;" ";"
|
||||
${Loop}
|
||||
|
||||
; Remove a leading or trailing semicolon from EnvVar
|
||||
StrCpy $7 $0 1 0
|
||||
${If} $7 == ";"
|
||||
StrCpy $0 $0 "" 1 ; Change ';<EnvVar>' to '<EnvVar>'
|
||||
${EndIf}
|
||||
StrLen $6 $0
|
||||
IntOp $6 $6 - 1
|
||||
StrCpy $7 $0 1 $6
|
||||
${If} $7 == ";"
|
||||
StrCpy $0 $0 $6 ; Change ';<EnvVar>' to '<EnvVar>'
|
||||
${EndIf}
|
||||
; DetailPrint "Scrubbed $1: [$0]" ; Uncomment to debug
|
||||
${EndIf}
|
||||
|
||||
/* Step 3. Remove all instances of the target path/string (even if "A" or "P")
|
||||
$6 = bool flag (1 = found and removed PathString)
|
||||
$7 = a string (e.g. path) delimited by semicolon(s)
|
||||
$8 = entry counter starting at 0
|
||||
$9 = copy of $0
|
||||
$R0 = tempChar */
|
||||
|
||||
${If} $5 != "" ; If EnvVar is not empty ...
|
||||
StrCpy $9 $0
|
||||
StrCpy $0 ""
|
||||
StrCpy $8 0
|
||||
StrCpy $6 0
|
||||
|
||||
${Do}
|
||||
${${UN}StrTok} $7 $9 ";" $8 "0" ; $7 = next entry, $8 = entry counter
|
||||
|
||||
${If} $7 == "" ; If we've run out of entries,
|
||||
${ExitDo} ; were done
|
||||
${EndIf} ;
|
||||
|
||||
; Remove leading and trailing spaces from this entry (critical step for Action=Remove)
|
||||
${Do}
|
||||
StrCpy $R0 $7 1
|
||||
${If} $R0 != " "
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
StrCpy $7 $7 "" 1 ; Remove leading space
|
||||
${Loop}
|
||||
${Do}
|
||||
StrCpy $R0 $7 1 -1
|
||||
${If} $R0 != " "
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
StrCpy $7 $7 -1 ; Remove trailing space
|
||||
${Loop}
|
||||
${If} $7 == $4 ; If string matches, remove it by not appending it
|
||||
StrCpy $6 1 ; Set 'found' flag
|
||||
${ElseIf} $7 != $4 ; If string does NOT match
|
||||
${AndIf} $0 == "" ; and the 1st string being added to $0,
|
||||
StrCpy $0 $7 ; copy it to $0 without a prepended semicolon
|
||||
${ElseIf} $7 != $4 ; If string does NOT match
|
||||
${AndIf} $0 != "" ; and this is NOT the 1st string to be added to $0,
|
||||
StrCpy $0 $0;$7 ; append path to $0 with a prepended semicolon
|
||||
${EndIf} ;
|
||||
|
||||
IntOp $8 $8 + 1 ; Bump counter
|
||||
${Loop} ; Check for duplicates until we run out of paths
|
||||
${EndIf}
|
||||
|
||||
; Step 4: Perform the requested Action
|
||||
;
|
||||
${If} $2 != "R" ; If Append or Prepend
|
||||
${If} $6 == 1 ; And if we found the target
|
||||
DetailPrint "Target is already present in $1. It will be removed and"
|
||||
${EndIf}
|
||||
${If} $0 == "" ; If EnvVar is (now) empty
|
||||
StrCpy $0 $4 ; just copy PathString to EnvVar
|
||||
${If} $6 == 0 ; If found flag is either 0
|
||||
${OrIf} $6 == "" ; or blank (if EnvVarName is empty)
|
||||
DetailPrint "$1 was empty and has been updated with the target"
|
||||
${EndIf}
|
||||
${ElseIf} $2 == "A" ; If Append (and EnvVar is not empty),
|
||||
StrCpy $0 $0;$4 ; append PathString
|
||||
${If} $6 == 1
|
||||
DetailPrint "appended to $1"
|
||||
${Else}
|
||||
DetailPrint "Target was appended to $1"
|
||||
${EndIf}
|
||||
${Else} ; If Prepend (and EnvVar is not empty),
|
||||
StrCpy $0 $4;$0 ; prepend PathString
|
||||
${If} $6 == 1
|
||||
DetailPrint "prepended to $1"
|
||||
${Else}
|
||||
DetailPrint "Target was prepended to $1"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${Else} ; If Action = Remove
|
||||
${If} $6 == 1 ; and we found the target
|
||||
DetailPrint "Target was found and removed from $1"
|
||||
${Else}
|
||||
DetailPrint "Target was NOT found in $1 (nothing to remove)"
|
||||
${EndIf}
|
||||
${If} $0 == ""
|
||||
DetailPrint "$1 is now empty"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
; Step 5: Update the registry at RegLoc with the updated EnvVar and announce the change
|
||||
;
|
||||
ClearErrors
|
||||
${If} $3 == HKLM
|
||||
WriteRegExpandStr ${hklm_all_users} $1 $0 ; Write it in all users section
|
||||
${ElseIf} $3 == HKCU
|
||||
WriteRegExpandStr ${hkcu_current_user} $1 $0 ; Write it to current user section
|
||||
${EndIf}
|
||||
|
||||
IfErrors 0 +4
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3"
|
||||
DetailPrint "Could not write updated $1 to $3"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
|
||||
; "Export" our change
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
EnvVarUpdate_Restore_Vars:
|
||||
;
|
||||
; Restore the user's variables and return ResultVar
|
||||
Pop $R0
|
||||
Pop $9
|
||||
Pop $8
|
||||
Pop $7
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Push $0 ; Push my $0 (ResultVar)
|
||||
Exch
|
||||
Pop $0 ; Restore his $0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!macroend ; EnvVarUpdate UN
|
||||
!insertmacro EnvVarUpdate ""
|
||||
!insertmacro EnvVarUpdate "un."
|
||||
;----------------------------------- EnvVarUpdate end----------------------------------------
|
||||
|
||||
!verbose pop
|
||||
!endif
|
||||
|
|
|
|||
|
|
@ -1,71 +1,71 @@
|
|||
# Author: Robert Kehl
|
||||
# Source: http://nsis.sourceforge.net/ReplaceInFile
|
||||
#
|
||||
!macro ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT
|
||||
Push "${SOURCE_FILE}"
|
||||
Push "${SEARCH_TEXT}"
|
||||
Push "${REPLACEMENT}"
|
||||
Call RIF
|
||||
!macroend
|
||||
|
||||
Function RIF
|
||||
|
||||
ClearErrors ; want to be a newborn
|
||||
|
||||
Exch $0 ; REPLACEMENT
|
||||
Exch
|
||||
Exch $1 ; SEARCH_TEXT
|
||||
Exch 2
|
||||
Exch $2 ; SOURCE_FILE
|
||||
|
||||
Push $R0 ; SOURCE_FILE file handle
|
||||
Push $R1 ; temporary file handle
|
||||
Push $R2 ; unique temporary file name
|
||||
Push $R3 ; a line to sar/save
|
||||
Push $R4 ; shift puffer
|
||||
|
||||
IfFileExists $2 +1 RIF_error ; knock-knock
|
||||
FileOpen $R0 $2 "r" ; open the door
|
||||
|
||||
GetTempFileName $R2 ; who's new?
|
||||
FileOpen $R1 $R2 "w" ; the escape, please!
|
||||
|
||||
RIF_loop: ; round'n'round we go
|
||||
FileRead $R0 $R3 ; read one line
|
||||
IfErrors RIF_leaveloop ; enough is enough
|
||||
RIF_sar: ; sar - search and replace
|
||||
Push "$R3" ; (hair)stack
|
||||
Push "$1" ; needle
|
||||
Push "$0" ; blood
|
||||
Call StrReplace ; do the bartwalk
|
||||
StrCpy $R4 "$R3" ; remember previous state
|
||||
Pop $R3 ; gimme s.th. back in return!
|
||||
StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
|
||||
FileWrite $R1 "$R3" ; save the newbie
|
||||
Goto RIF_loop ; gimme more
|
||||
|
||||
RIF_leaveloop: ; over'n'out, Sir!
|
||||
FileClose $R1 ; S'rry, Ma'am - clos'n now
|
||||
FileClose $R0 ; me 2
|
||||
|
||||
Delete "$2.old" ; go away, Sire
|
||||
Rename "$2" "$2.old" ; step aside, Ma'am
|
||||
Rename "$R2" "$2" ; hi, baby!
|
||||
|
||||
ClearErrors ; now i AM a newborn
|
||||
Goto RIF_out ; out'n'away
|
||||
|
||||
RIF_error: ; ups - s.th. went wrong...
|
||||
SetErrors ; ...so cry, boy!
|
||||
|
||||
RIF_out: ; your wardrobe?
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
Pop $2
|
||||
Pop $0
|
||||
Pop $1
|
||||
|
||||
# Author: Robert Kehl
|
||||
# Source: http://nsis.sourceforge.net/ReplaceInFile
|
||||
#
|
||||
!macro ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT
|
||||
Push "${SOURCE_FILE}"
|
||||
Push "${SEARCH_TEXT}"
|
||||
Push "${REPLACEMENT}"
|
||||
Call RIF
|
||||
!macroend
|
||||
|
||||
Function RIF
|
||||
|
||||
ClearErrors ; want to be a newborn
|
||||
|
||||
Exch $0 ; REPLACEMENT
|
||||
Exch
|
||||
Exch $1 ; SEARCH_TEXT
|
||||
Exch 2
|
||||
Exch $2 ; SOURCE_FILE
|
||||
|
||||
Push $R0 ; SOURCE_FILE file handle
|
||||
Push $R1 ; temporary file handle
|
||||
Push $R2 ; unique temporary file name
|
||||
Push $R3 ; a line to sar/save
|
||||
Push $R4 ; shift puffer
|
||||
|
||||
IfFileExists $2 +1 RIF_error ; knock-knock
|
||||
FileOpen $R0 $2 "r" ; open the door
|
||||
|
||||
GetTempFileName $R2 ; who's new?
|
||||
FileOpen $R1 $R2 "w" ; the escape, please!
|
||||
|
||||
RIF_loop: ; round'n'round we go
|
||||
FileRead $R0 $R3 ; read one line
|
||||
IfErrors RIF_leaveloop ; enough is enough
|
||||
RIF_sar: ; sar - search and replace
|
||||
Push "$R3" ; (hair)stack
|
||||
Push "$1" ; needle
|
||||
Push "$0" ; blood
|
||||
Call StrReplace ; do the bartwalk
|
||||
StrCpy $R4 "$R3" ; remember previous state
|
||||
Pop $R3 ; gimme s.th. back in return!
|
||||
StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
|
||||
FileWrite $R1 "$R3" ; save the newbie
|
||||
Goto RIF_loop ; gimme more
|
||||
|
||||
RIF_leaveloop: ; over'n'out, Sir!
|
||||
FileClose $R1 ; S'rry, Ma'am - clos'n now
|
||||
FileClose $R0 ; me 2
|
||||
|
||||
Delete "$2.old" ; go away, Sire
|
||||
Rename "$2" "$2.old" ; step aside, Ma'am
|
||||
Rename "$R2" "$2" ; hi, baby!
|
||||
|
||||
ClearErrors ; now i AM a newborn
|
||||
Goto RIF_out ; out'n'away
|
||||
|
||||
RIF_error: ; ups - s.th. went wrong...
|
||||
SetErrors ; ...so cry, boy!
|
||||
|
||||
RIF_out: ; your wardrobe?
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
Pop $2
|
||||
Pop $0
|
||||
Pop $1
|
||||
|
||||
FunctionEnd
|
||||
|
|
@ -1,51 +1,51 @@
|
|||
; StrReplace
|
||||
; Replaces all ocurrences of a given needle within a haystack with another string
|
||||
; Written by dandaman32
|
||||
|
||||
Var STR_REPLACE_VAR_0
|
||||
Var STR_REPLACE_VAR_1
|
||||
Var STR_REPLACE_VAR_2
|
||||
Var STR_REPLACE_VAR_3
|
||||
Var STR_REPLACE_VAR_4
|
||||
Var STR_REPLACE_VAR_5
|
||||
Var STR_REPLACE_VAR_6
|
||||
Var STR_REPLACE_VAR_7
|
||||
Var STR_REPLACE_VAR_8
|
||||
|
||||
Function StrReplace
|
||||
Exch $STR_REPLACE_VAR_2
|
||||
Exch 1
|
||||
Exch $STR_REPLACE_VAR_1
|
||||
Exch 2
|
||||
Exch $STR_REPLACE_VAR_0
|
||||
StrCpy $STR_REPLACE_VAR_3 -1
|
||||
StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
|
||||
StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
|
||||
loop:
|
||||
IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
|
||||
StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
|
||||
StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
|
||||
StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
|
||||
Goto loop
|
||||
found:
|
||||
StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
|
||||
IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
|
||||
StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
|
||||
StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
|
||||
StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
|
||||
Goto loop
|
||||
done:
|
||||
Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
|
||||
Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
|
||||
Exch $STR_REPLACE_VAR_0
|
||||
FunctionEnd
|
||||
|
||||
!macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
|
||||
Push "${HAYSTACK}"
|
||||
Push "${NEEDLE}"
|
||||
Push "${NEEDLE2}"
|
||||
Call StrReplace
|
||||
Pop "${OUT}"
|
||||
!macroend
|
||||
|
||||
!define StrReplace '!insertmacro "_strReplaceConstructor"'
|
||||
; StrReplace
|
||||
; Replaces all ocurrences of a given needle within a haystack with another string
|
||||
; Written by dandaman32
|
||||
|
||||
Var STR_REPLACE_VAR_0
|
||||
Var STR_REPLACE_VAR_1
|
||||
Var STR_REPLACE_VAR_2
|
||||
Var STR_REPLACE_VAR_3
|
||||
Var STR_REPLACE_VAR_4
|
||||
Var STR_REPLACE_VAR_5
|
||||
Var STR_REPLACE_VAR_6
|
||||
Var STR_REPLACE_VAR_7
|
||||
Var STR_REPLACE_VAR_8
|
||||
|
||||
Function StrReplace
|
||||
Exch $STR_REPLACE_VAR_2
|
||||
Exch 1
|
||||
Exch $STR_REPLACE_VAR_1
|
||||
Exch 2
|
||||
Exch $STR_REPLACE_VAR_0
|
||||
StrCpy $STR_REPLACE_VAR_3 -1
|
||||
StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
|
||||
StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
|
||||
loop:
|
||||
IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
|
||||
StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
|
||||
StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
|
||||
StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
|
||||
Goto loop
|
||||
found:
|
||||
StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
|
||||
IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
|
||||
StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
|
||||
StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
|
||||
StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
|
||||
Goto loop
|
||||
done:
|
||||
Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
|
||||
Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
|
||||
Exch $STR_REPLACE_VAR_0
|
||||
FunctionEnd
|
||||
|
||||
!macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
|
||||
Push "${HAYSTACK}"
|
||||
Push "${NEEDLE}"
|
||||
Push "${NEEDLE2}"
|
||||
Call StrReplace
|
||||
Pop "${OUT}"
|
||||
!macroend
|
||||
|
||||
!define StrReplace '!insertmacro "_strReplaceConstructor"'
|
||||
|
|
|
|||
|
|
@ -1,68 +1,68 @@
|
|||
# TextLog.nsh v1.1 - 2005-12-26
|
||||
# Written by Mike Schinkel [http://www.mikeschinkel.com/blog/]
|
||||
|
||||
Var /GLOBAL __TextLog_FileHandle
|
||||
Var /GLOBAL __TextLog_FileName
|
||||
Var /GLOBAL __TextLog_State
|
||||
|
||||
!define LogMsg '!insertmacro LogMsgCall'
|
||||
!macro LogMsgCall _text
|
||||
Call LogSetOn
|
||||
Push "${_text}"
|
||||
Call LogText
|
||||
Call LogSetOff
|
||||
!macroend
|
||||
|
||||
|
||||
!define LogText '!insertmacro LogTextCall'
|
||||
!macro LogTextCall _text
|
||||
Push "${_text}"
|
||||
Call LogText
|
||||
!macroend
|
||||
|
||||
Function LogText
|
||||
Exch $0 ; pABC -> 0ABC
|
||||
FileWrite $__TextLog_FileHandle "$0$\r$\n"
|
||||
Pop $0 ; 0ABC -> ABC
|
||||
FunctionEnd
|
||||
|
||||
!define LogSetFileName '!insertmacro LogSetFileNameCall'
|
||||
!macro LogSetFileNameCall _filename
|
||||
Push "${_filename}"
|
||||
Call LogSetFileName
|
||||
!macroend
|
||||
|
||||
Function LogSetFileName
|
||||
Exch $0 ; pABC -> 0ABC
|
||||
StrCpy $__TextLog_FileName "$0"
|
||||
StrCmp $__TextLog_State "open" +1 +3
|
||||
Call LogSetOff
|
||||
Call LogSetOn
|
||||
Pop $0 ; 0ABC -> ABC
|
||||
FunctionEnd
|
||||
|
||||
!define LogSetOn '!insertmacro LogSetOnCall'
|
||||
!macro LogSetOnCall
|
||||
Call LogSetOn
|
||||
!macroend
|
||||
|
||||
Function LogSetOn
|
||||
StrCmp $__TextLog_FileName "" +1 AlreadySet
|
||||
StrCpy $__TextLog_FileName "$INSTDIR\install.log"
|
||||
AlreadySet:
|
||||
StrCmp $__TextLog_State "open" +2
|
||||
FileOpen $__TextLog_FileHandle "$__TextLog_FileName" a
|
||||
FileSeek $__TextLog_FileHandle 0 END
|
||||
StrCpy $__TextLog_State "open"
|
||||
FunctionEnd
|
||||
|
||||
!define LogSetOff '!insertmacro LogSetOffCall'
|
||||
!macro LogSetOffCall
|
||||
Call LogSetOff
|
||||
!macroend
|
||||
|
||||
Function LogSetOff
|
||||
StrCmp $__TextLog_State "open" +1 +2
|
||||
FileClose $__TextLog_FileHandle
|
||||
StrCpy $__TextLog_State ""
|
||||
# TextLog.nsh v1.1 - 2005-12-26
|
||||
# Written by Mike Schinkel [http://www.mikeschinkel.com/blog/]
|
||||
|
||||
Var /GLOBAL __TextLog_FileHandle
|
||||
Var /GLOBAL __TextLog_FileName
|
||||
Var /GLOBAL __TextLog_State
|
||||
|
||||
!define LogMsg '!insertmacro LogMsgCall'
|
||||
!macro LogMsgCall _text
|
||||
Call LogSetOn
|
||||
Push "${_text}"
|
||||
Call LogText
|
||||
Call LogSetOff
|
||||
!macroend
|
||||
|
||||
|
||||
!define LogText '!insertmacro LogTextCall'
|
||||
!macro LogTextCall _text
|
||||
Push "${_text}"
|
||||
Call LogText
|
||||
!macroend
|
||||
|
||||
Function LogText
|
||||
Exch $0 ; pABC -> 0ABC
|
||||
FileWrite $__TextLog_FileHandle "$0$\r$\n"
|
||||
Pop $0 ; 0ABC -> ABC
|
||||
FunctionEnd
|
||||
|
||||
!define LogSetFileName '!insertmacro LogSetFileNameCall'
|
||||
!macro LogSetFileNameCall _filename
|
||||
Push "${_filename}"
|
||||
Call LogSetFileName
|
||||
!macroend
|
||||
|
||||
Function LogSetFileName
|
||||
Exch $0 ; pABC -> 0ABC
|
||||
StrCpy $__TextLog_FileName "$0"
|
||||
StrCmp $__TextLog_State "open" +1 +3
|
||||
Call LogSetOff
|
||||
Call LogSetOn
|
||||
Pop $0 ; 0ABC -> ABC
|
||||
FunctionEnd
|
||||
|
||||
!define LogSetOn '!insertmacro LogSetOnCall'
|
||||
!macro LogSetOnCall
|
||||
Call LogSetOn
|
||||
!macroend
|
||||
|
||||
Function LogSetOn
|
||||
StrCmp $__TextLog_FileName "" +1 AlreadySet
|
||||
StrCpy $__TextLog_FileName "$INSTDIR\install.log"
|
||||
AlreadySet:
|
||||
StrCmp $__TextLog_State "open" +2
|
||||
FileOpen $__TextLog_FileHandle "$__TextLog_FileName" a
|
||||
FileSeek $__TextLog_FileHandle 0 END
|
||||
StrCpy $__TextLog_State "open"
|
||||
FunctionEnd
|
||||
|
||||
!define LogSetOff '!insertmacro LogSetOffCall'
|
||||
!macro LogSetOffCall
|
||||
Call LogSetOff
|
||||
!macroend
|
||||
|
||||
Function LogSetOff
|
||||
StrCmp $__TextLog_State "open" +1 +2
|
||||
FileClose $__TextLog_FileHandle
|
||||
StrCpy $__TextLog_State ""
|
||||
FunctionEnd
|
||||
|
|
@ -1,183 +1,183 @@
|
|||
#
|
||||
# Taken from http://nsis.sourceforge.net/Setting_Environment_Variables
|
||||
# User handling modified by Fernando Cacciola
|
||||
# Laurent Rineau added un.DeleteEnvStr and adapted it to handle user.
|
||||
#
|
||||
!ifndef _WriteEnvStr_nsh
|
||||
!define _WriteEnvStr_nsh
|
||||
|
||||
#
|
||||
# Macro definition added by Fernando Cacciola
|
||||
#
|
||||
!define WriteEnvStr "!insertmacro WriteEnvStr"
|
||||
!macro WriteEnvStr name value all_users
|
||||
Push ${name}
|
||||
Push ${value}
|
||||
Push ${all_users}
|
||||
Call WriteEnvStr
|
||||
!macroend
|
||||
|
||||
!define un.DeleteEnvStr "!insertmacro un.DeleteEnvStr"
|
||||
!macro un.DeleteEnvStr name all_users
|
||||
Push ${name}
|
||||
Push ${all_users}
|
||||
Call un.DeleteEnvStr
|
||||
!macroend
|
||||
|
||||
!include WinMessages.nsh
|
||||
|
||||
!define WriteEnvStr_RegKey_AllUsers 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
|
||||
!define WriteEnvStr_RegKey_CurrentUser 'HKCU "Environment"'
|
||||
|
||||
#
|
||||
# WriteEnvStr - Writes an environment variable
|
||||
# Note: Win9x systems requires reboot
|
||||
#
|
||||
# Example:
|
||||
# Push "HOMEDIR" # name
|
||||
# Push "C:\New Home Dir\" # value
|
||||
# Push 1 (all users) or 0 (current user only)
|
||||
# Call WriteEnvStr
|
||||
#
|
||||
Function WriteEnvStr
|
||||
Exch $2 ; $2 all users?
|
||||
Exch
|
||||
Exch $1 ; $1 has environment variable value
|
||||
Exch 2
|
||||
Exch $0 ; $0 has environment variable name
|
||||
Push $3
|
||||
|
||||
Call IsNT
|
||||
Pop $3
|
||||
StrCmp $3 1 WriteEnvStr_NT
|
||||
; Not on NT
|
||||
StrCpy $3 $WINDIR 2 ; Copy drive of windows (c:)
|
||||
FileOpen $3 "$3\autoexec.bat" a
|
||||
FileSeek $3 0 END
|
||||
FileWrite $3 "$\r$\nSET $0=$1$\r$\n"
|
||||
FileClose $3
|
||||
SetRebootFlag true
|
||||
Goto WriteEnvStr_done
|
||||
|
||||
WriteEnvStr_NT:
|
||||
StrCmp $2 1 AllUsers
|
||||
WriteRegExpandStr ${WriteEnvStr_RegKey_CurrentUser} $0 $1
|
||||
Goto Written
|
||||
AllUsers:
|
||||
WriteRegExpandStr ${WriteEnvStr_RegKey_AllUsers} $0 $1
|
||||
Written:
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
WriteEnvStr_done:
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $0
|
||||
Pop $1
|
||||
FunctionEnd
|
||||
|
||||
#
|
||||
# un.DeleteEnvStr - Removes an environment variable
|
||||
# Note: Win9x systems requires reboot
|
||||
#
|
||||
# Example:
|
||||
# Push "HOMEDIR" # name
|
||||
# Push 1 (all users) or 0 (current user only)
|
||||
# Call un.DeleteEnvStr
|
||||
#
|
||||
Function un.DeleteEnvStr
|
||||
Exch $1 ; $1 all users?
|
||||
Exch
|
||||
Exch $0 ; $0 now has the name of the variable
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $6
|
||||
|
||||
Call un.IsNT
|
||||
Pop $2
|
||||
StrCmp $2 1 DeleteEnvStr_NT
|
||||
; Not on NT
|
||||
StrCpy $2 $WINDIR 2
|
||||
FileOpen $2 "$2\autoexec.bat" r
|
||||
GetTempFileName $5
|
||||
FileOpen $3 $5 w
|
||||
StrCpy $0 "SET $0="
|
||||
SetRebootFlag true
|
||||
|
||||
DeleteEnvStr_dosLoop:
|
||||
FileRead $2 $4
|
||||
StrLen $6 $0
|
||||
StrCpy $6 $4 $6
|
||||
StrCmp $6 $0 DeleteEnvStr_dosLoop
|
||||
StrCmp $6 "" DeleteEnvStr_dosLoopEnd
|
||||
FileWrite $3 $4
|
||||
Goto DeleteEnvStr_dosLoop
|
||||
|
||||
DeleteEnvStr_dosLoopEnd:
|
||||
FileClose $3
|
||||
FileClose $2
|
||||
StrCpy $2 $WINDIR 2
|
||||
Delete "$2\autoexec.bat"
|
||||
CopyFiles /SILENT $5 "$2\autoexec.bat"
|
||||
Delete $5
|
||||
Goto DeleteEnvStr_done
|
||||
|
||||
DeleteEnvStr_NT:
|
||||
StrCmp $1 1 DelAllUsers
|
||||
DeleteRegValue ${WriteEnvStr_RegKey_CurrentUser} $0
|
||||
Goto DelWritten
|
||||
DelAllUsers:
|
||||
DeleteRegValue ${WriteEnvStr_RegKey_AllUsers} $0
|
||||
DelWritten:
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
|
||||
0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
DeleteEnvStr_done:
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
!ifndef IsNT_KiCHiK
|
||||
!define IsNT_KiCHiK
|
||||
|
||||
#
|
||||
# [un.]IsNT - Pushes 1 if running on NT, 0 if not
|
||||
#
|
||||
# Example:
|
||||
# Call IsNT
|
||||
# Pop $0
|
||||
# StrCmp $0 1 +3
|
||||
# MessageBox MB_OK "Not running on NT!"
|
||||
# Goto +2
|
||||
# MessageBox MB_OK "Running on NT!"
|
||||
#
|
||||
!macro IsNT UN
|
||||
Function ${UN}IsNT
|
||||
Push $0
|
||||
ReadRegStr $0 HKLM \
|
||||
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
|
||||
StrCmp $0 "" 0 IsNT_yes
|
||||
; we are not NT.
|
||||
Pop $0
|
||||
Push 0
|
||||
Return
|
||||
|
||||
IsNT_yes:
|
||||
; NT!!!
|
||||
Pop $0
|
||||
Push 1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro IsNT ""
|
||||
!insertmacro IsNT "un."
|
||||
|
||||
!endif ; IsNT_KiCHiK
|
||||
|
||||
!endif ; _WriteEnvStr_nsh
|
||||
#
|
||||
# Taken from http://nsis.sourceforge.net/Setting_Environment_Variables
|
||||
# User handling modified by Fernando Cacciola
|
||||
# Laurent Rineau added un.DeleteEnvStr and adapted it to handle user.
|
||||
#
|
||||
!ifndef _WriteEnvStr_nsh
|
||||
!define _WriteEnvStr_nsh
|
||||
|
||||
#
|
||||
# Macro definition added by Fernando Cacciola
|
||||
#
|
||||
!define WriteEnvStr "!insertmacro WriteEnvStr"
|
||||
!macro WriteEnvStr name value all_users
|
||||
Push ${name}
|
||||
Push ${value}
|
||||
Push ${all_users}
|
||||
Call WriteEnvStr
|
||||
!macroend
|
||||
|
||||
!define un.DeleteEnvStr "!insertmacro un.DeleteEnvStr"
|
||||
!macro un.DeleteEnvStr name all_users
|
||||
Push ${name}
|
||||
Push ${all_users}
|
||||
Call un.DeleteEnvStr
|
||||
!macroend
|
||||
|
||||
!include WinMessages.nsh
|
||||
|
||||
!define WriteEnvStr_RegKey_AllUsers 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
|
||||
!define WriteEnvStr_RegKey_CurrentUser 'HKCU "Environment"'
|
||||
|
||||
#
|
||||
# WriteEnvStr - Writes an environment variable
|
||||
# Note: Win9x systems requires reboot
|
||||
#
|
||||
# Example:
|
||||
# Push "HOMEDIR" # name
|
||||
# Push "C:\New Home Dir\" # value
|
||||
# Push 1 (all users) or 0 (current user only)
|
||||
# Call WriteEnvStr
|
||||
#
|
||||
Function WriteEnvStr
|
||||
Exch $2 ; $2 all users?
|
||||
Exch
|
||||
Exch $1 ; $1 has environment variable value
|
||||
Exch 2
|
||||
Exch $0 ; $0 has environment variable name
|
||||
Push $3
|
||||
|
||||
Call IsNT
|
||||
Pop $3
|
||||
StrCmp $3 1 WriteEnvStr_NT
|
||||
; Not on NT
|
||||
StrCpy $3 $WINDIR 2 ; Copy drive of windows (c:)
|
||||
FileOpen $3 "$3\autoexec.bat" a
|
||||
FileSeek $3 0 END
|
||||
FileWrite $3 "$\r$\nSET $0=$1$\r$\n"
|
||||
FileClose $3
|
||||
SetRebootFlag true
|
||||
Goto WriteEnvStr_done
|
||||
|
||||
WriteEnvStr_NT:
|
||||
StrCmp $2 1 AllUsers
|
||||
WriteRegExpandStr ${WriteEnvStr_RegKey_CurrentUser} $0 $1
|
||||
Goto Written
|
||||
AllUsers:
|
||||
WriteRegExpandStr ${WriteEnvStr_RegKey_AllUsers} $0 $1
|
||||
Written:
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
WriteEnvStr_done:
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $0
|
||||
Pop $1
|
||||
FunctionEnd
|
||||
|
||||
#
|
||||
# un.DeleteEnvStr - Removes an environment variable
|
||||
# Note: Win9x systems requires reboot
|
||||
#
|
||||
# Example:
|
||||
# Push "HOMEDIR" # name
|
||||
# Push 1 (all users) or 0 (current user only)
|
||||
# Call un.DeleteEnvStr
|
||||
#
|
||||
Function un.DeleteEnvStr
|
||||
Exch $1 ; $1 all users?
|
||||
Exch
|
||||
Exch $0 ; $0 now has the name of the variable
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $6
|
||||
|
||||
Call un.IsNT
|
||||
Pop $2
|
||||
StrCmp $2 1 DeleteEnvStr_NT
|
||||
; Not on NT
|
||||
StrCpy $2 $WINDIR 2
|
||||
FileOpen $2 "$2\autoexec.bat" r
|
||||
GetTempFileName $5
|
||||
FileOpen $3 $5 w
|
||||
StrCpy $0 "SET $0="
|
||||
SetRebootFlag true
|
||||
|
||||
DeleteEnvStr_dosLoop:
|
||||
FileRead $2 $4
|
||||
StrLen $6 $0
|
||||
StrCpy $6 $4 $6
|
||||
StrCmp $6 $0 DeleteEnvStr_dosLoop
|
||||
StrCmp $6 "" DeleteEnvStr_dosLoopEnd
|
||||
FileWrite $3 $4
|
||||
Goto DeleteEnvStr_dosLoop
|
||||
|
||||
DeleteEnvStr_dosLoopEnd:
|
||||
FileClose $3
|
||||
FileClose $2
|
||||
StrCpy $2 $WINDIR 2
|
||||
Delete "$2\autoexec.bat"
|
||||
CopyFiles /SILENT $5 "$2\autoexec.bat"
|
||||
Delete $5
|
||||
Goto DeleteEnvStr_done
|
||||
|
||||
DeleteEnvStr_NT:
|
||||
StrCmp $1 1 DelAllUsers
|
||||
DeleteRegValue ${WriteEnvStr_RegKey_CurrentUser} $0
|
||||
Goto DelWritten
|
||||
DelAllUsers:
|
||||
DeleteRegValue ${WriteEnvStr_RegKey_AllUsers} $0
|
||||
DelWritten:
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
|
||||
0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
DeleteEnvStr_done:
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
!ifndef IsNT_KiCHiK
|
||||
!define IsNT_KiCHiK
|
||||
|
||||
#
|
||||
# [un.]IsNT - Pushes 1 if running on NT, 0 if not
|
||||
#
|
||||
# Example:
|
||||
# Call IsNT
|
||||
# Pop $0
|
||||
# StrCmp $0 1 +3
|
||||
# MessageBox MB_OK "Not running on NT!"
|
||||
# Goto +2
|
||||
# MessageBox MB_OK "Running on NT!"
|
||||
#
|
||||
!macro IsNT UN
|
||||
Function ${UN}IsNT
|
||||
Push $0
|
||||
ReadRegStr $0 HKLM \
|
||||
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
|
||||
StrCmp $0 "" 0 IsNT_yes
|
||||
; we are not NT.
|
||||
Pop $0
|
||||
Push 0
|
||||
Return
|
||||
|
||||
IsNT_yes:
|
||||
; NT!!!
|
||||
Pop $0
|
||||
Push 1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro IsNT ""
|
||||
!insertmacro IsNT "un."
|
||||
|
||||
!endif ; IsNT_KiCHiK
|
||||
|
||||
!endif ; _WriteEnvStr_nsh
|
||||
|
|
|
|||
|
|
@ -1,87 +1,87 @@
|
|||
;============================
|
||||
; Copyright 2007, 2008, 2009 GeometryFactory (France)
|
||||
; Authors: Andreas Fabri (andreas.fabri@geometryfactrory.com),
|
||||
; Fernando Cacciola (fernando.cacciola@geometryfactrory.com),
|
||||
; Laurent Rineau (laurent.rineau@geometryfactory.com)
|
||||
;============================
|
||||
; Some portions of this file have been derived from "boost.nsi", the Boost Windows Installer, contributed by www.boost-consulting.org.
|
||||
;
|
||||
; Copyright 2006 Daniel Wallin
|
||||
; Copyright 2006 Eric Niebler
|
||||
; Distributed under the Boost Software License, Version 1.0. (See
|
||||
; accompanying file LICENSE_1_0.txt or copy at
|
||||
; http://www.boost.org/LICENSE_1_0.txt)
|
||||
;============================
|
||||
|
||||
;!define SkipFiles
|
||||
;!define SkipSetEnvVar
|
||||
;!define SkipDownload
|
||||
!define ViaFTP
|
||||
|
||||
Var Platform
|
||||
Var IsTAUCSInstalled
|
||||
|
||||
!ifdef ViaFTP
|
||||
!define DownloadOK "OK"
|
||||
!define DownloadAborted "cancel"
|
||||
!else
|
||||
!define DownloadOK "success"
|
||||
!define DownloadAborted "cancel"
|
||||
!endif
|
||||
|
||||
!macro DownloadFileFrom SERVER SRC_FOLDER FILE TGT
|
||||
!ifndef SkipDownload
|
||||
!ifdef DebugLog
|
||||
${LogMsg} "Downloadimg ${SERVER}${SRC_FOLDER}${FILE} into ${TGT}\${FILE}"
|
||||
!endif
|
||||
!ifdef ViaFTP
|
||||
inetc::get ${SERVER}${SRC_FOLDER}${FILE} ${TGT}\${FILE}
|
||||
!else
|
||||
NSISdl::download ${SERVER}${SRC_FOLDER}${FILE} ${TGT}\${FILE}
|
||||
!endif
|
||||
Pop $0
|
||||
${If} "$0" == "OK"
|
||||
DetailPrint "${FILE} downloaded successfully."
|
||||
${ElseIf} "$0" == "URL Parts Error"
|
||||
DetailPrint "${FILE} downloaded successfully."
|
||||
${ElseIf} "$0" == "Terminated"
|
||||
DetailPrint "${FILE} download CANCELLED."
|
||||
${ElseIf} "$0" == "Cancelled"
|
||||
DetailPrint "${FILE} download CANCELLED."
|
||||
${Else}
|
||||
MessageBox MB_OK "Unable to download ${SERVER}${SRC_FOLDER}${FILE}. Error: $0"
|
||||
DetailPrint "ERROR $0: Unable to download ${SERVER}${SRC_FOLDER}${FILE}."
|
||||
${Endif}
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro DownloadFile SRC_FOLDER FILE TGT
|
||||
!insertmacro DownloadFileFrom ${FTP_SRC} ${SRC_FOLDER} ${FILE} ${TGT}
|
||||
!macroend
|
||||
|
||||
!macro Install_LAPACK_TAUCS_libs PLATFORM
|
||||
; Headers are not platform dependent so we include this only once, but here since
|
||||
; we want to download headers only if at least one lib variant was selected.
|
||||
${If} $IsTAUCSInstalled = 0
|
||||
StrCpy $IsTAUCSInstalled 1
|
||||
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "taucs.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "taucs_private.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "taucs_config_tests.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "taucs_config_build.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "blaswrap.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
|
||||
${If} "$Platform" == "win32"
|
||||
!insertmacro DownloadFile "auxiliary/win32/TAUCS-CGAL-3.7/" "taucs-common.zip" "$INSTDIR\auxiliary\taucs\lib"
|
||||
${Endif}
|
||||
|
||||
${Endif}
|
||||
|
||||
!insertmacro DownloadFile "auxiliary/${PLATFORM}/TAUCS-CGAL-3.7/" "taucs-libs.zip" "$INSTDIR\auxiliary\taucs\lib"
|
||||
!macroend
|
||||
|
||||
!macro Install_GMP_MPFR_bin PLATFORM
|
||||
!insertmacro DownloadFile "auxiliary/${PLATFORM}/GMP/5.0.1/" "gmp-all-CGAL-3.9.zip" "$INSTDIR\auxiliary\gmp"
|
||||
!insertmacro DownloadFile "auxiliary/${PLATFORM}/MPFR/3.0.0/" "mpfr-all-CGAL-3.9.zip" "$INSTDIR\auxiliary\gmp"
|
||||
!macroend
|
||||
|
||||
;============================
|
||||
; Copyright 2007, 2008, 2009 GeometryFactory (France)
|
||||
; Authors: Andreas Fabri (andreas.fabri@geometryfactrory.com),
|
||||
; Fernando Cacciola (fernando.cacciola@geometryfactrory.com),
|
||||
; Laurent Rineau (laurent.rineau@geometryfactory.com)
|
||||
;============================
|
||||
; Some portions of this file have been derived from "boost.nsi", the Boost Windows Installer, contributed by www.boost-consulting.org.
|
||||
;
|
||||
; Copyright 2006 Daniel Wallin
|
||||
; Copyright 2006 Eric Niebler
|
||||
; Distributed under the Boost Software License, Version 1.0. (See
|
||||
; accompanying file LICENSE_1_0.txt or copy at
|
||||
; http://www.boost.org/LICENSE_1_0.txt)
|
||||
;============================
|
||||
|
||||
;!define SkipFiles
|
||||
;!define SkipSetEnvVar
|
||||
;!define SkipDownload
|
||||
!define ViaFTP
|
||||
|
||||
Var Platform
|
||||
Var IsTAUCSInstalled
|
||||
|
||||
!ifdef ViaFTP
|
||||
!define DownloadOK "OK"
|
||||
!define DownloadAborted "cancel"
|
||||
!else
|
||||
!define DownloadOK "success"
|
||||
!define DownloadAborted "cancel"
|
||||
!endif
|
||||
|
||||
!macro DownloadFileFrom SERVER SRC_FOLDER FILE TGT
|
||||
!ifndef SkipDownload
|
||||
!ifdef DebugLog
|
||||
${LogMsg} "Downloadimg ${SERVER}${SRC_FOLDER}${FILE} into ${TGT}\${FILE}"
|
||||
!endif
|
||||
!ifdef ViaFTP
|
||||
inetc::get ${SERVER}${SRC_FOLDER}${FILE} ${TGT}\${FILE}
|
||||
!else
|
||||
NSISdl::download ${SERVER}${SRC_FOLDER}${FILE} ${TGT}\${FILE}
|
||||
!endif
|
||||
Pop $0
|
||||
${If} "$0" == "OK"
|
||||
DetailPrint "${FILE} downloaded successfully."
|
||||
${ElseIf} "$0" == "URL Parts Error"
|
||||
DetailPrint "${FILE} downloaded successfully."
|
||||
${ElseIf} "$0" == "Terminated"
|
||||
DetailPrint "${FILE} download CANCELLED."
|
||||
${ElseIf} "$0" == "Cancelled"
|
||||
DetailPrint "${FILE} download CANCELLED."
|
||||
${Else}
|
||||
MessageBox MB_OK "Unable to download ${SERVER}${SRC_FOLDER}${FILE}. Error: $0"
|
||||
DetailPrint "ERROR $0: Unable to download ${SERVER}${SRC_FOLDER}${FILE}."
|
||||
${Endif}
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro DownloadFile SRC_FOLDER FILE TGT
|
||||
!insertmacro DownloadFileFrom ${FTP_SRC} ${SRC_FOLDER} ${FILE} ${TGT}
|
||||
!macroend
|
||||
|
||||
!macro Install_LAPACK_TAUCS_libs PLATFORM
|
||||
; Headers are not platform dependent so we include this only once, but here since
|
||||
; we want to download headers only if at least one lib variant was selected.
|
||||
${If} $IsTAUCSInstalled = 0
|
||||
StrCpy $IsTAUCSInstalled 1
|
||||
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "taucs.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "taucs_private.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "taucs_config_tests.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "taucs_config_build.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
!insertmacro DownloadFile "auxiliary/$Platform/TAUCS-CGAL-3.7/" "blaswrap.h.zip" "$INSTDIR\auxiliary\taucs\include"
|
||||
|
||||
${If} "$Platform" == "win32"
|
||||
!insertmacro DownloadFile "auxiliary/win32/TAUCS-CGAL-3.7/" "taucs-common.zip" "$INSTDIR\auxiliary\taucs\lib"
|
||||
${Endif}
|
||||
|
||||
${Endif}
|
||||
|
||||
!insertmacro DownloadFile "auxiliary/${PLATFORM}/TAUCS-CGAL-3.7/" "taucs-libs.zip" "$INSTDIR\auxiliary\taucs\lib"
|
||||
!macroend
|
||||
|
||||
!macro Install_GMP_MPFR_bin PLATFORM
|
||||
!insertmacro DownloadFile "auxiliary/${PLATFORM}/GMP/5.0.1/" "gmp-all-CGAL-3.9.zip" "$INSTDIR\auxiliary\gmp"
|
||||
!insertmacro DownloadFile "auxiliary/${PLATFORM}/MPFR/3.0.0/" "mpfr-all-CGAL-3.9.zip" "$INSTDIR\auxiliary\gmp"
|
||||
!macroend
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue