; $VER: Install-GBDK 2.1.0. (21.04.99)
; © 1999 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.\n maccer   - the macro expander for assembler files.")
    (source "GBDK/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 "GBDK/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 "GBDK/lib/")
    (dest dest-lib)
		(pattern "#?")
		(files)
		(confirm)))

(procedure install-examples
  (set dest-examples (tackon GBDKdir "examples"))
  (if (not (exists dest-examples))
    (makedir dest-examples))
  (copyfiles
		(prompt "Copying example files.")
		(help "These are optional, but can be quite educational to take a look at.")
    (source "GBDK/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 libs, assembler and linker.")
		(help "These are some of the documentation that is supplied with the original source distribution (http://www.aracnet.com/~pfelber/GBDK/bin/SDK-2.0.17.tar.gz).")
    (source "GBDK/doc/")
    (dest dest-doc)
		(pattern "#?")
		(files)
		(confirm)))

(procedure install-html
  (set dest-html (tackon GBDKdir "html"))
  (if (not (exists dest-html))
    (makedir dest-html))
  (copyfiles
		(prompt "Copying documentation for compiler. This is a mirror of the GBDK home page (http://www.aracnet.com/~pfelber/GBDK/index.html).")
		(help "These are some of the documentation that is supplied with the original source distribution (http://www.aracnet.com/~pfelber/GBDK/bin/SDK-2.1.0.tar.gz).")
    (source "GBDK/html/")
    (dest dest-html)
		(pattern "#?")
		(files)
		(confirm)))


(message "Welcome to the GBDK-2.1 installation utility.\nIt will install everything you need to develop games for GameBoy on Amiga. You can run the programs either on the real thing (GameBoy, Super GameBoy, GameBoy Pocket or GameBoy Color) or with an emulator such as AmigaVGB (Aminet:misc/emu/AmigaVGB.lha).\n\nThis Amiga port is © 1999 by Lars Malmborg.\nOriginal UN*X version by Pascal Felber and Michael Hope.")

(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-examples)

(complete 70)

(install-doc)

(complete 80)

(install-html)

(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"))
)
