-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python: Add py-spy build logic, and upgrade it (#68)
* Upgrade py-spy to v0.3.6 (commit fcf4aa16587ae0b425d7533b828827901d14b24e). * Build py-spy as part of gProfiler's build, so upgrading it as as easy as changing the revision. It's also nicer when there's just a single build script.
- Loading branch information
Showing
10 changed files
with
99 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,3 @@ black | |
mypy | ||
isort | ||
docker | ||
pyinstaller==4.0 | ||
staticx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# requirements for the standalone executable | ||
pyinstaller==4.0 | ||
staticx==0.12.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (c) Granulate. All rights reserved. | ||
# Licensed under the AGPL3 License. See LICENSE.md in the project root for license information. | ||
# | ||
set -euo pipefail | ||
|
||
git clone --depth 1 -b v0.3.6g1 https://github.com/Granulate/py-spy.git && git -C py-spy reset --hard fcf4aa16587ae0b425d7533b828827901d14b24e | ||
cd py-spy | ||
cargo build --release --target=x86_64-unknown-linux-musl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (c) Granulate. All rights reserved. | ||
# Licensed under the AGPL3 License. See LICENSE.md in the project root for license information. | ||
# | ||
set -euo pipefail | ||
|
||
# prepares the environment for building py-spy: | ||
# 1. installs the rust target x86_64-unknown-linux-musl - this can build static binaries | ||
# 2. downloads, builds & installs libunwind with musl | ||
# 2. downloads, builds & installs libz with musl | ||
# I use musl because it builds statically. otherwise, we need to build with old glibc; I tried to | ||
# build on centos:7 but it caused some errors out-of-the-box (libunwind was built w/o -fPIC and rust tried | ||
# to build it as shared (?)) | ||
# in any way, building it static solves all issues. and I find it better to use more recent versions of libraries | ||
# like libunwind/zlib. | ||
|
||
rustup target add x86_64-unknown-linux-musl | ||
|
||
apt-get update && apt-get install -y musl-dev musl-tools | ||
|
||
mkdir builds && cd builds | ||
|
||
wget https://github.com/libunwind/libunwind/releases/download/v1.5/libunwind-1.5.0.tar.gz | ||
tar -xf libunwind-1.5.0.tar.gz | ||
cd libunwind-1.5.0 | ||
CC=musl-gcc ./configure --disable-minidebuginfo --enable-ptrace --disable-tests --disable-documentation | ||
make | ||
make install | ||
|
||
wget https://zlib.net/zlib-1.2.11.tar.xz | ||
tar -xf zlib-1.2.11.tar.xz | ||
cd zlib-1.2.11 | ||
# note the use of --prefix here. it matches the directory https://github.com/benfred/remoteprocess/blob/master/build.rs expects to find libs for musl. | ||
# the libunwind configure may install it in /usr/local/lib for all I care, but if we override /usr/local/lib/libz... with the musl ones, | ||
# it won't do any good... | ||
CC=musl-gcc ./configure --prefix=/usr/local/musl/x86_64-unknown-linux-musl | ||
make | ||
make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters