make_duplicity.sh 2.38 KB
Newer Older
1
#!/usr/bin/env bash
2
# Copyright (C) 2015-2016 GRNET S.A.
3 4 5 6 7 8 9 10 11 12 13 14 15 16
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

17 18 19 20
OS_NAME=$(uname -s)
if [ $? -ne 0 ]; then
    OS_NAME=$(/bin/uname -s)
fi
21
OS_NAME=${OS_NAME:0:6}
22

23 24 25
if [[ "$OS_NAME" = "CYGWIN" ]]
then
    export PATH=/usr/bin:$PATH
26 27 28 29
fi

cd "$(dirname "$0")"
ROOTPATH=$(pwd)
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
BUILDDIR=$ROOTPATH/build
mkdir -p $BUILDDIR

if [ -z "$1" ]
  then
    echo "Downloading duplicity"
    cd $BUILDDIR
    rm -rf duplicity-0.7.05*
    wget https://launchpad.net/duplicity/0.7-series/0.7.05/+download/duplicity-0.7.05.tar.gz
    tar xzvf duplicity-0.7.05.tar.gz
    cd duplicity-0.7.05
    SRCPATH=$(pwd)
  else
    cd $1
    SRCPATH=$(pwd)
fi

47 48 49 50 51 52 53
cd $ROOTPATH
echo $(pwd)
echo $SRCPATH

DUPL=$BUILDDIR/duplicity
echo building under $DUPL
rm -rf $DUPL
54
mkdir -p $DUPL/lib
55
WHEELHOUSE=$DUPL/wheelhouse
56
mkdir $WHEELHOUSE
57

58 59
easy_install-2.7 pip
pip install wheel
60 61 62 63 64 65 66 67 68 69 70 71 72
pip wheel lockfile -w $WHEELHOUSE
if [ $? -ne 0 ]; then
    exit 1
fi
pip wheel python-swiftclient -w $WHEELHOUSE

cd $WHEELHOUSE
for i in *; do unzip $i -d $DUPL/lib; done
cd $DUPL
rm -r $WHEELHOUSE

cd $SRCPATH
rm -rf build
73 74
patch -N -p0 < $ROOTPATH/src/duplicity-patches/timeview.patch
patch -N -p0 < $ROOTPATH/src/duplicity-patches/syspath.patch
75
patch -N -p0 < $ROOTPATH/src/duplicity-patches/cacert.patch
76
patch -N -p0 < $ROOTPATH/src/duplicity-patches/setrlimit.patch
77
LIBRSYNC_DIR=/usr/local python setup.py build --executable="/usr/bin/env python"
78
cd build/lib.*
79 80 81 82
cp -pr * $DUPL/lib
cd ../scripts-2.7
cp -p duplicity $DUPL

83 84 85 86 87 88 89 90 91 92
if [[ "$OS_NAME" = "Darwin" ]]
then
    cd $DUPL/lib/duplicity
    LIBRSYNC=librsync.2.dylib
    LIBRSYNC_PATH=/usr/local/opt/librsync/lib/$LIBRSYNC
    cp $LIBRSYNC_PATH .
    chmod +w $LIBRSYNC
    install_name_tool -change $LIBRSYNC_PATH @loader_path/$LIBRSYNC _librsync.so
fi

93 94
echo built in $DUPL
echo must be used with PYTHONPATH=$DUPL/lib