build-debian-package.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. ## Usage:
  3. ## ./zcutil/build-debian-package.sh
  4. set -e
  5. set -x
  6. BUILD_PATH="/tmp/zcbuild"
  7. PACKAGE_NAME="zcash"
  8. SRC_PATH=`pwd`
  9. SRC_DEB=$SRC_PATH/contrib/DEBIAN
  10. umask 022
  11. if [ ! -d $BUILD_PATH ]; then
  12. mkdir $BUILD_PATH
  13. fi
  14. PACKAGE_VERSION=$(grep Version $SRC_PATH/contrib/DEBIAN/control | cut -d: -f2 | tr -d ' ')
  15. BUILD_DIR="$BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64"
  16. if [ -d $BUILD_DIR ]; then
  17. rm -R $BUILD_DIR
  18. fi
  19. DEB_BIN=$BUILD_DIR/usr/bin
  20. DEB_DOC=$BUILD_DIR/usr/share/doc/$PACKAGE_NAME
  21. DEB_MAN=$BUILD_DIR/usr/share/man/man1
  22. mkdir -p $BUILD_DIR/DEBIAN $DEB_BIN $DEB_DOC $DEB_MAN
  23. chmod 0755 -R $BUILD_DIR/*
  24. # Copy control file
  25. cp $SRC_DEB/control $BUILD_DIR/DEBIAN
  26. # Package maintainer scripts (currently empty)
  27. #cp $SRC_DEB/postinst $BUILD_DIR/DEBIAN
  28. #cp $SRC_DEB/postrm $BUILD_DIR/DEBIAN
  29. #cp $SRC_DEB/preinst $BUILD_DIR/DEBIAN
  30. #cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN
  31. # Copy binaries
  32. cp $SRC_PATH/src/zcashd $DEB_BIN
  33. cp $SRC_PATH/src/zcash-cli $DEB_BIN
  34. cp $SRC_PATH/zcutil/fetch-params.sh $DEB_BIN/zcash-fetch-params
  35. # Copy docs
  36. cp $SRC_PATH/doc/release-notes/release-notes-1.0.0.md $DEB_DOC/changelog
  37. cp $SRC_DEB/changelog $DEB_DOC/changelog.Debian
  38. cp $SRC_DEB/copyright $DEB_DOC
  39. cp -r $SRC_DEB/examples $DEB_DOC
  40. # Copy manpages
  41. cp $SRC_DEB/manpages/zcashd.1 $DEB_MAN
  42. cp $SRC_DEB/manpages/zcash-cli.1 $DEB_MAN
  43. # Gzip files
  44. gzip --best -n $DEB_DOC/changelog
  45. gzip --best -n $DEB_DOC/changelog.Debian
  46. gzip --best -n $DEB_MAN/zcashd.1
  47. gzip --best -n $DEB_MAN/zcash-cli.1
  48. # Create the Debian package
  49. fakeroot dpkg-deb --build $BUILD_DIR
  50. cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64.deb $SRC_PATH
  51. # Analyze with Lintian, reporting bugs and policy violations
  52. lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-amd64.deb
  53. exit 0