[Build] Fixes for cygwin-related cross-platform compatibility quirks.

This commit is contained in:
hackademix 2018-10-13 10:34:18 +02:00
parent 808fd652be
commit 816d8ae485
2 changed files with 19 additions and 11 deletions

View File

@ -88,7 +88,15 @@ done
echo "Creating $XPI.xpi..." echo "Creating $XPI.xpi..."
mkdir -p "$XPI_DIR" mkdir -p "$XPI_DIR"
"$BUILD_CMD" $BUILD_OPTS --source-dir=$(cygpath -w "$BUILD") --artifacts-dir=$(cygpath -w "$XPI_DIR") --ignore-files=test/XSS_test.js if which cygpath; then
WEBEXT_IN="$(cygpath -w "$BUILD")"
WEBEXT_OUT="$(cygpath -w "$XPI_DIR")"
else
WEBEXT_IN="$BUILD"
WEBEXT_OUT="$XPI_DIR"
fi
"$BUILD_CMD" $BUILD_OPTS --source-dir="$WEBEXT_IN" --artifacts-dir="$WEBEXT_OUT" --ignore-files=test/XSS_test.js
SIGNED="$XPI_DIR/noscript_security_suite-$VER-an+fx.xpi" SIGNED="$XPI_DIR/noscript_security_suite-$VER-an+fx.xpi"
if [ -f "$SIGNED" ]; then if [ -f "$SIGNED" ]; then
mv "$SIGNED" "$XPI.xpi" mv "$SIGNED" "$XPI.xpi"

View File

@ -3,7 +3,7 @@ use strict;
require LWP::UserAgent; require LWP::UserAgent;
use LWP::Simple; use LWP::Simple;
use RegExp::List; use Regexp::List;
use File::stat; use File::stat;
use File::Basename; use File::Basename;
use List::MoreUtils qw(uniq); use List::MoreUtils qw(uniq);
@ -17,7 +17,7 @@ sub create_re
{ {
my $cache = "$HERE/html5_events.re"; my $cache = "$HERE/html5_events.re";
my $archive = "$HERE/html5_events_archive.txt"; my $archive = "$HERE/html5_events_archive.txt";
my $sb = stat($cache); my $sb = stat($cache);
if ($sb && time() - $sb->mtime < 86400) if ($sb && time() - $sb->mtime < 86400)
@ -27,7 +27,7 @@ sub create_re
close IN; close IN;
return $content[0]; return $content[0];
} }
sub fetch_url sub fetch_url
{ {
my $url = shift(@_); my $url = shift(@_);
@ -53,30 +53,30 @@ sub create_re
$content = join("\n", grep(/^\s*Atom\("on\w+"/, split(/[\n\r]/, $content))); $content = join("\n", grep(/^\s*Atom\("on\w+"/, split(/[\n\r]/, $content)));
$content =~ s/.*"(on\w+)".*/$1 /g; $content =~ s/.*"(on\w+)".*/$1 /g;
open IN, "<$archive"; open IN, "<$archive";
my @archived = <IN>; my @archived = <IN>;
close IN; close IN;
$content .= join("\n", @archived); $content .= join("\n", @archived);
$content =~ s/\s+/\n/g; $content =~ s/\s+/\n/g;
$content =~ s/^\s+|\s+$//g; $content =~ s/^\s+|\s+$//g;
my @all_events = grep(!/^only$/, uniq(split("\n", $content))); my @all_events = grep(!/^only$/, uniq(split("\n", $content)));
open (OUT, ">$archive"); open (OUT, ">$archive");
print OUT join("\n", @all_events); print OUT join("\n", @all_events);
close OUT; close OUT;
my $l = Regexp::List->new; my $l = Regexp::List->new;
my $re = $l->list2re(@all_events); my $re = $l->list2re(@all_events);
$re =~ s/\(\?[-^]\w+:(.*)\)/$1/; $re =~ s/\(\?[-^]\w+:(.*)\)/$1/;
open (OUT, ">$cache"); open (OUT, ">$cache");
print OUT $re; print OUT $re;
close OUT; close OUT;
$re; $re;
} }