[haiku-development] Re: PoorMan development finished

On 2009-03-30 at 10:13:08 [+0200], Ma Jie <china.majie@xxxxxxxxx> wrote:
> 
> I am happy to announce that PoorMan development is finished. And now I
> want to know how can I submit the patch. It's compressed to about
> 60KB. I tried to create a patch by using svn diff, but the sub
> directory is not included. I think I should attach the whole source
> files?
> 
> And there is two targets in the thttpd makefile I don't know how to
> translate them into Jam language. This is the first time I use Jam so
> I need your help.
> 
> mime_encodings.h:    mime_encodings.txt
>     rm -f mime_encodings.h
>     sed < mime_encodings.txt > mime_encodings.h \
>       -e 's/#.*//' -e 's/[     ]*$$//' -e '/^$$/d' \
>       -e 's/[     ][     ]*/", 0, "/' -e 's/^/{ "/' -e 's/$$/", 0 },/'
> 
> mime_types.h:    mime_types.txt
>     rm -f mime_types.h
>     sed < mime_types.txt > mime_types.h \
>       -e 's/#.*//' -e 's/[     ]*$$//' -e '/^$$/d' \
>       -e 's/[     ][     ]*/", 0, "/' -e 's/^/{ "/' -e 's/$$/", 0 },/'


The rule and actions would look like this (completely untested):

rule THTTPMakeHeader header : text
{
        header = [ FGristFiles $(header) ] ;
        text = [ FGristFiles $(text) ] ;

        SEARCH on $(text) = $(SEARCH_SOURCE) ;
        MakeLocateArch $(header) ;

        Depends $(header) : $(text) ;
        LocalClean clean : $(header) ;

        THTTPMakeHeader1 $(header) $(text) ;
}

actions THTTPMakeHeader1
{
        rm -f $(1)
        sed < $(2) > $(1) \
          -e 's/#.*//' -e 's/[  ]*$$//' -e '/^$$/d' \
          -e 's/[       ][      ]*/", 0, "/' -e 's/^/{ "/' -e 's/$$/", 0 },/'
}

Invoke like:

THTTPMakeHeader mime_encodings.h : mime_encodings.txt ;
THTTPMakeHeader mime_types.h : mime_types.txt ;

CU, Ingo

Other related posts: