-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #278 from mariux64/add-bpftrace-0.20.3
bpftrace: add version 0.20.3, and associated tools
- Loading branch information
Showing
1 changed file
with
203 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
#!/bin/bash | ||
|
||
|
||
# ------------------------------------------------------------------- Debug | ||
|
||
COOKIE=$(mcookie|cut -c-8); grep -v V_GREP_ME $0 > /dev/shm/runme-$COOKIE.sh ; sleep 0.3; exec bash /dev/shm/runme-$COOKIE.sh | ||
# TESTING=1 | ||
|
||
# ---------------------------------------------------------------- Preamble | ||
|
||
PKG=bpftrace | ||
VERSION=0.20.3 | ||
BUILD=0 | ||
|
||
PREFIX=/pkg/$PKG-$VERSION-$BUILD | ||
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$PKG-$VERSION-$BUILD ; fi | ||
|
||
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin | ||
|
||
set -e | ||
|
||
umask 022 | ||
|
||
BUILD_TMPDIR=/scratch/local2/$PKG-$VERSION-$BUILD.$USER.build.tmp | ||
|
||
test -z "$TESTING" && test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR ) | ||
export TMPDIR=$BUILD_TMPDIR | ||
export HOME=$BUILD_TMPDIR/home | ||
mkdir -p $HOME | ||
# copy this script to a defined location | ||
cp $0 $BUILD_TMPDIR; ME="$BUILD_TMPDIR/$(basename $0)" | ||
|
||
mkdir -p $PREFIX | ||
cat >$PREFIX/profile <<-EOF | ||
PATH=$PREFIX/bin:\$PATH | ||
export LD_LIBRARY_PATH=$PREFIX/lib\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH | ||
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\$PKG_CONFIG_PATH | ||
export PKG_CONFIG_PATH | ||
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ; fi | ||
EOF | ||
. $PREFIX/profile | ||
|
||
NPROC=$(( $(nproc) * 4 / 5 + 1 )) | ||
export MAKEFLAGS="-j $NPROC" | ||
|
||
BUILDDIR=$PREFIX/build | ||
|
||
mkdir -p $BUILDDIR | ||
cd $BUILDDIR | ||
|
||
|
||
# ------------------------------------- this relies on python, roll our own | ||
|
||
( | ||
PYTHONVERSION=3.11.9 | ||
|
||
# orig: https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz | ||
BEEHIVE=https://beehive.molgen.mpg.de/bfd4d3bfeac4216ce35d7a503bf02d5c/Python-3.11.9.tgz | ||
test -e Python-$PYTHONVERSION.tgz || wget -nv $BEEHIVE | ||
test -d Python-$PYTHONVERSION || tar -xf Python-$PYTHONVERSION.tgz | ||
cd Python-$PYTHONVERSION | ||
|
||
|
||
# These may come handy if the Python build needs exclusive stuff from $PREFIX | ||
# INCLUDEDIR=$PREFIX/include \ | ||
# LIBDIR=$PREFIX/lib \ | ||
LDFLAGS="-Wl,-rpath=$PREFIX/lib" \ | ||
./configure \ | ||
--prefix=$PREFIX \ | ||
--enable-shared | ||
|
||
make -j $NPROC | ||
make install | ||
|
||
# it might come to happen that something down the line may just call 'python', defuse ... | ||
test -e $PREFIX/bin/python || ln -s python3 $PREFIX/bin/python | ||
|
||
python -m ensurepip | ||
pip3 install --prefix=$PREFIX -I pip | ||
( # fix 'please update' noise from pip | ||
cd $PREFIX/lib/python*/site-packages | ||
sed -ne '/^#Epatch:pip/ s/^#Epatch:\S* // p' $ME | patch -p1 --verbose | ||
) | ||
# I hate to do this ... | ||
ln -s lib $PREFIX/lib64 | ||
pip3 install setuptools | ||
) | ||
|
||
# ----------------------------------------------- build needed dependencies | ||
|
||
( | ||
# orig https://github.com/iovisor/bcc/releases/download/v0.30.0/bcc-src-with-submodule.tar.gz | ||
BEEHIVE=https://beehive.molgen.mpg.de/970e131dfc95896b4db6da4c0a375f27/bcc-src-with-submodule-0.30.0.tar.gz | ||
test -e bcc-src-with-submodule-0.30.0.tar.gz || wget -nv $BEEHIVE | ||
test -d bcc || tar -xf bcc-src-with-submodule-0.30.0.tar.gz | ||
mkdir -p bcc/build | ||
cd bcc/build | ||
cmake \ | ||
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | ||
-DCMAKE_VERBOSE_MAKEFILE=ON \ | ||
-DKERNELHEADERS_DIR=/usr/include/linux \ | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
-DENABLE_LLVM_SHARED=ON \ | ||
-DRUN_LUA_TESTS=OFF \ | ||
.. | ||
|
||
make -j $NPROC | ||
make install | ||
) | ||
|
||
( | ||
# orig: https://github.com/libbpf/libbpf/archive/refs/tags/v1.4.0.tar.gz | ||
BEEHIVE=https://beehive.molgen.mpg.de/1d1ecd6073cd59f96e780d9858dcde9b/libbpf-1.4.0.tar.gz | ||
test -e libbpf-1.4.0.tar.gz || wget -nv $BEEHIVE | ||
test -d libbpf-1.4.0 || tar -xf libbpf-1.4.0.tar.gz | ||
cd libbpf-1.4.0/src | ||
|
||
PREFIX=$PREFIX make install | ||
) | ||
|
||
( | ||
# orig: https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.2.tar.gz | ||
BEEHIVE=https://beehive.molgen.mpg.de/ab6070fadc7c50072ef4153fb1c46a87/cereal-1.3.2.tar.gz | ||
test -e cereal-1.3.2.tar.gz || wget -nv $BEEHIVE | ||
test -d cereal-1.3.2 || tar -xf cereal-1.3.2.tar.gz | ||
mkdir -p cereal-1.3.2/build | ||
cd cereal-1.3.2/build | ||
|
||
cmake \ | ||
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | ||
-DCMAKE_VERBOSE_MAKEFILE=ON \ | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
-DJUST_INSTALL_CEREAL=ON \ | ||
.. | ||
|
||
make | ||
make install | ||
) | ||
|
||
# ----------------------------------------------------------- the main tool | ||
|
||
( | ||
# orig: https://github.com/bpftrace/bpftrace/archive/refs/tags/v0.20.3.tar.gz | ||
BEEHIVE=https://beehive.molgen.mpg.de/2fad05fd87ccefce5bc58e4f2bc3674a/bpftrace-0.20.3.tar.gz | ||
test -e bpftrace-0.20.3.tar.gz || wget -nv $BEEHIVE | ||
test -d bpftrace-0.20.3 || tar -xf bpftrace-0.20.3.tar.gz | ||
mkdir -p bpftrace-0.20.3/build | ||
cd bpftrace-0.20.3/build | ||
|
||
cmake \ | ||
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | ||
-DCMAKE_VERBOSE_MAKEFILE=ON \ | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
-DLIBBCC_INCLUDE_DIRS=$PREFIX/include/bcc \ | ||
-DLIBBPF_INCLUDE_DIRS=$PREFIX/include/bpf \ | ||
-DLIBCEREAL_INCLUDE_DIRS=$PREFIX/include \ | ||
-DBUILD_TESTING=OFF \ | ||
.. | ||
|
||
make | ||
make install | ||
) | ||
|
||
# ----------------------------------------------------------- miscellaneous | ||
|
||
( | ||
# well, thats not related to bpftrace, but since we also have all the tools from | ||
# libbpf and bcc, throw them in here too | ||
# orig: https://github.com/sdsc/blktrace/archive/refs/tags/blktrace-1.1.0.tar.gz | ||
BEEHIVE=https://beehive.molgen.mpg.de/acdf93f3f54d73a23dba181a2fffa37e/blktrace-1.1.0.tar.gz | ||
test -e blktrace-1.1.0.tar.gz || wget -nv $BEEHIVE | ||
test -d blktrace-blktrace-1.1.0 || tar -xf blktrace-1.1.0.tar.gz | ||
cd blktrace-blktrace-1.1.0 | ||
|
||
make | ||
make install prefix=$PREFIX mandir=$PREFIX/share/man | ||
) | ||
|
||
echo "# done ..." | ||
|
||
exit | ||
|
||
|
||
# -------------------------------------------------------- Included patches | ||
|
||
#Epatch:pip # Operation 'Forever young', disable version-check per default. | ||
#Epatch:pip # The option needs to be kept, because some tools make use of | ||
#Epatch:pip # it and would cause pip to fail. | ||
#Epatch:pip --- a/pip/_internal/cli/cmdoptions.py 2022-08-09 17:29:15.853442948 +0200 | ||
#Epatch:pip +++ b/pip/_internal/cli/cmdoptions.py 2022-08-10 10:31:35.124945154 +0200 | ||
#Epatch:pip @@ -892,7 +892,6 @@ | ||
#Epatch:pip dest="disable_pip_version_check", | ||
#Epatch:pip action="store_true", | ||
#Epatch:pip - default=False, | ||
#Epatch:pip - help="Don't periodically check PyPI to determine whether a new version " | ||
#Epatch:pip - "of pip is available for download. Implied with --no-index.", | ||
#Epatch:pip + default=True, | ||
#Epatch:pip + help="Ignore this option, the version check IS disabled.", | ||
#Epatch:pip ) | ||
|
||
|
||
# -------------------------------------------------------- This is the end. | ||
|