2007-08-20 Chris Johns <chisj@rtems.org>

* filewrite.nsi, getparameters.nsi, instance-check.nsi,
        mingw-path.nsi, sm-dummy.nsi, strslash.nsi, strstr.nsi,
        options.nsi: Added the shared between the 2 installer scripts.

        * msys-path.nsi: Fixed the last LF bug.

        * rtems-autotools.nsi, rtems-tools.nsi: Fixed the instance check,
        added a start menu, remove pages from target installers.

        * rtems.ini: Fixed the URL links. Added support link.

        * rtems_logo.bmp: Trimmed a little more to get a better image.

        * ba-wrap.sh: Stop on a error.

        * build-exes.sh: Use the option parameter variables. Change the
        order the section appear in the installer.
This commit is contained in:
Chris Johns
2007-08-20 02:12:48 +00:00
parent b11f3a6d02
commit 598aab1fe5
16 changed files with 635 additions and 290 deletions

View File

@@ -1,3 +1,23 @@
2007-08-20 Chris Johns <chisj@rtems.org>
* filewrite.nsi, getparameters.nsi, instance-check.nsi,
mingw-path.nsi, sm-dummy.nsi, strslash.nsi, strstr.nsi,
options.nsi: Added the shared between the 2 installer scripts.
* msys-path.nsi: Fixed the last LF bug.
* rtems-autotools.nsi, rtems-tools.nsi: Fixed the instance check,
added a start menu, remove pages from target installers.
* rtems.ini: Fixed the URL links. Added support link.
* rtems_logo.bmp: Trimmed a little more to get a better image.
* ba-wrap.sh: Stop on a error.
* build-exes.sh: Use the option parameter variables. Change the
order the section appear in the installer.
2007-08-03 Chris Johns <chisj@rtems.org>
* rtems_logo.bmp: Clipped to get the correct proportions
in the installer's header.

View File

@@ -12,4 +12,8 @@ echo "Build output: $source/at-log.txt"
echo
$source/build-autotools.sh $* 2>&1 >> $source/at-log.txt
ec=$?
if [ $ec -ne 0 ]; then
echo "ERROR: code '$ec'. Press Any Key to continue"
read
fi
exit $ec

View File

@@ -170,7 +170,7 @@ target_installer_exec()
echo " Strcpy \$1 \"\$INSTDIR\\Packages\\$outfile\"" >> $of
echo " ${t}_found:" >> $of
echo " DetailPrint \"Installing: \$1\"" >> $of
echo " ExecWait '\"\$1\" /S /D=\$INSTDIR' \$0" >> $of
echo " ExecWait '\"\$1\" \$SilentOption \$DebugOption /D=\$INSTDIR' \$0" >> $of
echo " BringToFront" >> $of
echo " IntCmp \$0 0 +3" >> $of
echo " MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \"${!tst} install failed. Do you wish to continue ?\" IDYES +2" >> $of
@@ -367,12 +367,14 @@ create_installer()
fi
echo "!include \"$treloc/rtems-files.nsi\"" >> $of
echo "!include \"$source/rtems-tools.nsi\"" >> $of
echo "!include \"$source/options.nsi\"" >> $of
if [ $n = $common_label ]; then
echo "!include \"$relocation/rtems-sections.nsi\"" >> $of
fi
echo "!include \"$source/rtems-tools.nsi\"" >> $of
echo "cp $source/rtems.ini $treloc/rtems.ini"
$cp $source/rtems.ini $treloc/rtems.ini
check "coping the dialog definition file: $treloc/rtems.ini"

View File

@@ -0,0 +1,5 @@
!macro FILE_WRITE_LINE Handle Text
FileWrite ${Handle} `${Text}`
FileWriteByte ${Handle} "13"
FileWriteByte ${Handle} "10"
!macroend

View File

@@ -0,0 +1,41 @@
; GetParameters
; input, none
; output, top of stack (replaces, with e.g. whatever)
; modifies no other variables.
Function GetParameters
Push $R0
Push $R1
Push $R2
Push $R3
StrCpy $R2 1
StrLen $R3 $CMDLINE
;Check for quote or space
StrCpy $R0 $CMDLINE $R2
StrCmp $R0 '"' 0 +3
StrCpy $R1 '"'
Goto loop
StrCpy $R1 " "
loop:
IntOp $R2 $R2 + 1
StrCpy $R0 $CMDLINE 1 $R2
StrCmp $R0 $R1 get
StrCmp $R2 $R3 get
Goto loop
get:
IntOp $R2 $R2 + 1
StrCpy $R0 $CMDLINE 1 $R2
StrCmp $R0 " " get
StrCpy $R0 $CMDLINE "" $R2
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd

