Boost logo

Boost-Build :

From: Eric Woodruff (eric.woodruff_at_[hidden])
Date: 2008-04-02 02:54:18


Volodya,

OK, I checked out the trunk versions of jam and build/v2. I then figured
how to write the generator for tar, I think. Here's the complete output
I get now:

notice: Searching /etc /home/eric /home/eric/workspaces/tar/../boost/tools/build/v2 /usr/share/boost-build /home/eric/workspaces/boost/tools/build/v2/kernel /home/eric/workspaces/boost/tools/build/v2/util /home/eric/workspaces/boost/tools/build/v2/build /home/eric/workspaces/boost/tools/build/v2/tools /home/eric/workspaces/boost/tools/build/v2/new /home/eric/workspaces/boost/tools/build/v2/. for site-config configuration file site-config.jam .
notice: Loading site-config configuration file site-config.jam from /home/eric/workspaces/boost/tools/build/v2/site-config.jam .
notice: Searching /home/eric /home/eric/workspaces/tar/../boost/tools/build/v2 /usr/share/boost-build /home/eric/workspaces/boost/tools/build/v2/kernel /home/eric/workspaces/boost/tools/build/v2/util /home/eric/workspaces/boost/tools/build/v2/build /home/eric/workspaces/boost/tools/build/v2/tools /home/eric/workspaces/boost/tools/build/v2/new /home/eric/workspaces/boost/tools/build/v2/. for user-config configuration file user-config.jam .
notice: Loading user-config configuration file user-config.jam from /home/eric/workspaces/boost/tools/build/v2/user-config.jam .
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "--toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
don't know how to make dist/hello

...found 11 targets...
...updating 6 targets...
...can't find 1 target...
...can't make 1 target...
MkDir1 dist
MkDir1 bin
MkDir1 bin/gcc-4.1.3
MkDir1 bin/gcc-4.1.3/debug
Jamfile</home/eric/workspaces/tar>.touchfile bin/gcc-4.1.3/debug/hello
common.copy dist/hello
...skipped <pbin/gcc-4.1.3/debug>hello.tar for lack of dist/hello
...
...skipped 1 target...
...updated 6 targets...

I've attached my project files, including the rudimentary tar.jam.

Thanks for your help,

Eric

Vladimir Prus wrote:
> On Sunday 30 March 2008 23:11:29 Eric Woodruff wrote:
>
>> Hi,
>>
>> I'm ultimately seeking to create an rpm generator to package files in a
>> dist directory from a pre-defined list, with a scanner that will read
>> this list and build the targets necessary to satisfy the install. To
>> simplify things, I'll start with a tar generator that works something like:
>>
>> tar dist : files.list ;
>>
>>
>> And suppose files.list just has one entry of '/usr/bin/hello'.
>>
>> Building dist.tar should first build dist/usr/bin/hello. This implies to
>> me that bjam should understand how to build dist/usr/bin/hello from the
>> command line, given the following Jamfile:
>>
>> make hello : : @sayhi ;
>>
>> actions sayhi {
>> echo hi > $(<) ;
>> }
>>
>> install dist/usr/bin : hello ;
>>
>
> I'm not exactly sure why being able to specify a file on the *command line*
> will help you to implement any Boost.Build core functionality, unless you're
> planning to run a second bjam.
>
>
>
>> Unfortunately, it doesn't work:
>>
>> rm -rf dist bin ; bjam dist/usr/bin/hello
>>
>> don't know how to make <e>dist/usr/bin/hello
>> ...found 1 target...
>> ...can't find 1 target...
>>
>
> Please always include the complete output. In this case, you've skipped
> the following bits:
>
> notice: could not find main target dist/usr/bin/hello
> notice: assuming it's a name of file to create.
>
> Anyway, can you try SVN HEAD, revision 43986, and see if it helps?
>
> - Volodya
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
>
>

boost-build ../boost/tools/build/v2/ ;

hello

explicit hello ;
make hello : : @touchfile ;
install dist : hello ;

actions touchfile {
        mkdir -p $(<:D)
        touch $(<)
}

import tar ;
tar hello.tar : hello.files : <dir>dist ;

import type ;
type.register FILES : files ;
type.register TAR : tar ;

import generators ;
import scanner ;
import feature : feature ;
import toolset : flags ;

feature dir : : free ;
flags tar.archive DIR <dir> ;

generators.register-standard tar.archive : FILES : TAR ;
actions archive bind DIR {
        sed -re 's%^/(.*)$%\1%' $(>) | tar cf $(<) -C $(DIR) --files-from -
}

class tar-files-scanner : scanner
{
    import virtual-target ;
    import path ;
    import scanner ;
        
    rule __init__ ( includes * )
    {
        scanner.__init__ ;
        self.includes = $(includes) ;
    }
    
  rule pattern ( )
  {
        return "^(.*)$" ;
  }

  rule process ( target : matches * : binding )
  {
    local target_path = [ NORMALIZE_PATH $(binding:D) ] ;

# NOCARE $(matches) ;
    INCLUDES $(target) : $(self.includes:G=)/$(matches) ;
    SEARCH on $(matches) = $(target_path) $(self.includes:G=) ;
    
    scanner.propagate $(__name__) : $(matches) : $(target) ;
  }
}

# Register this scanner to check the included
# files relative to the <dir> path
scanner.register tar-files-scanner : dir ;
type.set-scanner FILES : tar-files-scanner ;



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk