Skip to content

Commit 3f76ab2

Browse files
committed
wip: checkpoint
1 parent 9535222 commit 3f76ab2

File tree

9 files changed

+159
-128
lines changed

9 files changed

+159
-128
lines changed

pyroscope_ffi/ruby/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.DS_Store
33
**/target
44
*.so
5+
*.bundle
56
Gemfile.lock
67
/pkg
78
/doc

pyroscope_ffi/ruby/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
pyroscope_beta (0.1.5)
4+
pyroscope_beta (0.1.6)
55
ffi (~> 1.9)
66
fiddle (~> 1.1)
77

pyroscope_ffi/ruby/Rakefile

Lines changed: 2 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ rescue Bundler::BundlerError => e
1414
exit e.status_code
1515
end
1616

17-
#load File.expand_path('./ext/thread_id/Rakefile', __dir__)
18-
#load File.expand_path('./ext/rbspy/Rakefile', __dir__)
17+
load File.expand_path('./ext/thread_id/Rakefile', __dir__)
18+
load File.expand_path('./ext/rbspy/Rakefile', __dir__)
1919

2020
task default: %w[hello]
2121

@@ -28,106 +28,3 @@ spec = Bundler.load_gemspec('pyroscope.gemspec')
2828
# add your default gem packing task
2929
Gem::PackageTask.new(spec) do |pkg|
3030
end
31-
32-
exttask1 = Rake::ExtensionTask.new('thread_id', spec) do |ext|
33-
ext.lib_dir = 'lib'
34-
ext.source_pattern = '*.{rs,toml}'
35-
ext.cross_compile = true
36-
ext.cross_platform = %w[x86_64-linux x86_64-darwin arm64-darwin aarch64-linux]
37-
end
38-
39-
exttask2 = Rake::ExtensionTask.new('rbspy', spec) do |ext|
40-
ext.lib_dir = 'lib'
41-
ext.source_pattern = '*.{rs,toml}'
42-
ext.cross_compile = true
43-
ext.cross_platform = %w[x86_64-linux x86_64-darwin arm64-darwin aarch64-linux]
44-
end
45-
46-
namespace :gem do
47-
desc "Push all freshly-built gems to RubyGems"
48-
task :push do
49-
Rake::Task.tasks.select { |t| t.name =~ %r{^pkg/#{spec.name}-.*\.gem} && t.already_invoked }.each do |pkgtask|
50-
sh "gem", "push", pkgtask.name
51-
end
52-
53-
Rake::Task.tasks
54-
.select { |t| t.name =~ %r{^gem:cross:} && exttask1.cross_platform.include?(t.name.split(":").last) }
55-
.select(&:already_invoked)
56-
.each do |task|
57-
platform = task.name.split(":").last
58-
sh "gem", "push", "pkg/#{spec.full_name}-#{platform}.gem"
59-
end
60-
end
61-
62-
namespace :cross do
63-
task :prepare do
64-
require "rake_compiler_dock"
65-
sh "bundle package"
66-
end
67-
68-
exttask1.cross_platform.each do |platform|
69-
desc "Cross-compile all native gems in parallel"
70-
multitask :all => platform
71-
72-
desc "Cross-compile a binary gem for #{platform}"
73-
task platform => :prepare do
74-
RakeCompilerDock.sh <<-EOT, platform: platform, image: "rbsys/rcd:#{platform}"
75-
set -e
76-
77-
if [ -d "/opt/osxcross/target/bin" ]; then
78-
# This string replacement is a workaround for https://github.com/oxidize-rb/rb-sys/pull/23
79-
TARGET_CC="${CARGO_BUILD_TARGET/darwin/darwin20.2}-cc"
80-
TARGET_AR="${CARGO_BUILD_TARGET/darwin/darwin20.2}-ar"
81-
else
82-
TARGET_CC="#{platform}-gnu-gcc"
83-
TARGET_AR="#{platform}-gnu-ar"
84-
fi
85-
export TARGET_CC TARGET_AR
86-
export GVB_VERSION_OVERRIDE="#{spec.version}"
87-
[[ "#{platform}" =~ ^a ]] && apt-get update && apt-get install -y libssl-dev
88-
[[ "#{platform}" =~ ^a ]] && rustup default nightly
89-
# This re-installs the nightly version of the relevant target after
90-
# we so rudely switch the default toolchain
91-
[ "#{platform}" = "arm64-darwin" ] && rustup target add aarch64-apple-darwin
92-
[ "#{platform}" = "aarch64-linux" ] && rustup target add aarch64-unknown-linux-gnu
93-
bundle install
94-
rake native:#{platform} gem RUBY_CC_VERSION=3.1.0
95-
EOT
96-
end
97-
end
98-
99-
exttask2.cross_platform.each do |platform|
100-
desc "Cross-compile all native gems in parallel"
101-
multitask :all => platform
102-
103-
desc "Cross-compile a binary gem for #{platform}"
104-
task platform => :prepare do
105-
RakeCompilerDock.sh <<-EOT, platform: platform, image: "rbsys/rcd:#{platform}"
106-
set -e
107-
108-
#apt-get update
109-
#apt-get install -y libssl-dev
110-
111-
if [ -d "/opt/osxcross/target/bin" ]; then
112-
# This string replacement is a workaround for https://github.com/oxidize-rb/rb-sys/pull/23
113-
TARGET_CC="${CARGO_BUILD_TARGET/darwin/darwin20.2}-cc"
114-
TARGET_AR="${CARGO_BUILD_TARGET/darwin/darwin20.2}-ar"
115-
else
116-
TARGET_CC="#{platform}-gnu-gcc"
117-
TARGET_AR="#{platform}-gnu-ar"
118-
fi
119-
export TARGET_CC TARGET_AR
120-
export GVB_VERSION_OVERRIDE="#{spec.version}"
121-
[[ "#{platform}" =~ ^a ]] && apt-get update && apt-get install -y libssl-dev
122-
[[ "#{platform}" =~ ^a ]] && rustup default nightly
123-
# This re-installs the nightly version of the relevant target after
124-
# we so rudely switch the default toolchain
125-
[ "#{platform}" = "arm64-darwin" ] && rustup target add aarch64-apple-darwin
126-
[ "#{platform}" = "aarch64-linux" ] && rustup target add aarch64-unknown-linux-gnu
127-
bundle install
128-
rake native:#{platform} gem RUBY_CC_VERSION=3.1.0
129-
EOT
130-
end
131-
end
132-
end
133-
end

pyroscope_ffi/ruby/ext/rbspy/Cargo.lock

Lines changed: 133 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyroscope_ffi/ruby/ext/rbspy/Cargo.toml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,5 @@ name = "rbspy"
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11-
pyroscope = {version = "0.5" }
11+
pyroscope = {version = "0.5.2" }
1212
pyroscope_rbspy = { version = "0.2" }
13-
# Add openssl-sys as a direct dependency so it can be cross compiled to
14-
# x86_64-unknown-linux-musl using the "vendored" feature below
15-
#openssl-sys = "*"
16-
17-
#[features]
18-
# Force openssl-sys to staticly link in the openssl library. Necessary when
19-
# cross compiling to x86_64-unknown-linux-musl.
20-
#vendored = ["openssl-sys/vendored"]

0 commit comments

Comments
 (0)