1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
From: David MacMahon <davidm@astro.berkeley.edu>
Date: Sat, 2 Mar 2013 11:06:42 -0800
Subject: Add --enable-autobuild option
This enables the automatic download and build of the pgplot library only if the
user provides the --enable-autobuild option. This is more security conscious
as it requires the user's explicit permission (by providing --enable-autobuild)
to download and install this third party library.
---
ext/extconf-auto.rb | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/ext/extconf-auto.rb b/ext/extconf-auto.rb
index 64020d1..5891862 100644
--- a/ext/extconf-auto.rb
+++ b/ext/extconf-auto.rb
@@ -14,7 +14,24 @@
load "./extconf.rb"
+# Exit if user did not specify "--enable-autobuild"
+if !enable_config('autobuild', false)
+ # Print reminder about --enable-autobuild option if pgplot was not found
+ if !$have_pgplot
+ puts
+ puts "The PGPLOT library was not found. To auto-build it as part of"
+ puts "installing Ruby/PGLOT, pass the --enable-autobuild option."
+ puts
+ puts "Examples:"
+ puts
+ puts " Gem install: gem install pgplot -- --enable-autobuild"
+ puts "Manual install: ruby extconf.rb --enable-autobuild"
+ end
+ exit
+end
+# Exit if pgplot library was found
exit if $have_pgplot
+# Exit unless a fortran compiler was found
exit unless %w[gfortran g77].any?{|cmd| system("which #{cmd}")}
puts "enabling auto-build PGPLOT Library..."
|