aboutsummaryrefslogtreecommitdiff
path: root/development
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-02-04 16:54:47 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2021-02-07 01:39:56 +0700
commit349056b07cdd667823725d6a7d0b07ae194e3509 (patch)
tree18b8ebc2ae0c0087f28b2a17d726e46df26da9e8 /development
parent9ac7edd685fd26baafc6cb3ccb75b2b9bcd51a26 (diff)
development/perf: Autodetect kernel version.
Signed-off-by: B. Watson <yalhcru@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'development')
-rw-r--r--development/perf/README21
-rw-r--r--development/perf/perf.SlackBuild46
-rw-r--r--development/perf/perf.info2
3 files changed, 64 insertions, 5 deletions
diff --git a/development/perf/README b/development/perf/README
index 56771df929c5..1ec21e6c9ef0 100644
--- a/development/perf/README
+++ b/development/perf/README
@@ -4,7 +4,22 @@ such as instructions executed, cache-misses suffered, or branches
mispredicted. They form a basis for profiling applications to trace
dynamic control flow and identify hotspots.
-Please note that this SBo doesn't have any sources in the DOWNLOAD
-setting, as the sources are already part of a full slackware install.
-
Optional dependencies: audit, numactl, libunwind
+
+Please note that this build doesn't have any sources in the .info
+file, as the sources are already part of the Slackware kernel-source
+package. Your running kernel's version should match the kernel-source
+version. If it doesn't:
+
+- If your kernel source is located in /usr/src/linux-$VERSION, you
+ can export KERNEL=<version> in the script's environment. Example:
+
+ export KERNEL=4.4.240
+
+- If your kernel source is somewhere else, you can export
+ KERNEL=</path/to/source>. Example:
+
+ export KERNEL=/home/myuser/kernels/linux-4.2.240
+
+Please note that the package's version number will match the version
+of the kernel source, *not* necessarily what's in the perf.info file.
diff --git a/development/perf/perf.SlackBuild b/development/perf/perf.SlackBuild
index 1a81ae0622d1..ac56703e5a7d 100644
--- a/development/perf/perf.SlackBuild
+++ b/development/perf/perf.SlackBuild
@@ -22,8 +22,15 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 20210202 bkw: Modified by SlackBuilds.org, autodetect the kernel
+# version and allow the user to override it. Avoids having this build
+# break every time Pat releases a new kernel in patches/.
+
PRGNAM=perf
+
+# This VERSION is actually a dummy. Use KERNEL to set the version.
VERSION=${VERSION:-4.4.227}
+
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -56,7 +63,44 @@ fi
set -e
-SRCDIR="/usr/src/linux-$VERSION/tools/perf"
+die() {
+ echo "$0: fatal: $@" 1>&2
+ cat 1>&2 <<EOF
+
+Please make sure the correct version of the kernel source is
+installed, and/or set the KERNEL environment variable to one of:
+
+- The full path to the kernel source, e.g. KERNEL="/usr/src/linux-4.4.227"
+- Or, the kernel version e.g. KERNEL="4.4.227"
+EOF
+ exit 1
+}
+
+case "$KERNEL" in
+ # if unset, use the running kernel:
+ "") SRCDIR="/usr/src/linux-$( uname -r )" ;;
+ # if it's an absolute path, use it as-is:
+ /*) SRCDIR="$KERNEL" ;;
+ # otherwise assume it's a version number:
+ *) SRCDIR="/usr/src/linux-$KERNEL" ;;
+esac
+
+[ -f "$SRCDIR/Makefile" ] || die "Can't find kernel source in \"$SRCDIR\""
+
+# get the kernel version number from the top-level Makefile. This
+# allows cases where the kernel source directory isn't named after the
+# version number. It also verifies that the Makefile actually exists
+# (because after upgrading/removing a kernel-source package, the
+# directory might still exist, with the .config and other generated
+# files, but no kernel source!)
+cd $SRCDIR
+VERSION="$( make kernelversion | tail -1 )"
+[ -z "$VERSION" ] && die "Can't get kernel version (source corrupted?)"
+echo "=== VERSION=\"$VERSION\""
+
+SRCDIR="$SRCDIR/tools/perf"
+[ -d "$SRCDIR" ] || die "Kernel source missing tools/perf directory"
+
BUILDDIR=$TMP/$PRGNAM-$VERSION
rm -rf $PKG $BUILDDIR
diff --git a/development/perf/perf.info b/development/perf/perf.info
index 1dcb42c49514..014af450323a 100644
--- a/development/perf/perf.info
+++ b/development/perf/perf.info
@@ -1,7 +1,7 @@
PRGNAM="perf"
VERSION="4.4.227"
HOMEPAGE="https://perf.wiki.kernel.org/index.php/Main_Page"
-DOWNLOAD="http://www.pastemobile.org/static/perf.dummy"
+DOWNLOAD="https://slackware.uk/~urchlay/src/perf.dummy"
MD5SUM="9cba6c70fb57a22a155073d54748b614"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""