@@ -20,11 +20,14 @@ def sys(cmd)
20
20
ret
21
21
end
22
22
23
- def windows?
24
- RbConfig ::CONFIG [ 'host_os' ] =~ /mswin|mingw/
23
+ MAKE = if Gem . win_platform?
24
+ # On Windows, Ruby-DevKit only has 'make'.
25
+ find_executable ( 'make' )
26
+ else
27
+ find_executable ( 'gmake' ) || find_executable ( 'make' )
25
28
end
26
29
27
- if !( MAKE = find_executable ( 'gmake' ) || find_executable ( 'make' ) )
30
+ if !MAKE
28
31
abort "ERROR: GNU make is required to build Rugged."
29
32
end
30
33
@@ -64,7 +67,7 @@ def windows?
64
67
abort "ERROR: CMake is required to build Rugged."
65
68
end
66
69
67
- if !windows ? && !find_executable ( 'pkg-config' )
70
+ if !Gem . win_platform ? && !find_executable ( 'pkg-config' )
68
71
abort "ERROR: pkg-config is required to build Rugged."
69
72
end
70
73
@@ -73,14 +76,14 @@ def windows?
73
76
74
77
Dir . chdir ( "build" ) do
75
78
# On Windows, Ruby-DevKit is MSYS-based, so ensure to use MSYS Makefiles.
76
- generator = "-G \" MSYS Makefiles\" " if windows ?
79
+ generator = "-G \" MSYS Makefiles\" " if Gem . win_platform ?
77
80
sys ( "cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo #{ generator } " )
78
81
sys ( MAKE )
79
82
80
83
# "normal" libraries (and libgit2 builds) get all these when they build but we're doing it
81
84
# statically so we put the libraries in by hand. It's important that we put the libraries themselves
82
85
# in $LIBS or the final linking stage won't pick them up
83
- if windows ?
86
+ if Gem . win_platform ?
84
87
$LDFLAGS << " " + "-L#{ Dir . pwd } /deps/winhttp"
85
88
$LIBS << " -lwinhttp -lcrypt32 -lrpcrt4 -lole32 -lz"
86
89
else
0 commit comments