Skip to content

Commit f1d69cb

Browse files
committed
Merge branch 'main' into 0.5.2
2 parents 8d855aa + d9a6015 commit f1d69cb

File tree

11 files changed

+74
-35
lines changed

11 files changed

+74
-35
lines changed

pyroscope_ffi/python/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# Packages
55
*.egg
6+
.eggs/
67
!/tests/**/*.egg
78
*/*.egg-info
89
*.egg-info

pyroscope_ffi/python/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ clean:
44
rm -rf dist
55
rm -rf wheelhouse
66
rm -rf pyroscope_beta.egg-info
7+
rm -rf lib/target
78

89
.PHONY: build
910
build: clean

pyroscope_ffi/python/manylinux.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Install tooling
5+
yum -y -q install wget gcc libffi-devel
6+
7+
# Install Rust
8+
curl https://sh.rustup.rs -sSf | sh -s -- -y
9+
export PATH=~/.cargo/bin:$PATH
10+
11+
# Install libunwind
12+
wget https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz
13+
tar -zxvf libunwind-1.6.2.tar.gz
14+
cd libunwind-1.6.2
15+
./configure --disable-minidebuginfo --enable-ptrace --disable-tests --disable-documentation
16+
make
17+
make install
18+
19+
# Build wheels
20+
/opt/python/cp37-cp37m/bin/python setup.py bdist_wheel
21+
22+
# Audit wheels
23+
for wheel in dist/*-linux_*.whl; do
24+
auditwheel repair $wheel -w dist/
25+
rm $wheel
26+
done
File renamed without changes.

pyroscope_ffi/python/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ def build_native(spec):
1919
in_path='target/release'),
2020
header_filename=lambda:
2121
build.find_header('pyroscope_ffi.h',in_path='include'),
22-
rtld_flags=['NOW', 'NODELETE']
22+
rtld_flags=['NOW']
2323
)
2424

2525
setup(
26+
platforms="any",
2627
milksnake_tasks=[build_native],
28+
setup_requires=["milksnakex>=0.1.6"],
2729
)

pyroscope_ffi/ruby/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.DS_Store
33
**/target
44
*.so
5+
tmp

pyroscope_ffi/ruby/Rakefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# frozen_string_literal: true
22

3-
load File.expand_path('./ext/rbspy/Rakefile', __dir__)
3+
require 'rake/extensiontask'
4+
45
load File.expand_path('./ext/thread_id/Rakefile', __dir__)
6+
load File.expand_path('./ext/rbspy/Rakefile', __dir__)
57

68
task default: %w[hello]
79

810
task :hello do
911
puts 'Hello!'
1012
end
13+
14+
Rake::ExtensionTask.new('thread_id')
15+
Rake::ExtensionTask.new('rbspy')

pyroscope_ffi/ruby/ext/rbspy/Rakefile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require "shellwords"
44

5-
class RakeCargoHelper
5+
class RbspyRakeCargoHelper
66
attr_reader :gemname
77

88
def initialize(gemname=File.basename(__dir__))
@@ -104,54 +104,55 @@ class RakeCargoHelper
104104

105105
end
106106

107-
task default: [:install, :clean]
107+
task default: [:rbspy_install, :rbspy_clean]
108+
task rbspy: [:rbspy_install, :rbspy_clean]
108109

109110
desc "set dev mode for subsequent task, run like `rake dev install`"
110-
task :dev do
111+
task :rbspy_dev do
111112
@dev = true
112113
end
113114

114115
desc "build gem native extension and copy to lib"
115-
task install: [:cd, :build] do
116-
helper = RakeCargoHelper.new
116+
task rbspy_install: [:rbspy_cd, :rbspy_build] do
117+
helper = RbspyRakeCargoHelper.new
117118
profile_dir = @dev ? "debug" : "release"
118-
source = File.join(RakeCargoHelper.cargo_target_dir, profile_dir, helper.rust_name)
119+
source = File.join(RbspyRakeCargoHelper.cargo_target_dir, profile_dir, helper.rust_name)
119120
dest = File.join(helper.install_dir, helper.ruby_name)
120121
mkdir_p(helper.install_dir)
121122
rm(dest) if File.exist?(dest)
122123
cp(source, dest)
123124
end
124125

125126
desc "build gem native extension"
126-
task build: [:cargo, :cd] do
127-
sh "cargo", "rustc", *(["--locked", "--release"] unless @dev), "--", *RakeCargoHelper.flags
127+
task rbspy_build: [:rbspy_cargo, :rbspy_cd] do
128+
sh "cargo", "rustc", *(["--locked", "--release"] unless @dev), "--", *RbspyRakeCargoHelper.flags
128129
end
129130

130131
desc "clean up release build artifacts"
131-
task clean: [:cargo, :cd] do
132+
task rbspy_clean: [:rbspy_cargo, :rbspy_cd] do
132133
sh "cargo clean --release"
133134
end
134135

135136
desc "clean up build artifacts"
136-
task clobber: [:cargo, :cd] do
137+
task rbspy_clobber: [:rbspy_cargo, :rbspy_cd] do
137138
sh "cargo clean"
138139
end
139140

