Hello,

My attachment was stripped out.
here is autogen.pl a Makefile generator for binpatch-1.1.0.

#!/usr/bin/perl
use strict;
my $SITE="ftp://ftp.openbsd.org/pub";;
if(@ARGV==1){
  $SITE=$ARGV[0];
}else{
  printf("binpatch Makefile skelton(s) generator.\n");
  printf("example usage: perl $0 ftp://ftp.openbsd.org/pub\n";);
  exit(0);
}
my $OSREV=`uname -r`;
chomp $OSREV;
my $ARCH=`uname -m`;
chomp $ARCH;
my @list=("common",$ARCH);
if (! -e "$OSREV.tar.gz"){
        system("ftp $SITE/OpenBSD/patches/$OSREV.tar.gz");
}
system("tar zxvf $OSREV.tar.gz");
my $mk;
open($mk,">Makefile") or die;
printf($mk "MASTER_SITE_OPENBSD=$SITE\n");
my $sh;
open($sh,"|sort -n > make.sh") or die;
for(@list){
  my $arch=$_;
  my @patches;
  my $dir;
  opendir($dir,"$OSREV/$arch");
  for(sort readdir $dir){
    if(/^(.+).patch$/){
       $_=$1;
      push @patches,$_;
      /^(\d+)/;
      printf($sh "make PATCH=\"%s\" build plist package install\n",$1);
    }
  }
  closedir($dir);
  printf($mk "PATCH_%s=%s\n","\U$arch",join(" ",@patches));
}
close($sh);
for(@list){
  my $arch=$_;
  my $dir;
  opendir($dir,"$OSREV/$arch") or die;
  for(sort readdir $dir){
    next if !/^(.+).patch$/;
    my $name=$1;
    my $file=$_;
    my $fh;
    open($fh,"$OSREV/$arch/$file") or die;
    my $flag=0;
    my $ldir=".";
    while(<$fh>){
      chomp;
      if(/^Index:/ or /^\-\-\-/){
        printf($mk "\n");
        last;
      }
      if($flag==2){
        if(/cd (.+)/){
          $ldir.="/".$1;
          $ldir=~s/\/\.\//\//g;
          $ldir=~s/^\.\///;
          do{}while($ldir=~s/[^\/]+\/\.\.\///g);
          $dir='${WRKSRC}/'.$ldir;
          s/cd (.+)/cd $dir/;
        }
        s/make obj/\${_obj}/;
        s/make cleandir/\${_cleandir}/;
        s/make clean/\${_cleandir}/;
        s/make depend/\${_depend}/;
        s/make includes/\${_includes}/;
        s/make build/\${_build}/;
        s/make install/\${_install}/;
        s/make -f Makefile.bsd-wrapper obj/\${_obj_wrp}/;
        s/make -f Makefile.bsd-wrapper cleandir/\${_cleandir_wrp}/;
        s/make -f Makefile.bsd-wrapper clean/\${_cleandir_wrp}/;
        s/make -f Makefile.bsd-wrapper depend/\${_depend_wrp}/;
        s/make -f Makefile.bsd-wrapper install/\${_install_wrp}/;
        s/make -f Makefile.bsd-wrapper build/\${_build_wrp}/;
        s/make -f Makefile.bsd-wrapper/\${_build_wrp}/;
        s/make/\${_build}/;
        if(/_install/){
          $_="";
        }
        s/^\s+//;
        s/\s+$//;
        if(!/^$/){
          if(/^cd/){
            printf($mk "\t$_ \&\& \\\n\t(");  
          }elsif(/_build/){
            printf($mk "%s)\n",$_);
          }else{
            printf($mk "%s; ",$_);
          }
        }
      }
      if(/then.*build.*install.*kernel/i){
        printf($mk "$name: _kernel\n");
        $flag=3;
      }elsif(/then.*build.*install/i){
        printf($mk "$name:\n");
        $flag=1;
      }
      if(/:/ and $flag==1){
        $flag=2;
      }
    }
    close($fh);
  }
}
printf($mk ".include \"bsd.binpatch.mk\"\n");
close($mk);



On Wed, 3 Mar 2010 11:22:31 -0700
Barry Grumbine <[email protected]> wrote:

> Hello,
> 
> Your post to to [email protected] could not have been more timely.
> I've just started setting up binpatch and am at the point where I have
> to translate patch file instructions into Makefile commands.
> 
> I would like to have a look at autogen.pl but the attachment was
> stripped out of your e-mail by the mailing list.
> 
> Would you please send it to me, and/or post another message to misc@
> with the text of autogen.pl inline with the message.
> 
> 
> Thanks,
> 
> Barry
> 


-- 
G Otsuji <[email protected]>

Reply via email to