You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.5 KiB

  1. #!/bin/sh
  2. # Copyright 2017 Roger Shimizu <rogershimizu@gmail.com>
  3. #
  4. # This is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. DEPS="git-buildpackage equivs"
  9. sudo apt-get install -y $DEPS
  10. gbp_build() {
  11. REPO=$1
  12. BRANCH=$2
  13. PROJECT_NAME=$(basename $1|sed s/\.git$//)
  14. gbp clone --pristine-tar $REPO
  15. cd $PROJECT_NAME
  16. git checkout $BRANCH
  17. mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
  18. rm ${PROJECT_NAME}-build-deps_*.deb
  19. gbp buildpackage -us -uc --git-ignore-branch --git-pristine-tar
  20. cd -
  21. }
  22. dsc_build() {
  23. DSC=$1
  24. DSC_FILE=$(basename $1)
  25. dget -ux $DSC
  26. PROJECT_NAME=$(grep ^Source: $DSC_FILE|cut -d" " -f2)
  27. echo cd ${PROJECT_NAME}-*
  28. cd ${PROJECT_NAME}-*
  29. mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
  30. rm ${PROJECT_NAME}-build-deps_*.deb
  31. dpkg-buildpackage -us -uc
  32. cd -
  33. }
  34. # Build libcork deb if you don't have
  35. gbp_build https://github.com/rogers0/libcork trusty
  36. sudo dpkg -i libcork-dev_*.deb libcork16_*.deb
  37. # Build libcorkipset deb if you don't have
  38. gbp_build https://github.com/rogers0/libcorkipset trusty
  39. sudo dpkg -i libcorkipset-dev_*.deb libcorkipset1_*.deb
  40. # Build libmbedtls deb if you don't have
  41. gbp_build https://anonscm.debian.org/cgit/collab-maint/mbedtls.git debian/jessie-backports
  42. sudo dpkg -i libmbed*.deb
  43. # Build libsodium deb if you don't have
  44. dsc_build http://httpredir.debian.org/debian/pool/main/libs/libsodium/libsodium_1.0.11-1~bpo8+1.dsc
  45. sudo dpkg -i libsodium*.deb
  46. # Build shadowsocks-libev
  47. gbp clone --pristine-tar https://anonscm.debian.org/git/collab-maint/shadowsocks-libev.git
  48. # Add patch to work with ubuntu trusty (14.04)
  49. cd shadowsocks-libev
  50. sed -i 's/dh $@/dh $@ --with systemd,autoreconf/' debian/rules
  51. sed -i 's/debhelper (>= 10)/debhelper (>= 9), dh-systemd, dh-autoreconf/' debian/control
  52. echo 9 > debian/compat
  53. git add -u
  54. git commit -m "Patch to work with ubuntu trusty (14.04)"
  55. cd -
  56. gbp_build https://anonscm.debian.org/git/collab-maint/shadowsocks-libev.git master
  57. sudo dpkg -i shadowsocks-libev_*.deb
  58. sudo apt-get install -fy
  59. # Cleanup
  60. sudo apt-get purge -y libcork-build-deps libcorkipset-build-deps shadowsocks-libev-build-deps \
  61. mbedtls-build-deps libsodium-build-deps \
  62. $DEPS libcork-dev libcorkipset-dev libmbedtls-dev libsodium-dev debhelper
  63. sudo apt-get autoremove -y