Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move recipe definitions in dependencies.yml #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
libgpg-error:
version: '1.47'
sha256: 9e3c670966b96ecc746c28c2c419541e3bcb787d1a73930f5e5f5e1bcbbb9bdb
libassuan:
version: '2.5.6'
sha256: e9fd27218d5394904e4e39788f9b1742711c3e6b41689a31aa3380bd5aa4f426
95 changes: 52 additions & 43 deletions ext/gpgme/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'mkmf'
require 'yaml'

# Available options:
#
Expand All @@ -9,6 +10,56 @@

ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))

def load_recipes
require 'rubygems'
require 'mini_portile2'

dependencies = YAML.load_file(File.join(ROOT, 'dependencies.yml'))

libgpg_error_recipe = MiniPortile.new('libgpg-error', dependencies['libgpg-error']['version']).tap do |recipe|
recipe.target = File.join(ROOT, "ports")
recipe.files = [{
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
:sha256 => dependencies['libgpg-error']['sha256']
}]
recipe.configure_options = [
'--enable-install-gpg-error-config',
'--disable-shared',
'--enable-static',
'--disable-nls',
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
]
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
unless File.exist?(checkpoint)
recipe.cook
FileUtils.touch checkpoint
end
recipe.activate
end

libassuan_recipe = MiniPortile.new('libassuan', dependencies['libassuan']['version']).tap do |recipe|
recipe.target = File.join(ROOT, "ports")
recipe.files = [{
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
:sha256 => dependencies['libassuan']['sha256']
}]
recipe.configure_options = [
'--disable-shared',
'--enable-static',
"--with-gpg-error-prefix=#{libgpg_error_recipe.path}",
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
]
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
unless File.exist?(checkpoint)
recipe.cook
FileUtils.touch checkpoint
end
recipe.activate
end

[libgpg_error_recipe, libassuan_recipe]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to return a hash so the order of elements doesn't matter?

end

if arg_config('--clean')
require 'pathname'
require 'fileutils'
Expand Down Expand Up @@ -62,49 +113,7 @@
************************************************************************
EOS

require 'rubygems'
require 'mini_portile2'

libgpg_error_recipe = MiniPortile.new('libgpg-error', '1.47').tap do |recipe|
recipe.target = File.join(ROOT, "ports")
recipe.files = [{
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
:sha256 => '9e3c670966b96ecc746c28c2c419541e3bcb787d1a73930f5e5f5e1bcbbb9bdb'
}]
recipe.configure_options = [
'--enable-install-gpg-error-config',
'--disable-shared',
'--enable-static',
'--disable-nls',
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
]
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
unless File.exist?(checkpoint)
recipe.cook
FileUtils.touch checkpoint
end
recipe.activate
end

libassuan_recipe = MiniPortile.new('libassuan', '2.5.6').tap do |recipe|
recipe.target = File.join(ROOT, "ports")
recipe.files = [{
:url => "https://www.gnupg.org/ftp/gcrypt/#{recipe.name}/#{recipe.name}-#{recipe.version}.tar.bz2",
:sha256 => 'e9fd27218d5394904e4e39788f9b1742711c3e6b41689a31aa3380bd5aa4f426'
}]
recipe.configure_options = [
'--disable-shared',
'--enable-static',
"--with-gpg-error-prefix=#{libgpg_error_recipe.path}",
"CFLAGS=-fPIC #{ENV["CFLAGS"]}",
]
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
unless File.exist?(checkpoint)
recipe.cook
FileUtils.touch checkpoint
end
recipe.activate
end
libgpg_error_recipe, libassuan_recipe = load_recipes

pkg_config_paths = [
File.join(libgpg_error_recipe.lib_path, 'pkgconfig'),
Expand Down
3 changes: 2 additions & 1 deletion gpgme.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Gem::Specification.new do |s|
s.date = '2024-01-31'
s.email = 'ueno@gnu.org'
s.extensions = ['ext/gpgme/extconf.rb']
s.files = Dir['{lib,ext,test,examples}/**/*'] +
s.files = ['dependencies.yml'] +
Dir['{lib,ext,test,examples}/**/*'] +
Dir['ports/archives/*']
s.rubyforge_project = 'ruby-gpgme'
s.homepage = 'http://github.com/ueno/ruby-gpgme'
Expand Down
Loading