; $VER: Install-GBDK 1.0 (02.10.96)
; © 1996 Lars Malmborg <glue@df.lth.se>

(procedure install-bin
  (set dest-bin (tackon GBDKdir "bin"))
  (if (not (exists dest-bin))
    (makedir dest-bin))
  (copyfiles
		(prompt "Copying binaries.")
		(help "All binaries should be installed.\n lcc      - the front-end.\n cpp      - the C pre-processor.\n rcc      - the C compiler.\n asGB     - the assembler.\n linkGB   - the linker.\n ILBMtoGB - the bitmap converter.")
    (source "bin/")
    (dest dest-bin)
		(pattern "#?")
		(files)
		(confirm)))

(procedure install-include
  (set dest-include (tackon GBDKdir "include"))
  (if (not (exists dest-include))
    (makedir dest-include))
  (copyfiles
		(prompt "Copying includes.")
		(help "All include files should be installed.")
    (source "include/")
    (dest dest-include)
		(pattern "#?")
		(files)
		(confirm)))

(procedure install-lib
  (set dest-lib (tackon GBDKdir "lib"))
  (if (not (exists dest-lib))
    (makedir dest-lib))
  (copyfiles
		(prompt "Copying link libraries.")
		(help "All libraries (not real libraries, but anyhow...) should be installed as well as global.h.\nThe sources are optional, but can be quite educational.")
    (source "lib/")
    (dest dest-lib)
		(pattern "#?")
		(files)
		(confirm)))

(procedure install-tst
  (set dest-tst (tackon GBDKdir "tst"))
  (if (not (exists dest-tst))
    (makedir dest-tst))
  (copyfiles
		(prompt "Copying first suite of the test files.")
		(help "These are optional, but can be quite educational to take a look at.")
    (source "tst/")
    (dest dest-tst)
		(pattern "#?")
		(files)
		(confirm)))

(procedure install-examples
  (set dest-examples (tackon GBDKdir "examples"))
  (if (not (exists dest-examples))
    (makedir dest-examples))
  (copyfiles
		(prompt "Copying second suite of the test files.")
		(help "These are optional, but can be quite educational to take a look at.")
    (source "examples/")
    (dest dest-examples)
		(pattern "#?")
		(files)
		(confirm)))

(procedure install-doc
  (set dest-doc (tackon GBDKdir "doc"))
  (if (not (exists dest-doc))
    (makedir dest-doc))
  (copyfiles
		(prompt "Copying documentation for GBDK and GameBoy hardware.")
		(help "GBDK.guide contains all information needed for developing.\nasmlnk.doc is the documentation for the assembler and linker.")
    (source "doc/")
    (dest dest-doc)
		(pattern "#?")
		(files)
		(confirm)))


(message "Welcome to the GBDK installation utility.\nIt will install everything you need to develop games for GameBoy on Amiga. You can run the programs with AmigaVGB (Aminet:misc/emu/AmigaVGB.lha).\n\nThis Amiga port is © 1996 by Lars Malmborg.\nOriginal UN*X version is © 1996 by Pascal Felber.")

(set dir
  (askdir
    (prompt "Please select where you want to install GBDK. A drawer named 'GBDK' will be created in this directory")
    (help "Choose where you want GBDK to be stored. All files will be copied to this location.")
    (default "Work:") ) )

(complete 5)

(set GBDKdir (tackon dir "GBDK") )
(if (not (exists GBDKdir) )
  ( (makedir GBDKdir) ) )

(complete 10)

(set @default-dest GBDKdir)

(complete 20)

(install-bin)

(complete 40)

(install-include)

(complete 50)

(install-lib)

(complete 60)

(install-tst)

(complete 70)

(install-examples)

(complete 80)

(install-doc)

(complete 90)

(startup "GBDK"
	(prompt
		"Some instructions need to be added to the \"S:User-startup\" so that your system will be properly configured to use GBDK.")
	(help "The following will be added to the \"S:User-startup\" if you install to the default destination:\n\n;BEGIN GBDK\nAssign GBDK: Work:GBDK\nPath Work:GBDK/bin\n;END GBDK")
	(command (cat (cat "Assign GBDK: " GBDKdir) "\n"))
	(command (cat (cat "Path " dest-bin) "\n"))
)
