lib/autobuild/packages/genom.rb in autobuild-0.6.2 vs lib/autobuild/packages/genom.rb in autobuild-0.6.3

- old
+ new

@@ -15,17 +15,20 @@ super use :autogen => 'autogen' end + def import + super + get_provides + end + # Called before running the rake tasks and # after all imports have been made def prepare - super - get_requires - get_provides + get_requires end # The file touched by genom on successful generation def genomstamp; File.join(srcdir, '.genom', 'genom-stamp') end @@ -95,10 +98,23 @@ end def regen cmdline = [ 'genom', "#{name}.gen", *genomflags ] + # Check that the module has been generated with the same flags + genom_mk = "#{srcdir}/autoconf/genom.mk" + if File.exists?(genom_mk) + contents = File.open(genom_mk).readlines + old_file = contents.find { |l| l =~ /^GENFILE/ }.gsub('GENFILE=', '').strip + old_flags = Shellwords.shellwords( + contents.find { |l| l =~ /^GENFLAGS/ }.gsub('GENFLAGS=', '')) + + if old_file != "#{name}.gen" || !(old_flags - genomflags).empty? || !(genomflags - old_flags).empty? + File.rm_f genomstamp + end + end + file buildstamp => genomstamp file genomstamp => genom_dependencies file genomstamp => srcdir do Dir.chdir(srcdir) do Subprocess.run(name, 'genom', *cmdline) @@ -110,9 +126,11 @@ # configure does not depend on the .gen file # since the generation takes care of rebuilding configure # if .gen has changed Dir.chdir(srcdir) { Subprocess.run(name, 'genom', File.expand_path('autogen')) } end + + super("#{srcdir}/autoconf/configure.ac") end end end