Changeset 1651 for trunk/base


Ignore:
Timestamp:
Jan 13, 2003, 7:32:27 PM (17 years ago)
Author:
landonf (Landon Fuller)
Message:

Add option deprecation routines
Deprecate build.target.all and build.target.install
Add install command and default it off of build command
Update documentation to reflect option changes

Location:
trunk/base
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/doc/portfile.7

    r1211 r1651  
    547547
    548548.It Ic build.type
    549 Type of make required, either 'gnu' or 'bsd'
     549Defines which 'make' is required, either 'gnu' or 'bsd'
    550550Sets build.cmd to either 'gnumake' or 'bsdmake' accordingly
    551551.br
     
    553553.Em optional
    554554.Sy Default:
    555 .Em bsd
    556 .br
    557 .Sy Example:
    558 .Dl build.type  gnu
     555.Em gnu
     556.br
     557.Sy Example:
     558.Dl build.type  bsd
    559559
    560560.It Ic build.pre_args
     
    564564.Em read-only
    565565.Sy Default:
    566 .Em ${build.target.current}
     566.Em ${build.target}
    567567
    568568
     
    578578
    579579.It Ic build.target.all
    580 Target to pass to make for building everything
     580.br
     581.Sy Deprecated:
     582.Dl Replaced by build.target
     583
     584.It Ic build.target
     585Target passed to ${build.cmd}
    581586.br
    582587.Sy Type:
     
    586591.br
    587592.Sy Example:
    588 .Dl build.target.all all-src
     593.Dl build.target all-src
    589594
    590595.El
     
    592597.Ss INSTALL OPTIONS
    593598Execute necessary install commands
    594 .Bl -tag -width lc
     599
     600.Bl -tag -width lc
     601.It Ic install.cmd
     602Install command to run relative to ${worksrcdir}
     603.br
     604.Sy Type:
     605.Em optional
     606.Sy Default:
     607.Em ${build.cmd}
     608.br
     609.Sy Example:
     610.Dl install.cmd pbxbuild
     611
     612.It Ic install.type
     613Defines which 'make' is required, either 'gnu' or 'bsd'
     614Sets install.cmd to either 'gnumake' or 'bsdmake' accordingly
     615.br
     616.Sy Type:
     617.Em optional
     618.Sy Default:
     619.Em ${build.type}
     620.br
     621.Sy Example:
     622.Dl install.type        gnu
     623
     624.It Ic install.pre_args
     625Arguments to pass to ${install.cmd} before ${install.args}
     626.br
     627.Sy Type:
     628.Em read-only
     629.Sy Default:
     630.Em ${install.target}
     631
     632
     633.It Ic install.args
     634Arguments to pass to ${install.cmd}
     635.br
     636.Sy Type:
     637.Em optional
     638.br
     639.Sy Example:
     640.Dl build.args  -DPREFIX=${prefix}
     641
    595642
    596643.It Ic build.target.install
    597 Install target to pass to ${build.cmd}
     644.br
     645.Sy Deprecated:
     646.Dl Replaced by install.target
     647
     648.It Ic install.target
     649Install target to pass to ${install.cmd}
    598650.br
    599651.Sy Type:
     
    603655.br
    604656.Sy Example:
    605 .Dl build.target.install        install-src
    606 
    607 .El
     657.Dl install.target install-src
     658
     659.El
     660
    608661.Ss REGISTRY OPTIONS
    609662Register installed package contents
  • trunk/base/src/port1.0/portbuild.tcl

    r1638 r1651  
    4040
    4141# define options
    42 options build.target.all
     42options build.target.all build.target
    4343commands build
    4444# defaults
    4545default build.dir {${workpath}/${worksrcdir}}
    4646default build.cmd {[build_getmaketype]}
    47 default build.pre_args {${build.target.current}}
    48 default build.target.all all
     47default build.pre_args {${build.target}}
     48option_deprecate build.target.all build.target
     49default build.target "all"
     50
    4951
    5052set UI_PREFIX "---> "
     
    8284
    8385proc build_start {args} {
    84     global UI_PREFIX portname build.target.all
     86    global UI_PREFIX portname build.target
    8587
    86     ui_msg "$UI_PREFIX [format [msgcat::mc "Building %s with target %s"] ${portname} ${build.target.all}]"
     88    ui_msg "$UI_PREFIX [format [msgcat::mc "Building %s with target %s"] ${portname} ${build.target}]"
    8789}
    8890
    8991proc build_main {args} {
    90     global portname workdir prefix build.type build.cmd build.env build.target.all build.target.current UI_PREFIX worksrcdir
    91 
    92     set build.target.current ${build.target.all}
    9392    system "[command build]"
    9493    return 0
  • trunk/base/src/port1.0/portinstall.tcl

    r1638 r1651  
    4040
    4141# define options
    42 options build.target.install
     42options install.target build.target.install
     43commands install
    4344
    4445# Set defaults
    45 default build.target.install install
     46default install.dir {${build.dir}}
     47default install.cmd {${build.cmd}}
     48default install.pre_args {${install.target}}
     49default install.target install
     50option_deprecate build.target.install install.target
    4651
    4752set UI_PREFIX "---> "
    4853
    4954proc install_start {args} {
    50     global UI_PREFIX portname build.target.install destpath
     55    global UI_PREFIX portname destpath
    5156
    5257    ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s"] ${portname}]"
     
    5661
    5762proc install_main {args} {
    58     global portname portversion categories description depends_run contents workdir worksrcdir prefix build.type build.cmd build.target.install UI_PREFIX build.target.current
    59 
    60     set build.target.current ${build.target.install}
    61     if [catch {system "[command build]"}] {
    62         return -code error [msgcat::mc "Installation failed"]
    63     }
     63    system "[command install]"
    6464    return 0
    6565}
  • trunk/base/src/port1.0/portmain.tcl

    r1638 r1651  
    5454default workpath {[file join $portpath $workdir]}
    5555default prefix /opt/local
    56 # XXX destdir is depricated in favor of destpath, but is provided
    57 # for backwards compatibility
    5856default destdir destroot
    5957default destpath {${workpath}/${destdir}}
  • trunk/base/src/port1.0/portutil.tcl

    r1643 r1651  
    115115}
    116116
     117# option_deprecate
     118# Causes a warning to be printed when an option is set or accessed
     119proc option_deprecate {option {newoption ""} } {
     120    eval "proc warn_deprecated_$option \{option action args\} \{ \n\
     121        global portname $option $newoption \n\
     122        if \{\"$newoption\" != \"\" \&\& \$action != \"read\" \} \{ \n\
     123            $newoption \[set $option\] \n\
     124        \} else \{ \n\
     125            ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\" \n\
     126            if \{ \"$newoption\" != \"\" && \$action == \"read\" \} \{ \n\
     127                $option \[set $newoption\] \n\
     128            \} \n\
     129        \}
     130    \}"
     131    # If a new option is specified, default the option to {${newoption}}
     132    if {$newoption != ""} {
     133        eval "default $option {\$\{$newoption\}}"
     134    }
     135    option_proc $option warn_deprecated_$option
     136}
     137
    117138proc option_proc {option args} {
     139    global option_procs $option
     140    eval "lappend option_procs($option) $args"
     141    # Add a read trace to the variable, as the option procedures have no access to reads
     142    trace variable $option r option_proc_trace
     143}
     144
     145# option_proc_trace
     146# trace handler for option reads. Calls option procedures with correct arguments.
     147proc option_proc_trace {optionName index op} {
    118148    global option_procs
    119     eval "lappend option_procs($option) $args"
     149    foreach p $option_procs($optionName) {
     150        eval "$p $optionName read"
     151    }
    120152}
    121153
Note: See TracChangeset for help on using the changeset viewer.