Browse Source
Update deb build script
Update deb build script
Now build script is able to auto detect system and choose libraries necessary to build. Also update the README accordingly.pull/1379/head
committed by
Max Lv
4 changed files with 164 additions and 134 deletions
Unified View
Diff Options
@ -0,0 +1,160 @@ |
|||||
|
#!/bin/sh |
||||
|
# Copyright 2017 Roger Shimizu <rogershimizu@gmail.com> |
||||
|
# |
||||
|
# This is free software; you can redistribute it and/or modify |
||||
|
# it under the terms of the GNU General Public License as published by |
||||
|
# the Free Software Foundation; either version 3 of the License, or |
||||
|
# (at your option) any later version. |
||||
|
|
||||
|
if [ -d .git ]; then |
||||
|
echo Please run this script in a clean place. |
||||
|
echo e.g. |
||||
|
echo " mkdir -p ~/build-area/" |
||||
|
echo " cp $0 ~/build-area/" |
||||
|
echo " cd ~/build-area" |
||||
|
echo " ./$(basename $0)" |
||||
|
exit |
||||
|
fi |
||||
|
|
||||
|
apt_init() { |
||||
|
DEPS="git-buildpackage equivs" |
||||
|
sudo apt-get update |
||||
|
sudo apt-get install -y $DEPS |
||||
|
} |
||||
|
|
||||
|
# Cleanup |
||||
|
apt_clean() { |
||||
|
sudo apt-get purge -y $DEPS $DEPS_BPO shadowsocks-libev-build-deps \ |
||||
|
libcork-dev libcorkipset-dev debhelper |
||||
|
sudo apt-get purge -y libcork-build-deps libcorkipset-build-deps |
||||
|
sudo apt-get purge -y mbedtls-build-deps libmbedtls-dev |
||||
|
sudo apt-get purge -y libsodium-build-deps libsodium-dev |
||||
|
sudo apt-get autoremove -y |
||||
|
} |
||||
|
|
||||
|
gbp_build() { |
||||
|
REPO=$1 |
||||
|
BRANCH=$2 |
||||
|
PROJECT_NAME=$(basename $1|sed s/\.git$//) |
||||
|
gbp clone --pristine-tar $REPO |
||||
|
cd $PROJECT_NAME |
||||
|
git checkout $BRANCH |
||||
|
mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" |
||||
|
rm ${PROJECT_NAME}-build-deps_*.deb |
||||
|
gbp buildpackage -us -uc --git-ignore-branch --git-pristine-tar |
||||
|
git clean -fdx |
||||
|
git reset --hard HEAD |
||||
|
cd - |
||||
|
} |
||||
|
|
||||
|
dsc_build() { |
||||
|
DSC=$1 |
||||
|
DSC_FILE=$(basename $1) |
||||
|
dget -ux $DSC |
||||
|
PROJECT_NAME=$(grep ^Source: $DSC_FILE|cut -d" " -f2) |
||||
|
echo cd ${PROJECT_NAME}-* |
||||
|
cd ${PROJECT_NAME}-* |
||||
|
mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" |
||||
|
rm ${PROJECT_NAME}-build-deps_*.deb |
||||
|
dpkg-buildpackage -us -uc |
||||
|
cd - |
||||
|
} |
||||
|
|
||||
|
# Build and install libcork deb |
||||
|
build_install_libcork() { |
||||
|
BRANCH=$1 |
||||
|
gbp_build https://github.com/rogers0/libcork $BRANCH |
||||
|
sudo dpkg -i libcork-dev_*.deb libcork16_*.deb |
||||
|
} |
||||
|
|
||||
|
# Build and install libcorkipset deb |
||||
|
build_install_libcorkipset() { |
||||
|
BRANCH=$1 |
||||
|
gbp_build https://github.com/rogers0/libcorkipset $BRANCH |
||||
|
sudo dpkg -i libcorkipset-dev_*.deb libcorkipset1_*.deb |
||||
|
} |
||||
|
|
||||
|
# Build libmbedtls deb |
||||
|
build_install_libmbedtls() { |
||||
|
gbp_build https://anonscm.debian.org/cgit/collab-maint/mbedtls.git debian/jessie-backports |
||||
|
sudo dpkg -i libmbed*.deb |
||||
|
} |
||||
|
|
||||
|
# Build libsodium deb |
||||
|
build_install_libsodium() { |
||||
|
dsc_build http://httpredir.debian.org/debian/pool/main/libs/libsodium/libsodium_1.0.11-1~bpo8+1.dsc |
||||
|
sudo dpkg -i libsodium*.deb |
||||
|
} |
||||
|
|
||||
|
# Add patch to work on system with debhelper 9 only |
||||
|
patch_sslibev_dh9() { |
||||
|
gbp clone --pristine-tar https://anonscm.debian.org/git/collab-maint/shadowsocks-libev.git |
||||
|
cd shadowsocks-libev |
||||
|
sed -i 's/dh $@/dh $@ --with systemd,autoreconf/' debian/rules |
||||
|
sed -i 's/debhelper (>= 10)/debhelper (>= 9), dh-systemd, dh-autoreconf/' debian/control |
||||
|
echo 9 > debian/compat |
||||
|
git add -u |
||||
|
git commit -m "Patch to work with ubuntu trusty (14.04)" |
||||
|
cd - |
||||
|
} |
||||
|
|
||||
|
# Build and install shadowsocks-libev deb |
||||
|
build_install_sslibev() { |
||||
|
gbp_build https://anonscm.debian.org/git/collab-maint/shadowsocks-libev.git master |
||||
|
sudo dpkg -i shadowsocks-libev_*.deb |
||||
|
sudo apt-get install -fy |
||||
|
} |
||||
|
|
||||
|
OSID=$(grep ^ID= /etc/os-release|cut -d= -f2) |
||||
|
case "$OSID" in |
||||
|
debian) |
||||
|
OSVER=$(grep ^VERSION= /etc/os-release|cut -d\( -f2|cut -d\) -f1) |
||||
|
;; |
||||
|
ubuntu) |
||||
|
OSVER=$(grep DISTRIB_CODENAME /etc/lsb-release|cut -d= -f2) |
||||
|
;; |
||||
|
*) |
||||
|
OSVER=unknown |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
case "$OSVER" in |
||||
|
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" |
||||
|
;; |
||||
|
stretch|unstable|sid|yakkety) |
||||
|
echo Please install from official repository: |
||||
|
echo " apt install shadowsocks-libev" |
||||
|
;; |
||||
|
trusty) |
||||
|
apt_init |
||||
|
build_install_libcork trusty |
||||
|
build_install_libcorkipset trusty |
||||
|
build_install_libmbedtls |
||||
|
build_install_libsodium |
||||
|
patch_sslibev_dh9 |
||||
|
build_install_sslibev |
||||
|
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 |
||||
|
build_install_libcork debian |
||||
|
build_install_libcorkipset debian |
||||
|
build_install_sslibev |
||||
|
apt_clean |
||||
|
;; |
||||
|
*) |
||||
|
echo Your system $OSID/$OSVER is not supported yet. |
||||
|
echo Please report issue: |
||||
|
echo " https://github.com/shadowsocks/shadowsocks-libev/issues/new" |
||||
|
;; |
||||
|
esac |
@ -1,72 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
# Copyright 2017 Roger Shimizu <rogershimizu@gmail.com> |
|
||||
# |
|
||||
# This is free software; you can redistribute it and/or modify |
|
||||
# it under the terms of the GNU General Public License as published by |
|
||||
# the Free Software Foundation; either version 3 of the License, or |
|
||||
# (at your option) any later version. |
|
||||
|
|
||||
DEPS="git-buildpackage equivs" |
|
||||
sudo apt-get install -y $DEPS |
|
||||
|
|
||||
gbp_build() { |
|
||||
REPO=$1 |
|
||||
BRANCH=$2 |
|
||||
PROJECT_NAME=$(basename $1|sed s/\.git$//) |
|
||||
gbp clone --pristine-tar $REPO |
|
||||
cd $PROJECT_NAME |
|
||||
git checkout $BRANCH |
|
||||
mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" |
|
||||
rm ${PROJECT_NAME}-build-deps_*.deb |
|
||||
gbp buildpackage -us -uc --git-ignore-branch --git-pristine-tar |
|
||||
cd - |
|
||||
} |
|
||||
|
|
||||
dsc_build() { |
|
||||
DSC=$1 |
|
||||
DSC_FILE=$(basename $1) |
|
||||
dget -ux $DSC |
|
||||
PROJECT_NAME=$(grep ^Source: $DSC_FILE|cut -d" " -f2) |
|
||||
echo cd ${PROJECT_NAME}-* |
|
||||
cd ${PROJECT_NAME}-* |
|
||||
mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" |
|
||||
rm ${PROJECT_NAME}-build-deps_*.deb |
|
||||
dpkg-buildpackage -us -uc |
|
||||
cd - |
|
||||
} |
|
||||
|
|
||||
# Build libcork deb if you don't have |
|
||||
gbp_build https://github.com/rogers0/libcork trusty |
|
||||
sudo dpkg -i libcork-dev_*.deb libcork16_*.deb |
|
||||
|
|
||||
# Build libcorkipset deb if you don't have |
|
||||
gbp_build https://github.com/rogers0/libcorkipset trusty |
|
||||
sudo dpkg -i libcorkipset-dev_*.deb libcorkipset1_*.deb |
|
||||
|
|
||||
# Build libmbedtls deb if you don't have |
|
||||
gbp_build https://anonscm.debian.org/cgit/collab-maint/mbedtls.git debian/jessie-backports |
|
||||
sudo dpkg -i libmbed*.deb |
|
||||
|
|
||||
# Build libsodium deb if you don't have |
|
||||
dsc_build http://httpredir.debian.org/debian/pool/main/libs/libsodium/libsodium_1.0.11-1~bpo8+1.dsc |
|
||||
sudo dpkg -i libsodium*.deb |
|
||||
|
|
||||
# Build shadowsocks-libev |
|
||||
gbp clone --pristine-tar https://anonscm.debian.org/git/collab-maint/shadowsocks-libev.git |
|
||||
# Add patch to work with ubuntu trusty (14.04) |
|
||||
cd shadowsocks-libev |
|
||||
sed -i 's/dh $@/dh $@ --with systemd,autoreconf/' debian/rules |
|
||||
sed -i 's/debhelper (>= 10)/debhelper (>= 9), dh-systemd, dh-autoreconf/' debian/control |
|
||||
echo 9 > debian/compat |
|
||||
git add -u |
|
||||
git commit -m "Patch to work with ubuntu trusty (14.04)" |
|
||||
cd - |
|
||||
gbp_build https://anonscm.debian.org/git/collab-maint/shadowsocks-libev.git master |
|
||||
sudo dpkg -i shadowsocks-libev_*.deb |
|
||||
sudo apt-get install -fy |
|
||||
|
|
||||
# Cleanup |
|
||||
sudo apt-get purge -y libcork-build-deps libcorkipset-build-deps shadowsocks-libev-build-deps \ |
|
||||
mbedtls-build-deps libsodium-build-deps \ |
|
||||
$DEPS libcork-dev libcorkipset-dev libmbedtls-dev libsodium-dev debhelper |
|
||||
sudo apt-get autoremove -y |
|
@ -1,59 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
# Copyright 2017 Roger Shimizu <rogershimizu@gmail.com> |
|
||||
# |
|
||||
# This is free software; you can redistribute it and/or modify |
|
||||
# it under the terms of the GNU General Public License as published by |
|
||||
# the Free Software Foundation; either version 3 of the License, or |
|
||||
# (at your option) any later version. |
|
||||
|
|
||||
DEPS="git-buildpackage equivs" |
|
||||
sudo apt-get install -y $DEPS |
|
||||
|
|
||||
gbp_build() { |
|
||||
REPO=$1 |
|
||||
BRANCH=$2 |
|
||||
PROJECT_NAME=$(basename $1|sed s/\.git$//) |
|
||||
gbp clone --pristine-tar $REPO |
|
||||
cd $PROJECT_NAME |
|
||||
git checkout $BRANCH |
|
||||
mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" |
|
||||
rm ${PROJECT_NAME}-build-deps_*.deb |
|
||||
gbp buildpackage -us -uc --git-ignore-branch --git-pristine-tar |
|
||||
cd - |
|
||||
} |
|
||||
|
|
||||
dsc_build() { |
|
||||
DSC=$1 |
|
||||
DSC_FILE=$(basename $1) |
|
||||
dget -ux $DSC |
|
||||
PROJECT_NAME=$(grep ^Source: $DSC_FILE|cut -d" " -f2) |
|
||||
echo cd ${PROJECT_NAME}-* |
|
||||
cd ${PROJECT_NAME}-* |
|
||||
mk-build-deps --root-cmd sudo --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" |
|
||||
rm ${PROJECT_NAME}-build-deps_*.deb |
|
||||
dpkg-buildpackage -us -uc |
|
||||
cd - |
|
||||
} |
|
||||
|
|
||||
# Build libcork deb if you don't have |
|
||||
gbp_build https://github.com/rogers0/libcork debian |
|
||||
sudo dpkg -i libcork-dev_*.deb libcork16_*.deb |
|
||||
|
|
||||
# Build libcorkipset deb if you don't have |
|
||||
gbp_build https://github.com/rogers0/libcorkipset debian |
|
||||
sudo dpkg -i libcorkipset-dev_*.deb libcorkipset1_*.deb |
|
||||
|
|
||||
# Build shadowsocks-libev |
|
||||
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 |
|
||||
gbp_build https://anonscm.debian.org/git/collab-maint/shadowsocks-libev.git master |
|
||||
sudo dpkg -i shadowsocks-libev_*.deb |
|
||||
sudo apt-get install -fy |
|
||||
|
|
||||
# Cleanup |
|
||||
sudo apt-get purge -y libcork-build-deps libcorkipset-build-deps shadowsocks-libev-build-deps \ |
|
||||
$DEPS $DEPS_BPO libcork-dev libcorkipset-dev |
|
||||
sudo apt-get autoremove -y |
|
Write
Preview
Loading…
Cancel
Save