Skip to content

Commit

Permalink
Merge branch 'no-cmake-by-kmx' of github.com:PerlGameDev/Alien-Box2D …
Browse files Browse the repository at this point in the history
…into no-cmake-by-kmx
  • Loading branch information
kmx committed May 31, 2011
2 parents 9168096 + d899415 commit e641987
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
34 changes: 33 additions & 1 deletion inc/My/Builder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ sub build_binaries {
}

chdir $srcdir;
my @cmd = ($Config{make}, '-f', $makefile, "PREFIX=$prefixdir", 'install');
my @cmd = ($self->_get_make, '-f', $makefile, "PREFIX=$prefixdir", 'install');
push @cmd, "CXXFLAGS=$cxxflags" if $cxxflags;
#push @cmd, "CXX=g++"; ### the default in makefile.unix is 'c++' - here you can override it
printf("(cmd: %s)\n", join(' ', @cmd));
Expand Down Expand Up @@ -290,4 +290,36 @@ sub apply_patch {
}
}

sub _get_make {
my ($self) = @_;

return $Config{make} if $^O eq 'MSWin32';

my @try = ($Config{gmake}, 'gmake', 'make', $Config{make});
my %tested;
print "Gonna detect GNU make:\n";
foreach my $name ( @try ) {
next unless $name;
next if $tested{$name};
$tested{$name} = 1;
print "- testing: '$name'\n";
if ($self->_is_gnu_make($name)) {
print "- found: '$name'\n";
return $name
}
}
print "- fallback to: 'make'\n";
return 'make';
}

sub _is_gnu_make {
my ($self, $name) = @_;
my $devnull = File::Spec->devnull();
my $ver = `$name --version 2> $devnull`;
if ($ver =~ /GNU Make/i) {
return 1;
}
return 0;
}

1;
24 changes: 12 additions & 12 deletions patches/mingw-minmax.diff
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ diff -ru build_src.orig/Box2D_v2.1.2/Box2D/Box2D/Common/b2Math.h build_src/Box2D
--- build_src.orig/Box2D_v2.1.2/Box2D/Box2D/Common/b2Math.h 2010-04-13 00:48:44.000000000 +0200
+++ build_src/Box2D_v2.1.2/Box2D/Box2D/Common/b2Math.h 2011-05-31 09:48:43.924407900 +0200
@@ -21,6 +21,12 @@

#include <Box2D/Common/b2Settings.h>

+#ifdef __MINGW32__
+/* otherwise: macro "min" requires 2 arguments, but only 1 given */
+#undef min
+#undef max
+#endif
+
#include <cmath>
#include <cfloat>
#include <cstddef>

#include <Box2D/Common/b2Settings.h>

+#ifdef __MINGW32__
+/* otherwise: macro "min" requires 2 arguments, but only 1 given */
+#undef min
+#undef max
+#endif
+
#include <cmath>
#include <cfloat>
#include <cstddef>

0 comments on commit e641987

Please sign in to comment.