View File

@@ -0,0 +1,23 @@
;
; $Id$
;
; RTEMS Tools Installer.
;
; Copyright Chris Johns (chrisj@rtems.org)
;
Function CheckInstance
Push $R0
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "RTEMSTools") i .r1 ?e'
Pop $R0
!ifdef COMMON_FILES
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort
!else
StrCmp $R0 0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "This installer should not be run directly. Please run the rtems${PRODUCT_VERSION}-tools-${RTEMS_BUILD_VERSION}.exe installer."
Abort
!endif
Pop $R0
FunctionEnd

View File

@@ -0,0 +1,69 @@
;
; $Id$
;
; RTEMS Tools Installer.
;
; Copyright Chris Johns (chrisj@rtems.org)
;
Function MinGWPath
Push $R0
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MinGW" "InstallLocation"
Exch $R0
FunctionEnd
Function MinGWCheckFile
Exch $R0
DetailPrint "Checking for MinGW $R0."
IfFileExists "$R0" +5 0
DetailPrint "Could not find $R0."
Exch $R0
Return
StrCpy $R0 "ok"
Exch $R0
FunctionEnd
Function MinGWCheckExes
Exch $R0
Push $R1
StrCpy $R1 "$R0/bin/gcc.exe"
Push $R1
Call MinGWCheckFile
Pop $R1
StrCmp "ok" 0 Done
StrCpy $R1 "$R0/bin/as.exe"
Push $R1
Call MinGWCheckFile
Pop $R1
StrCmp "ok" 0 Done
StrCpy $R1 "$R0/bin/ld.exe"
Push $R1
Call MinGWCheckFile
Pop $R1
Done:
StrCpy $R0 $R1
Pop $R1
Exch $R0
FunctionEnd
Function MinGWDetect
Push $R0
Push $R1
StrCpy $R1 "c:\mingw"
DetailPrint "Checking MinGW default install path: $R1"
Push $R1
Call MinGWCheckExes
Pop $R0
StrCmp $R0 "ok" Found
DetailPrint "Checking Registry for MinGW Installed Path"
Call MinGWPath
Pop $R0
ifErrors 0 +3
MessageBox MB_OK "MinGW Not Installed. Please install MinGW from http://www.mingw.org/"
Abort
Found:
StrCpy $R0 $R1
DetailPrint "MinGW Found: $R0"
Pop $R1
Exch $R0
FunctionEnd

View File

@@ -1,3 +1,13 @@
;
; $Id$
;
; RTEMS Tools Installer.
;
; Copyright Chris Johns (chrisj@rtems.org)
;
!include "${RTEMS_SOURCE}/strslash.nsi"
Function MsysPath
Push $R0
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MSYS-1.0_is1" "Inno Setup: App Path"
@@ -107,3 +117,35 @@ Function MSYSDetectSilent
Pop $R1
Exch $R0
FunctionEnd
Function MSYSFstabUpdate
Call MSYSDetectSilent
Pop $R0
Push $R0
Push $INSTDIR
Push '\\'
Pop $R0
Call StrSlash
Pop $R1
Pop $R0
DetailPrint "Setting MSYS fstab: $R1 -> /opt/rtems-${PRODUCT_VERSION}"
StrCpy $R1 "$R1 /opt/rtems-${PRODUCT_VERSION}$\n"
FileOpen $9 "$R0\etc\fstab" a
ifErrors 0 +3
MessageBox MB_OK "Cannot open $R0\etc\fstab. MSYS mount point not added."
Goto Close
FileSeek $9 0 SET
ReadLoop:
FileRead $9 $R2
ifErrors Append
StrCmp $R1 $R2 Close ReadLoop
Append:
FileSeek $9 0 END
StrCpy $R2 $R2 1 -1
StrCmp $R2 "$\n" +2 0
FileWrite $9 "$\n"
FileWrite $9 $R1
Close:
FileClose $9
ClearErrors
FunctionEnd

54
contrib/mingw/options.nsi Normal file
View File

