| 1 | # GNU Install script for MPW.
 | 
|---|
| 2 | 
 | 
|---|
| 3 | Set OldExit "{Exit}"
 | 
|---|
| 4 | Set Exit 0
 | 
|---|
| 5 | 
 | 
|---|
| 6 | Set TempUserStartup "{TempFolder}"__temp__UserStartup
 | 
|---|
| 7 | 
 | 
|---|
| 8 | Echo '# UserStartup generated by GNU Install script' > "{TempUserStartup}"
 | 
|---|
| 9 | Echo ''                                         >> "{TempUserStartup}"
 | 
|---|
| 10 | 
 | 
|---|
| 11 | # (should) Check that disk space is sufficient for installation.
 | 
|---|
| 12 | 
 | 
|---|
| 13 | # Assume that the install script is where everything else is.
 | 
|---|
| 14 | 
 | 
|---|
| 15 | Set thisdir "`Directory`"
 | 
|---|
| 16 | 
 | 
|---|
| 17 | # Copy the binaries to the desired place.
 | 
|---|
| 18 | 
 | 
|---|
| 19 | Confirm -t "Copy the binaries to somewhere else?"
 | 
|---|
| 20 | Set TmpStatus {Status}
 | 
|---|
| 21 | If {TmpStatus} == 0
 | 
|---|
| 22 |         Set bindest "`GetFileName -d -m "Where to install the binaries?"`"
 | 
|---|
| 23 |         If {Status} == 0
 | 
|---|
| 24 |                 If "`Exists "{thisdir}bin"`" != ""
 | 
|---|
| 25 |                         For afile In "{thisdir}"bin:\Option-x
 | 
|---|
| 26 |                                 Duplicate -y "{afile}" "{bindest}"
 | 
|---|
| 27 |                         End For
 | 
|---|
| 28 |                 Else
 | 
|---|
| 29 |                         Echo "bin directory not found, exiting"
 | 
|---|
| 30 |                         Exit 1
 | 
|---|
| 31 |                 End If
 | 
|---|
| 32 |         Else
 | 
|---|
| 33 |                 Echo "No destination supplied, exiting"
 | 
|---|
| 34 |                 Exit 1
 | 
|---|
| 35 |         End If
 | 
|---|
| 36 | Else If {TmpStatus} == 4
 | 
|---|
| 37 |         # Use the existing directory.
 | 
|---|
| 38 |         Set bindest "{thisdir}bin:"
 | 
|---|
| 39 | Else
 | 
|---|
| 40 |         # Cancelled from confirmation, escape altogether.
 | 
|---|
| 41 |         Exit 1
 | 
|---|
| 42 | End If
 | 
|---|
| 43 | 
 | 
|---|
| 44 | # Copy the libraries to the desired place.
 | 
|---|
| 45 | 
 | 
|---|
| 46 | Confirm -t "Copy the libraries to somewhere else?"
 | 
|---|
| 47 | Set TmpStatus {Status}
 | 
|---|
| 48 | If {TmpStatus} == 0
 | 
|---|
| 49 |         Set libdest "`GetFileName -d -m "Where to install the libraries?"`"
 | 
|---|
| 50 |         If {Status} == 0
 | 
|---|
| 51 |                 If "`Exists "{thisdir}lib:"`" != ""
 | 
|---|
| 52 |                         For afile In "{thisdir}"lib:\Option-x
 | 
|---|
| 53 |                                 Duplicate -y "{afile}" "{libdest}"
 | 
|---|
| 54 |                         End For
 | 
|---|
| 55 |                 Else
 | 
|---|
| 56 |                         Echo "lib directory not found, exiting"
 | 
|---|
| 57 |                         Exit 1
 | 
|---|
| 58 |                 End If
 | 
|---|
| 59 |         Else
 | 
|---|
| 60 |                 Echo "No destination supplied, exiting"
 | 
|---|
| 61 |                 Exit 1
 | 
|---|
| 62 |         End If
 | 
|---|
| 63 | Else If {TmpStatus} == 4
 | 
|---|
| 64 |         # Use the existing directory.
 | 
