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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #!/bin/bash -e
michael@0 2
michael@0 3 # This takes one commandline argument, the name of the package. If no
michael@0 4 # name is given, then we'll end up just using the name associated with
michael@0 5 # an arbitrary .tar.gz file in the rootdir. That's fine: there's probably
michael@0 6 # only one.
michael@0 7 #
michael@0 8 # Run this from the 'packages' directory, just under rootdir
michael@0 9
michael@0 10 ## Set LIB to lib if exporting a library, empty-string else
michael@0 11 LIB=
michael@0 12 #LIB=lib
michael@0 13
michael@0 14 PACKAGE="$1"
michael@0 15 VERSION="$2"
michael@0 16
michael@0 17 # We can only build Debian packages, if the Debian build tools are installed
michael@0 18 if [ \! -x /usr/bin/debuild ]; then
michael@0 19 echo "Cannot find /usr/bin/debuild. Not building Debian packages." 1>&2
michael@0 20 exit 0
michael@0 21 fi
michael@0 22
michael@0 23 # Double-check we're in the packages directory, just under rootdir
michael@0 24 if [ \! -r ../Makefile -a \! -r ../INSTALL ]; then
michael@0 25 echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2
michael@0 26 echo "Also, you must run \"make dist\" before running this script." 1>&2
michael@0 27 exit 0
michael@0 28 fi
michael@0 29
michael@0 30 # Find the top directory for this package
michael@0 31 topdir="${PWD%/*}"
michael@0 32
michael@0 33 # Find the tar archive built by "make dist"
michael@0 34 archive="$PACKAGE-$VERSION"
michael@0 35 if [ -z "${archive}" ]; then
michael@0 36 echo "Cannot find ../$PACKAGE*.tar.gz. Run \"make dist\" first." 1>&2
michael@0 37 exit 0
michael@0 38 fi
michael@0 39
michael@0 40 # Create a pristine directory for building the Debian package files
michael@0 41 trap 'rm -rf '`pwd`/tmp'; exit $?' EXIT SIGHUP SIGINT SIGTERM
michael@0 42
michael@0 43 rm -rf tmp
michael@0 44 mkdir -p tmp
michael@0 45 cd tmp
michael@0 46
michael@0 47 # Debian has very specific requirements about the naming of build
michael@0 48 # directories, and tar archives. It also wants to write all generated
michael@0 49 # packages to the parent of the source directory. We accommodate these
michael@0 50 # requirements by building directly from the tar file.
michael@0 51 ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive}.orig.tar.gz"
michael@0 52 tar zfx "${LIB}${archive}.orig.tar.gz"
michael@0 53 [ -n "${LIB}" ] && mv "${archive}" "${LIB}${archive}"
michael@0 54 cd "${LIB}${archive}"
michael@0 55 # This is one of those 'specific requirements': where the deb control files live
michael@0 56 ln -s "packages/deb" "debian"
michael@0 57
michael@0 58 # Now, we can call Debian's standard build tool
michael@0 59 debuild -uc -us
michael@0 60 cd ../.. # get back to the original top-level dir
michael@0 61
michael@0 62 # We'll put the result in a subdirectory that's named after the OS version
michael@0 63 # we've made this .deb file for.
michael@0 64 destdir="debian-$(cat /etc/debian_version 2>/dev/null || echo UNKNOWN)"
michael@0 65
michael@0 66 rm -rf "$destdir"
michael@0 67 mkdir -p "$destdir"
michael@0 68 mv $(find tmp -mindepth 1 -maxdepth 1 -type f) "$destdir"
michael@0 69
michael@0 70 echo
michael@0 71 echo "The Debian package files are located in $PWD/$destdir"

mercurial