@@ -0,0 +1,54 @@
;
; $Id$
;
; RTEMS Tools Installer.
;
; Copyright Chris Johns (chrisj@rtems.org)
;
!ifndef OPTIONS_DEFINED
!define OPTIONS_DEFINED
!include "${RTEMS_SOURCE}/strstr.nsi"
!include "${RTEMS_SOURCE}/getparameters.nsi"
Var "SilentOption"
Var "DebugOption"
Var "DebugScriptOption"
Function CheckCmdLineOption
Exch $R0
Call GetParameters
Push $R0
Call StrStr
Exch $R1
StrCmp $R1 "" 0 +2
StrCpy $R0 "not-found"
Pop $R1
Exch $R0
FunctionEnd
Function CheckSilent
StrCpy $SilentOption ""
Push $R0
Push "/SILENT"
Call CheckCmdLineOption
Pop $R0
StrCmp $R0 "not-found" +2 0
StrCpy $SilentOption "/S"
Pop $R0
FunctionEnd
Function CheckDebug
StrCpy $DebugOption ""
Push $R0
Push "/DEBUG"
Call CheckCmdLineOption
Pop $R0
StrCmp $R0 "not-found" +3 0
StrCpy $DebugScriptOption "-d"
StrCpy $DebugOption "/DEBUG"
Pop $R0
FunctionEnd
!endif

View File

@@ -12,6 +12,10 @@
!define PRODUCT_VERSION ${RTEMS_VERSION}
!define PRODUCT_PUBLISHER "RTEM Project Team"
!define PRODUCT_WEB_SITE "http://www.rtems.org/"
!define PRODUCT_TITLE "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
; MUI 1.66 compatible ------
!include "MUI.nsh"
@@ -26,21 +30,18 @@
!define MUI_COMPONENTSPAGE_SMALLDESC
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Details of what will happen.
Page custom RTEMSMessage
; License page
;!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "${RTEMS_LICENSE_FILE}"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Start Menu Support
!include "${RTEMS_SOURCE}/sm-dummy.nsi"
var smfolder
!define MUI_STARTMENUPAGE_DISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "RTEMS ${PRODUCT_VERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU_DUMMY Application $smfolder
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
@@ -63,15 +64,21 @@ ShowInstDetails show
ShowUnInstDetails show
BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}"
AllowRootDirInstall false
AutoCloseWindow false
AutoCloseWindow true
CRCCheck force
!include "${RTEMS_SOURCE}/instance-check.nsi"
!include "${RTEMS_SOURCE}/mingw-path.nsi"
!include "${RTEMS_SOURCE}/msys-path.nsi"
!include "${RTEMS_SOURCE}/options.nsi"
!include "${RTEMS_SOURCE}/filewrite.nsi"
Section "RTEMS ${RTEMS_TARGET} Tools" SecTools
SetDetailsView show
AddSize ${RTEMS_TOOLS_SIZE}
Call MSYSFstabUpdate
/*
* Detect if MSYS is installed.
*/
@@ -117,8 +124,8 @@ Section "RTEMS ${RTEMS_TARGET} Tools" SecTools
Pop $R0
Call StrSlash
Pop $R0
DetailPrint "Building autoconf. Command window closes automatically."
ExecWait '"$9\bin\sh" --login -c "$R1 -p /opt/rtems-${PRODUCT_VERSION} -b $R2 -c $R0"' $0
DetailPrint "Building automake. Command window closes automatically. Debug:$DebugScriptOption"
ExecWait '"$9\bin\sh" --login -c "$R1 $DebugScriptOption -p /opt/rtems-${PRODUCT_VERSION} -b $R2 -c $R0"' $0
BringToFront
IntCmp $0 0 +3
MessageBox MB_OK "Autoconf build failed. See $INSTDIR\Packages\Source\at-log.txt"
@@ -137,8 +144,8 @@ Section "RTEMS ${RTEMS_TARGET} Tools" SecTools
Pop $R0
Call StrSlash
Pop $R0
DetailPrint "Building automake. Command window closes automatically."
ExecWait '"$9\bin\sh" --login -c "$R1 -p /opt/rtems-${PRODUCT_VERSION} -b $R2 -c $R0"' $0
DetailPrint "Building automake. Command window closes automatically. Debug:$DebugScriptOption"
ExecWait '"$9\bin\sh" --login -c "$R1 $DebugScriptOption -p /opt/rtems-${PRODUCT_VERSION} -b $R2 -c $R0"' $0
BringToFront
IntCmp $0 0 +3
MessageBox MB_OK "Automake build failed. See $INSTDIR\Packages\Source\at-log.txt"
@@ -153,74 +160,15 @@ Section "RTEMS ${RTEMS_TARGET} Tools" SecTools
RMDir /r "$INSTDIR\Packages\Build"
SectionEnd
!macro FILE_WRITE_LINE Handle Text
FileWrite ${Handle} `${Text}`
FileWriteByte ${Handle} "13"
FileWriteByte ${Handle} "10"
!macroend
Function .onInit
;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "rtems.ini"
FunctionEnd
Function RTEMSMessage
!insertmacro MUI_HEADER_TEXT \
"RTEMS Tools (Autoconf/Automake)" \
"A tool set for the RTEMS operating system."
;Display the Install Options dialog
Push $R0
Push $R1
Push $R2
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\rtems.ini"
Pop $R0
GetDlgItem $R1 $R0 1200 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "12" "700"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1202 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1203 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1204 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1205 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1206 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
InstallOptions::show
Pop $R0
Pop $R2
Pop $R1
Pop $R0
;Check if we are the correct instance for our mode.
Call CheckInstance
;Handle the Command line options
Call CheckSilent
Call CheckDebug
;See if MinGW and MSYS are installed
Call MinGWDetect
Call MSYSDetect
FunctionEnd
Var FileList
@@ -323,54 +271,31 @@ Function un.RemoveFilesFromFile
Pop $R7
FunctionEnd
; Push $filenamestring (e.g. 'c:\this\and\that\filename.htm')
; Push '\\'
; Pop $R0
; Call StrSlash
; Pop $R0
; ;Now $R0 contains 'c:/this/and/that/filename.htm'
Function StrSlash
Exch $R0
Push $R1
Push $R2
StrCpy $R1 0
loop:
IntOp $R1 $R1 - 1
StrCpy $R2 $R0 1 $R1
StrCmp $R2 "" done
StrCmp $R2 "\" 0 loop ;" keep to get Emacs for fontlock
StrCpy $R2 $R0 $R1
Push $R1
IntOp $R1 $R1 + 1
StrCpy $R1 $R0 "" $R1
StrCpy $R0 "$R2/$R1"
Pop $R1
IntOp $R1 $R1 - 1
Goto loop
done:
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
Section -Post
StrCpy $R0 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
StrCpy $R1 "RTEMS ${RTEMS_TARGET} Tools.lnk"
WriteUninstaller "$R0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"DisplayName" "$(^Name)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"UninstallString" "$R0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"DisplayVersion" "${PRODUCT_VERSION} Build-${RTEMS_BUILD_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"Publisher" "${PRODUCT_PUBLISHER}"
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $R2
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$R2"
CreateDirectory "$SMPROGRAMS\$R2\Uninstall"
CreateShortCut "$SMPROGRAMS\$R2\Uninstall\$R1" "$R0"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section Uninstall
SetDetailsView show
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}"
DetailPrint "Delete the installed files"
Push "$INSTDIR\Uninstall\${RTEMS_AUTOCONF}-files"
call un.RemoveFilesFromFile
@@ -388,8 +313,10 @@ Section Uninstall
!insertmacro RTEMS_DELETE_AUTOMAKE_PATCHES
RMDir "$INSTDIR\Packages\Source"
RMDir "$INSTDIR\Packages\Build"
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $smfolder
Delete "$SMPROGRAMS\$smfolder\Uninstall\RTEMS ${RTEMS_TARGET} Tools.lnk"
Delete $INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe
RMDir "$INSTDIR"
DetailPrint "All done."
SetAutoClose false
SetAutoClose true
SectionEnd

