toolkit/crashreporter/google-breakpad/src/third_party/glog/packages/deb.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/crashreporter/google-breakpad/src/third_party/glog/packages/deb.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +#!/bin/bash -e
     1.5 +
     1.6 +# This takes one commandline argument, the name of the package.  If no
     1.7 +# name is given, then we'll end up just using the name associated with
     1.8 +# an arbitrary .tar.gz file in the rootdir.  That's fine: there's probably
     1.9 +# only one.
    1.10 +#
    1.11 +# Run this from the 'packages' directory, just under rootdir
    1.12 +
    1.13 +## Set LIB to lib if exporting a library, empty-string else
    1.14 +LIB=
    1.15 +#LIB=lib
    1.16 +
    1.17 +PACKAGE="$1"
    1.18 +VERSION="$2"
    1.19 +
    1.20 +# We can only build Debian packages, if the Debian build tools are installed
    1.21 +if [ \! -x /usr/bin/debuild ]; then
    1.22 +  echo "Cannot find /usr/bin/debuild. Not building Debian packages." 1>&2
    1.23 +  exit 0
    1.24 +fi
    1.25 +
    1.26 +# Double-check we're in the packages directory, just under rootdir
    1.27 +if [ \! -r ../Makefile -a \! -r ../INSTALL ]; then
    1.28 +  echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2
    1.29 +  echo "Also, you must run \"make dist\" before running this script." 1>&2
    1.30 +  exit 0
    1.31 +fi
    1.32 +
    1.33 +# Find the top directory for this package
    1.34 +topdir="${PWD%/*}"
    1.35 +
    1.36 +# Find the tar archive built by "make dist"
    1.37 +archive="$PACKAGE-$VERSION"
    1.38 +if [ -z "${archive}" ]; then
    1.39 +  echo "Cannot find ../$PACKAGE*.tar.gz. Run \"make dist\" first." 1>&2
    1.40 +  exit 0
    1.41 +fi
    1.42 +
    1.43 +# Create a pristine directory for building the Debian package files
    1.44 +trap 'rm -rf '`pwd`/tmp'; exit $?' EXIT SIGHUP SIGINT SIGTERM
    1.45 +
    1.46 +rm -rf tmp
    1.47 +mkdir -p tmp
    1.48 +cd tmp
    1.49 +
    1.50 +# Debian has very specific requirements about the naming of build
    1.51 +# directories, and tar archives. It also wants to write all generated
    1.52 +# packages to the parent of the source directory. We accommodate these
    1.53 +# requirements by building directly from the tar file.
    1.54 +ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive}.orig.tar.gz"
    1.55 +tar zfx "${LIB}${archive}.orig.tar.gz"
    1.56 +[ -n "${LIB}" ] && mv "${archive}" "${LIB}${archive}"
    1.57 +cd "${LIB}${archive}"
    1.58 +# This is one of those 'specific requirements': where the deb control files live
    1.59 +ln -s "packages/deb" "debian"
    1.60 +
    1.61 +# Now, we can call Debian's standard build tool
    1.62 +debuild -uc -us
    1.63 +cd ../..                            # get back to the original top-level dir
    1.64 +
    1.65 +# We'll put the result in a subdirectory that's named after the OS version
    1.66 +# we've made this .deb file for.
    1.67 +destdir="debian-$(cat /etc/debian_version 2>/dev/null || echo UNKNOWN)"
    1.68 +
    1.69 +rm -rf "$destdir"
    1.70 +mkdir -p "$destdir"
    1.71 +mv $(find tmp -mindepth 1 -maxdepth 1 -type f) "$destdir"
    1.72 +
    1.73 +echo
    1.74 +echo "The Debian package files are located in $PWD/$destdir"

mercurial