am_edit

来自「KDE下的西门子手机管理程序」· 代码 · 共 1,913 行 · 第 1/5 页

TXT
1,913
字号
                next;            }                        my %dir_hash =              (               'los' => 'locolor/16x16',               'lom' => 'locolor/32x32',               'him' => 'hicolor/32x32',               'hil' => 'hicolor/48x48',               'lo16' => 'locolor/16x16',               'lo22' => 'locolor/22x22',               'lo32' => 'locolor/32x32',               'hi16' => 'hicolor/16x16',               'hi22' => 'hicolor/22x22',               'hi32' => 'hicolor/32x32',               'hi48' => 'hicolor/48x48',               'hisc' => 'hicolor/scalable'              );                        $newfile =~ s@.*-($appname\.(png|xpm?))@$1@;                        if (! defined $dir_hash{$prefix}) {                print STDERR "unknown icon prefix $prefix in $printname\n";                next;            }                        my $dir = $dir_hash{$prefix} . "/" . $type_hash{$type};            if ($newfile =~ /-[^\.]/) {                my $tmp = $newfile;                $tmp =~ s/^([^-]+)-.*$/$1/;                $dir = $dir . "/" . $tmp;                $newfile =~ s/^[^-]+-//;            }                        if (!defined $directories{$dir}) {                $install .= "\t\$(mkinstalldirs) \$(DESTDIR)\$($destdir)/$dir\n";                $directories{$dir} = 1;            }                        $install .= "\t\$(INSTALL_DATA) \$(srcdir)/$file \$(DESTDIR)\$($destdir)/$dir/$newfile\n";            $uninstall .= "\t-rm -f \$(DESTDIR)\$($destdir)/$dir/$newfile\n";                    }    }        if (length($install)) {        $target_adds{"install-data-am"} .= "install-kde-icons ";        $target_adds{"uninstall-am"} .= "uninstall-kde-icons ";        appendLines("install-kde-icons:\n" . $install . "\nuninstall-kde-icons:\n" . $uninstall);    }}sub handle_POFILES($$){  my @pofiles = split(" ", $_[0]);  my $lang = $_[1];  # Build rules for creating the gmo files  my $tmp = "";  my $allgmofiles     = "";  my $pofileLine   = "POFILES =";  foreach $pofile (@pofiles)    {        $pofile =~ /(.*)\.[^\.]*$/;          # Find name minus extension        $tmp .= "$1.gmo: $pofile\n";        $tmp .= "\trm -f $1.gmo; \$(GMSGFMT) -o $1.gmo \$(srcdir)/$pofile\n";        $tmp .= "\ttest ! -f $1.gmo || touch $1.gmo\n";        $allgmofiles .= " $1.gmo";        $pofileLine  .= " $1.po";    }  appendLines ($tmp);  my $lookup = 'POFILES\s*=([^\n]*)';  if ($MakefileData !~ /\n$lookup/) {    appendLines("$pofileLine\nGMOFILES =$allgmofiles");  } else {    substituteLine ($lookup, "$pofileLine\nGMOFILES =$allgmofiles");  }    if ($allgmofiles) {        # Add the "clean" rule so that the maintainer-clean does something        appendLines ("clean-nls:\n\t-rm -f $allgmofiles\n");	$target_adds{"maintainer-clean"} .= "clean-nls ";	$lookup = 'DISTFILES\s*=\s*(.*)';	if ($MakefileData =~ /\n$lookup\n/) {	  $tmp = "DISTFILES = \$(GMOFILES) \$(POFILES) $1";	  substituteLine ($lookup, $tmp);	}    }  $target_adds{"install-data-am"} .= "install-nls ";  $tmp = "install-nls:\n";  $tmp .= "install-nls:\n";  if ($lang) {    $tmp  .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES\n";  }  $tmp .= "\t\@for base in ";  foreach $pofile (@pofiles)    {      $pofile =~ /(.*)\.[^\.]*$/;          # Find name minus extension      $tmp .= "$1 ";    }  $tmp .= "; do \\\n";  if ($lang) {    $tmp .= "\t  echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n";    $tmp .= "\t  test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n"  } else {    $tmp .= "\t  echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n";    $tmp .= "\t  \$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES ; \\\n";    $tmp .= "\t  test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n";  }  $tmp .= "\tdone\n\n";  appendLines ($tmp);  $target_adds{"uninstall"} .= "uninstall-nls ";  $tmp = "uninstall-nls:\n";  foreach $pofile (@pofiles)    {      $pofile =~ /(.*)\.[^\.]*$/;          # Find name minus extension      if ($lang) {	$tmp .= "\trm -f \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/$1.mo\n";      } else {	$tmp .= "\trm -f \$(DESTDIR)\$(kde_locale)/$1/LC_MESSAGES/\$(PACKAGE).mo\n";      }    }  appendLines($tmp);  $target_adds{"all"} .= "all-nls ";  $tmp = "all-nls: \$(GMOFILES)\n";  appendLines($tmp);  $target_adds{"distdir"} .= "distdir-nls ";  $tmp = "distdir-nls:\$(GMOFILES)\n";  $tmp .= "\tfor file in \$(POFILES); do \\\n";  $tmp .= "\t  cp \$(srcdir)/\$\$file \$(distdir); \\\n";  $tmp .= "\tdone\n";  $tmp .= "\ttest -z \"\$(GMOFILES)\" || cp \$(GMOFILES) \$(distdir)\n";  appendLines ($tmp);  if (!$lang) {    appendLines("merge:\n\t\$(MAKE) -f \$(top_srcdir)/admin/Makefile.common package-merge POFILES=\"\${POFILES}\" PACKAGE=\${PACKAGE}\n\n");  } }#-----------------------------------------------------------------------------# Returns 0 if the line was processed - 1 otherwise.# Errors are logged in the global $errorflagssub tag_POFILES (){    my $lookup = 'POFILES\s*=([^\n]*)';    return 1    if ($MakefileData !~ /\n$lookup/);    print STDOUT "POFILES processing <$1>\n"   if ($verbose);    my $tmp = $1;    # make sure these are all gone.    if ($MakefileData =~ /\n\.po\.gmo:\n/)    {        print STDERR "Warning: Found old .po.gmo rules in $printname. New po rules not added\n";        return 1;    }    # Either find the pofiles in the directory (AUTO) or use    # only the specified po files.    my $pofiles = "";    if ($tmp =~ /^\s*AUTO\s*$/)    {        opendir (THISDIR, ".");	next if ($entry eq "CVS" || $entry =~ /^\./  || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^#.*#$/);	$pofiles =  join(" ", grep(/\.po$/, readdir(THISDIR)));        closedir (THISDIR);        print STDOUT "pofiles found = $pofiles\n"   if ($verbose);    }    else    {        $tmp =~ s/\034/ /g;        $pofiles = $tmp;    }    return 1    if (!$pofiles);        # Nothing to do    handle_POFILES($pofiles, $kdelang);    return 0;}sub helper_LOCALINSTALL($){  my $lookup = "\n" . $_[0] . ":";  if ($MakefileData =~ /($lookup)/) {    my $install = $MakefileData;    $install =~ s/\n/\035/g;    $install =~ s/.*\035$_[0]:[^\035]*\035//;    my $emptyline = 0;    while (! $emptyline) {      if ($install =~ /([^\035]*)\035(.*)/) {	local $line = $1;	$install = $2;	if ($line !~ /^\s*$/ && $line !~ /^(\@.*\@)*\t/) {	  $emptyline = 1;	} else {	  replaceDestDir($line);	}      } else {	$emptyline = 1;      }    }  }}sub tag_LOCALINSTALL (){  helper_LOCALINSTALL('install-exec-local');  helper_LOCALINSTALL('install-data-local');  helper_LOCALINSTALL('uninstall-local');  return 0;}sub replaceDestDir($) {  local $line = $_[0];  if (   $line =~ /^\s*(\@.*\@)*\s*\$\(mkinstalldirs\)/      || $line =~ /^\s*(\@.*\@)*\s*\$\(INSTALL\S*\)/      || $line =~ /^\s*(\@.*\@)*\s*(-?rm.*) \S*$/)  {    $line =~ s/^(.*) ([^\s]*)\s*$/$1 \$(DESTDIR)$2/ if ($line !~ /\$\(DESTDIR\)/);  }  if ($line ne $_[0]) {    $_[0] = quotemeta $_[0];    substituteLine($_[0], $line);  }}#---------------------------------------------------------------------------sub tag_CLOSURE () {    return if ($program !~ /_la$/);        my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n";    $MakefileData =~ m/$lookup/;    return if ($1 !~ /CXXLINK/);    if ($MakefileData !~ /\n$program\_LDFLAGS\s*=.*-no-undefined/ &&        $MakefileData !~ /\n$program\_LDFLAGS\s*=.*KDE_PLUGIN/ ) {        print STDERR "Report: $program contains undefined in $printname\n" if ($program =~ /^lib/ && $dryrun);        return;    }    my $closure = $realname{$program} . ".closure";    my $lines = "$closure: \$($program\_OBJECTS) \$($program\_DEPENDENCIES)\n";    $lines .= "\t\@echo \"int main() {return 0;}\" > $program\_closure.$cxxsuffix\n";    $lines .= "\t\@\$\(LTCXXCOMPILE\) -c $program\_closure.$cxxsuffix\n";    $lines .= "\t\@\$\(CXXLINK\) $program\_closure.lo \$($program\_LDFLAGS) \$($program\_OBJECTS) \$($program\_LIBADD) \$(LIBS)\n";    $lines .= "\t\@rm -f $program\_closure.* $closure\n";    $lines .= "\t\@echo \"timestamp\" > $closure\n";    $lines .= "\n";    appendLines($lines);    $lookup = $realname{$program} . ": (.*)";    if ($MakefileData =~ /\n$lookup\n/) {        $lines  = "\@KDE_USE_CLOSURE_TRUE@". $realname{$program} . ": $closure $1";        $lines .= "\n\@KDE_USE_CLOSURE_FALSE@" . $realname{$program} . ": $1";        substituteLine($lookup, $lines);    }}sub tag_DIST () {    my %foundfiles = ();    opendir (THISDIR, ".");    foreach $entry (readdir(THISDIR)) {        next if ($entry eq "CVS" || $entry =~ /^\./  || $entry =~ /^Makefile$$/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/);        next if (! -f $entry);        next if ($entry =~ /\.moc/ || $entry =~ /\.lo$/ || $entry =~ /\.la$/ || $entry =~ /\.o/);        $foundfiles{$entry} = 1;    }    closedir (THISDIR);    my @marks = ("EXTRA_DIST", "DIST_COMMON", '\S*_SOURCES', '\S*_HEADERS', 'MAINTAINERCLEANFILES', 'CLEANFILES', 'DISTCLEANFILES', '\S*_OBJECTS');    foreach $mark (@marks) {        while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) {            foreach $file (split('[\034\s]', $2)) {                $file =~ s/\.\///;                $foundfiles{$file} = 0 if (defined $foundfiles{$file});            }        }    }    my @files = ("Makefile", "config.cache", "config.log", "stamp-h",                 "stamp-h1", "stamp-h1", "config.h", "Makefile", "config.status", "config.h", "libtool");    foreach $file (@files) {        $foundfiles{$file} = 0 if (defined $foundfiles{$file});    }    my $KDE_DIST = "";    foreach $file (keys %foundfiles) {        if ($foundfiles{$file} == 1) {            $KDE_DIST .= "$file ";        }    }    if ($KDE_DIST) {        print "KDE_DIST $printname $KDE_DIST\n" if ($verbose);                my $lookup = "DISTFILES *=(.*)";        if ($MakefileData =~ /\n$lookup\n/) {            substituteLine($lookup, "KDE_DIST=$KDE_DIST\n\nDISTFILES=$1 \$(KDE_DIST)\n");        }    }}#-----------------------------------------------------------------------------# Returns 0 if the line was processed - 1 otherwise.# Errors are logged in the global $errorflagssub tag_DOCFILES (){#    if ($MakefileData =~ /\nSUBDIRS\s*=/) { # subdirs#      $MakefileData =~ /\n(.*-recursive:\s*)\n/;#      my $orig_rules = $1;#      my $rules = $orig_rules;#      $rules =~ s/:\s*$//;#      substituteLine($orig_rules, "$rules docs-recursive:");#      appendLines("docs: docs-recursive docs-am\n");#    } else {#      appendLines("docs: docs-am\n");#    }    $target_adds{"all"} .= "docs-am ";    my $lookup = 'KDE_DOCS\s*=\s*([^\n]*)';    goto nodocs    if ($MakefileData !~ /\n$lookup/);    print STDOUT "KDE_DOCS processing <$1>\n"   if ($verbose);    tag_SUBDIRS();    my $tmp = $1;    # Either find the files in the directory (AUTO) or use    # only the specified po files.    my $files = "";    my $appname = $tmp;    $appname =~ s/^(\S*)\s*.*$/$1/;    if ($appname =~ /AUTO/) {      $appname = basename($makefileDir);    }    if ($tmp !~ / - /)    {        opendir (THISDIR, ".");	foreach $entry (readdir(THISDIR)) {	  next if ($entry eq "CVS" || $entry =~ /^\./  || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/);	  next if (! -f $entry);	  $files .= "$entry ";	}        closedir (THISDIR);        print STDOUT "docfiles found = $files\n"   if ($verbose);    }    else    {        $tmp =~ s/\034/ /g;	$tmp =~ s/^\S*\s*-\s*//;        $files = $tmp;    }    goto nodocs if (!$files);        # Nothing to do    if ($files =~ /(^| )index\.docbook($| )/) {            my $lines = "";      my $lookup = 'KDB2HTML\s*=';      #if ($MakefileData !~ /\n($lookup)/) {#	$lines = "KDB2HTML = \$(SHELL) /\$(kde_bindir)/kdb2html\n";#      }      $lines .= "docs-am: HTML HTML/index.html\n";      $lines .= "\n";      $lines .= "HTML:\n";      $lines .= "\ttest -d HTML || mkdir HTML\n";

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?