View File

@@ -12,11 +12,20 @@
!define PRODUCT_VERSION ${RTEMS_VERSION}
!define PRODUCT_PUBLISHER "RTEMS Project Team"
!define PRODUCT_WEB_SITE "http://www.rtems.org/"
!ifdef COMMON_FILES
!define PRODUCT_TITLE "${PRODUCT_NAME} ${PRODUCT_VERSION} (Build ${RTEMS_BUILD_VERSION})"
!else
!define PRODUCT_TITLE "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
!endif
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
; MUI 1.66 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_FUNCTION_GUIINIT
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
@@ -26,21 +35,45 @@
!define MUI_COMPONENTSPAGE_SMALLDESC
!ifdef COMMON_FILES
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Details of what will happen.
Page custom RTEMSMessage
; License page
;!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "${RTEMS_LICENSE_FILE}"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!define MUI_PAGE_HEADER_SUBTEXT "Choose the folder in which to install the RTEMS Tools."
!define MUI_DIRECTORYPAGE_TEXT_TOP "${PRODUCT_NAME} will install RTEMS Tools in the following directory. To install in a different folder click Browse and select another folder. Click Next to continue."
!insertmacro MUI_PAGE_DIRECTORY
!endif
; Start menu page
!ifndef COMMON_FILES
!include "${RTEMS_SOURCE}/sm-dummy.nsi"
!endif
var smfolder
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "RTEMS ${PRODUCT_VERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!ifdef COMMON_FILES
!insertmacro MUI_PAGE_STARTMENU Application $smfolder
!else
!insertmacro MUI_PAGE_STARTMENU_DUMMY Application $smfolder
!endif
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
!ifdef COMMON_FILES
; Finish page
!insertmacro MUI_PAGE_FINISH
!endif
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
@@ -56,21 +89,27 @@ Page custom RTEMSMessage
ReserveFile "rtems.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
!ifdef COMMON_FILES
Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (Build ${RTEMS_BUILD_VERSION})"
OutFile "${RTEMS_BINARY}/rtems${PRODUCT_VERSION}-tools-${RTEMS_BUILD_VERSION}.exe"
BrandingText "RTEMS Tools v${PRODUCT_VERSION}"
AutoCloseWindow false
!else
Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
OutFile "${RTEMS_BINARY}/${RTEMS_OUTFILE}"
BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}"
AutoCloseWindow true
!endif
InstallDir "C:\opt\rtems-${PRODUCT_VERSION}"
ShowInstDetails show
ShowUnInstDetails show
BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}"
AllowRootDirInstall false
AutoCloseWindow false
CRCCheck force
!include "${RTEMS_SOURCE}/instance-check.nsi"
!include "${RTEMS_SOURCE}/msys-path.nsi"
!include "${RTEMS_SOURCE}/options.nsi"
!include "${RTEMS_SOURCE}/filewrite.nsi"
Section -SecFiles
AddSize ${RTEMS_TOOLS_SIZE}
@@ -86,21 +125,20 @@ Section -SecCommon
SectionEnd
!endif
!macro FILE_WRITE_LINE Handle Text
FileWrite ${Handle} `${Text}`
FileWriteByte ${Handle} "13"
FileWriteByte ${Handle} "10"
!macroend
Function .onInit
;Check if we are the correct instance for our mode.
Call CheckInstance
;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "rtems.ini"
;Handle the Command line options
Call CheckSilent
Call CheckDebug
Call MSYSFstabUpdate
FunctionEnd
Function RTEMSMessage
!insertmacro MUI_HEADER_TEXT \
"RTEMS Tools (${RTEMS_TARGET})" \
"RTEMS Tools (Build ${RTEMS_BUILD_VERSION})" \
"A tool set for the RTEMS operating system."
;Display the Install Options dialog
@@ -109,86 +147,54 @@ Function RTEMSMessage
Push $R1
Push $R2
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\rtems.ini"
Pop $R0
GetDlgItem $R1 $R0 1200 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "12" "700"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1202 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1203 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1204 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1205 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1206 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
InstallOptions::show
Pop $R0
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\rtems.ini"
Pop $R0
GetDlgItem $R1 $R0 1200 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "12" "700"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1202 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1203 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1204 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1205 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
GetDlgItem $R1 $R0 1206 ;1200 + Field number - 1
;$R1 contains the HWND of the first field
CreateFont $R2 "Tahoma" "8" "300"
SendMessage $R1 ${WM_SETFONT} $R2 0
InstallOptions::show
Pop $R0
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
; Push $filenamestring (e.g. 'c:\this\and\that\filename.htm')
; Push '\\'
; Pop $R0
; Call StrSlash
; Pop $R0
; ;Now $R0 contains 'c:/this/and/that/filename.htm'
Function StrSlash
Exch $R0
Push $R1
Push $R2
StrCpy $R1 0
loop:
IntOp $R1 $R1 - 1
StrCpy $R2 $R0 1 $R1
StrCmp $R2 "" done
StrCmp $R2 "\" 0 loop ; "
StrCpy $R2 $R0 $R1
Push $R1
IntOp $R1 $R1 + 1
StrCpy $R1 $R0 "" $R1
StrCpy $R0 "$R2/$R1"
Pop $R1
IntOp $R1 $R1 - 1
Goto loop
done:
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
!ifdef COMMON_FILES
Section -BatchFiles
FileOpen $9 $INSTDIR\rtems.bat w
FileOpen $9 $INSTDIR\rtems-env.bat w
!insertmacro FILE_WRITE_LINE $9 "@echo off"
!insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
!insertmacro FILE_WRITE_LINE $9 "set PATH=$INSTDIR\bin;c:\mingw\bin;c:\msys\1.0\bin;%PATH%"
@@ -201,14 +207,14 @@ Section -BatchFiles
!insertmacro FILE_WRITE_LINE $9 ":Finished"
FileClose $9
FileOpen $9 $INSTDIR\rtems-cmd.bat w
FileOpen $9 $INSTDIR\rtems.bat w
!insertmacro FILE_WRITE_LINE $9 "@echo off"
!insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
!insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT"
!insertmacro FILE_WRITE_LINE $9 "start command.com /e:4096 /k $INSTDIR\rtems.bat %1 %2 %3 %4"
!insertmacro FILE_WRITE_LINE $9 "start command.com /e:4096 /k $INSTDIR\rtems-env.bat %1 %2 %3 %4"
!insertmacro FILE_WRITE_LINE $9 "exit"
!insertmacro FILE_WRITE_LINE $9 ":WinNT"
!insertmacro FILE_WRITE_LINE $9 "start cmd.exe /k $INSTDIR\rtems.bat %1 %2 %3 %4"
!insertmacro FILE_WRITE_LINE $9 "start cmd.exe /k $INSTDIR\rtems-env.bat %1 %2 %3 %4"
!insertmacro FILE_WRITE_LINE $9 "exit"
FileClose $9
@@ -216,7 +222,7 @@ Section -BatchFiles
!insertmacro FILE_WRITE_LINE $9 "@echo off"
!insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
!insertmacro FILE_WRITE_LINE $9 "rem We can only handle 9 parameters. More is too hard."
!insertmacro FILE_WRITE_LINE $9 "call $INSTDIR\rtems.bat"
!insertmacro FILE_WRITE_LINE $9 "call $INSTDIR\rtems-env.bat"
!insertmacro FILE_WRITE_LINE $9 "%1 %2 %3 %4 %5 %6 %7 %8 %9"
FileClose $9
@@ -235,94 +241,101 @@ Section -BatchFiles
!insertmacro FILE_WRITE_LINE $9 " -e 's/s:\([0-9]*\):/s(\1):/'"
FileClose $9
SectionEnd
Section -MSYSLinks
Call MSYSDetectSilent
Pop $R0
ifFileExists "$R0\etc\fstab" 0 Done
Push $R0
Push $INSTDIR
Push '\\'
Pop $R0
Call StrSlash
Pop $R1
Pop $R0
DetailPrint "Setting MSYS fstab: $R1 -> /opt/rtems-${PRODUCT_VERSION}"
StrCpy $R1 "$R1 /opt/rtems-${PRODUCT_VERSION}$\n"
FileOpen $9 "$R0\etc\fstab" a
ifErrors 0 +3
MessageBox MB_OK "Cannot open $R0\etc\fstab. MSYS mount point no added."
Goto Close
FileSeek $9 0 SET
ReadLoop:
FileRead $9 $R2
ifErrors Append
StrCmp $R1 $R2 Close ReadLoop
Append:
FileSeek $9 0 END
FileWrite $9 $R1
Close:
FileClose $9
Done:
ClearErrors
SectionEnd
!endif
Section -Post
!ifdef COMMON_FILES
StrCpy $R0 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-uninst.exe"
StrCpy $R1 "RTEMS Tools.lnk"
!else
StrCpy $R0 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
StrCpy $R1 "RTEMS ${RTEMS_TARGET} Tools.lnk"
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $smfolder
!endif
WriteUninstaller "$R0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"DisplayName" "$(^Name)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"UninstallString" "$R0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"DisplayVersion" "${PRODUCT_VERSION} Build-${RTEMS_BUILD_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
"Publisher" "${PRODUCT_PUBLISHER}"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$smfolder"
!ifdef COMMON_FILES
SetOutPath $INSTDIR
WriteIniStr "$INSTDIR\RTEMS.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
WriteIniStr "$INSTDIR\RTEMS-Wiki.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}wiki"
WriteIniStr "$INSTDIR\RTEMS-Documentation.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}onlinedocs/releases/rtemsdocs-4.7.99.2/share/rtems/html/"
WriteIniStr "$INSTDIR\RTEMS-Support.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}support.html"
CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Tools.lnk" "$INSTDIR\rtems.bat"
CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Website.lnk" "$INSTDIR\RTEMS.url"
CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Wiki.lnk" "$INSTDIR\RTEMS-Wiki.url"
CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Documentation.lnk" "$INSTDIR\RTEMS-Documentation.url"
CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Support.lnk" "$INSTDIR\RTEMS-Support.url"
!endif
CreateDirectory "$SMPROGRAMS\$smfolder\Uninstall"
CreateShortCut "$SMPROGRAMS\$smfolder\Uninstall\$R1" "$R0"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
"Are you sure you want to uninstall RTEMS Tools (${RTEMS_TARGET})?" IDYES +2
"Are you sure you want to uninstall ${PRODUCT_TITLE} ?" IDYES +2
Abort
FunctionEnd
Section Uninstall
SetDetailsView show
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DetailPrint "Delete the installed files"
!insertmacro RTEMS_DELETE_FILES
StrCpy $2 0
!ifdef COMMON_FILES
FindFirst $0 $1 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-*-uninst.exe"
Uninstall_Targets:
StrCmp $1 "" Uninstall_Targets_Done
IntCmp $2 0 0 +3
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
"You have tools installed. Are you sure you want to uninstall all RTEMS Tools ?" IDYES +2
Abort
StrCpy $2 1
DetailPrint "Uninstalling $1"
ExecWait '"$INSTDIR\$1" /S'
ExecWait '"$INSTDIR\$1" $SilentOption $DebugOption'
Delete $1
BringToFront
FindNext $0 $1
Goto Uninstall_Targets
Uninstall_Targets_Done:
FindClose $0
!endif
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DetailPrint "Delete the installed files"
!insertmacro RTEMS_DELETE_FILES
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $smfolder
!ifdef COMMON_FILES
Delete "$INSTDIR\AUTHORS"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\README"
Delete "$INSTDIR\rtems.bat"
Delete "$INSTDIR\rtems-cmd.bat"
Delete "$INSTDIR\rtems-env.bat"
Delete "$INSTDIR\sh-run.bat"
Delete "$INSTDIR\vs-make.sh"
Delete "$INSTDIR\RTEMS.url"
Delete "$INSTDIR\RTEMS-Wiki.url"
Delete "$INSTDIR\RTEMS-Documentation.url"
Delete "$INSTDIR\RTEMS-Support.url"
RMDir /r "$SMPROGRAMS\$smfolder"
Delete "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-uninst.exe"
!else
Delete "$SMPROGRAMS\$smfolder\Uninstall\RTEMS ${RTEMS_TARGET} Tools.lnk"
Delete "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
Delete "$INSTDIR\Packages"
!endif
RMDir "$INSTDIR"
DetailPrint "All done."
!ifdef COMMON_FILES
SetAutoClose false
!else
SetAutoClose true
!endif
SectionEnd

View File

@@ -7,15 +7,15 @@
;
[Settings]
NumFields=8
NumFields=10
[Field 1]
Type=Label
Text=RTEMS Tools for Windows is a set of MinGW tools suitable for compiling RTEMS and RTEMS applications. You should install download and install the MinGW runtime and if you wish to build RTEMS and if you need autoconf or automake support the MSYS and MSYS DTK packages as well. You can find the MinGW and MSYS installers on the MinGW web site.\r\n\r\nFurther information and the source code with patches can be located via the Wiki.
Text=RTEMS Tools for Windows is a set of MinGW tools suitable for compiling RTEMS and RTEMS applications. You should download and install the MinGW runtime and if you wish to build RTEMS or if you need autoconf or automake support the MSYS and MSYS DTK packages as well. You can find the MinGW and MSYS installers on the MinGW web site under the link below.\r\n\r\nFurther information and the source code with patches can be located via the Wiki.
Left=0
Right=292
Top=25
Bottom=87
Top=15
Bottom=74
[Field 2]
Type=Label
@@ -29,50 +29,67 @@ Bottom=12
Type=Link
Text=http://www.rtems.org/wiki/index.php/MinGW_Tools_for_Windows
State=http://www.rtems.org/wiki/index.php/MinGW_Tools_for_Windows
Left=71
Right=292
Top=100
Bottom=108
Left=50
Right=271
Top=117
Bottom=125
[Field 4]
Type=Link
Text=http://www.rtems.org/
State=http://www.rtems.org/
Left=71
Right=187
Top=89
Text=http://www.rtems.org/support.html
State=http://www.rtems.org/support.html
Left=78
Right=217
Top=91
Bottom=99
[Field 5]
Type=Link
Text=http://www.mingw.org/
State=http://www.mingw.org/
Left=71
Right=196
Top=112
Bottom=120
Text=http://www.rtems.org/
State=http://www.rtems.org/
Left=50
Right=166
Top=106
Bottom=116
[Field 6]
Type=Label
Text=RTEMS Website
Left=2
Right=65
Top=89
Bottom=97
Type=Link
Text=http://www.mingw.org/
State=http://www.mingw.org/
Left=50
Right=175
Top=127
Bottom=135
[Field 7]
Type=Label
Text=Tools Wiki
Left=2
Right=46
Top=101
Bottom=109
Text=RTEMS
Left=16
Right=44
Top=106
Bottom=114
[Field 8]
Type=Label
Text=MinGW Website
Left=2
Right=57
Top=112
Bottom=120
Text=Tools Wiki
Left=6
Right=46
Top=116
Bottom=124
[Field 9]
Type=Label
Text=MinGW Website
Left=18
Right=45
Top=127
Bottom=135
[Field 10]
Type=Label
Text=Professional RTEMS Support is available from OAR. Contact them for a quote.
Left=8
Right=292
Top=78
Bottom=88

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 105 KiB

View File

@@ -0,0 +1,36 @@
;
; Copy the the MUI code with the page bit missing
;
!macro MUI_PAGE_STARTMENU_DUMMY ID VAR
!insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}STARTMENUPAGE
!insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_DEFAULTFOLDER "$(^Name)"
!insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_TEXT_TOP "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_STARTMENU_TOP)"
!insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_TEXT_CHECKBOX "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_STARTMENU_CHECKBOX)"
!define MUI_STARTMENUPAGE_VARIABLE "${VAR}"
!define "MUI_STARTMENUPAGE_${ID}_VARIABLE" "${MUI_STARTMENUPAGE_VARIABLE}"
!define "MUI_STARTMENUPAGE_${ID}_DEFAULTFOLDER" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
!ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT
!define "MUI_STARTMENUPAGE_${ID}_REGISTRY_ROOT" "${MUI_STARTMENUPAGE_REGISTRY_ROOT}"
!endif
!ifdef MUI_STARTMENUPAGE_REGISTRY_KEY
!define "MUI_STARTMENUPAGE_${ID}_REGISTRY_KEY" "${MUI_STARTMENUPAGE_REGISTRY_KEY}"
!endif
!ifdef MUI_STARTMENUPAGE_REGISTRY_VALUENAME
!define "MUI_STARTMENUPAGE_${ID}_REGISTRY_VALUENAME" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
!endif
!undef MUI_STARTMENUPAGE_VARIABLE
!undef MUI_STARTMENUPAGE_TEXT_TOP
!undef MUI_STARTMENUPAGE_TEXT_CHECKBOX
!undef MUI_STARTMENUPAGE_DEFAULTFOLDER
!insertmacro MUI_UNSET MUI_STARTMENUPAGE_NODISABLE
!insertmacro MUI_UNSET MUI_STARTMENUPAGE_REGISTRY_ROOT
!insertmacro MUI_UNSET MUI_STARTMENUPAGE_REGISTRY_KEY
!insertmacro MUI_UNSET MUI_STARTMENUPAGE_REGISTRY_VALUENAME
!insertmacro MUI_UNSET MUI_STARTMENUPAGE_BGCOLOR
!macroend

