⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 am_edit

📁 bookcase,by shell script and c++ and perl
💻
📖 第 1 页 / 共 5 页
字号:
            my $sourcedir = '';            if (-f "$makefileDir/$source.ui") {                $sourcedir = '$(srcdir)/';            }            if (!$uiFiles{$source}) {                $dep_lines .= "$source.$cxxsuffix: $sourcedir$source.ui $source.h $source.moc\n";                $dep_lines .= "\trm -f $source.$cxxsuffix\n";                if (!$kdeopts{"qtonly"}) {                    $dep_lines .= "\techo '#include <klocale.h>' > $source.$cxxsuffix\n";                    my ($mangled_source) = $source;                    $mangled_source =~ s/[^A-Za-z0-9]/_/g;  # get rid of garbage                    $dep_lines .= "\t\$(UIC) -tr \${UIC_TR} -i $source.h $sourcedir$source.ui > $source.$cxxsuffix.temp ; ret=\$\$?; \\\n";                    $dep_lines .= "\tsed -e \"s,\${UIC_TR}( \\\"\\\" ),QString::null,g\" $source.$cxxsuffix.temp | sed -e \"s,\${UIC_TR}( \\\"\\\"\\, \\\"\\\" ),QString::null,g\" | sed -e \"s,image\\([0-9][0-9]*\\)_data,img\\1_" . $mangled_source . ",g\" >> $source.$cxxsuffix ;\\\n";		    $dep_lines .= "\trm -f $source.$cxxsuffix.temp ;\\\n";                } else {                    $dep_lines .= "\t\$(UIC) -i $source.h $sourcedir$source.ui > $source.$cxxsuffix; ret=\$\$?; \\\n";                }		$dep_lines .= "\tif test \"\$\$ret\" = 0; then echo '#include \"$source.moc\"' >> $source.$cxxsuffix; else rm -f $source.$cxxsuffix ; exit \$\$ret ; fi\n\n";                $dep_lines .= "$source.h: $sourcedir$source.ui\n";                $dep_lines .= "\t\$(UIC) -o $source.h $sourcedir$source.ui\n\n";                $dep_lines .= "$source.moc: $source.h\n";                $dep_lines .= "\t\$(MOC) $source.h -o $source.moc\n";		$uiFiles{$source} = 1;                $depedmocs{$program} .= " $source.moc";                $globalmocs{$source} = "\035$source.h\035$source.cpp";            }                        if ($program =~ /_la$/) {                $realObjs{$program} .= " $source.lo";            } else {                $realObjs{$program} .= " $source.\$(OBJEXT)";            }            $sources{$program} .= " $source.$cxxsuffix";            $sources_changed{$program} = 1;            $important{$program} .= "$source.h ";            $ui_output .= "\\\n\t$source.$cxxsuffix $source.h $source.moc ";            push(@cleanfiles, "$source.$cxxsuffix");            push(@cleanfiles, "source.h");            push(@cleanfiles, "$source.moc");            $dep_files .= " \$(DEPDIR)/$source.P" if($dep_files !~/$source.P/ );        }    }    if ($dep_lines) {        appendLines($dep_lines);    }}sub tag_ICON(){    my $lookup = '([^\s]*)_ICON\s*=\s*([^\n]*)';    my $install = "";    my $uninstall = "";    while ($MakefileData =~ /\n$lookup/og) {        my $destdir;        if ($1 eq "KDE") {            $destdir = "kde_icondir";        } else {            $destdir = $1 . "dir";        }        my $iconauto = ($2 =~ /AUTO\s*$/);        my @appnames = ();        if ( ! $iconauto ) {	    my $appicon_str = $2;            my @_appnames = split(" ", $appicon_str);            print STDOUT "KDE_ICON processing <@_appnames>\n"   if ($verbose);            foreach $appname (@_appnames) {                push(@appnames, quotemeta($appname));            }        } else {            print STDOUT "KDE_ICON processing <AUTO>\n"   if ($verbose);        }        my @files = ();        opendir (THISDIR, ".");        foreach $entry (readdir(THISDIR)) {            next if ($entry eq "CVS" || $entry =~ /^\./  || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/);            next if (! -f $entry);            if ( $iconauto )              {                  push(@files, $entry)                    if ($entry =~ /\.xpm/ || $entry =~ /\.png/ || $entry =~ /\.mng/ || $entry =~ /\.svg/);              } else {                  foreach $appname (@appnames) {                      push(@files, $entry)                        if ($entry =~ /-$appname\.xpm/ || $entry =~ /-$appname\.png/ || $entry =~ /-$appname\.mng/ || $entry =~ /-$appname\.svg/);                  }              }        }        closedir (THISDIR);                my %directories = ();                foreach $file (@files) {            my $newfile = $file;            my $prefix = $file;            $prefix =~ s/\.(png|xpm|mng|svg|svgz)$//;            my $appname = $prefix;            $appname =~ s/^[^-]+-// if ($appname =~ /-/) ;            $appname =~ s/^[^-]+-// if ($appname =~ /-/) ;            $appname = quotemeta($appname);            $prefix =~ s/$appname$//;            $prefix =~ s/-$//;                        $prefix = 'lo16-app' if ($prefix eq 'mini');            $prefix = 'lo32-app' if ($prefix eq 'lo');            $prefix = 'hi48-app' if ($prefix eq 'large');            $prefix .= '-app' if ($prefix =~ m/^...$/);                        my $type = $prefix;            $type =~ s/^.*-([^-]+)$/$1/;            $prefix =~ s/^(.*)-[^-]+$/$1/;                        my %type_hash =              (               'action' => 'actions',               'app' => 'apps',               'device' => 'devices',               'filesys' => 'filesystems',               'mime' => 'mimetypes'              );            if (! defined $type_hash{$type} ) {                print STDERR "unknown icon type $type in $printname ($file)\n";                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',               'hi64' => 'hicolor/64x64',               'hi128' => 'hicolor/128x128',               'hisc' => 'hicolor/scalable', 	       'cr16' => 'crystalsvg/16x16',               'cr22' => 'crystalsvg/22x22',               'cr32' => 'crystalsvg/32x32',               'cr48' => 'crystalsvg/48x48',               'cr64' => 'crystalsvg/64x64',               'cr128' => 'crystalsvg/128x128',               'crsc' => 'crystalsvg/scalable'              );                        $newfile =~ s@.*-($appname\.(png|xpm|mng|svgz|svg?))@$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/o) {    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/o) {	  $tmp = "DISTFILES = \$(GMOFILES) \$(POFILES) $1";	  substituteLine ($lookup, $tmp);	}    }  $target_adds{"install-data-am"} .= "install-nls ";  $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  if test -f \$\$base.gmo; then \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n";    $tmp .= "\t  elif test -f \$(srcdir)/\$\$base.gmo; then \$(INSTALL_DATA) \$(srcdir)/\$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n";    $tmp .= "\t  fi ;\\\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  if test -f \$\$base.gmo; then \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n";    $tmp .= "\t  elif test -f \$(srcdir)/\$\$base.gmo; then \$(INSTALL_DATA) \$(srcdir)/\$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n";    $tmp .= "\t  fi ;\\\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 .= "\tfor file in \$(GMOFILES); do \\\n";  $tmp .= "\t  cp \$(srcdir)/\$\$file \$(distdir); \\\n";  $tmp .= "\tdone\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/o);    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, ".");	$pofiles =  join(" ", grep(/\.po$/, readdir(THISDIR)));        closedir (THISDIR);        print STDOUT "pofiles found = $pofiles\n"   if ($verbose);	if (-f "charset" && -f "kdelibs.po") {	    handle_TOPLEVEL();	}    }    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 = "\035" . $_[0] . " *:[^\035]*\035\t";  my $copy = $MakefileData;  $copy =~ s/\n/\035/g;  if ($copy =~ /($lookup.*)$/) {    $install = $1;    $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($) {

⌨️ 快捷键说明

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