[DRE-commits] [ruby-gherkin] 08/16: use debian/Rakefile to regenerate upstream C and Ruby files from ragel

Cédric Boutillier boutil at alioth.debian.org
Tue Aug 13 13:16:49 UTC 2013


This is an automated email from the git hooks/post-receive script.

boutil pushed a commit to branch master
in repository ruby-gherkin.

commit 18630635282089209ac6fb866178cbd0dfda3eae
Author: Cédric Boutillier <boutil at debian.org>
Date:   Mon Aug 12 18:49:04 2013 +0200

    use debian/Rakefile to regenerate upstream C and Ruby files from ragel
---
 debian/Rakefile |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/rules    |    8 ++++++++
 2 files changed, 61 insertions(+)

diff --git a/debian/Rakefile b/debian/Rakefile
new file mode 100644
index 0000000..1615207
--- /dev/null
+++ b/debian/Rakefile
@@ -0,0 +1,53 @@
+# Rakefile inspired by tasks/compile.rake
+# modified to jsut generate .rb and .c from ragel
+# and skip compilation of the .c files
+# Last-modified: 2013-08-12
+
+require 'rake/clean'
+require File.expand_path(File.dirname(__FILE__) + '/../tasks/ragel_task')
+BYPASS_NATIVE_IMPL = true
+require 'gherkin/i18n'
+
+CLEAN.include [
+  'pkg', 'tmp',
+  '**/*.{o,bundle,jar,so,obj,pdb,lib,def,exp,log,rbc}', 'ext',
+  'java/target',
+  'lib/*.dll',
+  'ext/**/*.c',
+  'doc'
+]
+
+langs = Gherkin::I18n.all
+
+desc "generate files"
+task :generate
+
+langs.each do |i18n|
+  rb = RagelTask.new('rb', i18n)
+  c = RagelTask.new('c', i18n)
+
+  lexer_dir = "ext/gherkin_lexer_#{i18n.underscored_iso_code}"
+  extconf = lexer_dir + "/extconf.rb"
+
+  directory lexer_dir
+
+  file extconf => lexer_dir do
+    FileUtils.mkdir(File.dirname(extconf)) unless File.directory?(File.dirname(extconf))
+    File.open(extconf, "w") do |io|
+      io.write(<<-EOF)
+require 'mkmf'
+CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags']
+$CFLAGS << ' -O0' if CONFIG['CC'] =~ /gcc|clang/
+dir_config("gherkin_lexer_#{i18n.underscored_iso_code}")
+have_library("c", "main")
+create_makefile("gherkin_lexer_#{i18n.underscored_iso_code}")
+EOF
+    end
+  end
+    
+    desc "generate files for #{i18n.underscored_iso_code}"
+    task :"gherkin_lexer_#{i18n.underscored_iso_code}" => [extconf, rb.target, c.target]
+    
+    task :generate => [:"gherkin_lexer_#{i18n.underscored_iso_code}"]
+end
+
diff --git a/debian/rules b/debian/rules
index e195ce2..2842089 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,3 +5,11 @@
 
 override_dh_installchangelogs:
 	dh_installchangelogs History.md
+
+override_dh_auto_install:
+	rake -I lib/ -f debian/Rakefile generate
+	dh_auto_install -O--buildsystem=ruby
+
+override_dh_clean:
+	rake -I lib/ -f debian/Rakefile clean
+	dh_clean

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-gherkin.git



More information about the Pkg-ruby-extras-commits mailing list