Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to remove code duplication from Jamfile
From: å×ÇÅÎÉÊ ûÕÂÉÎ (shubin_evgeniy_at_[hidden])
Date: 2010-03-22 03:43:44


Thanks, it work almost as I want. There is only one problem in transform-script. When variables
are substituted the result is :
 sed "s_at_PREFIX@/home/eshubin/test_at_g" ../../scripts/rc_script.freebsd | sed > /home/eshubin/test/scripts/harvester_master
.

In the second element of pipe there is an error (It should be sed "s_at_NAME@harvester_master_at_g" > /home/eshubin/test/scripts/harvester_master).

Fri, 19 Mar 2010 19:06:19 +0300 ÐÉÓØÍÏ ÏÔ Vladimir Prus <ghost_at_[hidden]>:

> On Friday 19 March 2010 17:56:40 å×ÇÅÎÉÊ ûÕÂÉÎ wrote:
>
> > I have have a project with Jamroot, which consists of some subprojects with Jamfiles.
> > In each Jamfile I have this block of code:
> > ...
> >
> > DAEMON_NAME = daemon_name ; #specific for each subproject
> >
>
> >
> > explicit install install-bin install-conf $(INSTALL_PATH)/scripts/$(DAEMON_NAME) ;
> >
> >
> >
> > Could anyone explain me how to move this block of code to Jamroot of top project?
>
> You can put this in Jamroot:
>
> constant JAMROOT : $(__name__) ;
> actions transform-script
> {
> sed "s_at_PREFIX@$(INSTALL_PATH)@g" $(>) | sed "s_at_NAME@$(DAEMON_NAME)@g" > $(<)
> }
>
> rule your-install ( DAEMON_NAME )
> {
> alias install : install-bin install-conf $(INSTALL_PATH)/scripts/$(DAEMON_NAME) ;
> install install-bin : $(DAEMON_NAME) : <location>$(INSTALL_PATH)/bin ;
> install install-conf : ../../conf/$(DAEMON_NAME).conf : <location>$(INSTALL_PATH)/conf ;
>
> make $(INSTALL_PATH)/scripts/$(DAEMON_NAME) : ../../scripts/rc_script.freebsd : @$(JAMROOT).transform-script ;
> }
>
> and then have:
>
> your-install some-daemon ;
>
> inside Jamfile for each component. Does this work?
>
> Thanks,
>
> --
> Vladimir Prus
> http://vladimir_prus.blogspot.com
> Boost.Build: http://boost.org/boost-build2
>


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