diff --git a/README.md b/README.md index 69295937..a6936a7b 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,9 @@ If you insist on building from source, you will need to manually install libsodi from `jessie-backports`, **NOT** libsodium in main repository. Please follow the instructions on [Debian Backports Website](https://backports.debian.org). -**Note for Ubuntu 14.04 (Trusty) / 16.04 (Xenial) users**: +You can also use the same build script for Ubuntu LTS as below. + +**Note for Debian (>=8) / Ubuntu 14.04 (Trusty) / 16.04 (Xenial) users**: You can build shadowsocks-libev and all its dependencies by script: ```bash diff --git a/debian/copyright b/debian/copyright index 9c572701..a9ee2635 100644 --- a/debian/copyright +++ b/debian/copyright @@ -37,7 +37,7 @@ Files: m4/stack-protector.m4 Copyright: 2007 Google Inc. License: Apache-2.0 -Files: scripts/deb4*.sh +Files: scripts/build_deb.sh Copyright: 2017 Roger Shimizu License: GPL-3+ diff --git a/scripts/build_deb.sh b/scripts/build_deb.sh index 1ca5663b..18ff0de6 100755 --- a/scripts/build_deb.sh +++ b/scripts/build_deb.sh @@ -17,8 +17,24 @@ if [ -d .git ]; then fi apt_init() { - DEPS="git-buildpackage equivs" - sudo apt-get update + DEPS="$1" + DEPS_BPO="$2" + if [ -n "$DEPS_BPO" ]; then + BPO=${OSVER}-backports + case "$OSID" in + debian) + REPO=http://httpredir.debian.org/debian + ;; + ubuntu) + REPO=http://archive.ubuntu.com/ubuntu + ;; + esac + sudo sh -c "printf \"deb $REPO ${OSVER}-backports main\" > /etc/apt/sources.list.d/${OSVER}-backports.list" + sudo apt-get update + sudo apt-get install -y -t $BPO $DEPS_BPO + else + sudo apt-get update + fi sudo apt-get install -y $DEPS } @@ -123,15 +139,17 @@ wheezy|precise) echo Sorry, your system $OSID/$OSVER is not supported. ;; jessie) - echo Please install from official backports repository: - echo " apt install -t jessie-backports shadowsocks-libev" + apt_init "git-buildpackage equivs" "debhelper libsodium-dev" + build_install_sslibev + apt_clean ;; stretch|unstable|sid|yakkety) - echo Please install from official repository: - echo " apt install shadowsocks-libev" + apt_init "git-buildpackage equivs" + build_install_sslibev + apt_clean ;; trusty) - apt_init + apt_init "git-buildpackage equivs" build_install_libcork trusty build_install_libcorkipset trusty build_install_libmbedtls @@ -141,12 +159,7 @@ trusty) apt_clean ;; xenial) - DEPS_BPO="debhelper" - BPO=xenial-backports - sudo sh -c 'printf "deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse" > /etc/apt/sources.list.d/xenial-backports.list' - sudo apt-get update - sudo apt-get install -y -t $BPO $DEPS_BPO - apt_init + apt_init "git-buildpackage equivs" debhelper build_install_libcork debian build_install_libcorkipset debian build_install_sslibev