Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support the --disable-htmldoc option to ./configure and setup.rb

  • Loading branch information...
commit fcadb749ff395fdc06f67d6b9af6302caa2f2d31 1 parent 5c2f2bd
rmagick authored
5 README.txt
View
@@ -166,6 +166,11 @@ addition to the regular options, there are a few RMagick-specific options:
> examples and will always complete. This option is useful if you're having
> trouble installing RMagick and you want to see all the failing examples.
+* --disable-htmldoc (or --enable-htmldoc=no)
+ > By default the install process runs all the RMagick example programs
+ > and generates HTML versions of all the examples. This options causes
+ > the install process to skip this step. No documentation is installed.
+
* --with-graphics-magick
> If you have both ImageMagick and GraphicsMagick installed, this option will
> force RMagick to be configured with GraphicsMagick.
8 configure.ac
View
@@ -695,9 +695,15 @@ AC_ARG_ENABLE(no-harm,
[RUBY_CONFIG_OPTS="$RUBY_CONFIG_OPTS --no-harm"], )
AC_ARG_ENABLE(allow-example-errors,
- AS_HELP_STRING([--enable-allow-example-errors], [allow installation to proceed even if a lot of examples fail [--disable-allow-example-errors]]),
+ AS_HELP_STRING([--enable-allow-example-errors], [allow installation to proceed even if a lot of examples fail [[--disable-allow-example-errors]]]),
[RUBY_CONFIG_OPTS="$RUBY_CONFIG_OPTS --allow-example-errors"], )
+AC_ARG_ENABLE(htmldoc,
+ AS_HELP_STRING([--disable-htmldoc], [skip creating the HTML documentation and examples [[--enable-htmldoc]]]),
+ [if test "$enable_htmldoc" = no; then
+ RUBY_CONFIG_OPTS="$RUBY_CONFIG_OPTS --disable-htmldoc"
+ fi], )
+
RUBY_VERSION_STRING=`$RUBY --version`
AC_DEFINE_UNQUOTED(RUBY_VERSION_STRING, "$RUBY_VERSION_STRING")
2  metaconfig.in
View
@@ -2,5 +2,7 @@
# define additional install.rb config options
# add --allow-example-errors - default is false (only allow 5 examples to fail)
add_bool_config('allow-example-errors', false, 'Allow installation to proceed even if a lot of examples fail')
+# add --disable-htmldoc - default is false, if true don't build doc and examples
+add_bool_config('disable-htmldoc', false, "don't build HTML doc and examples")
# add --doc-dir - default is $prefix/share/RMagick
add_path_config('doc-dir', "$prefix/share/RMagick", 'where to install RMagick documentation')
39 post-install.rb
View
@@ -4,6 +4,9 @@
require 'find'
if defined?(Installer) && self.class == Installer
+
+ BUILD_HTMLDOC = get_config('disable-htmldoc') != 'yes'
+
$docdir = nil
# Where to install the documentation
@@ -14,23 +17,35 @@ def docdir
$docdir = dir
end
else
+
+ BUILD_HTMLDOC = true
+
def docdir
return ARGV[0]
end
end
-puts "\npost-install.rb: installing documentation..."
-
-Find.find('doc') do |file|
- next if FileTest.directory? file
- target = file.sub(/^doc\//,docdir())
- unless FileTest.exists? File.dirname(target)
- File.makedirs(File.dirname(target), true)
- # Mark this directory as one we created so
- # that uninstall.rb knows it's okay to delete
- f = File.new("#{File.dirname(target)}/.rmagick", "w")
- f.close
+if BUILD_HTMLDOC
+
+ puts "\npost-install.rb: installing documentation..."
+
+ Find.find('doc') do |file|
+ next if FileTest.directory? file
+ target = file.sub(/^doc\//,docdir())
+ unless FileTest.exists? File.dirname(target)
+ File.makedirs(File.dirname(target), true)
+ # Mark this directory as one we created so
+ # that uninstall.rb knows it's okay to delete
+ f = File.new("#{File.dirname(target)}/.rmagick", "w")
+ f.close
+ end
+ File.install(file, target, 0644)
end
- File.install(file, target, 0644)
+
+else
+
+ puts "\npost-install.rb: --disable-htmldoc specified. No documentation will be installed."
+
end
+
exit
70 post-setup.rb
View
@@ -13,12 +13,14 @@
RUBYPROG = get_config('ruby-prog')
SRCDIR = curr_srcdir()
ALLOW_EXAMPLE_ERRORS = get_config('allow-example-errors') == 'yes'
+ BUILD_HTMLDOC = get_config('disable-htmldoc') != 'yes'
else
RUBYPROG = 'ruby'
SRCDIR = '.'
ALLOW_EXAMPLE_ERRORS = true
+ BUILD_HTMLDOC = true
end
@@ -200,46 +202,54 @@ def filetoHTML(file, html)
puts "setup.rb: entering post-setup phase..."
-#
-# Don't bother if we're in the sandbox
-#
-if File.exists? 'CVS/Entries'
- puts "post-setup.rb: in CVS sandbox - stopping..."
- exit
-end
-puts "post-setup.rb: setting up documentation..."
+if BUILD_HTMLDOC
+ #
+ # Don't bother if we're in the sandbox
+ #
+ if File.exists? 'CVS/Entries'
+ puts "post-setup.rb: in CVS sandbox - stopping..."
+ exit
+ end
-# We're in the source directory. Process the doc in-place. The post-install.rb
-# script moves the generated documentation to the ultimate installation directories.
+ puts "post-setup.rb: setting up documentation..."
+ # We're in the source directory. Process the doc in-place. The post-install.rb
+ # script moves the generated documentation to the ultimate installation directories.
-cwd = Dir.getwd()
-Dir.chdir('doc')
-begin
+ cwd = Dir.getwd()
+ Dir.chdir('doc') # need to work with 1.6.x, can't use block form
+ begin
- # Step 1A: edit the shebang line in the examples
- Dir.chdir('ex')
- files = Dir['*.rb']
- files.each do |file|
- filter(file) { |line| line.sub(/\A\#!\s*\S*ruby\s/, '#!'+RUBYPROG+' ') }
+ # Step 1A: edit the shebang line in the examples
+ Dir.chdir('ex')
+ files = Dir['*.rb']
+ files.each do |file|
+ filter(file) { |line| line.sub(/\A\#!\s*\S*ruby\s/, '#!'+RUBYPROG+' ') }
- # Step 1B: Make a copy of the example as HTML in the doc directory
- filetoHTML(file, "../#{file}.html")
- end
+ # Step 1B: Make a copy of the example as HTML in the doc directory
+ filetoHTML(file, "../#{file}.html")
+ end
+
+ # Step 2: run the examples
+ examples = Dir['*.rb'].sort
+ examples -= DONT_RUN
+ es = ExampleSet.new(examples.length)
+ begin
+ examples.each { |example| es.update(example) }
+ ensure
+ es.persist
+ end
- # Step 2: run the examples
- examples = Dir['*.rb'].sort
- examples -= DONT_RUN
- es = ExampleSet.new(examples.length)
- begin
- examples.each { |example| es.update(example) }
ensure
- es.persist
+ Dir.chdir(cwd)
end
-ensure
- Dir.chdir(cwd)
+else
+
+ puts "post-setup.rb: --disable-htmldoc specified. No documentation will be set up."
+
end
+exit
Please sign in to comment.
Something went wrong with that request. Please try again.