diff --git a/config/add-chrome.pl b/config/add-chrome.pl index 9799767744a..fcf556c067e 100644 --- a/config/add-chrome.pl +++ b/config/add-chrome.pl @@ -13,6 +13,29 @@ my $chromeType = $ARGV[2]; my $pkgName = $ARGV[3]; my $jarFileName = $ARGV[4]; +my $win32 = ($^O =~ /((MS)?win32)|cygwin|os2/i) ? 1 : 0; +my $macos = ($^O =~ /MacOS|darwin/i) ? 1 : 0; +my $unix = !($win32 || $macos) ? 1 : 0; + +sub foreignPlatformFile +{ + my ($jarfile) = @_; + + if (!$win32 && index($jarfile, "-win") != -1) { + return 1; + } + + if (!$unix && index($jarfile, "-unix") != -1) { + return 1; + } + + if (!$macos && index($jarfile, "-mac") != -1) { + return 1; + } + + return 0; +} + #print "add-chrome $installedChromeFile $disableJarPackaging $chromeType $pkgName $jarFileName\n"; my $nofilelocks = 0; @@ -24,6 +47,8 @@ if ($jarFileName =~ /(.*)\.jar/) { $jarFileName = $1; } +if (!foreignPlatformFile($jarFileName)) { + my $line; if ($disableJarPackaging) { $line = "$chromeType,install,url,resource:/chrome/$jarFileName/$chromeType/$pkgName/"; @@ -86,4 +111,5 @@ if ($err) { die "error: can't close $installedChromeFile: $!"; } print "+++ adding chrome $installedChromeFile\n+++\t$line\n"; +} diff --git a/config/make-jars.pl b/config/make-jars.pl index e7abe7cebac..feb622010be 100644 --- a/config/make-jars.pl +++ b/config/make-jars.pl @@ -77,6 +77,29 @@ if ($verbose) { . "\n"; } +my $win32 = ($^O =~ /((MS)?win32)|cygwin|os2/i) ? 1 : 0; +my $macos = ($^O =~ /MacOS|darwin/i) ? 1 : 0; +my $unix = !($win32 || $macos) ? 1 : 0; + +sub foreignPlatformFile +{ + my ($jarfile) = @_; + + if (!$win32 && index($jarfile, "-win") != -1) { + return 1; + } + + if (!$unix && index($jarfile, "-unix") != -1) { + return 1; + } + + if (!$macos && index($jarfile, "-mac") != -1) { + return 1; + } + + return 0; +} + sub zipErrorCheck($$) { my ($err,$lockfile) = @_; @@ -319,7 +342,7 @@ while () { my $srcPath = defined($2) ? substr($2, 1, -1) : $2; EnsureFileInDir("$chromeDir/$jarfile", $baseFilesDir, $dest, $srcPath, 0); $args = "$args$dest "; - if ($autoreg && $dest =~ /([\w\d.\-\_\+]+)\/([\w\d.\-\_\\\/]+)contents.rdf/) + if (!foreignPlatformFile($jarfile) && $autoreg && $dest =~ /([\w\d.\-\_\+]+)\/([\w\d.\-\_\\\/]+)contents.rdf/) { my $chrome_type = $1; my $pkg_name = $2; @@ -330,7 +353,7 @@ while () { my $srcPath = defined($2) ? substr($2, 1, -1) : $2; EnsureFileInDir("$chromeDir/$jarfile", $baseFilesDir, $dest, $srcPath, 1); $overrides = "$overrides$dest "; - if ($autoreg && $dest =~ /([\w\d.\-\_\+]+)\/([\w\d.\-\_\\\/]+)contents.rdf/) + if (!foreignPlatformFile($jarfile) && $autoreg && $dest =~ /([\w\d.\-\_\+]+)\/([\w\d.\-\_\\\/]+)contents.rdf/) { my $chrome_type = $1; my $pkg_name = $2;