140141
desc "check for cargo"
141-
task :cargo do
142-
raise <<-MSG unless RakeCargoHelper.command?("cargo")
142+
task :rbspy_cargo do
143+
raise <<-MSG unless RbspyRakeCargoHelper.command?("cargo")
143144
This gem requires a Rust compiler and the `cargo' build tool to build the
144145
gem's native extension. See https://www.rust-lang.org/tools/install for
145146
how to install Rust. `cargo' is usually part of the Rust installation.
146147
MSG
147148

148-
raise <<-MSG if Gem.win_platform? && RakeCargoHelper.rust_toolchain !~ /gnu/
149-
Found Rust toolchain `#{RakeCargoHelper.rust_toolchain}' but the gem native
149+
raise <<-MSG if Gem.win_platform? && RbspyRakeCargoHelper.rust_toolchain !~ /gnu/
150+
Found Rust toolchain `#{RbspyRakeCargoHelper.rust_toolchain}' but the gem native
150151
extension requires the gnu toolchain on Windows.
151152
MSG
152153
end
153154

154155
# ensure task is running in the right dir
155-
task :cd do
156+
task :rbspy_cd do
156157
cd(__dir__) unless __dir__ == pwd
157158
end
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
require 'mkmf'
2+
require 'rb_sys/mkmf'
23
require 'rake'
34

4-
create_makefile('rbspy')
5+
create_rust_makefile('rbspy')
56

67
app = Rake.application
78
app.init
89
app.add_import 'Rakefile'
910
app.load_rakefile
1011

11-
app['default'].invoke
12+
app['rbspy'].invoke

pyroscope_ffi/ruby/ext/thread_id/Rakefile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require "shellwords"
44

5-
class RakeCargoHelper
5+
class ThreadIdRakeCargoHelper
66
attr_reader :gemname
77

88
def initialize(gemname=File.basename(__dir__))
@@ -104,54 +104,55 @@ class RakeCargoHelper
104104

105105
end
106106

107-
task default: [:install, :clean]
107+
task default: [:thread_id_install, :thread_id_clean]
108+
task thread_id: [:thread_id_install, :thread_id_clean]
108109

109110
desc "set dev mode for subsequent task, run like `rake dev install`"
110-
task :dev do
111+
task :thread_id_dev do
111112
@dev = true
112113
end
113114

114115
desc "build gem native extension and copy to lib"
115-
task install: [:cd, :build] do
116-
helper = RakeCargoHelper.new
116+
task thread_id_install: [:thread_id_cd, :thread_id_build] do
117+
helper = ThreadIdRakeCargoHelper.new
117118
profile_dir = @dev ? "debug" : "release"
118-
source = File.join(RakeCargoHelper.cargo_target_dir, profile_dir, helper.rust_name)
119+
source = File.join(ThreadIdRakeCargoHelper.cargo_target_dir, profile_dir, helper.rust_name)
119120
dest = File.join(helper.install_dir, helper.ruby_name)
120121
mkdir_p(helper.install_dir)
121122
rm(dest) if File.exist?(dest)
122123
cp(source, dest)
123124
end
124125

125126
desc "build gem native extension"
126-
task build: [:cargo, :cd] do
127-
sh "cargo", "rustc", *(["--locked", "--release"] unless @dev), "--", *RakeCargoHelper.flags
127+
task thread_id_build: [:thread_id_cargo, :thread_id_cd] do
128+
sh "cargo", "rustc", *(["--locked", "--release"] unless @dev), "--", *ThreadIdRakeCargoHelper.flags
128129
end
129130

130131
desc "clean up release build artifacts"
131-
task clean: [:cargo, :cd] do
132+
task thread_id_clean: [:thread_id_cargo, :thread_id_cd] do
132133
sh "cargo clean --release"
133134
end
134135

135136
desc "clean up build artifacts"
136-
task clobber: [:cargo, :cd] do
137+
task thread_id_clobber: [:thread_id_cargo, :thread_id_cd] do
137138
sh "cargo clean"
138139
end
139140

140141
desc "check for cargo"
141-
task :cargo do
142-
raise <<-MSG unless RakeCargoHelper.command?("cargo")
142+
task :thread_id_cargo do
143+
raise <<-MSG unless ThreadIdRakeCargoHelper.command?("cargo")
143144
This gem requires a Rust compiler and the `cargo' build tool to build the
144145
gem's native extension. See https://www.rust-lang.org/tools/install for
145146
how to install Rust. `cargo' is usually part of the Rust installation.
146147
MSG
147148

148-
raise <<-MSG if Gem.win_platform? && RakeCargoHelper.rust_toolchain !~ /gnu/
149-
Found Rust toolchain `#{RakeCargoHelper.rust_toolchain}' but the gem native
149+
raise <<-MSG if Gem.win_platform? && ThreadIdRakeCargoHelper.rust_toolchain !~ /gnu/
150+
Found Rust toolchain `#{ThreadIdRakeCargoHelper.rust_toolchain}' but the gem native
150151
extension requires the gnu toolchain on Windows.
151152
MSG
152153
end
153154

154155
# ensure task is running in the right dir
155-
task :cd do
156+
task :thread_id_cd do
156157
cd(__dir__) unless __dir__ == pwd
157158
end

0 commit comments

Comments
 (0)