View File

@@ -0,0 +1,29 @@
; Push $filenamestring (e.g. 'c:\this\and\that\filename.htm')
; Push '\\'
; Pop $R0
; Call StrSlash
; Pop $R0
; ;Now $R0 contains 'c:/this/and/that/filename.htm'
Function StrSlash
Exch $R0
Push $R1
Push $R2
StrCpy $R1 0
loop:
IntOp $R1 $R1 - 1
StrCpy $R2 $R0 1 $R1
StrCmp $R2 "" done
StrCmp $R2 "\" 0 loop ; "
StrCpy $R2 $R0 $R1
Push $R1
IntOp $R1 $R1 + 1
StrCpy $R1 $R0 "" $R1
StrCpy $R0 "$R2/$R1"
Pop $R1
IntOp $R1 $R1 - 1
Goto loop
done:
Pop $R2
Pop $R1
Exch $R0
FunctionEnd

63
contrib/mingw/strstr.nsi Normal file
View File

@@ -0,0 +1,63 @@
!define StrStr "!insertmacro StrStr"
!macro StrStr ResultVar String SubString
Push `${String}`
Push `${SubString}`
Call StrStr
Pop `${ResultVar}`
!macroend
Function StrStr
/*After this point:
------------------------------------------
$R0 = SubString (input)
$R1 = String (input)
$R2 = SubStringLen (temp)
$R3 = StrLen (temp)
$R4 = StartCharPos (temp)
$R5 = TempStr (temp)*/
;Get input from user
Exch $R0
Exch
Exch $R1
Push $R2
Push $R3
Push $R4
Push $R5
;Get "String" and "SubString" length
StrLen $R2 $R0
StrLen $R3 $R1
;Start "StartCharPos" counter
StrCpy $R4 0
;Loop until "SubString" is found or "String" reaches its end
loop:
;Remove everything before and after the searched part ("TempStr")
StrCpy $R5 $R1 $R2 $R4
;Compare "TempStr" with "SubString"
StrCmp $R5 $R0 done
;If not "SubString", this could be "String"'s end
IntCmp $R4 $R3 done 0 done
;If not, continue the loop
IntOp $R4 $R4 + 1
Goto loop
done:
/*After this point:
------------------------------------------
$R0 = ResultVar (output)*/
;Remove part before "SubString" on "String" (if there has one)
StrCpy $R0 $R1 `` $R4
;Return output to user
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd