Debian Codegraph @

ext/re2/recipes.rb

raw symbols SCIP
1 # frozen_string_literal: true
2
3 # re2 (https://github.com/mudge/re2)
4 # Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
5 # backtracking regular expression engines like those used in PCRE, Perl, and
6 # Python".
7 #
8 # Copyright (c) 2010, Paul Mucur (https://mudge.name)
9 # Released under the BSD Licence, please see LICENSE.txt
10
11 PACKAGE_ROOT_DIR = File.expand_path('../..', __dir__)
12 REQUIRED_MINI_PORTILE_VERSION = '~> 2.8.9' # keep this version in sync with the one in the gemspec
13
14 def load_recipes
15 require 'yaml'
16 dependencies = YAML.load_file(File.join(PACKAGE_ROOT_DIR, 'dependencies.yml'))
17
18 abseil_recipe = build_recipe('abseil', dependencies['abseil']['version']) do |recipe|
19 recipe.files = [{
20 url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/#{recipe.version}.tar.gz",
21 sha256: dependencies['abseil']['sha256']
22 }]
23 end
24
25 re2_recipe = build_recipe('libre2', dependencies['libre2']['version']) do |recipe|
26 recipe.files = [{
27 url: "https://github.com/google/re2/releases/download/#{recipe.version}/re2-#{recipe.version}.tar.gz",
28 sha256: dependencies['libre2']['sha256']
29 }]
30 end
31
32 [abseil_recipe, re2_recipe]
33 end
34
35 def build_recipe(name, version)
36 require 'rubygems'
37 gem('mini_portile2', REQUIRED_MINI_PORTILE_VERSION) # gemspec is not respected at install time
38 require 'mini_portile2'
39
40 MiniPortileCMake.new(name, version).tap do |recipe|
41 recipe.target = File.join(PACKAGE_ROOT_DIR, 'ports')
42 recipe.configure_options += [
43 # abseil needs a C++17 compiler
44 '-DCMAKE_CXX_STANDARD=17',
45 # needed for building the C extension shared library with -fPIC
46 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
47 # ensures pkg-config and installed libraries will be in lib, not lib64
48 '-DCMAKE_INSTALL_LIBDIR=lib',
49 '-DCMAKE_CXX_VISIBILITY_PRESET=hidden'
50 ]
51
52 yield recipe
53 end
54 end