.key DIR/K,QUIET/S,SETENV/K
.bra {
.ket }
.def SETENV RAM:
.def DIR ""

; Check to see if we should assign env: to ram:
If "{SETENV}" Eq "SETENV"
  Assign ENV: Exists >NIL:
  If Warn
    Assign ENV: "{SETENV}"
  EndIf
EndIf

; Check for ENV first
Assign ENV: Exists >nil:
If Warn
  Echo "You must assign ENV: to someplace first. Try RAM:"
  Skip END
EndIf

; Check directory
If "{DIR}" Eq "" 
  Cd >ENV:adedir
Else 
  Echo >ENV:adedir "{DIR}"
EndIf

; Move to specified directory
If "$adedir" Not Eq ""
  Which PushCD >nil:
  If Not Warn
    PushCD "$adedir"
  Else
    Cd >ENV:adetempdir
    Echo >ENV:adetempcmd "Cd *"$adetempdir*"" NoLine
    Echo >ENV:adetempgo "Cd *"$adedir*"" NoLine
    Execute ENV:adetempgo
    Delete ENV:adetempgo >nil:
  EndIf
EndIf

FAILAT 200
If "{QUIET}" Not Eq "QUIET"
  Echo "Making GNU C to work..."
EndIf

; This script is executed from your S:User-Startup script in order to
; set up the ADE environment.  All assigns are made relative to "ADE:",
; which has to be assigned prior to running this script.  This would
; normally be done like:
;

; Assign DEFER ADE: PPC-CDROM:PPCRelease/ADE
Assign ADE: ""

;  execute ADE:Sys/S/ADE-Startup

; Check to see if we have already run this script once, and if so, simply
; exit.  We might try to run it more than once, if for example the user
; reruns the install script in order to change some metatool prefs.

;if EXISTS ram:ADE-datestamp
;  skip END
;else
;  date >ram:ADE-datestamp
;endif

; Tools should search LOCAL: for files that may have been added to 
; supplement the standard ADE environment, to account for the case 
; where it is impossible to add these files directly to the ADE:
; tree (such as when it is located on a CD-ROM)
;
; If no LOCAL: is already defined, supply a default assignment to T:,
; which we know exists.  This assignment can be overridden in the
; user's User-Startup script, either by defining it before calling
; this script, or redefining it afterwards.

assign LOCAL: exists >NIL:
if WARN
  assign LOCAL: T:
endif

; Make assigns for ADE things, like general binaries, manual pages,
; info files, etc.  We try to keep these to an absolute minimum!

assign BIN: ADE:bin
assign USR: ADE:
if EXISTS ADE:var
  assign VAR:  ADE:var
endif
assign ETC: ADE:etc
assign INFO:   ADE:info
assign MAN: ADE:man
assign TMP: T:
path ADE:bin ADD
path ADE:local/bin ADD
path ADE:lib/gcc-lib/m68k-amigaos/2.95.3 ADD

; Add various directories under ADE: that supplement the normal
; system logical defines, like "LIBS:", "L:", "DEV:", etc.
; We have to have C: in here if we want the Workbench to notice
; anything in BIN:, or have them available from any CLIs already
; running.

assign C:   ADE:bin     ADD
assign DEVS:   ADE:Sys/Devs   ADD
assign LIBS:   ADE:Sys/Libs   ADD
assign L:   ADE:Sys/L   ADD
assign S:   ADE:Sys/S   ADD
assign C:   ADE:Sys/C   ADD

; Assign GNU: to ADE: for backwards compatibility.  This will be
; removed at some point in the future.

assign GNU: ADE:  
assign GG:  ADE:  

assign home:   GG:home
assign var: GG:var

; Mount the ixpipe: device

Assign IXPIPE: Exists >Nil:
If Warn
  mount IXPIPE: from DEVS:MountList.IXPIPE
EndIf

; Install GNU Emacs version 18.59
;   Assign GNUEmacs: so emacs can find it's files.
;   Cancel any system supplied alias for emacs.
;   Use the emacs specific shell since bin:sh (PD ksh) causes a crash
;     when you try to use it under emacs.

if EXISTS ADE:lib/emacs/18.59
  assign GNUemacs: ADE:lib/emacs/18.59
  unalias emacs
  setenv ESHELL GNUemacs:etc/sh
endif

; Install Matt Dillon's fifo library, for emacs and others.
; Note that it must be able to find LIBS:fifo.library when run.

run <nil: >nil: ADE:Sys/L/fifo-handler

assign lib: ade:lib
assign lib: ade:local/lib ADD
; assign dev: ram:

resident bin:sh force

Set TERM amiga


; Xgeek
setenv DISPLAY :0
; path gg:X11R6.3/bin ADD
resident bin:sh force

LAB END

; Return to previous directory
If "$adedir" Not Eq ""
  Which PopCD >nil:
  If Not Warn
    PopCD
  Else
    Execute ENV:adetempcmd
    Delete ENV:adetempdir ENV:adetempcmd >nil:
  EndIf

  Delete ENV:adetempdir >nil:
EndIf
