| 1 | # Wedge definition for uftrace.
|
| 2 | #
|
| 3 | # Loaded by deps/wedge.sh.
|
| 4 |
|
| 5 | set -o nounset
|
| 6 | set -o pipefail
|
| 7 | set -o errexit
|
| 8 |
|
| 9 | WEDGE_NAME='uftrace'
|
| 10 | WEDGE_VERSION='0.13'
|
| 11 | WEDGE_IS_ABSOLUTE=1 # TODO: consider relaxing
|
| 12 |
|
| 13 | wedge-make() {
|
| 14 | local src_dir=$1
|
| 15 | local build_dir=$2
|
| 16 | local install_dir=$3
|
| 17 |
|
| 18 | # PATCH SOURCE FOR SHARED LIB PROBLEM
|
| 19 | # TODO:
|
| 20 | # - use 'diff' util
|
| 21 | # - upgrade all containers to Debian bullseye / Python 3.9, to get rid of
|
| 22 | # this garbage
|
| 23 | # - there was no 'm' ABI flag in python 2.7 or 3.9, but there is in 3.6 and 3.7
|
| 24 |
|
| 25 | local makefile=$src_dir/check-deps/Makefile.check
|
| 26 |
|
| 27 | # look for libpython3.6m.so, not libpython3.6.so
|
| 28 | # 2023-07: not needed on Debian 12 Bookworm
|
| 29 | if test -n "${UBUNTU_HACK:-}"; then
|
| 30 | sed -i 's/--modversion)$/--modversion)m/' $makefile
|
| 31 |
|
| 32 | # additionally, look for libpython3.6m.so.1.0 !!!
|
| 33 | local c_file=$src_dir/utils/script-python.c
|
| 34 | sed -i 's/".so"/".so.1.0"/' $c_file
|
| 35 | fi
|
| 36 |
|
| 37 | pushd $build_dir
|
| 38 |
|
| 39 | $src_dir/configure --help || true
|
| 40 | echo
|
| 41 |
|
| 42 | # Note: smoke test should look like this, with Python 3 plugins
|
| 43 | #
|
| 44 | # uftrace v0.13 ( x86_64 python3 perf sched )
|
| 45 | #
|
| 46 | # It depends on 'pkg-config python3 --cflags'
|
| 47 | #
|
| 48 | # There is a misleading message at the beginning that says libpython OFF
|
| 49 | #
|
| 50 | # I tried --with-libpython, and it doesn't seem to affect it either way.
|
| 51 |
|
| 52 | # 2023-07: Debian 12 Bookworm needs:
|
| 53 | #
|
| 54 | # apt-get install pkgconfig
|
| 55 |
|
| 56 | $src_dir/configure --prefix=$install_dir
|
| 57 | echo
|
| 58 |
|
| 59 | time make
|
| 60 |
|
| 61 | popd
|
| 62 | }
|
| 63 |
|
| 64 | wedge-install() {
|
| 65 | local build_dir=$1
|
| 66 |
|
| 67 | pushd $build_dir
|
| 68 |
|
| 69 | # install-strip is a GNU thing! It discards symbols.
|
| 70 |
|
| 71 | # TODO: copy them from the original binary in $BUILD_DIR
|
| 72 | # objcopy --add-debug-link, etc.
|
| 73 |
|
| 74 | # Does not have 'install-strip' target
|
| 75 |
|
| 76 | time make install
|
| 77 |
|
| 78 | popd
|
| 79 | }
|
| 80 |
|
| 81 | wedge-smoke-test() {
|
| 82 | local install_dir=$1
|
| 83 | local wedge_dir=$2
|
| 84 |
|
| 85 | local uftrace=$install_dir/bin/uftrace
|
| 86 | $uftrace --version | tee version.txt
|
| 87 |
|
| 88 | if grep python3 version.txt; then
|
| 89 | echo 'Python 3 support found'
|
| 90 | else
|
| 91 | echo 'FAILED to build with Python 3 support'
|
| 92 | return 1
|
| 93 | fi
|
| 94 |
|
| 95 | cc -pg -o hello $wedge_dir/hello.c
|
| 96 |
|
| 97 | $uftrace record hello
|
| 98 | $uftrace replay hello
|
| 99 | $uftrace script -S $wedge_dir/plugin.py
|
| 100 | }
|
| 101 |
|
| 102 | # vim: filetype=sh
|