|---|
| 65 |         Set libdest "{thisdir}lib:"
 | 
|---|
| 66 | Else
 | 
|---|
| 67 |         # Cancelled from confirmation, escape altogether.
 | 
|---|
| 68 |         Exit 1
 | 
|---|
| 69 | End If
 | 
|---|
| 70 | 
 | 
|---|
| 71 | 
 | 
|---|
| 72 | # Add the location of the binaries to the command path.
 | 
|---|
| 73 | 
 | 
|---|
| 74 | Echo -n 'Set Commands "'                        >> "{TempUserStartup}"
 | 
|---|
| 75 | Echo -n "{bindest}"                             >> "{TempUserStartup}"
 | 
|---|
| 76 | Echo    ',{Commands}"'                          >> "{TempUserStartup}"
 | 
|---|
| 77 | Echo ''                                         >> "{TempUserStartup}"
 | 
|---|
| 78 | 
 | 
|---|
| 79 | # Set up GCC exec prefix.
 | 
|---|
| 80 | 
 | 
|---|
| 81 | Set gcclibdir "{libdest}"gcc-lib:
 | 
|---|
| 82 | 
 | 
|---|
| 83 | Echo -n 'Set GCC_EXEC_PREFIX "'                 >> "{TempUserStartup}"
 | 
|---|
| 84 | Echo -n "{gcclibdir}"                           >> "{TempUserStartup}"
 | 
|---|
| 85 | Echo    '"'                                     >> "{TempUserStartup}"
 | 
|---|
| 86 | Echo "Export GCC_EXEC_PREFIX"                   >> "{TempUserStartup}"
 | 
|---|
| 87 | Echo ''                                         >> "{TempUserStartup}"
 | 
|---|
| 88 | 
 | 
|---|
| 89 | # Set up path to libgcc.xcoff etc.
 | 
|---|
| 90 | 
 | 
|---|
| 91 | Echo -n 'Set GCCPPCLibraries "'                 >> "{TempUserStartup}"
 | 
|---|
| 92 | Echo -n "{libdest}"                             >> "{TempUserStartup}"
 | 
|---|
| 93 | Echo    '"'                                     >> "{TempUserStartup}"
 | 
|---|
| 94 | Echo "Export GCCPPCLibraries"                   >> "{TempUserStartup}"
 | 
|---|
| 95 | Echo ''                                         >> "{TempUserStartup}"
 | 
|---|
| 96 | 
 | 
|---|
| 97 | # Display contents of UserStartup, confirm installation.
 | 
|---|
| 98 | 
 | 
|---|
| 99 | Set UserStartupName "UserStartup\Option-8GNU"
 | 
|---|
| 100 | 
 | 
|---|
| 101 | Echo "Contents of" {UserStartupName} "will be:"
 | 
|---|
| 102 | Catenate "{TempUserStartup}"
 | 
|---|
| 103 | 
 | 
|---|
| 104 | Confirm "Install {UserStartupName} into the MPW folder {MPW} ?"
 | 
|---|
| 105 | If {Status} == 0
 | 
|---|
| 106 |         Duplicate "{TempUserStartup}" "{MPW}{UserStartupName}"
 | 
|---|
| 107 |         Delete -y "{TempUserStartup}"
 | 
|---|
| 108 | Else
 | 
|---|
| 109 |         Echo "{UserStartupName} file not installed"
 | 
|---|
| 110 | End If
 | 
|---|
| 111 | 
 | 
|---|
| 112 | # (should) Check HEXA resource, warn if low.
 | 
|---|
| 113 | 
 | 
|---|
| 114 | # (should) Check for spaces in pathnames, warn if found.
 | 
|---|
| 115 | 
 | 
|---|
| 116 | Echo "Installation was successful."
 | 
|---|
| 117 | Echo ""
 | 
|---|
| 118 | Echo "Be sure to review the usage notes in 'Read Me for MPW' before proceeding!"
 | 
|---|
| 119 | 
 | 
|---|
| 120 | # Restore previous settings.
 | 
|---|
| 121 | 
 | 
|---|
| 122 | Set Exit "{OldExit}"
 | 
|---|