diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-03 18:20:35 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-03 18:20:35 +0900 |
commit | 8a264b5bfc63b9e996d026f0393361842598568a (patch) | |
tree | 718131d239619b20a0a7d584a8f764c1eeae3e23 | |
parent | 4df013ca9a908ed3868545b351ab4dc372339d3a (diff) | |
download | poe-8a264b5bfc63b9e996d026f0393361842598568a.tar.gz |
rakefile: remove namespace
-rw-r--r-- | Rakefile | 153 |
1 files changed, 75 insertions, 78 deletions
@@ -69,91 +69,88 @@ RUBY_PATCHES = { ] } -namespace :compiler do - RUBY_MIRROR = "https://cache.ruby-lang.org/pub/ruby" - desc "Install a ruby" - task :ruby, [:version] do |t, args| - version = args[:version] - id = "ruby-#{version}" - if version =~ /^(1\.1[a-d]|1\.[02-9]|2\..)/ - archive_dir = "ruby-#{version}" - url = "#{RUBY_MIRROR}/#{$1}/ruby-#{version}.tar.gz" - elsif version =~ /^0\./ - archive_dir = "ruby-#{version}" - url = "#{RUBY_MIRROR}/1.0/ruby-#{version}.tar.gz" - elsif version =~ /snapshot/ - archive_dir = version - url = "#{RUBY_MIRROR}/#{version}.tar.gz" - else - raise ArgumentError, "unknown ruby" - end - - destdir = $datadir + "/env/ruby/#{id}" - raise ArgumentError, "already installed?" if Dir.exist?(destdir.to_s) - prefix = "/usr" - - Dir.mktmpdir { |tmpdir| - FileUtils.chdir(tmpdir) { - download(url, "archive.tar.gz") - system("tar xf archive.tar.gz") or raise("failed to extract") - FileUtils.chdir(archive_dir) { - RUBY_PATCHES[:ruby].each { |regexp, *patch_names| - next if regexp !~ version - patch_names.each { |name| - puts "applying patch #{name}..." - patch_file = File.expand_path("../patches/ruby/#{name}.patch", __FILE__) - retriable { - system("patch --dry-run -R -N -p1 <#{patch_file}") or - system("patch -N -p1 <#{patch_file}") or - raise("patch failed: #{name}") - } +RUBY_MIRROR = "https://cache.ruby-lang.org/pub/ruby" +desc "Install a ruby" +task :ruby, [:version] do |t, args| + version = args[:version] + id = "ruby-#{version}" + if version =~ /^(1\.1[a-d]|1\.[02-9]|2\..)/ + archive_dir = id + url = "#{RUBY_MIRROR}/#{$1}/#{id}.tar.gz" + elsif version =~ /^0\./ + archive_dir = id + url = "#{RUBY_MIRROR}/1.0/#{id}.tar.gz" + elsif version =~ /snapshot/ + archive_dir = version + url = "#{RUBY_MIRROR}/#{version}.tar.gz" + else + raise ArgumentError, "unknown ruby" + end + + destdir = $datadir + "/env/ruby/#{id}" + raise ArgumentError, "already installed?" if Dir.exist?(destdir.to_s) + prefix = "/usr" + + Dir.mktmpdir { |tmpdir| + FileUtils.chdir(tmpdir) { + download(url, "archive.tar.gz") + system("tar xf archive.tar.gz") or raise("failed to extract") + FileUtils.chdir(archive_dir) { + RUBY_PATCHES[:ruby].each { |regexp, *patch_names| + next if regexp !~ version + patch_names.each { |name| + puts "applying patch #{name}..." + patch_file = File.expand_path("../patches/ruby/#{name}.patch", __FILE__) + retriable { + system("patch --dry-run -R -N -p1 <#{patch_file}") or + system("patch -N -p1 <#{patch_file}") or + raise("patch failed: #{name}") } } - retriable { - system("./configure --prefix=#{prefix} --enable-shared --disable-install-doc --without-tk --without-tcllib --without-tklib") or raise("failed to configure") - system("make -j6") or raise("failed to make") - system("make install DESTDIR=#{destdir}") or raise("failed to install") - } - - add_compiler("ruby", id, { - version: `LD_LIBRARY_PATH=#{destdir}#{prefix}/lib #{destdir}#{prefix}/bin/ruby -v`, - version_command: "#{prefix}/bin/ruby -v", - commandline: ["#{prefix}/bin/ruby", "{}"] - }) } + retriable { + system("./configure --prefix=#{prefix} --enable-shared --disable-install-doc --without-tk --without-tcllib --without-tklib") or raise("failed to configure") + system("make -j6") or raise("failed to make") + system("make install DESTDIR=#{destdir}") or raise("failed to install") + } + + add_compiler("ruby", id, { + version: `LD_LIBRARY_PATH=#{destdir}#{prefix}/lib #{destdir}#{prefix}/bin/ruby -v`, + version_command: "#{prefix}/bin/ruby -v", + commandline: ["#{prefix}/bin/ruby", "{}"] + }) } } - end - - PHP_MIRROR = "http://jp2.php.net/distributions" - desc "Install a php" - task :php, [:version] do |t, args| - version = args[:version] - id = "php-#{version}" - url = "#{PHP_MIRROR}/#{id}.tar.gz" - - destdir = $datadir + "/env/php/#{id}" - raise ArgumentError, "already installed?" if Dir.exist?(destdir.to_s) - prefix = "/usr" - - Dir.mktmpdir { |tmpdir| - FileUtils.chdir(tmpdir) { - download(url, "archive.tar.gz") - system("tar xf archive.tar.gz") or raise("failed to extract") - FileUtils.chdir(id) { - retriable { - system("./configure --prefix=#{prefix} --enable-shared") or raise("failed to configure") - system("make -j6") or raise("failed to make") - system("make install INSTALL_ROOT=#{destdir}") or raise("failed to install") - } + } +end - add_compiler("php", id, { - version: `LD_LIBRARY_PATH=#{destdir}#{prefix}/lib #{destdir}#{prefix}/bin/php -v`, - version_command: "#{prefix}/bin/php -v", - commandline: ["#{prefix}/bin/php", "{}"] - }) +desc "Install a php" +task :php, [:version] do |t, args| + version = args[:version] + id = "php-#{version}" + url = "http://museum.php.net/php#{version[0]}/#{id}.tar.gz" + + destdir = $datadir + "/env/php/#{id}" + raise ArgumentError, "already installed?" if Dir.exist?(destdir.to_s) + prefix = "/usr" + + Dir.mktmpdir { |tmpdir| + FileUtils.chdir(tmpdir) { + download(url, "archive.tar.gz") + system("tar xf archive.tar.gz") or raise("failed to extract") + FileUtils.chdir(id) { + retriable { + system("./configure --prefix=#{prefix} --enable-shared") or raise("failed to configure") + system("make -j6") or raise("failed to make") + system("make install INSTALL_ROOT=#{destdir}") or raise("failed to install") } + + add_compiler("php", id, { + version: `LD_LIBRARY_PATH=#{destdir}#{prefix}/lib #{destdir}#{prefix}/bin/php -v`, + version_command: "#{prefix}/bin/php -v", + commandline: ["#{prefix}/bin/php", "{}"] + }) } } - end + } end |