Skip to content

Commit ef8851c

Browse files
committed
Add patches to make libsass gcc 4.4 compatible
1 parent 8403584 commit ef8851c

4 files changed

+618
-0
lines changed

Makefile.PL

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ my $skip_manifest = env_option 'PSASS_SKIP_MANIFEST', 0;
4949
my $skip_version = env_option 'PSASS_SKIP_VERSION', 0;
5050
my $update_deps = env_option 'PSASS_UPDATE_DEPS', 0;
5151
my $checkout_deps = env_option 'PSASS_CHECKOUT_DEPS', 0;
52+
my $patch_gcc44 = env_option 'PSASS_PATCH_GCC44', 0;
5253
my $skip_git = env_option 'PSASS_SKIP_GIT', 0;
5354

5455
# arrays for various switches
@@ -80,6 +81,7 @@ sub help
8081
print " --checkout-deps Checkout submodules at linked commit (needs git repo)\n";
8182
print " --get-versions Show versions of all perl package (.pm) files\n";
8283
print " --set-versions Set versions of all perl package (.pm) files\n";
84+
print " --patch-gcc44 Patch libsass for gcc44 compatibility\n";
8385
print " --skip-git Do not try to use anything git related\n";
8486
print "\n";
8587
print " You may use environment variables to set any option\n";
@@ -161,6 +163,7 @@ GetOptions(
161163
'--library!' => \$install_library,
162164
'--compiler:s' => \$compiler,
163165
'--profiling!' => \$profiling,
166+
'--patch-gcc44' => \$patch_gcc44,
164167
'--skip-git!' => \$skip_git,
165168
'--skip-version!' => \$skip_version,
166169
'--skip-manifest!' => \$skip_manifest,
@@ -311,6 +314,24 @@ if ($install_sassc) {
311314
}
312315
}
313316

317+
################################################################################
318+
# patch sources
319+
################################################################################
320+
321+
if ($patch_gcc44) {
322+
my $cwd = Cwd::getcwd;
323+
chdir ("libsass") or die "pushd: $!";
324+
print "Patching libsass source for gcc compatibility\n";
325+
foreach my $patch (sort glob("../patches/*.patch")) {
326+
print "applying $patch\n";
327+
# system "git", "am", "--abort";
328+
system "git", "am", "--3way", "--keep-cr",
329+
"--ignore-space-change", "--quiet", $patch;
330+
}
331+
system "perl", "script/replace-range-for-loops.pl";
332+
chdir ($cwd) or die "popd: $!";
333+
}
334+
314335
################################################################################
315336
# compiler configurations
316337
################################################################################

0 commit comments

Comments
 (0)