Skip to content

Commit 9185afb

Browse files
rogers0madeye
authored andcommitted
Update build script to enable jessie/stretch etc
Also include a few cleanup that simplified pkg installation from backports repository.
1 parent 67661fb commit 9185afb

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ If you insist on building from source, you will need to manually install libsodi
128128
from `jessie-backports`, **NOT** libsodium in main repository.
129129
Please follow the instructions on [Debian Backports Website](https://backports.debian.org).
130130

131-
**Note for Ubuntu 14.04 (Trusty) / 16.04 (Xenial) users**:
131+
You can also use the same build script for Ubuntu LTS as below.
132+
133+
**Note for Debian (>=8) / Ubuntu 14.04 (Trusty) / 16.04 (Xenial) users**:
132134
You can build shadowsocks-libev and all its dependencies by script:
133135

134136
```bash

debian/copyright

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Files: m4/stack-protector.m4
3737
Copyright: 2007 Google Inc.
3838
License: Apache-2.0
3939

40-
Files: scripts/deb4*.sh
40+
Files: scripts/build_deb.sh
4141
Copyright: 2017 Roger Shimizu <[email protected]>
4242
License: GPL-3+
4343

scripts/build_deb.sh

+26-13
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,24 @@ if [ -d .git ]; then
1717
fi
1818

1919
apt_init() {
20-
DEPS="git-buildpackage equivs"
21-
sudo apt-get update
20+
DEPS="$1"
21+
DEPS_BPO="$2"
22+
if [ -n "$DEPS_BPO" ]; then
23+
BPO=${OSVER}-backports
24+
case "$OSID" in
25+
debian)
26+
REPO=http://httpredir.debian.org/debian
27+
;;
28+
ubuntu)
29+
REPO=http://archive.ubuntu.com/ubuntu
30+
;;
31+
esac
32+
sudo sh -c "printf \"deb $REPO ${OSVER}-backports main\" > /etc/apt/sources.list.d/${OSVER}-backports.list"
33+
sudo apt-get update
34+
sudo apt-get install -y -t $BPO $DEPS_BPO
35+
else
36+
sudo apt-get update
37+
fi
2238
sudo apt-get install -y $DEPS
2339
}
2440

@@ -123,15 +139,17 @@ wheezy|precise)
123139
echo Sorry, your system $OSID/$OSVER is not supported.
124140
;;
125141
jessie)
126-
echo Please install from official backports repository:
127-
echo " apt install -t jessie-backports shadowsocks-libev"
142+
apt_init "git-buildpackage equivs" "debhelper libsodium-dev"
143+
build_install_sslibev
144+
apt_clean
128145
;;
129146
stretch|unstable|sid|yakkety)
130-
echo Please install from official repository:
131-
echo " apt install shadowsocks-libev"
147+
apt_init "git-buildpackage equivs"
148+
build_install_sslibev
149+
apt_clean
132150
;;
133151
trusty)
134-
apt_init
152+
apt_init "git-buildpackage equivs"
135153
build_install_libcork trusty
136154
build_install_libcorkipset trusty
137155
build_install_libmbedtls
@@ -141,12 +159,7 @@ trusty)
141159
apt_clean
142160
;;
143161
xenial)
144-
DEPS_BPO="debhelper"
145-
BPO=xenial-backports
146-
sudo sh -c 'printf "deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse" > /etc/apt/sources.list.d/xenial-backports.list'
147-
sudo apt-get update
148-
sudo apt-get install -y -t $BPO $DEPS_BPO
149-
apt_init
162+
apt_init "git-buildpackage equivs" debhelper
150163
build_install_libcork debian
151164
build_install_libcorkipset debian
152165
build_install_sslibev

0 commit comments

Comments
 (0)