vibe_zstd 1.0.0 → 1.0.1
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +14 -8
- data/benchmark/README.md +12 -13
- data/benchmark/for_readme.rb +23 -19
- data/benchmark/multithreading.rb +9 -10
- data/ext/vibe_zstd/extconf.rb +2 -2
- data/lib/vibe_zstd/version.rb +1 -1
- metadata +2 -3
- data/ext/vibe_zstd/Makefile +0 -270
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 477fc83f7449b75b1203fc6fed58adc6e3a2d99865dc41436b70f2c60a217e0f
|
|
4
|
+
data.tar.gz: '0392722a997331e639e81315c1bdab2ac7f86a3a01fabe9606008f3efecb34ce'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0848f31e127fb0bcd930b86795ea6ee748b20c61e8f12496270450a95a643d0dadf023ae16cd87050babd62da6a97e1ca2960354cb22e31f221722907aa8611f'
|
|
7
|
+
data.tar.gz: 7419556dbf9f5a280c2d812d70e340972052d63e899c02cf75a773b7552274b701ee25c8c945770a0316d2929cceb3f1a082f4e3c7dd94b3fe4d80deb17101c2
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.1] - 2025-10-24
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Include assembly files in build to fix compilation on x86_64 Linux platforms
|
|
14
|
+
|
|
10
15
|
## [1.0.0] - 2025-10-22
|
|
11
16
|
|
|
12
17
|
### Added
|
data/README.md
CHANGED
|
@@ -384,7 +384,7 @@ reader.eof? # => true/false
|
|
|
384
384
|
|
|
385
385
|
### Multi-threaded Compression
|
|
386
386
|
|
|
387
|
-
Enable parallel compression for large
|
|
387
|
+
Enable parallel compression for large files:
|
|
388
388
|
|
|
389
389
|
```ruby
|
|
390
390
|
cctx = VibeZstd::CCtx.new
|
|
@@ -399,15 +399,21 @@ large_data = File.read('big_file.txt')
|
|
|
399
399
|
compressed = cctx.compress(large_data)
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
-
**
|
|
402
|
+
**When to use multi-threading:**
|
|
403
403
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
404
|
+
Multi-threading can improve compression speed for large files, but benefits vary significantly based on:
|
|
405
|
+
- File size (generally only beneficial for larger files)
|
|
406
|
+
- Data compressibility (less compressible data sees better improvements)
|
|
407
|
+
- Compression level (higher levels may benefit more)
|
|
408
|
+
- Available CPU cores and system load
|
|
409
409
|
|
|
410
|
-
**
|
|
410
|
+
**Recommendations:**
|
|
411
|
+
- Start with 2-4 worker threads for large files
|
|
412
|
+
- Files smaller than a few MB typically won't benefit
|
|
413
|
+
- Always benchmark with your specific data and use case
|
|
414
|
+
- Consider that more threads increase memory usage
|
|
415
|
+
|
|
416
|
+
See the [official zstd documentation](https://facebook.github.io/zstd/zstd_manual.html) for detailed performance characteristics.
|
|
411
417
|
|
|
412
418
|
#### Multi-threading Tuning
|
|
413
419
|
|
data/benchmark/README.md
CHANGED
|
@@ -125,22 +125,21 @@ ruby benchmark/dictionary_training.rb
|
|
|
125
125
|
**What it tests:** Performance impact of using multiple worker threads for compression.
|
|
126
126
|
|
|
127
127
|
**Key findings:**
|
|
128
|
-
- Multi-threading
|
|
129
|
-
-
|
|
130
|
-
-
|
|
128
|
+
- Multi-threading benefits vary significantly based on file size, data characteristics, and compression settings
|
|
129
|
+
- Smaller files (< few MB) typically don't benefit due to overhead
|
|
130
|
+
- Performance improvements depend heavily on data compressibility
|
|
131
131
|
- More workers = higher memory usage
|
|
132
|
-
|
|
133
|
-
**Typical speedups:**
|
|
134
|
-
- 2 workers: 1.5-1.8x faster
|
|
135
|
-
- 4 workers: 2.0-2.5x faster
|
|
136
|
-
- 8 workers: 2.2-3.0x faster
|
|
132
|
+
- Optimal thread count is typically 2-4 workers
|
|
137
133
|
|
|
138
134
|
**When to use:**
|
|
139
|
-
- ✓ Large files
|
|
140
|
-
- ✓
|
|
141
|
-
- ✓
|
|
142
|
-
- ✗ Small
|
|
143
|
-
- ✗
|
|
135
|
+
- ✓ Large files where compression is a bottleneck
|
|
136
|
+
- ✓ When you've benchmarked your specific use case and confirmed benefits
|
|
137
|
+
- ✓ Higher compression levels (where compression work is more substantial)
|
|
138
|
+
- ✗ Small files (generally < few MB)
|
|
139
|
+
- ✗ Without benchmarking your specific workload
|
|
140
|
+
- ✗ When memory usage is a concern
|
|
141
|
+
|
|
142
|
+
**Recommendation:** Always benchmark with your actual data. Multi-threading overhead can outweigh benefits for many workloads. See the [official zstd documentation](https://facebook.github.io/zstd/zstd_manual.html) for detailed guidance.
|
|
144
143
|
|
|
145
144
|
### 6. Dictionary Training (`dictionary_training.rb`)
|
|
146
145
|
|
data/benchmark/for_readme.rb
CHANGED
|
@@ -14,9 +14,9 @@ puts "Reusing compression/decompression contexts vs creating new ones (5000 iter
|
|
|
14
14
|
|
|
15
15
|
# Test with different data sizes
|
|
16
16
|
test_cases = {
|
|
17
|
-
"1KB" => DataGenerator.json_data(count: 5),
|
|
18
|
-
"10KB" => DataGenerator.json_data(count: 50),
|
|
19
|
-
"100KB" => DataGenerator.json_data(count: 500)
|
|
17
|
+
"1KB" => BenchmarkHelpers::DataGenerator.json_data(count: 5),
|
|
18
|
+
"10KB" => BenchmarkHelpers::DataGenerator.json_data(count: 50),
|
|
19
|
+
"100KB" => BenchmarkHelpers::DataGenerator.json_data(count: 500)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
puts "| Data Size | New Context | Reused Context | Speedup |"
|
|
@@ -47,14 +47,14 @@ test_cases.each do |size_label, test_data|
|
|
|
47
47
|
reused_ops = iterations / reused_time.real
|
|
48
48
|
speedup = reused_ops / new_ops
|
|
49
49
|
|
|
50
|
-
puts "| #{size_label} | #{Formatter.format_number(new_ops.to_i)} ops/s | #{Formatter.format_number(reused_ops.to_i)} ops/s | #{speedup.round(2)}x |"
|
|
50
|
+
puts "| #{size_label} | #{BenchmarkHelpers::Formatter.format_number(new_ops.to_i)} ops/s | #{BenchmarkHelpers::Formatter.format_number(reused_ops.to_i)} ops/s | #{speedup.round(2)}x |"
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
cctx_mem = Memory.estimate_cctx(3)
|
|
54
|
-
dctx_mem = Memory.estimate_dctx
|
|
53
|
+
cctx_mem = BenchmarkHelpers::Memory.estimate_cctx(3)
|
|
54
|
+
dctx_mem = BenchmarkHelpers::Memory.estimate_dctx
|
|
55
55
|
total_mem = cctx_mem + dctx_mem
|
|
56
56
|
|
|
57
|
-
puts "\n**Memory savings:** Reusing contexts saves #{Formatter.format_bytes(total_mem * 4999)} for 5000 operations (99.98% reduction)\n"
|
|
57
|
+
puts "\n**Memory savings:** Reusing contexts saves #{BenchmarkHelpers::Formatter.format_bytes(total_mem * 4999)} for 5000 operations (99.98% reduction)\n"
|
|
58
58
|
puts "**Recommendation:** Always reuse CCtx/DCtx instances for multiple operations.\n\n"
|
|
59
59
|
|
|
60
60
|
# 2. Dictionary Performance
|
|
@@ -90,7 +90,7 @@ puts "\nOriginal size: #{test_sample.bytesize} bytes\n\n"
|
|
|
90
90
|
puts "## Compression Levels\n\n"
|
|
91
91
|
puts "Speed vs compression ratio trade-offs:\n\n"
|
|
92
92
|
|
|
93
|
-
large_data = DataGenerator.mixed_data(size: 50_000)
|
|
93
|
+
large_data = BenchmarkHelpers::DataGenerator.mixed_data(size: 50_000)
|
|
94
94
|
levels = [-1, 1, 3, 9, 19]
|
|
95
95
|
|
|
96
96
|
puts "| Level | Ratio | Speed (ops/sec) | Memory | Use Case |"
|
|
@@ -106,7 +106,7 @@ levels.each do |level|
|
|
|
106
106
|
|
|
107
107
|
ops_per_sec = 10 / time.real
|
|
108
108
|
ratio = large_data.bytesize.to_f / compressed.bytesize
|
|
109
|
-
memory = Memory.estimate_cctx(level)
|
|
109
|
+
memory = BenchmarkHelpers::Memory.estimate_cctx(level)
|
|
110
110
|
|
|
111
111
|
use_case = case level
|
|
112
112
|
when -1 then "Ultra-fast, real-time"
|
|
@@ -116,16 +116,16 @@ levels.each do |level|
|
|
|
116
116
|
when 19 then "Maximum compression"
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
puts "| #{level} | #{ratio.round(2)}x | #{Formatter.format_number(ops_per_sec.to_i)} | #{Formatter.format_bytes(memory)} | #{use_case} |"
|
|
119
|
+
puts "| #{level} | #{ratio.round(2)}x | #{BenchmarkHelpers::Formatter.format_number(ops_per_sec.to_i)} | #{BenchmarkHelpers::Formatter.format_bytes(memory)} | #{use_case} |"
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
puts "\n"
|
|
123
123
|
|
|
124
124
|
# 4. Multi-threading
|
|
125
125
|
puts "## Multi-threading Performance\n\n"
|
|
126
|
-
puts "Compression speedup with multiple workers (
|
|
126
|
+
puts "Compression speedup with multiple workers (20MB data, level 9):\n\n"
|
|
127
127
|
|
|
128
|
-
mt_data = DataGenerator.mixed_data(size:
|
|
128
|
+
mt_data = BenchmarkHelpers::DataGenerator.mixed_data(size: 20_000_000)
|
|
129
129
|
|
|
130
130
|
puts "| Workers | Throughput | Speedup | Efficiency |"
|
|
131
131
|
puts "|---------|------------|---------|------------|"
|
|
@@ -133,25 +133,29 @@ puts "|---------|------------|---------|------------|"
|
|
|
133
133
|
baseline_throughput = nil
|
|
134
134
|
|
|
135
135
|
[0, 2, 4].each do |workers|
|
|
136
|
-
cctx = VibeZstd::CCtx.new
|
|
137
|
-
cctx.
|
|
136
|
+
cctx = VibeZstd::CCtx.new(compression_level: 9)
|
|
137
|
+
cctx.workers = workers if workers > 0
|
|
138
|
+
cctx.job_size = 5_000_000 if workers > 0 # Set job size for better parallelism
|
|
139
|
+
|
|
140
|
+
# Debug: verify workers are set correctly
|
|
141
|
+
puts "DEBUG: Requested #{workers} workers, actual: #{cctx.workers}" if ENV["DEBUG"]
|
|
138
142
|
|
|
139
143
|
cctx.compress(mt_data) # warmup
|
|
140
144
|
|
|
141
145
|
time = Benchmark.measure do
|
|
142
|
-
|
|
146
|
+
3.times { cctx.compress(mt_data) }
|
|
143
147
|
end
|
|
144
148
|
|
|
145
|
-
throughput = (mt_data.bytesize *
|
|
149
|
+
throughput = (mt_data.bytesize * 3 / time.real)
|
|
146
150
|
|
|
147
151
|
if workers == 0
|
|
148
152
|
baseline_throughput = throughput
|
|
149
|
-
puts "| #{workers} (single) | #{Formatter.format_bytes(throughput.to_i)}/s | 1.0x | 100% |"
|
|
153
|
+
puts "| #{workers} (single) | #{BenchmarkHelpers::Formatter.format_bytes(throughput.to_i)}/s | 1.0x | 100% |"
|
|
150
154
|
else
|
|
151
155
|
speedup = throughput / baseline_throughput
|
|
152
156
|
efficiency = (speedup / workers * 100).round(0)
|
|
153
|
-
puts "| #{workers} | #{Formatter.format_bytes(throughput.to_i)}/s | #{speedup.round(2)}x | #{efficiency}% |"
|
|
157
|
+
puts "| #{workers} | #{BenchmarkHelpers::Formatter.format_bytes(throughput.to_i)}/s | #{speedup.round(2)}x | #{efficiency}% |"
|
|
154
158
|
end
|
|
155
159
|
end
|
|
156
160
|
|
|
157
|
-
puts "\n**Note:** Multi-threading is most effective for data
|
|
161
|
+
puts "\n**Note:** Multi-threading is most effective for large files. Performance benefits vary based on data characteristics, compression level, and system resources. Always benchmark your specific use case.\n"
|
data/benchmark/multithreading.rb
CHANGED
|
@@ -8,7 +8,7 @@ require_relative "helpers"
|
|
|
8
8
|
|
|
9
9
|
BenchmarkHelpers.run_comparison(title: "Multi-threaded Compression Performance") do |results|
|
|
10
10
|
# Generate large test data (multi-threading only helps with larger data)
|
|
11
|
-
large_data = DataGenerator.mixed_data(size:
|
|
11
|
+
large_data = DataGenerator.mixed_data(size: 5_000_000)
|
|
12
12
|
puts "Test data size: #{Formatter.format_bytes(large_data.bytesize)}"
|
|
13
13
|
puts "CPU cores available: #{begin
|
|
14
14
|
`sysctl -n hw.ncpu`.strip
|
|
@@ -23,7 +23,7 @@ BenchmarkHelpers.run_comparison(title: "Multi-threaded Compression Performance")
|
|
|
23
23
|
Formatter.section("Testing: #{workers} worker#{(workers == 1) ? "" : "s"} #{(workers == 0) ? "(single-threaded)" : ""}")
|
|
24
24
|
|
|
25
25
|
cctx = VibeZstd::CCtx.new
|
|
26
|
-
cctx.
|
|
26
|
+
cctx.workers = workers if workers > 0
|
|
27
27
|
|
|
28
28
|
# Warm up
|
|
29
29
|
cctx.compress(large_data)
|
|
@@ -74,7 +74,7 @@ BenchmarkHelpers.run_comparison(title: "Multi-threaded Compression Performance")
|
|
|
74
74
|
|
|
75
75
|
job_sizes.each do |job_size|
|
|
76
76
|
cctx = VibeZstd::CCtx.new
|
|
77
|
-
cctx.
|
|
77
|
+
cctx.workers = 4
|
|
78
78
|
cctx.job_size = job_size
|
|
79
79
|
|
|
80
80
|
time = Benchmark.measure do
|
|
@@ -95,11 +95,10 @@ BenchmarkHelpers.run_comparison(title: "Multi-threaded Compression Performance")
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
puts "\n💡 Multi-threading Recommendations:"
|
|
98
|
-
puts " ✓
|
|
99
|
-
puts " ✓
|
|
98
|
+
puts " ✓ Generally only beneficial for large files (multiple MB or larger)"
|
|
99
|
+
puts " ✓ Start with 2-4 workers and benchmark your specific use case"
|
|
100
|
+
puts " ✓ Performance benefits vary greatly by data type and compression level"
|
|
100
101
|
puts " ✓ More workers = higher memory usage"
|
|
101
|
-
puts "
|
|
102
|
-
puts "\n
|
|
103
|
-
puts "
|
|
104
|
-
puts " - 4 workers: 2.0-2.5x faster"
|
|
105
|
-
puts " - 8 workers: 2.2-3.0x faster (diminishing returns)"
|
|
102
|
+
puts " ✗ May show no improvement or even slowdown for many workloads"
|
|
103
|
+
puts "\n Always benchmark with your actual data before enabling in production."
|
|
104
|
+
puts " See: https://facebook.github.io/zstd/zstd_manual.html"
|
data/ext/vibe_zstd/extconf.rb
CHANGED
|
@@ -27,11 +27,11 @@ have_library("pthread") || abort("pthread library is required for multithreading
|
|
|
27
27
|
# selectively, or entirely remove this flag.
|
|
28
28
|
append_cflags("-fvisibility=hidden")
|
|
29
29
|
|
|
30
|
-
# Gather all vendored zstd source files
|
|
30
|
+
# Gather all vendored zstd source files (including assembly with arch guards)
|
|
31
31
|
zstd_sources = Dir[
|
|
32
32
|
"#{LIBZSTD_DIR}/common/*.c",
|
|
33
33
|
"#{LIBZSTD_DIR}/compress/*.c",
|
|
34
|
-
"#{LIBZSTD_DIR}/decompress/*.c",
|
|
34
|
+
"#{LIBZSTD_DIR}/decompress/*.{c,S}",
|
|
35
35
|
"#{LIBZSTD_DIR}/dictBuilder/*.c",
|
|
36
36
|
"#{LIBZSTD_DIR}/deprecated/*.c"
|
|
37
37
|
].map { |path| File.basename(path) }
|
data/lib/vibe_zstd/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vibe_zstd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kelley Reynolds
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-10-
|
|
10
|
+
date: 2025-10-24 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: benchmark-ips
|
|
@@ -62,7 +62,6 @@ files:
|
|
|
62
62
|
- benchmark/multithreading.rb
|
|
63
63
|
- benchmark/run_all.rb
|
|
64
64
|
- benchmark/streaming.rb
|
|
65
|
-
- ext/vibe_zstd/Makefile
|
|
66
65
|
- ext/vibe_zstd/cctx.c
|
|
67
66
|
- ext/vibe_zstd/dctx.c
|
|
68
67
|
- ext/vibe_zstd/dict.c
|
data/ext/vibe_zstd/Makefile
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
SHELL = /bin/sh
|
|
3
|
-
|
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
|
5
|
-
V = 0
|
|
6
|
-
V0 = $(V:0=)
|
|
7
|
-
Q1 = $(V:1=)
|
|
8
|
-
Q = $(Q1:0=@)
|
|
9
|
-
ECHO1 = $(V:1=@ :)
|
|
10
|
-
ECHO = $(ECHO1:0=@ echo)
|
|
11
|
-
NULLCMD = :
|
|
12
|
-
|
|
13
|
-
#### Start of system configuration section. ####
|
|
14
|
-
|
|
15
|
-
srcdir = .
|
|
16
|
-
topdir = /Users/kreynolds/.rbenv/versions/3.3.7/include/ruby-3.3.0
|
|
17
|
-
hdrdir = $(topdir)
|
|
18
|
-
arch_hdrdir = /Users/kreynolds/.rbenv/versions/3.3.7/include/ruby-3.3.0/arm64-darwin24
|
|
19
|
-
PATH_SEPARATOR = :
|
|
20
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
|
21
|
-
prefix = $(DESTDIR)/Users/kreynolds/.rbenv/versions/3.3.7
|
|
22
|
-
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
|
23
|
-
rubyarchprefix = $(rubylibprefix)/$(arch)
|
|
24
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
|
25
|
-
exec_prefix = $(prefix)
|
|
26
|
-
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
|
27
|
-
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
|
28
|
-
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
|
29
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
|
30
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
|
31
|
-
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
|
32
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
|
33
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
|
34
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
|
35
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
|
36
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
|
37
|
-
sitedir = $(rubylibprefix)/site_ruby
|
|
38
|
-
rubyarchdir = $(rubylibdir)/$(arch)
|
|
39
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
|
40
|
-
sitearchincludedir = $(includedir)/$(sitearch)
|
|
41
|
-
archincludedir = $(includedir)/$(arch)
|
|
42
|
-
sitearchlibdir = $(libdir)/$(sitearch)
|
|
43
|
-
archlibdir = $(libdir)/$(arch)
|
|
44
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
|
45
|
-
mandir = $(datarootdir)/man
|
|
46
|
-
localedir = $(datarootdir)/locale
|
|
47
|
-
libdir = $(exec_prefix)/lib
|
|
48
|
-
psdir = $(docdir)
|
|
49
|
-
pdfdir = $(docdir)
|
|
50
|
-
dvidir = $(docdir)
|
|
51
|
-
htmldir = $(docdir)
|
|
52
|
-
infodir = $(datarootdir)/info
|
|
53
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
|
54
|
-
oldincludedir = $(DESTDIR)/usr/include
|
|
55
|
-
includedir = $(SDKROOT)$(prefix)/include
|
|
56
|
-
runstatedir = $(localstatedir)/run
|
|
57
|
-
localstatedir = $(prefix)/var
|
|
58
|
-
sharedstatedir = $(prefix)/com
|
|
59
|
-
sysconfdir = $(prefix)/etc
|
|
60
|
-
datadir = $(datarootdir)
|
|
61
|
-
datarootdir = $(prefix)/share
|
|
62
|
-
libexecdir = $(exec_prefix)/libexec
|
|
63
|
-
sbindir = $(exec_prefix)/sbin
|
|
64
|
-
bindir = $(exec_prefix)/bin
|
|
65
|
-
archdir = $(rubyarchdir)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
CC_WRAPPER =
|
|
69
|
-
CC = clang
|
|
70
|
-
CXX = clang++
|
|
71
|
-
LIBRUBY = $(LIBRUBY_SO)
|
|
72
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
|
73
|
-
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
|
74
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation $(MAINLIBS)
|
|
75
|
-
empty =
|
|
76
|
-
OUTFLAG = -o $(empty)
|
|
77
|
-
COUTFLAG = -o $(empty)
|
|
78
|
-
CSRCFLAG = $(empty)
|
|
79
|
-
|
|
80
|
-
RUBY_EXTCONF_H =
|
|
81
|
-
cflags = -fdeclspec $(optflags) $(debugflags) $(warnflags)
|
|
82
|
-
cxxflags =
|
|
83
|
-
optflags = -O3 -fno-fast-math
|
|
84
|
-
debugflags = -ggdb3
|
|
85
|
-
warnflags = -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef
|
|
86
|
-
cppflags =
|
|
87
|
-
CCDLFLAGS = -fno-common
|
|
88
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) -fno-common -pipe -fvisibility=hidden $(ARCH_FLAG)
|
|
89
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I/opt/homebrew/opt/zstd/include
|
|
90
|
-
DEFS =
|
|
91
|
-
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
|
92
|
-
CXXFLAGS = $(CCDLFLAGS) -fdeclspec $(ARCH_FLAG)
|
|
93
|
-
ldflags = -L. -fstack-protector-strong -L/opt/homebrew/opt/gmp/lib -L/opt/homebrew/opt/zstd/lib
|
|
94
|
-
dldflags = -L/opt/homebrew/opt/gmp/lib -Wl,-undefined,dynamic_lookup
|
|
95
|
-
ARCH_FLAG = -arch arm64
|
|
96
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
|
97
|
-
LDSHARED = $(CC) -dynamic -bundle
|
|
98
|
-
LDSHAREDXX = $(CXX) -dynamic -bundle
|
|
99
|
-
AR = llvm-ar
|
|
100
|
-
EXEEXT =
|
|
101
|
-
|
|
102
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
|
103
|
-
RUBY_SO_NAME = ruby.3.3
|
|
104
|
-
RUBYW_INSTALL_NAME =
|
|
105
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
|
106
|
-
RUBYW_BASE_NAME = rubyw
|
|
107
|
-
RUBY_BASE_NAME = ruby
|
|
108
|
-
|
|
109
|
-
arch = arm64-darwin24
|
|
110
|
-
sitearch = $(arch)
|
|
111
|
-
ruby_version = 3.3.0
|
|
112
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
|
113
|
-
RUBY = $(ruby)
|
|
114
|
-
BUILTRUBY = $(bindir)/$(RUBY_BASE_NAME)
|
|
115
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
|
116
|
-
|
|
117
|
-
RM = rm -f
|
|
118
|
-
RM_RF = rm -fr
|
|
119
|
-
RMDIRS = rmdir -p
|
|
120
|
-
MAKEDIRS = mkdir -p
|
|
121
|
-
INSTALL = /usr/bin/install -c
|
|
122
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
|
123
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
|
124
|
-
COPY = cp
|
|
125
|
-
TOUCH = exit >
|
|
126
|
-
|
|
127
|
-
#### End of system configuration section. ####
|
|
128
|
-
|
|
129
|
-
preload =
|
|
130
|
-
libpath = . $(libdir)
|
|
131
|
-
LIBPATH = -L. -L$(libdir)
|
|
132
|
-
DEFFILE =
|
|
133
|
-
|
|
134
|
-
CLEANFILES = mkmf.log
|
|
135
|
-
DISTCLEANFILES =
|
|
136
|
-
DISTCLEANDIRS =
|
|
137
|
-
|
|
138
|
-
extout =
|
|
139
|
-
extout_prefix =
|
|
140
|
-
target_prefix = /vibe_zstd
|
|
141
|
-
LOCAL_LIBS =
|
|
142
|
-
LIBS = $(LIBRUBYARG_SHARED) -lzstd -lpthread
|
|
143
|
-
ORIG_SRCS = cctx.c dctx.c dict.c frames.c streaming.c vibe_zstd.c
|
|
144
|
-
SRCS = $(ORIG_SRCS) vibe_zstd.c
|
|
145
|
-
OBJS = vibe_zstd.o
|
|
146
|
-
HDRS = $(srcdir)/vibe_zstd.h $(srcdir)/vibe_zstd_internal.h
|
|
147
|
-
LOCAL_HDRS =
|
|
148
|
-
TARGET = vibe_zstd
|
|
149
|
-
TARGET_NAME = vibe_zstd
|
|
150
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
|
151
|
-
DLLIB = $(TARGET).bundle
|
|
152
|
-
EXTSTATIC =
|
|
153
|
-
STATIC_LIB =
|
|
154
|
-
|
|
155
|
-
TIMESTAMP_DIR = .
|
|
156
|
-
BINDIR = $(bindir)
|
|
157
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
|
158
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
|
159
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
|
160
|
-
HDRDIR = $(sitehdrdir)$(target_prefix)
|
|
161
|
-
ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix)
|
|
162
|
-
TARGET_SO_DIR =
|
|
163
|
-
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
|
164
|
-
CLEANLIBS = $(TARGET_SO) $(TARGET_SO).dSYM
|
|
165
|
-
CLEANOBJS = $(OBJS) *.bak
|
|
166
|
-
TARGET_SO_DIR_TIMESTAMP = $(TIMESTAMP_DIR)/.sitearchdir.-.vibe_zstd.time
|
|
167
|
-
|
|
168
|
-
all: $(DLLIB)
|
|
169
|
-
static: $(STATIC_LIB)
|
|
170
|
-
.PHONY: all install static install-so install-rb
|
|
171
|
-
.PHONY: clean clean-so clean-static clean-rb
|
|
172
|
-
|
|
173
|
-
clean-static::
|
|
174
|
-
clean-rb-default::
|
|
175
|
-
clean-rb::
|
|
176
|
-
clean-so::
|
|
177
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
|
178
|
-
-$(Q)$(RM_RF) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
|
179
|
-
|
|
180
|
-
distclean-rb-default::
|
|
181
|
-
distclean-rb::
|
|
182
|
-
distclean-so::
|
|
183
|
-
distclean-static::
|
|
184
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
|
185
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
|
186
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
|
187
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
|
188
|
-
|
|
189
|
-
realclean: distclean
|
|
190
|
-
install: install-so install-rb
|
|
191
|
-
|
|
192
|
-
install-so: $(DLLIB) $(TARGET_SO_DIR_TIMESTAMP)
|
|
193
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
|
194
|
-
clean-static::
|
|
195
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
|
196
|
-
install-rb: pre-install-rb do-install-rb install-rb-default
|
|
197
|
-
install-rb-default: pre-install-rb-default do-install-rb-default
|
|
198
|
-
pre-install-rb: Makefile
|
|
199
|
-
pre-install-rb-default: Makefile
|
|
200
|
-
do-install-rb:
|
|
201
|
-
do-install-rb-default:
|
|
202
|
-
pre-install-rb-default:
|
|
203
|
-
@$(NULLCMD)
|
|
204
|
-
$(TARGET_SO_DIR_TIMESTAMP):
|
|
205
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
|
206
|
-
$(Q) $(TOUCH) $@
|
|
207
|
-
|
|
208
|
-
site-install: site-install-so site-install-rb
|
|
209
|
-
site-install-so: install-so
|
|
210
|
-
site-install-rb: install-rb
|
|
211
|
-
|
|
212
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
|
213
|
-
|
|
214
|
-
.cc.o:
|
|
215
|
-
$(ECHO) compiling $(<)
|
|
216
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
217
|
-
|
|
218
|
-
.cc.S:
|
|
219
|
-
$(ECHO) translating $(<)
|
|
220
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
221
|
-
|
|
222
|
-
.mm.o:
|
|
223
|
-
$(ECHO) compiling $(<)
|
|
224
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
225
|
-
|
|
226
|
-
.mm.S:
|
|
227
|
-
$(ECHO) translating $(<)
|
|
228
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
229
|
-
|
|
230
|
-
.cxx.o:
|
|
231
|
-
$(ECHO) compiling $(<)
|
|
232
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
233
|
-
|
|
234
|
-
.cxx.S:
|
|
235
|
-
$(ECHO) translating $(<)
|
|
236
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
237
|
-
|
|
238
|
-
.cpp.o:
|
|
239
|
-
$(ECHO) compiling $(<)
|
|
240
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
241
|
-
|
|
242
|
-
.cpp.S:
|
|
243
|
-
$(ECHO) translating $(<)
|
|
244
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
245
|
-
|
|
246
|
-
.c.o:
|
|
247
|
-
$(ECHO) compiling $(<)
|
|
248
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
249
|
-
|
|
250
|
-
.c.S:
|
|
251
|
-
$(ECHO) translating $(<)
|
|
252
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
253
|
-
|
|
254
|
-
.m.o:
|
|
255
|
-
$(ECHO) compiling $(<)
|
|
256
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
257
|
-
|
|
258
|
-
.m.S:
|
|
259
|
-
$(ECHO) translating $(<)
|
|
260
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
261
|
-
|
|
262
|
-
$(TARGET_SO): $(OBJS) Makefile
|
|
263
|
-
$(ECHO) linking shared-object vibe_zstd/$(DLLIB)
|
|
264
|
-
-$(Q)$(RM) $(@)
|
|
265
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
|
266
|
-
$(Q) $(POSTLINK)
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|