Changeset 9122 in project


Ignore:
Timestamp:
02/29/08 08:11:54 (12 years ago)
Author:
Ivan Raikov
Message:

Introduced option -install-prefix; supersedes -destdir.

Location:
chicken/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/chicken-setup.1

    r9082 r9122  
    212212
    213213.TP
    214 .BI \-destdir \ PATH
    215 Specifies alternative installation prefix. This affects executable
    216 files, examples, and files installed with the
     214.BI \-install-prefix \ PATH
     215Specifies alternative installation prefix. The installation paths for
     216all executable files, examples, and files installed with the
    217217.I copy-file
    218 procedure.
     218and
     219.I move-file
     220procedures will be prepended by this prefix, if it is specified.
    219221
    220222.TP
     
    258260.TP
    259261.B CHICKEN_PREFIX
    260 An alternative installation prefix, where the Scheme-to-C translator
    261 and any support files and libraries are located. Defaults to the installation
    262 time prefix given when configuring the system.
     262The installation prefix where CHICKEN Scheme and its support files and
     263libraries are located. Defaults to the installation time prefix given
     264when configuring the system.
     265
     266.TP
     267.B CHICKEN_INSTALL_PREFIX
     268An alternative installation prefix that will be prepended to extension
     269installation paths if specified.
    263270
    264271.TP
  • chicken/trunk/chicken-setup.scm

    r9083 r9122  
    3030  (uses srfi-1 regex utils posix tcp match srfi-18 srfi-13)
    3131  (export move-file run:execute make/proc uninstall-extension
    32           install-extension install-program install-script
    33           setup-verbose-flag setup-install-flag installation-prefix
    34           find-library find-header program-path remove-file* patch
    35           yes-or-no? setup-build-directory setup-root-directory
    36           create-directory test-compile try-compile copy-file run-verbose
    37           required-chicken-version required-extension-version
    38           cross-chicken ##sys#current-source-filename host-extension) )
     32          install-extension install-program install-script setup-verbose-flag
     33          setup-install-flag installation-prefix chicken-prefix find-library
     34          find-header program-path remove-file* patch yes-or-no?
     35          setup-build-directory setup-root-directory create-directory
     36          test-compile try-compile copy-file run-verbose
     37          required-chicken-version required-extension-version cross-chicken
     38          ##sys#current-source-filename host-extension) )
    3939
    4040
     
    111111
    112112(define-constant long-options
    113   '("-help" "-uninstall" "-list" "-run" "-repository" "-program-path" "-version" "-script"
    114     "-fetch" "-host" "-proxy" "-keep" "-verbose" "-csc-option" "-dont-ask" "-no-install" "-docindex" "-eval"
    115     "-debug" "-ls" "-release" "-test" "-fetch-tree" "-tree" "-svn" "-local" "-destdir" "-revision"
    116     "-host-extension" "-build-prefix" "-download-dir") )
     113'("-help" "-uninstall" "-list" "-run" "-repository" "-program-path"
     114  "-version" "-script" "-fetch" "-host" "-proxy" "-keep" "-verbose"
     115  "-csc-option" "-dont-ask" "-no-install" "-docindex" "-eval"
     116  "-debug" "-ls" "-release" "-test" "-fetch-tree" "-tree" "-svn"
     117  "-local" "-revision" "-host-extension" "-build-prefix"
     118  "-download-path" "-install-prefix") )
     119
    117120
    118121(define-constant short-options
    119   '(#\h #\u #\l #\r #\R #\P #\V #\s #\f #\H #\p #\k #\v #\c #\d #\n #\i #\e #\D #f #f #\t #f #f #f #f #f #f
     122  '(#\h #\u #\l #\r #\R #\P #\V #\s #\f #\H #\p #\k #\v #\c #\n #\i #\e #\D #f #f #\t #f #f #f #f #f #f
    120123    #f) )
    121124
     
    128131    ("chicken-bug" . ,(foreign-value "C_CHICKEN_BUG_PROGRAM" c-string))))
    129132
    130 (define *install-bin-path*
    131   (or (and-let* ((p (getenv "CHICKEN_PREFIX")))
    132         (make-pathname p "bin") )
    133       (foreign-value "C_INSTALL_BIN_HOME" c-string) ) )
    134133
    135134(define *cc* (foreign-value "C_TARGET_CC" c-string))
     
    152151(register-feature! 'chicken-setup)
    153152
    154 (define program-path (make-parameter *install-bin-path*))
    155 (define (cross-chicken) (##sys#fudge 39))
    156 (define host-extension (make-parameter #f))
     153(define chicken-bin-path
     154  (or (and-let* ((p (getenv "CHICKEN_PREFIX")))
     155        (make-pathname p "bin") )
     156      (foreign-value "C_INSTALL_BIN_HOME" c-string) ) )
     157
     158(define chicken-prefix
     159  (or (getenv "CHICKEN_PREFIX")
     160      (match (string-match "(.*)/bin/?" chicken-bin-path)
     161             ((_ p) p)
     162             (_ "/usr/local") ) ) )
     163
     164(define example-path
     165  (make-parameter
     166   (or (and-let* ((p chicken-prefix))
     167         (make-pathname p "/share/chicken/examples") )
     168       "/usr/local/share/chicken/examples")))
     169
     170(define program-path (make-parameter chicken-bin-path))
    157171
    158172(define setup-build-prefix
     
    173187(define setup-install-flag        (make-parameter #t))
    174188
     189(define (cross-chicken) (##sys#fudge 39))
     190(define host-extension (make-parameter #f))
    175191
    176192(define *copy-command* (if *windows-shell* 'copy "cp -r"))
     
    190206(define *proxy-host* #f)
    191207(define *proxy-port* #f)
    192 (define *example-directory* (make-pathname (chicken-home) "examples"))
    193208(define *base-directory* (current-directory))
    194209(define *fetch-tree-only* #f)
    195210(define *svn-repository* #f)
    196211(define *local-repository* #f)
    197 (define *destdir* #f)
    198 (define *repository-hosts*
    199   (list (list "www.call-with-current-continuation.org" *default-eggdir* 80)))
     212(define *repository-hosts* (list (list "www.call-with-current-continuation.org" *default-eggdir* 80)))
    200213(define *revision* #f)
    201214(define *run-tests* #f)
     
    279292          (cons* (quotewrap
    280293                  (make-pathname
    281                    *install-bin-path*
     294                   chicken-bin-path
    282295                   (cdr (assoc prg *installed-executables*))))
    283296                 "-feature" "compiling-extension"
     
    285298          " ") )
    286299        ((assoc prg *installed-executables*) =>
    287          (lambda (a) (quotewrap (make-pathname *install-bin-path* (cdr a)))))
     300         (lambda (a) (quotewrap (make-pathname chicken-bin-path (cdr a)))))
    288301        (else prg) ) )
    289302
     
    515528      -svn URL                   fetches extension from subversion repository
    516529      -local PATH                fetches extension from local filesystem
    517       -destdir PATH              specifies alternative installation prefix
    518530      -revision REV              specifies SVN revision for checkout
    519531      -build-prefix PATH         location where chicken-setup will create egg build directories
     
    521533                                  /tmp/chicken-setup-{MAJOR-VERSION}-{USER}
    522534                                  if none of these variables are found in the environment)
    523       -download-dir PATH         location where chicken-setup will save downloaded files
     535      -download-path PATH         location where chicken-setup will save downloaded files
    524536                                 (default: {BUILD-PREFIX}/downloads)
     537      -install-prefix PATH       specifies alternative installation prefix
    525538  --                             ignores all following arguments
    526539
     
    538551
    539552(define installation-prefix
    540   (make-parameter
    541    (or (getenv "CHICKEN_PREFIX")
    542        (match (string-match "(.*)/bin/?" *install-bin-path*)
    543          ((_ p) p)
    544          (_ #f) ) ) ) )
     553  (make-parameter (or (getenv "CHICKEN_INSTALL_PREFIX") #f)))
    545554
    546555(define (with-ext filename ext)
     
    651660(define (copy-file from to #!optional (err #t))
    652661  (let ((from (if (pair? from) (car from) from))
    653         (to (if (pair? from) (make-pathname to (cadr from)) to)) )
     662        (to ((lambda (pre) (let ((to-path (if (pair? from) (make-pathname to (cadr from)) to)))
     663                             (if (and pre (not (string-prefix? pre to-path)))
     664                                 (make-pathname pre to-path) to-path)))
     665             (installation-prefix))))
    654666    (ensure-directory to)
    655667    (cond ((or (glob? from) (file-exists? from))
     
    659671
    660672(define (move-file from to)
    661   (let ((from (if (pair? from) (car from) from))
    662         (to (if (pair? from) (make-pathname to (cadr from)) to)) )
     673  (let ((from  (if (pair? from) (car from) from))
     674        (to    (let ((to-path (if (pair? from) (make-pathname to (cadr from)) to)))
     675                 (if (and pre (not (string-prefix? pre to-path)))
     676                     (make-pathname pre to-path) to-path))))
    663677    (ensure-directory to)
    664678    (run (,*move-command* ,(quotewrap from) ,(quotewrap to)) ) ) )
     
    725739          (set! *rebuild-doc-index* #t)) )
    726740      (and-let* ((exs (assq 'examples info)))
    727         (print "\n* Installing example files in " *example-directory* ":")
    728         (for-each
    729          (lambda (f)
    730            (copy-file f (make-pathname *example-directory* f) #f)
    731            (unless *windows-shell*
    732              (run (chmod a+rx ,*example-directory*))) )
    733          (cdr exs))
    734         (newline) )
     741        (let ((example-dest
     742               ((lambda (pre) (if pre (list pre (example-path)) (list (example-path))))
     743                (installation-prefix))))
     744          (print "\n* Installing example files in " example-dest ":")
     745          (for-each
     746           (lambda (f)
     747             (copy-file f (make-pathname example-dest f) #f)
     748             (unless *windows-shell*
     749               (run (chmod a+rx ,example-dest))) )
     750           (cdr exs))
     751          (newline) ))
    735752      (write-info id dests info) ) ) )
    736753
     
    742759  (when (setup-install-flag)
    743760    (let* ((files (check-filelist (if (list? files) files (list files))))
    744            (ppath (if *destdir* (make-pathname *destdir* "bin") (program-path)))
     761           (ppath ((lambda (pre) (if pre (make-pathname pre (program-path)) (program-path)))
     762                   (installation-prefix)))
    745763           (files (if *windows*
    746764                      (map (lambda (f)
     
    763781  (when (setup-install-flag)
    764782    (let* ((files (check-filelist (if (list? files) files (list files))))
    765            (ppath (if *destdir* (make-pathname *destdir* "bin") (program-path)))
     783           (ppath ((lambda (pre) (if pre (make-pathname pre (program-path)) (program-path)))
     784                   (installation-prefix)))
    766785           (pfiles (map (lambda (f)
    767786                          (let ((from (if (pair? f) (car f) f))
     
    796815
    797816(define (repo-path #!optional ddir?)
    798   (let ((p (if (and ddir? *destdir*)
    799                (make-pathname
    800                 (list *destdir* "lib/chicken")
    801                 (pathname-file (repository-path))) ; we need the binary-compat. version
     817  (let ((p (if (and ddir? (installation-prefix))
     818               (make-pathname (installation-prefix) (repository-path))
    802819               (repository-path))) )
    803820    (ensure-directory p)
     
    10891106  (let ((rpath (repository-path))
    10901107        (hn (get-host-name)))
    1091     (with-output-to-file (doc-stylesheet)
     1108    (with-output-to-file (doc-stylesheet #t)
    10921109      (lambda () (display #<<EOF
    10931110body, html {
     
    11671184EOF
    11681185    )))
    1169     (with-output-to-file (doc-index)
     1186    (with-output-to-file (doc-index #t)
    11701187      (lambda ()
    11711188        (print "<html><head><title>Egg documentation index for " hn
     
    13101327         (print (program-path))
    13111328         (exit) )
    1312         (("-destdir" path . more)
    1313          (set! *example-directory* (make-pathname path "examples"))
    1314          (set! *destdir* path)
     1329        (("-install-prefix" path . more)
    13151330         (installation-prefix path)
    13161331         (loop more) )
     
    13181333         (setup-build-prefix path)
    13191334         (loop more) )
    1320         (("-download-dir" path . more)
     1335        (("-download-path" path . more)
    13211336         (setup-download-directory path)
    13221337         (loop more) )
     
    13761391         (loop more) )
    13771392        (("-docindex" . more)
    1378          (let ((di (doc-index)))
     1393         (let ((di (doc-index #t)))
    13791394           (unless (file-exists? di)
    13801395             (build-doc-index) )
     
    14081423         (host-extension #t)
    14091424         (loop more) )
    1410         (((or "-run" "-script" "-proxy" "-host" "-csc-option" "-ls" "-destdir"
     1425        (((or "-run" "-script" "-proxy" "-host" "-csc-option" "-ls" "-install-prefix"
    14111426              "-tree" "-local" "-svn" "-eval" "-create-tree" "-build-prefix" "-download-dir"))
    14121427         (error "missing option argument" (car args)) )
Note: See TracChangeset for help on using the changeset viewer.