Skip to content

Commit 6ce3d50

Browse files
committed
Use Gem.win_platform? instead of custom code
1 parent f2620c7 commit 6ce3d50

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

ext/rugged/extconf.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ def sys(cmd)
1515
ret
1616
end
1717

18-
def windows?
19-
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
20-
end
21-
2218
if !(MAKE = find_executable('gmake') || find_executable('make'))
2319
abort "ERROR: GNU make is required to build Rugged."
2420
end
@@ -59,7 +55,7 @@ def windows?
5955
abort "ERROR: CMake is required to build Rugged."
6056
end
6157

62-
if !windows? && !find_executable('pkg-config')
58+
if !Gem.win_platform? && !find_executable('pkg-config')
6359
abort "ERROR: pkg-config is required to build Rugged."
6460
end
6561

@@ -68,14 +64,14 @@ def windows?
6864

6965
Dir.chdir("build") do
7066
# On Windows, Ruby-DevKit is MSYS-based, so ensure to use MSYS Makefiles.
71-
generator = "-G \"MSYS Makefiles\"" if windows?
67+
generator = "-G \"MSYS Makefiles\"" if Gem.win_platform?
7268
sys("cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo #{generator}")
7369
sys(MAKE)
7470

7571
# "normal" libraries (and libgit2 builds) get all these when they build but we're doing it
7672
# statically so we put the libraries in by hand. It's important that we put the libraries themselves
7773
# in $LIBS or the final linking stage won't pick them up
78-
if windows?
74+
if Gem.win_platform?
7975
$LDFLAGS << " " + "-L#{Dir.pwd}/deps/winhttp"
8076
$LIBS << " -lwinhttp -lcrypt32 -lrpcrt4 -lole32"
8177
else

0 commit comments

Comments
 (0)