(module pre-installer mzscheme
(require (lib "setup-extension.ss" "make")
(lib "compile.ss" "dynext")
(lib "link.ss" "dynext")
(lib "file.ss"))
(require "sqlid-libpath.scm")
(provide pre-installer)
(define (inserr env message)
(display
(format " ~a~%" message))
(display
(format " Setting environment variable ~a might help.~% It will be used as PLT_EXTENSION_LIB_PATHS variable~%"
env )))
(define saved-plt-extension-lib-paths #f)
(define (cond-set-extension_lib_path env)
(let ((var (getenv env)))
(if (eq? var #f)
(begin
(display (format " ~a has not been set, will *not* be used for PLT_EXTENSION_LIB_PATHS~%" env))
(if saved-plt-extension-lib-paths
(begin
(display (format " Resetting PLT_EXTENSION_LIB_PATHS=~a~%" saved-plt-extension-lib-paths))
(putenv "PLT_EXTENSION_LIB_PATHS" saved-plt-extension-lib-paths))))
(begin
(display (format " Setting PLT_EXTENSION_LIB_PATHS=~a~%" var))
(putenv "PLT_EXTENSION_LIB_PATHS" var)))))
(define (pre-installer plthome package-dir)
(display (format " plthome = ~a ~%" plthome))
(display (format " package-dir = ~a ~%" package-dir))
(set-libpath)
(set! saved-plt-extension-lib-paths (getenv "PLT_EXTENSION_LIB_PATHS"))
(display (format "SQLITE3 DRIVER ~%"))
(with-handlers ((exn:fail? (lambda (exn) (inserr "SQLITE3_EXTENSION_LIB_PATH" "SQLITE3 DRIVER NOT INSTALLED"))))
(cond-set-extension_lib_path "SQLITE3_EXTENSION_LIB_PATH")
(display (format " PLT_EXTENSION_LIB_PATHS=~a~%" (getenv "PLT_EXTENSION_LIB_PATHS")))
(eval
(pre-install plthome
(build-path package-dir)
"c-sqld-sqlite.c"
(build-path package-dir)
(list)
(list "sqlite3" "pthread")
(list)
(list)
(list)
(list "c-sqld-sqlite.scm")
(lambda (k) (k))
#t)))
(display (format "POSTGRESQL DRIVER ~%"))
(with-handlers ((exn:fail? (lambda (exn) (inserr "PSQL_EXTENSION_LIB_PATH" "POSTGRESQL DRIVER NOT INSTALLED"))))
(cond-set-extension_lib_path "PSQL_EXTENSION_LIB_PATH")
(display (format " PLT_EXTENSION_LIB_PATHS=~a~%" (getenv "PLT_EXTENSION_LIB_PATHS")))
(pre-install plthome
(build-path package-dir)
"c-sqld-psql.c"
(build-path package-dir)
(list)
(list "pq" "pthread")
(list)
(list)
(list)
(list "c-sqld-psql.scm")
(lambda (k) (k))
#t))
(display (format "MYSQL DRIVER ~%"))
(with-handlers ((exn:fail? (lambda (exn) (inserr "MYSQL_EXTENSION_LIB_PATH" "MYQSL DRIVER NOT INSTALLED"))))
(cond-set-extension_lib_path "MYSQL_EXTENSION_LIB_PATH")
(display (format " PLT_EXTENSION_LIB_PATHS=~a~%" (getenv "PLT_EXTENSION_LIB_PATHS")))
(pre-install plthome
(build-path package-dir)
"c-sqld-mysql.c"
(build-path package-dir)
(list)
(list "mysqlclient" "pthread")
(list)
(list)
(list)
(list "c-sqld-mysql.scm")
(lambda (k) (k))
#t))
(display (format "ORACLE DRIVER ~%"))
(with-handlers ((exn:fail? (lambda (exn) (inserr "ORACLE_EXTENSION_LIB_PATH" "ORACLE DRIVER NOT INSTALLED"))))
(cond-set-extension_lib_path "ORACLE_EXTENSION_LIB_PATH")
(display (format " PLT_EXTENSION_LIB_PATHS=~a~%" (getenv "PLT_EXTENSION_LIB_PATHS")))
(pre-install plthome
(build-path package-dir)
"c-sqld-oracle.c"
(build-path package-dir)
(list)
(list "sqlora8" "pthread")
(list)
(list)
(list)
(list "c-sqld-oracle.scm")
(lambda (k) (k))
#t))
(display (format "DB2 DRIVER ~%"))
(with-handlers ((exn:fail? (lambda (exn) (inserr "DB2_EXTENSION_LIB_PATH" "DB2 DRIVER NOT INSTALLED"))))
(cond-set-extension_lib_path "DB2_EXTENSION_LIB_PATH")
(display (format " PLT_EXTENSION_LIB_PATHS=~a~%" (getenv "PLT_EXTENSION_LIB_PATHS")))
(pre-install plthome
(build-path package-dir)
"c-sqld-db2.c"
(build-path package-dir)
(list)
(list "db2" "pthread")
(list)
(list)
(list)
(list "c-sqld-db2.scm")
(lambda (k) (k))
#t))
)
)