diff options
Diffstat (limited to 'build-scripts/buildperfdsc')
-rwxr-xr-x | build-scripts/buildperfdsc | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/build-scripts/buildperfdsc b/build-scripts/buildperfdsc new file mode 100755 index 0000000..4f5578b --- /dev/null +++ b/build-scripts/buildperfdsc @@ -0,0 +1,128 @@ +#!/bin/sh +# +# Simple script to generate a deb package for perf. This simply +# replaces any distro provided linux-tools package. + +set -e + +version=$KERNELRELEASE +revision=$(cat .version) +if [ -n "$KDEB_PKGVERSION" ]; then + packageversion=$KDEB_PKGVERSION +else + packageversion=$version-$revision +fi +if [ -n "$KDEB_PERFNAME" ]; then + packagename=$KDEB_PERFNAME +else + packagename=perf +fi + +# Try to determine maintainer and email values +if [ -n "$DEBEMAIL" ]; then + email=$DEBEMAIL +elif [ -n "$EMAIL" ]; then + email=$EMAIL +else + email=$(id -nu)@$(hostname -f) +fi +if [ -n "$DEBFULLNAME" ]; then + name=$DEBFULLNAME +elif [ -n "$NAME" ]; then + name=$NAME +else + name="Anonymous" +fi +maintainer="$name <$email>" + +# Try to determine distribution +if [ -n "$KDEB_CHANGELOG_DIST" ]; then + distribution=$KDEB_CHANGELOG_DIST +elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ]; then + : # nothing to do in this case +else + distribution="unstable" + echo >&2 "Using default distribution of 'unstable' in the changelog" + echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly" +fi + +mkdir -p debian + +# Generate a simple changelog template +cat <<EOF > debian/changelog +$packagename ($packageversion) $distribution; urgency=low + + * Perf built for Linux version $version. + + -- $maintainer $(date -R) +EOF + +# Generate copyright file +cat <<EOF > debian/copyright +This is a packacked upstream version of the Linux kernel. + +The sources may be found at most Linux ftp sites, including: +ftp://ftp.kernel.org/pub/linux/kernel + +Copyright: 1991 - 2015 Linus Torvalds and others. + +The git repository for mainline kernel development is at: +git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + +On Debian GNU/Linux systems, the complete text of the GNU General Public +License version 2 can be found in \`/usr/share/common-licenses/GPL-2'. +EOF + +build_depends="debhelper, python-dev, libperl-dev, bison, flex, \ +libaudit-dev, libdw-dev, libelf-dev, libiberty-dev, libnewt-dev, autoconf, \ +automake, libtool, libglib2.0-dev, libgtk2.0-dev, libudev-dev, libwrap0-dev, \ +libiberty-dev, libunwind8-dev [amd64 arm64 i386], binutils-dev, liblzma-dev, \ +libnuma-dev [amd64 arm64 i386 powerpc ppc64 ppc64el], asciidoc, xmlto" + +# Generate a control file +cat <<EOF > debian/control +Source: $packagename +Section: kernel +Priority: optional +Maintainer: $maintainer +Build-Depends: $build_depends +Standards-Version: 3.8.4 +Homepage: http://www.kernel.org/ + +Package: $packagename +Replaces: linux-base, linux-tools, linux-tools-common +Depends: \${shlibs:Depends}, \${perl:Depends} +Architecture: any +Description: Performance analysis tools for Linux $version + This package contains the Linux kernel, modules and corresponding other + files, version: $version. +EOF + +echo 9 > debian/compat + +cat <<EOF > debian/rules +#!/usr/bin/make -f +%: + dh \$@ + +override_dh_auto_install: + \$(MAKE) -C tools/perf prefix=\$(shell pwd)/debian/perf/usr install + +override_dh_auto_clean: + dh_clean + \$(MAKE) -C tools/perf clean + +EOF + +mv ${packagename}-${KERNELVERSION}.tar.xz ../${packagename}_${version}.orig.tar.xz +tar caf ../${packagename}_${packageversion}.debian.tar.xz debian/{compat,copyright,rules,changelog,control} +dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" \ + -b / ../${packagename}_${version}.orig.tar.xz ../${packagename}_${packageversion}.debian.tar.xz +mv ${packagename}_${packageversion}*dsc .. +dpkg-genchanges -S > ../${packagename}_${packageversion}_source.changes + +exit 0 |