Skip to content

Instantly share code, notes, and snippets.

@shulima
Created March 25, 2015 22:31
Show Gist options
  • Save shulima/c42dbaadd26535725666 to your computer and use it in GitHub Desktop.
Save shulima/c42dbaadd26535725666 to your computer and use it in GitHub Desktop.
Look up DLEXT instead of assuming .so
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index f605188..d28d77b 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -21,6 +21,8 @@ generator_built = \
ext/guestfs/_guestfs.c \
bindtests.rb
+DLEXT := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['DLEXT']")
+
EXTRA_DIST = \
$(generator_built) \
Rakefile.in \
@@ -38,7 +40,7 @@ CLEANFILES = \
ext/guestfs/*~ \
ext/guestfs/extconf.h \
ext/guestfs/_guestfs.o \
- ext/guestfs/_guestfs.so \
+ ext/guestfs/_guestfs.$(DLEXT) \
ext/guestfs/mkmf.log \
ext/guestfs/Makefile
@@ -59,7 +61,7 @@ install:
$(MKDIR_P) $(DESTDIR)$(RUBY_LIBDIR)
$(MKDIR_P) $(DESTDIR)$(RUBY_ARCHDIR)
$(INSTALL) -p -m 0644 $(srcdir)/lib/guestfs.rb $(DESTDIR)$(RUBY_LIBDIR)
- $(INSTALL) -p -m 0755 ext/guestfs/_guestfs.so $(DESTDIR)$(RUBY_ARCHDIR)
+ $(INSTALL) -p -m 0755 ext/guestfs/_guestfs.$(DLEXT) $(DESTDIR)$(RUBY_ARCHDIR)
TESTS = run-bindtests run-ruby-tests
diff --git a/ruby/Rakefile.in b/ruby/Rakefile.in
index 94a25fd..1dfc600 100644
--- a/ruby/Rakefile.in
+++ b/ruby/Rakefile.in
@@ -40,9 +40,11 @@ end
PKG_NAME='@PACKAGE_NAME@'
PKG_VERSION='@PACKAGE_VERSION@'
+DLEXT=RbConfig::CONFIG['DLEXT']
+
EXT_CONF='@abs_builddir@/ext/guestfs/extconf.rb'
MAKEFILE='@builddir@/ext/guestfs/Makefile'
-GUESTFS_MODULE='@builddir@/ext/guestfs/_guestfs.so'
+GUESTFS_MODULE="@builddir@/ext/guestfs/_guestfs.#{DLEXT}"
GUESTFS_SRC='@srcdir@/ext/guestfs/_guestfs.c'
CLEAN.include [ "@builddir@/ext/**/*.o", GUESTFS_MODULE,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment