Warning, file /sdk/kde-dev-scripts/kf5/bundle_data_files.pl was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #!/usr/bin/perl -w 0002 0003 # Changes from installing xmlgui5 files to bundling them into the resource. 0004 0005 use strict; 0006 my $file = "CMakeLists.txt"; 0007 my $xmlgui_files; 0008 my %qrc_files; 0009 my %filesForApp = (); 0010 my $modified = 0; 0011 open(my $FILE1, "<", $file) || die; 0012 while (<$FILE1>) { 0013 if (/qt5_add_resources\s*\(.*([\w]+\.qrc)/i) { 0014 $qrc_files{$1} = 1; # TODO the key should be the app name, and $1 should be the value 0015 } 0016 } 0017 close($FILE1); 0018 0019 open(my $FILE, "<", $file) || die; 0020 my @l = map { 0021 my $orig = $_; 0022 0023 if (/install\s*\(\s*FILES \s*((?:[\w\-\/]*\.rc\s*)*)\s*DESTINATION \s*\$\{KDE_INSTALL_KXMLGUI5DIR\}\/(\w+)/i) { 0024 $xmlgui_files = "$1"; 0025 my $appname = $2; 0026 print STDERR "Found xmlgui files $xmlgui_files in $appname\n"; 0027 $filesForApp{$appname} = $xmlgui_files; 0028 $_ = ""; # delete line 0029 0030 # while here, insert line about new qrc 0031 my $qrc_file = "$appname.qrc"; 0032 if (not defined $qrc_files{$qrc_file}) { 0033 $qrc_files{$qrc_file} = 1; 0034 $_ = "qt5_add_resources(${appname}_SRCS $qrc_file) #TODO move this to the right place, check the name of the variable\n"; 0035 } 0036 } 0037 0038 $modified ||= $orig ne $_; 0039 $_; 0040 } <$FILE>; 0041 0042 if ($modified) { 0043 open (my $OUT, ">", $file); 0044 print $OUT @l; 0045 close ($OUT); 0046 } 0047 0048 if (defined $xmlgui_files) { 0049 foreach my $appname (keys(%filesForApp)) { 0050 my $qrc_file = "$appname.qrc"; 0051 if (not -e $qrc_file) { 0052 open (my $QRC, ">", $qrc_file); 0053 print $QRC "<RCC>\n"; 0054 print $QRC "<qresource prefix=\"/kxmlgui5/$appname\">\n"; 0055 foreach my $xmlguifile (split(/ /, $filesForApp{$appname})) { 0056 print $QRC "<file>$xmlguifile</file>\n"; 0057 } 0058 print $QRC "</qresource>\n"; 0059 print $QRC "</RCC>\n"; 0060 close($QRC); 0061 system("git add $qrc_file"); 0062 } else { 0063 print STDERR "TODO: add these lines into $qrc_file, under prefix /xmlgui5/$appname\n"; 0064 0065 print STDERR "<qresource prefix=\"/kxmlgui5/$appname\">\n"; 0066 foreach my $xmlguifile (split(/ /, $filesForApp{$appname})) { 0067 print STDERR "<file>$xmlguifile</file>\n"; 0068 } 0069 print STDERR "</qresource>\n"; 0070 } 0071 } 0072 } 0073