summaryrefslogtreecommitdiffstats
path: root/contrib/mingw/mingw-path.nsi
blob: 1036ac5700a80f253bb7ee3d931f036bac9b2725 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
; 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