Kouhei Sutou
null+****@clear*****
Sat May 24 16:17:53 JST 2014
Kouhei Sutou 2014-05-24 16:17:53 +0900 (Sat, 24 May 2014) New Revision: e78c363d7d9adc8e00063e592772e0c73b05cade https://github.com/groonga/heroku-buildpack-groonga/commit/e78c363d7d9adc8e00063e592772e0c73b05cade Message: Use built Groonga on GitHub Modified files: bin/compile Modified: bin/compile (+37 -12) =================================================================== --- bin/compile 2014-05-19 23:51:42 +0900 (f307a13) +++ bin/compile 2014-05-24 16:17:53 +0900 (03b4fda) @@ -1,37 +1,62 @@ #!/usr/bin/env ruby # bin/compile <build-dir> <cache-dir> +require "rbconfig" require "fileutils" +include FileUtils + build_dir, cache_dir, env_dir, = ARGV version = "4.0.1" database_path = "groonga/database" +def sh(*command_line) + puts(command_line.join(" ")) + system(*command_line) or exit(false) +end + +def ruby(*command_line) + command_line.unshift(RbConfig.ruby) + sh(*command_line) +end + Dir.chdir(build_dir) do puts("-----> Installing Groonga #{version}") + base_url = "https://github.com/groonga/groonga/releases/download/v#{version}" base_name = "heroku-groonga-#{version}.tar.xz" - system("curl", - "--silent", - "--remote-name", - "http://groonga-builder.herokuapp.com/#{base_name}") - system("tar", "xf", base_name) - FileUtils.rm(base_name) - - puts("-----> Creating groonga database") + sh("curl", + "--silent", + "--remote-name", + "--location", + "#{base_url}/#{base_name}") + sh("tar", "xf", base_name) + rm(base_name) + + groonga_dir = "vendor/groonga" + rm(Dir.glob("#{groonga_dir}/lib/**/*.a")) + rm_r("#{groonga_dir}/share/groonga/examples") + rm_r("#{groonga_dir}/share/groonga/images") + + puts("-----> Creating Groonga database") ENV["PATH"] = [ - "#{build_dir}/vendor/groonga/bin", + "#{build_dir}/#{groonga_dir}/bin", ENV["PATH"], ].join(File::PATH_SEPARATOR) ENV["LD_LIBRARY_PATH"] = [ - "#{build_dir}/vendor/groonga/lib", + "#{build_dir}/#{groonga_dir}/lib", ENV["LD_LIBRARY_PATH"], ].join(File::PATH_SEPARATOR) - system("groonga", "-n", database_path, "quit") + sh("groonga", "-n", database_path, "quit") puts("-----> Loading data") + load_rb = "groonga/load.rb" + if File.executable?(load_rb) + ruby(load_rb, database_path) + end Dir.glob("groonga/*.grn").sort.each do |grn| - system("groonga", "--file", grn, database_path) + sh("groonga", "--file", grn, database_path) + rm(grn) end end -------------- next part -------------- HTML����������������������������... ダウンロード