Module: MilkTea::VendoredPCRE2
- Defined in:
- lib/milk_tea/bindings/vendored_pcre2.rb
Constant Summary collapse
- Error =
VendoredCLibrary::Error
- SOURCE_NAME =
"pcre2"- CONFIGURE_ARGS =
%w[ -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DPCRE2_BUILD_PCRE2_8=ON -DPCRE2_BUILD_PCRE2_16=OFF -DPCRE2_BUILD_PCRE2_32=OFF -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_PCRE2TEST=OFF -DPCRE2_BUILD_TESTS=OFF ].freeze
- SYSTEM_LINK_FLAGS =
%w[ -lm ].freeze
Class Method Summary collapse
- .archive_path(root: MilkTea.root) ⇒ Object
- .build_root(root: MilkTea.root) ⇒ Object
- .header_path(root: MilkTea.root) ⇒ Object
- .include_flags(root: MilkTea.root) ⇒ Object
- .include_root(root: MilkTea.root) ⇒ Object
- .install_root(root: MilkTea.root) ⇒ Object
- .library(root: MilkTea.root) ⇒ Object
- .link_flags(root: MilkTea.root) ⇒ Object
- .prepare!(root: MilkTea.root, **kwargs) ⇒ Object
- .source(root: MilkTea.root) ⇒ Object
- .source_root(root: MilkTea.root) ⇒ Object
Class Method Details
.archive_path(root: MilkTea.root) ⇒ Object
67 68 69 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 67 def archive_path(root: MilkTea.root) install_root(root:).join("lib/libpcre2-8.a") end |
.build_root(root: MilkTea.root) ⇒ Object
59 60 61 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 59 def build_root(root: MilkTea.root) MilkTea.writable_root_for(root).join("tmp/vendored-pcre2") end |
.header_path(root: MilkTea.root) ⇒ Object
55 56 57 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 55 def header_path(root: MilkTea.root) include_root(root:).join("pcre2.h") end |
.include_flags(root: MilkTea.root) ⇒ Object
71 72 73 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 71 def include_flags(root: MilkTea.root) library(root:).include_flags end |
.include_root(root: MilkTea.root) ⇒ Object
51 52 53 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 51 def include_root(root: MilkTea.root) install_root(root:).join("include") end |
.install_root(root: MilkTea.root) ⇒ Object
63 64 65 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 63 def install_root(root: MilkTea.root) MilkTea.writable_root_for(root).join("tmp/vendored-pcre2-prefix") end |
.library(root: MilkTea.root) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 31 def library(root: MilkTea.root) resolved_root = Pathname.new(File.(root.to_s)) @libraries ||= {} @libraries[resolved_root.to_s] ||= VendoredCLibrary::CMake.new( name: "pcre2", source_root: source_root(root: resolved_root), build_root: build_root(root: resolved_root), install_root: install_root(root: resolved_root), archive_path: archive_path(root: resolved_root), include_roots: [include_root(root: resolved_root)], configure_args: CONFIGURE_ARGS, system_link_flags: SYSTEM_LINK_FLAGS, cc_env_var: "PCRE2_CC", ) end |
.link_flags(root: MilkTea.root) ⇒ Object
75 76 77 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 75 def link_flags(root: MilkTea.root) library(root:).link_flags end |
.prepare!(root: MilkTea.root, **kwargs) ⇒ Object
79 80 81 82 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 79 def prepare!(root: MilkTea.root, **kwargs) source(root:).bootstrap! library(root:).prepare!(**kwargs) end |
.source(root: MilkTea.root) ⇒ Object
26 27 28 29 |
# File 'lib/milk_tea/bindings/vendored_pcre2.rb', line 26 def source(root: MilkTea.root) UpstreamSources.default_sources(root:).find { |entry| entry.name == SOURCE_NAME } || raise(Error, "missing upstream source definition for #{SOURCE_NAME}") end |