/thirdparty/breakpad/third_party/glog/packages/deb.sh

http://github.com/tomahawk-player/tomahawk · Shell · 71 lines · 35 code · 14 blank · 22 comment · 5 complexity · 5429391f8cda528c906e83d20e4a9f25 MD5 · raw file

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