pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
(doxygen-depend/files/generate) New file to generate Makefile
Module Name: pkgsrc-wip
Committed By: Makoto Fujiwara (CF-S9) <makoto%ki.nu@localhost>
Pushed By: mef
Date: Tue Nov 22 23:57:34 2016 +0900
Changeset: 056ad3081219252fae8022a12aea16aff49df6db
Added Files:
doxygen-depend/files/generate
Log Message:
(doxygen-depend/files/generate) New file to generate Makefile
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=056ad3081219252fae8022a12aea16aff49df6db
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
doxygen-depend/files/generate | 155 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 155 insertions(+)
diffs:
diff --git a/doxygen-depend/files/generate b/doxygen-depend/files/generate
new file mode 100644
index 0000000..9a58131
--- /dev/null
+++ b/doxygen-depend/files/generate
@@ -0,0 +1,155 @@
+#!/usr/pkg/bin/perl
+use File::Find;
+use Getopt::Std;
+use strict;
+our(%opts);
+
+getopts('p:hw', \%opts);
+
+# --------------------------------------------
+sub usage(){
+ print STDERR <<USAGE;
+$0
+ Synopsis:
+ -p pkgsrc path (default /usr/pkgsrc)
+ -w includes wip directory
+USAGE
+}
+# --------------------------------------------
+my ($pkgsrc) = '/usr/pkgsrc';
+my ($count) = 0;
+my ($wip) = 0;
+my $Makefile = 'doxygen-depend/Makefile';
+my (@lines);
+my (@prologue);
+my (@epilogue);
+
+my %COMMENT;
+my %DISABLE;
+my @POINTER;
+my %RENAME = qw(kdelibdocs3 kdelibdocs);
+
+if ($opts{'h'} ) { usage(); exit}
+if ($opts{'p'} ) { $pkgsrc = $opts{'p'}}
+if ($opts{'w'} ) { $wip++;}
+
+if (! -d $pkgsrc ){
+ print STDERR $pkgsrc .' is not a directory'."\n";
+}
+# --------------------------------------------
+# sub prologue(){
+# print <<PROLOGUE;
+# \# \$NetBSD\$
+# \# \$Id\$
+#
+# DISTNAME= doxygen-dependent-1.01
+# CATEGORIES= meta-pkgs
+# LICENSE= generic-nonlicense
+#
+# MAINTAINER= pkgsrc-users\@NetBSD.org
+# COMMENT= Collection of dependent pkgs to check doxygen update
+#
+# META_PACKAGE= YES
+#
+# .include "../../mk/bsd.pkg.mk"
+# PROLOGUE
+# }
+#sub epilogue(){
+#
+#}
+my $START = '# --- generated start --- See files/generate';
+my $END = '# --- generated end';
+
+sub readMakefile($$$$){
+ my ($Makefile) = shift;
+ my ($prologue ) = shift;
+ my ($lines ) = shift;
+ my ($epilogue ) = shift;
+
+
+ my ($prologue_chunk) = 1;
+ my ($epilogue_chunk) = 0;
+ open(Makefile, $Makefile) || die "Unable to open file $Makefile" . $!. "\n";
+ while (<Makefile>) {
+ if ( /^# --- generated start/ ) {
+ $prologue_chunk = 0; }
+ if ( /^# --- generated end/ ) {
+ $epilogue_chunk = 1; }
+
+ if ( $prologue_chunk ) { push(@{$prologue}, $_);}
+ elsif ( $epilogue_chunk ) { push(@{$epilogue}, $_);}
+ else {
+ chomp;
+ if (/(.)UILD_DEPENDS\+=\s+(\S+)-\[0-9\]\*:\S+\s*(.*)/) {
+# print $1,' - ',$2, ' - ', $3,"\n";
+ my ($comment) = $3;
+ $comment =~ s|^\s+||;
+ $comment =~ s|\s+$||;
+ $COMMENT{$2} = $comment;
+ $DISABLE{$2} = $1;
+ }
+ }
+ }
+}
+# --------------------------------------------
+sub wanted(){
+ my $dir = $File::Find::dir ;
+ my $path = "$File::Find::dir/$_" ;
+ my $fname = "$_";
+ my $yes = 0;
+
+ my $directory = $dir;
+ $directory =~ s|$pkgsrc/||;
+
+ if ( $directory =~ m|^wip/| && $wip == 0 ) { next; }
+ if ( $directory =~ m|^devel/doxygen| ) { next; }
+ if ( $directory =~ m|^meta-pkgs| ) { next; }
+
+ if ($fname =~ /^Makefile/ || $fname eq 'options.mk' ) {
+ open(FILE, $path) || print STDERR "failed to open $path\n";
+ while(<FILE>){
+ if (/^#/ ) { next;}
+ if (/without-doxygen/) { next;}
+ if (/doxygen/) {
+ $yes++;
+ }
+ }
+ close(FILE);
+ if ($yes && $directory =~ m|/| ) {
+ $count++;
+ my ($leaf) = $directory;
+ $leaf =~ s|.*/||;
+ my ($B) = $DISABLE{$leaf};
+ if ($DISABLE{$leaf} eq '') { $B = 'B';}
+ if ($RENAME{$leaf}) {
+ $leaf = $RENAME{$leaf};}
+ my ($comment) = $COMMENT{$leaf};
+ $directory =~ s/[\t ]*$//;
+ my ($string) =
+ sprintf "%s-[0-9]*:../../%s", $leaf, $directory;
+ if ( ! $comment =~ m|^[\t ]+$|) {
+ printf "%sUILD_DEPENDS+=\t%s+%s+\n", $B, $string, $comment;
+
+ } else {
+ printf "%sUILD_DEPENDS+=\t%-45s\n", $B, $string;
+
+ }
+ }
+ }
+}
+# --------------------------------------------
+readMakefile($pkgsrc.'/wip/'.$Makefile,
+ \@prologue, \@lines, \@epilogue);
+print @prologue;
+print $START,"\n";
+find (\&wanted, $pkgsrc);
+#print $END,"\n";
+print @epilogue;
+print "\n";
+
+print "# $count entries generated.\n";
+__END__
+
+cd wip/doxygen-depend
+perl files/generate > Makefile.new
+diff -u Makefile Makefile.new
Home |
Main Index |
Thread Index |
Old Index