pico_phone 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9666e8d2353fc78b1515c738358a13cff067bb282726cba801ba264cd9814261
4
- data.tar.gz: 34b97cb283f62a0ac4db956812bb5dc5c25051a9eaa6618aafb9980e12876daf
3
+ metadata.gz: 2e959460535cd80db8b9cd34c134deda2f23934023b26fe6cc3c77d74fadc3f0
4
+ data.tar.gz: '08fe97a453f6a589d663954964b294fc69be0040850414a187540d1f9cf906ee'
5
5
  SHA512:
6
- metadata.gz: 0c0cdcd99d53e45392cb9e3440f000a95103b55233dd73ccdc3097f6011ed3b057cfcc0e51aa9ffaaf33a4f661189844cc2d83eae2de57c6600d124f789b6647
7
- data.tar.gz: 3075b1f9eafbdf6e2facc2ac5d869a6f8b00b6058ff1995624280b773a214627e8d759959c4ce61583ad2ccaecf80922858158220bbdef46c70b1c4a7b4da78b
6
+ metadata.gz: 37d8f0bbc5d92eb1009cecdcbeda9fde2f93a80337fdd727a7a51f2961a6a990d25b9d9c89c1802ac53e090eda8cd4a2a4874d8eea22adbb864cdb89fb4b1a59
7
+ data.tar.gz: 53ecabd98cb90a17f8b41d8a5a442644271a924a1174812fea27ea87dd919e07d92c7b260fe1c9368981fec82c5b2a73fa9e763a7e1fe7d71fd9808fa6c6dc99
@@ -2,29 +2,65 @@ require "mkmf-rice"
2
2
 
3
3
  $CXXFLAGS << ' -std=c++17'
4
4
 
5
- # On macOS, libphonenumber's headers pull in protobuf and abseil transitively.
6
- # Each is its own Homebrew formula with its own opt prefix, so we add all three.
7
- # On Linux with libphonenumber-dev, all headers land in /usr/include and no
8
- # extra paths are needed.
9
- if RUBY_PLATFORM.include?('darwin')
10
- %w[libphonenumber protobuf abseil].each do |pkg|
11
- prefix = `brew --prefix #{pkg} 2>/dev/null`.strip
12
- next if prefix.empty?
13
- $INCFLAGS << " -I#{prefix}/include"
14
- $LDFLAGS << " -L#{prefix}/lib"
5
+ VENDOR_INSTALL = File.expand_path("vendor/install", __dir__)
6
+ NATIVE_BUILD = ENV["PICO_PHONE_NATIVE_BUILD"] == "1"
7
+
8
+ if NATIVE_BUILD
9
+ # Static linking against vendored libraries for native gem builds.
10
+ # All five dependencies are baked into the .so users need nothing installed.
11
+ $INCFLAGS << " -I#{VENDOR_INSTALL}/include"
12
+
13
+ static_libs = []
14
+ static_libs << "#{VENDOR_INSTALL}/lib/libphonenumber.a"
15
+ static_libs << "#{VENDOR_INSTALL}/lib/libprotobuf.a"
16
+ static_libs += Dir["#{VENDOR_INSTALL}/lib/libabsl_*.a"].sort
17
+
18
+ if RUBY_PLATFORM.include?("darwin")
19
+ boost_prefix = `brew --prefix boost 2>/dev/null`.strip
20
+ icu_prefix = `brew --prefix icu4c@78 2>/dev/null`.strip
21
+
22
+ %w[libboost_date_time libboost_thread libboost_atomic].each do |lib|
23
+ static_libs << "#{boost_prefix}/lib/#{lib}.a"
24
+ end
25
+
26
+ %w[libicui18n libicuuc libicudata].each do |lib|
27
+ static_libs << "#{icu_prefix}/lib/#{lib}.a"
28
+ end
29
+ else
30
+ # Linux: libphonenumber was built with USE_BOOST=OFF so no Boost needed.
31
+ # Ubuntu's libicu-dev static archives are not compiled with -fPIC and cannot
32
+ # be linked into a shared object. Link ICU dynamically instead — libicu74 is
33
+ # part of the Ubuntu 24.04 base system and is present in the target environment.
34
+ $LOCAL_LIBS << " -licui18n -licuuc -licudata -lpthread -ldl"
15
35
  end
16
- end
17
36
 
18
- $LOCAL_LIBS << ' -lphonenumber'
37
+ $LOCAL_LIBS << " " + static_libs.join(" ")
19
38
 
20
- unless find_header('phonenumbers/phonenumberutil.h')
21
- abort <<~MSG
39
+ unless find_header("phonenumbers/phonenumberutil.h")
40
+ abort "Could not find phonenumberutil.h in #{VENDOR_INSTALL}/include — run build_deps.sh first"
41
+ end
42
+ else
43
+ # Dynamic linking against system/Homebrew libraries (default developer workflow).
44
+ if RUBY_PLATFORM.include?("darwin")
45
+ %w[libphonenumber protobuf abseil].each do |pkg|
46
+ prefix = `brew --prefix #{pkg} 2>/dev/null`.strip
47
+ next if prefix.empty?
48
+ $INCFLAGS << " -I#{prefix}/include"
49
+ $LDFLAGS << " -L#{prefix}/lib"
50
+ end
51
+ end
52
+
53
+ $LOCAL_LIBS << " -lphonenumber"
22
54
 
23
- Could not find libphonenumber. Please install it before installing this gem:
24
- macOS: brew install libphonenumber
25
- Ubuntu: sudo apt-get install libphonenumber-dev
26
- Fedora: sudo dnf install libphonenumber-devel
27
- MSG
55
+ unless find_header("phonenumbers/phonenumberutil.h")
56
+ abort <<~MSG
57
+
58
+ Could not find libphonenumber. Please install it before installing this gem:
59
+ macOS: brew install libphonenumber
60
+ Ubuntu: sudo apt-get install libphonenumber-dev
61
+ Fedora: sudo dnf install libphonenumber-devel
62
+ MSG
63
+ end
28
64
  end
29
65
 
30
66
  create_makefile("pico_phone/pico_phone")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PicoPhone
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pico_phone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabi Jack
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
11
  date: 2026-07-03 00:00:00.000000000 Z
@@ -87,6 +88,7 @@ licenses:
87
88
  metadata:
88
89
  homepage_uri: https://github.com/gjack/pico_phone
89
90
  source_code_uri: https://github.com/gjack/pico_phone
91
+ post_install_message:
90
92
  rdoc_options: []
91
93
  require_paths:
92
94
  - lib
@@ -101,7 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
103
  - !ruby/object:Gem::Version
102
104
  version: '0'
103
105
  requirements: []
104
- rubygems_version: 3.6.2
106
+ rubygems_version: 3.5.22
107
+ signing_key:
105
108
  specification_version: 4
106
109
  summary: A thin Ruby wrapper around Google's libphonenumber for parsing, validating,
107
110
  and formatting phone numbers