;Skrypt instalacyjny oprogramowania do karty Prometeusz
;Grzegorz "Krashan" Kraszewski
;$VER: Prometheus Install PL 1.50 (28.7.2001)

(complete 0)

(set #msg_welcome "Welcome in Prometheus software installer. It will quickly copy some file in proper locations.\n\nNOTICE: Run the script in 'expert' mode if you want to install developer files.")
(set #msg_cplibprompt "Copying 'prometheus.library'.")
(set #msg_devsdir "Creating 'DEVS:PCI' directory.")
(set #msg_vendorsp "Copying the list of PCI boards and vendors.")
(set #msg_asktooldir "Select a directory where additional tools will be copied.")
(set #msg_asktooldirh "Additional tools are not required but may be useful for developer and advanced user.")
(set #msg_includeprompt "Copying %s.")
(set #msg_includehelp "Copying include file.")
(set #msg_compilerselect "Select the compiler for which include files should be installed.")
(set #msg_compselhelp "Prometheus SDK supports many Amiga compilers with compiler-specific include files like inlines, pragmas, stub libraries etc.")
(set #msg_incdirselect "Select a directory where AmigaOS compiler includes are located.")
(set #msg_incdirselhelp "The install script needs your include patch to copy Prometheus includes to proper locations. 'AmigaOS includes' means a directory where 'dos/', 'exec/', 'intuition/' etc. directories are located.")
(set #msg_vbcclib "Copying include/VBCC/lib/prometheus.lib.")
(set #msg_vbcclibhelp "Copying VBCC stub library.")
(set #msg_vbcclibdirsel "Select directory where VBCC link libraries are placed.")
(set #msg_vbcclibdirselhelp "Installer tries to copy 'prometheus.lib' linkable stub library to its proper location.")
(set #msg_copyfd "Copying fd/prometheus_lib.fd")
(set #msg_copyfdhelp "Copying library definition file.")
(set #msg_fdseldir "Select directory where library definitions (*.fd files) are placed.")
(set #msg_fdseldirhelp "Installer tries to copy 'prometheus_lib.fd' library definition to its proper location.")

(if (= @language "polski")
  (
    (set #msg_welcome "Witaj w programie instalacyjnym oprogramowania Prometeusza. Program ten szybko skopiuje kilka plików w odpowiednie miejsca.\n\nUWAGA: Uruchom skrypt w trybie 'ekspert' jeūeli chcesz zainstalowaź pliki dla programistów.")
    (set #msg_cplibprompt "Kopiujė bibliotekė 'prometheus.library'.")
    (set #msg_devsdir "Tworzė katalog 'DEVS:PCI'.")
    (set #msg_vendorsp "Kopiujė wykaz producentów i kart PCI do katalogu 'DEVS:PCI'")
    (set #msg_asktooldir "Wybierz katalog, do którego zostanā skopiowane programy pomocnicze.")
    (set #msg_asktooldirh "Dodatkowe programy nie sā niezbėdne, ale moga okazaź siė uūyteczne dla programisty lub zaawansowanego uūytkownika.")
    (set #msg_includeprompt "Kopiujė %s.")
    (set #msg_includehelp "Kopiujė plik nagīówkowy kompilatora.")
    (set #msg_compilerselect "Wybierz kompilator dla którego chcesz zainstalowaź pliki nagīówkowe.")
    (set #msg_compselhelp "W SDK Prometeusza znajdujā siė pliki nagīówkowe i biblioteki do wielu popularnych amigowych kompilatorów.")
    (set #msg_incdirselect "Wskaū katalog, w którym znajdujā siė pliki nagīówkowe AmigaOS.")
    (set #msg_incdirselhelp "Skrypt instalacyjny potrzebuje ōcieūki dostėpu do katalogu z plikami nagīówkowymi AmigaOS aby skopiowaź pliki Prometeusza w odpowiednie miejsca. Katalog z plikami nagīówkowymi AmigaOS to ten zawierajācy katalogi 'dos/', 'exec/', 'intuition/' itd.")
    (set #msg_vbcclib "Kopiujė include/VBCC/lib/prometheus.lib.")
    (set #msg_vbcclibhelp "Kopiujė bibliotekė ze 'stubami' dla VBCC.")
    (set #msg_vbcclibdirsel "Wskaū katalog, w którym znajdujā siė biblioteki linkowane VBCC.")
    (set #msg_vbcclibdirselhelp "Installer próbuje skopiowaź bibliotekė linkowalnā 'prometheus.lib' w odpowiednie miejsce.")
    (set #msg_copyfd "Kopiujė fd/prometheus_lib.fd")
    (set #msg_copyfdhelp "Kopiujė plik definicji biblioteki.")
    (set #msg_fdseldir "Wskaū katalog, w którym znajdujā siė definicje bibliotek (pliki *.fd).")
    (set #msg_fdseldirhelp "Installer próbuje skopiowaź plik 'prometheus_lib.fd' z definicjā biblioteki na jego wīaōciwe miejsce.")
  )
)

(message #msg_welcome (all))

;**** procedure for include file copying ****

(procedure p_copy_include #src #dest
  (set #dest2 (tackon #include_path #dest))
  (set #src2 (tackon "Developer/" #src))
  (copylib
    (prompt (#msg_includeprompt #src))
    (help #msg_includehelp)
    (confirm)
    (source #src2)
    (dest #dest2)
    (optional "nofail" "askuser")
  )
)

;**** install developer files ****

(if (= @user-level 2)
  (
    ;**** ask for compiler ****

    (set #compiler
      (askchoice
        (prompt #msg_compilerselect)
        (help #msg_compselhelp)
        (choices "[2pGCC" "VBCC" "SAS/C" "StormC")
        (default 0)
      )
    )

    ;**** ask for include path ****

    (set #include_path
      (askdir
        (prompt #msg_incdirselect)
        (help #msg_incdirselhelp)
        (default "include:")
      )
    )

    ;**** copying GCC includes ****

    (if (= #compiler 0)
      (
        (p_copy_include "include/clib/prometheus_protos.h" "clib")
        (p_copy_include "include/GCC/inline/prometheus.h" "inline")
        (p_copy_include "include/GCC/proto/prometheus.h" "proto")
        (p_copy_include "include/libraries/prometheus.h" "libraries")
      )
    )

    ;**** copying VBCC includes ****

    (if (= #compiler 1)
      (
        (p_copy_include "include/clib/prometheus_protos.h" "clib")
        (p_copy_include "include/VBCC/inline/prometheus_protos.h" "inline")
        (p_copy_include "include/libraries/prometheus.h" "libraries")
        (p_copy_include "include/proto/prometheus.h" "proto")
        (copyfiles
          (prompt #msg_vbcclib)
          (help #msg_vbcclibhelp)
          (source "Developer/include/VBCC/lib/prometheus.lib")
          (dest
            (askdir
              (prompt #msg_vbcclibridsel)
              (help #msg_vbcclibdirselhelp)
              (default "lib:")
            )
          )
          (optional "force" "askuser")
          (confirm)
        )
      )
    )

    ;**** copying SAS/C includes or StormC includes ****

    (if (OR (= #compiler 2) (= #compiler 3))
      (
        (p_copy_include "include/clib/prometheus_protos.h" "clib")
        (p_copy_include "include/pragma/prometheus_lib.h" "pragma")
        (p_copy_include "include/pragmas/prometheus_pragmas.h" "pragmas")
        (p_copy_include "include/proto/prometheus.h" "proto")
        (p_copy_include "include/libraries/prometheus.h" "libraries")
      )
    )

    ;**** copying FD file ****

    (copyfiles
      (prompt #msg_copyfd)
      (help #msg_copyfdhelp)
      (source "Developer/fd/prometheus_lib.fd")
      (dest
        (askdir
          (prompt #msg_fdseldir)
          (help #msg_fdseldirhelp)
          (default "FD:")
        )
      )
      (optional "force" "askuser")
      (confirm)
    )
  )
)

(complete 10)

;********** Kopiujė bibliotekė z ikonkā

(copylib
		(prompt  #cplibprompt)
      (help    "")
      (source  "Libs/prometheus.library")
      (dest    "LIBS:")
      (infos)
)

(complete 30)

;********** Kopiujė 'vendors.txt'

(if(NOT(exists "DEVS:PCI/"))
 		(makedir "DEVS:PCI/"
      		(prompt #msg_devsdir)
      )
)

(complete 40)

(copyfiles
		(prompt #msg_vendorsp)
      (source "Devs/vendors.txt")
      (dest   "DEVS:PCI/")
)

(complete 62)

;********** Które narzėdzia skopiowaź i gdzie

(copyfiles
		(prompt "Programy pomocnicze.")
      (all)
      (source "Tools/")
      (dest
      		(askdir
            		(prompt  #msg_asktooldir)
                  (help    #msg_asktooldirh)
                  (default "SYS:Tools/Prometheus")
                  (newpath)
            )
      )
      (infos)
)

(complete 100)

(set @default-dest "SYS:")

(exit)
