;
;  PPT Installer script
;
;  $Revision: 1.9 $
;      $Date: 1999/02/21 21:08:53 $
;

(welcome "This is the PPT Installation utility."
         "Thank you for choosing to test PPT.")

;
;  Set defaults
;

(set ##installdir "Work:")

; Processor

(set ##use020 (not (patmatch "68000|68010" (database "cpu"))))

; FPU

(set ##use881 (not (patmatch "688|68040|68060" (database "cpu"))))

; If user-level is expert, ask which versions to install.

(if (= @user-level 2)
    (set ##use020
         (askbool
          (prompt "\n"
                  "Do you wish to use the 68020+ optimized\n"
                  "versions of the BGUI library and PPT?")
          (help   (cat "It might be a good idea to install the version "
                       "that best suits your Amiga's processor." ))
          (default ##use020)
          )
         )
  )

(debug "Use020 : " ##use020)
(debug "Use881 : " ##use881)

;
;  Ask the directory to be installed in
;

(set ##installdir
    (askdir
        (prompt "Choose the directory you wish to install\n"
                "PPT in.  A directory called 'PPT' will be\n"
                "created for you in this directory"
        )
        (help   (cat "Choose the top directory for PPT.  Installer will "
                     "then create a directory called 'PPT' in the directory "
                     "you chose and copy all of the PPT software in that "
                     "directory.\n\n"
                     @askdir-help) )
        (default ##installdir)
    )
)

(debug "You chose" ##installdir)

;
;   Tack on the dir name
;

(set @default-dest (tackon ##installdir "PPT"))
(debug "You chose" @default-dest)

;
;   Remove old modules
;

(complete 20)

(if (exists @default-dest)
    (delete
        (tackon @default-dest "modules/#?")
        (prompt "Deleting previous installation")
        (help   "Since PPT modules can change between releases, "
                "for now the previous installation must be deleted "
                "before the new one is installed.")
        (confirm)
        (all)
    )
    (debug "No previous installation")
)

;
;   Copy main executables
;

(complete 30)

(copyfiles
    (prompt "Installing PPT executable")
    (source (if (= ##use020 1) "ppt020" "ppt" ) )
    (dest @default-dest)
    (newname "ppt")
    (help @copyfiles-help)
)


;; Copy docs

(complete 40)

(copyfiles
    (prompt "Installing documents")
    (source "Docs")
    (dest (tackon @default-dest "Docs") )
    (help (cat "Choose which document files you want to install. "
               "I really recommend you install them all.\n\n"
               @copyfiles-help) )
    (all)
    (infos)
    (confirm)
)

;; Copying image files

(complete 45)

(copyfiles
    (prompt "Installing image files")
    (source "Images")
    (dest (tackon @default-dest "Images") )
    (help (cat "Choose which images you wish to install. "
               "You don't have to install them, if you don't want to.\n\n"
               @copyfiles-help) )
    (all)
    (infos)
    (confirm)
)


(complete 50)

(copyfiles
    (prompt "Installing miscallaneous stuff")
    (source "")
    (choices "README" "HISTORY" "ReleaseNotes" "ppt.asc" "ModuleInfo" "GUI" "Contrib")
    (dest @default-dest)
    (help (cat "Choose which additional files you wish to install. "
               "Again, I recommend you to install these all, as these "
               "contain the release notes, the ModuleInfo utility, "
               "the icons, and contributed stuff.\n\n"
               @copyfiles-help) )
    (infos)
    (confirm)
)

(complete 60)

(copyfiles
    (prompt "Installing REXX scripts")
    (source "rexx")
    (dest (tackon @default-dest "rexx") )
    (help (cat "Here you can choose not to install all of the REXX scripts. "
               "I really recommend that you install them all.\n\n"
               @copyfiles-help) )
    (all)
    (infos)
    (confirm)
)


;; PPT libraries

(complete 70)

(copyfiles
    (prompt "Installing PPT external modules")
    (source "modules")
    (dest   (tackon @default-dest "modules") )
    (help   (cat "Choose which external modules you'd like to install. "
                 "If you wish to save space, you can remove those modules "
                 "you think you're not going to need, such as the modules "
                 "which have not been compiled for your processor.  However, "
                 "PPT can figure out which processor your machine has and "
                 "determine, which module is the best for you.  So you don't "
                 "really need to remove any of these modules.\n\n"
                 @copyfiles-help) )
    (confirm)
    (all)
)

;(copyfiles
;    (prompt "Copying PPT executables & modules")
;    (source "")
;    (dest @default-dest)
;    (pattern "~(libs)")
;    (help   @copyfiles-help)
;)

(copyfiles
    (prompt "Installing icons")
    (source "")
    (pattern "(PPT|README|Docs|ReleaseNotes|rexx|Images).info")
    (dest   @default-dest)
    (help   @copyfiles-help)
    (infos)
)

(copyfiles
    (prompt "Installing drawer icon")
    (source "/PPT.info")
    (dest   (tackon @default-dest "/"))
    (help   @copyfiles-help)
    (infos)
)


;
;   Install libraries
;

(complete 80)

(copylib
    (prompt "Copying BGUI library")
    (confirm)
    (source (if (= ##cpu020 1) ("libs/bgui.library_e") ("libs/bgui.library")))
    (dest   "libs:")
    (newname "bgui.library")
    (help   @copylib-help)
)

(copylib
    (prompt "Copying BGUI floating point gadget")
    (confirm)
    (source "libs/bgui_float.gadget")
    (dest   "SYS:Classes/Gadgets")
    (help   @copylib-help)
)

(copylib
    (prompt "Copying BGUI bitmap gadget")
    (confirm)
    (source "libs/bgui_bitmap.image")
    (dest   "SYS:Classes/Gadgets")
    (help   @copylib-help)
)

(copylib
    (prompt "Copying BGUI palette gadget")
    (confirm)
    (source "libs/bgui_palette.gadget")
    (dest   "SYS:Classes/Gadgets")
    (help   @copylib-help)
)

;
;   Make assigns
;

(complete 90)

(set ##jpegdir
    (askdir
        (prompt "You must now choose a place for any "
                "temporary JPEG files to be put in. "
                "(See Help for more info)"
        )
        (help   "The JPEG loader needs a JPEGTMP: assign "
                "in order to handle really large progressive "
                "or multi-scan files.  If you already happen "
                "to have this assign, just say 'Skip This Phase'. "
                "If not, then you should pick up a hard drive "
                "directory with plenty of space."
        )
        (default ##installdir)
    )
)

(makeassign "JPEGTMP" ##jpegdir)

(set ##jpegassign ("Assign >NIL: JPEGTMP: %s" ##jpegdir))

(startup "PPT JPEG loader"
    (prompt ( "\nI shall now add the following line\nto your S:User-Startup:\n\n%s"
               ##jpegassign)
            )
    (command ##jpegassign )
    (help @startup-help)
)

;
;   The END.
;
(complete 100)

