.pbuilderrc 7.8 KB
Newer Older
1
# ubuntu:
P
proller 已提交
2 3 4
# prepare old (trusty or earlier) host system:
# sudo ln -s gutsy /usr/share/debootstrap/scripts/artful
# sudo ln -s gutsy /usr/share/debootstrap/scripts/bionic
P
proller 已提交
5
# build ubuntu:
6
# sudo DIST=trusty pbuilder create --configfile debian/.pbuilderrc && DIST=trusty pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
7
# sudo DIST=xenial pbuilder create --configfile debian/.pbuilderrc && DIST=xenial pdebuild --configfile debian/.pbuilderrc
8
# sudo DIST=zesty  pbuilder create --configfile debian/.pbuilderrc && DIST=zesty  pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
9
# sudo DIST=artful pbuilder create --configfile debian/.pbuilderrc && DIST=artful pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
10 11
# sudo DIST=bionic pbuilder create --configfile debian/.pbuilderrc && DIST=bionic pdebuild --configfile debian/.pbuilderrc
# sudo DIST=devel  pbuilder create --configfile debian/.pbuilderrc && DIST=devel  pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
12
# build debian:
13
# sudo DIST=stable       pbuilder create --configfile debian/.pbuilderrc && DIST=stable       pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
14
# sudo DIST=testing      pbuilder create --configfile debian/.pbuilderrc && DIST=testing      pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
15
# sudo DIST=unstable     pbuilder create --configfile debian/.pbuilderrc && DIST=unstable     pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
16 17 18
# sudo DIST=experimental pbuilder create --configfile debian/.pbuilderrc && DIST=experimental pdebuild --configfile debian/.pbuilderrc
# build i386 experimental:
# sudo DIST=trusty       ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=trusty       ARCH=i386 pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
19
# sudo DIST=xenial       ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=xenial       ARCH=i386 pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
20 21
# sudo DIST=zesty        ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=zesty        ARCH=i386 pdebuild --configfile debian/.pbuilderrc
# sudo DIST=artful       ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=artful       ARCH=i386 pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
22
# sudo DIST=bionic       ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=bionic       ARCH=i386 pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
23 24 25
# sudo DIST=stable       ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=stable       ARCH=i386 pdebuild --configfile debian/.pbuilderrc
# sudo DIST=testing      ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=testing      ARCH=i386 pdebuild --configfile debian/.pbuilderrc
# sudo DIST=experimental ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=experimental ARCH=i386 pdebuild --configfile debian/.pbuilderrc
26
# use only clang:
P
proller 已提交
27
# env DEB_CC=clang-5.0 DEB_CXX=clang++-5.0 EXTRAPACKAGES="clang-5.0" DIST=artful pdebuild --configfile debian/.pbuilderrc
28
# clang+asan:
P
proller 已提交
29
# env DEB_CC=clang-5.0 DEB_CXX=clang++-5.0 EXTRAPACKAGES="clang-5.0 libc++abi-dev libc++-dev" CMAKE_FLAGS="-DENABLE_TCMALLOC=0 -DENABLE_UNWIND=0 -DCMAKE_BUILD_TYPE=Asan" DIST=artful pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
30
# clang+tsan:
P
proller 已提交
31
# env DEB_CC=clang-5.0 DEB_CXX=clang++-5.0 EXTRAPACKAGES="clang-5.0 libc++abi-dev libc++-dev" CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Tsan" DIST=artful pdebuild --configfile debian/.pbuilderrc
32 33
# without sse for old systems and some VM:
# env DH_VERBOSE=1 CMAKE_FLAGS="-DHAVE_SSE41=0 -DHAVE_SSE42=0 -DHAVE_POPCNT=0 -DHAVE_SSE2_INTRIN=0 -DSSE2FLAG=' ' -DHAVE_SSE42_INTRIN=0 -DSSE4FLAG=' ' -DHAVE_PCLMULQDQ_INTRIN=0 -DPCLMULFLAG=' '" DIST=artful pdebuild --configfile debian/.pbuilderrc
P
proller 已提交
34 35

# Your packages built here: /var/cache/pbuilder/*-*/result
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

# from https://wiki.debian.org/PbuilderTricks :

# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="sid"
TESTING_CODENAME="buster"
STABLE_CODENAME="stretch"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"

# List of Debian suites.
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $STABLE_BACKPORTS_SUITE
    "experimental" "unstable" "testing" "stable")

# List of Ubuntu suites. Update these when needed.
P
proller 已提交
51
UBUNTU_SUITES=("bionic" "artful" "zesty" "xenial" "trusty" "devel")
52 53

# Mirrors to use. Update these to your preferred mirror.
P
proller 已提交
54
DEBIAN_MIRROR="deb.debian.org"
55 56
#UBUNTU_MIRROR="mirrors.kernel.org"

P
proller 已提交
57
#DEBIAN_MIRROR="mirror.yandex.ru"
58
UBUNTU_MIRROR="mirror.yandex.ru"
59

P
proller 已提交
60
# Set a default distribution if none is used. Note that you can set your own default (i.e. ${DIST:="unstable"}).
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
: ${DIST:="$(lsb_release --short --codename)"}

# Optionally change Debian codenames in $DIST to their aliases.
case "$DIST" in
    $UNSTABLE_CODENAME)
        DIST="unstable"
        ;;
    $TESTING_CODENAME)
        DIST="testing"
        ;;
    $STABLE_CODENAME)
        DIST="stable"
        ;;
esac

# Optionally set the architecture to the host architecture if none set. Note
# that you can set your own default (i.e. ${ARCH:="i386"}).
: ${ARCH:="$(dpkg --print-architecture)"}

NAME="$DIST"
if [ -n "${ARCH}" ]; then
    NAME="$NAME-$ARCH"
    DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}")
fi

86 87
BASETGZ=${SET_BASETGZ}
BASETGZ=${BASETGZ:="/var/cache/pbuilder/$NAME-base.tgz"}
88
DISTRIBUTION="$DIST"
89 90
BUILDRESULT=${SET_BUILDRESULT}
BUILDRESULT=${BUILDRESULT:="/var/cache/pbuilder/$NAME/result/"}
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
BUILDPLACE="/var/cache/pbuilder/build/"

if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
    # Debian configuration
    OSNAME=debian
    MIRRORSITE="http://$DEBIAN_MIRROR/$OSNAME/"
    COMPONENTS="main contrib non-free"
    if $(echo "$STABLE_CODENAME stable" | grep -q $DIST); then
        OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE $STABLE_BACKPORTS_SUITE $COMPONENTS"
    fi
    # APTKEYRINGS=/usr/share/keyrings/debian-archive-keyring.gpg
    # sudo apt install debian-archive-keyring
    DEBOOTSTRAPOPTS+=( '--keyring' '/usr/share/keyrings/debian-archive-keyring.gpg' )
elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then
    # Ubuntu configuration
    OSNAME=ubuntu
    MIRRORSITE="http://$UBUNTU_MIRROR/$OSNAME/"
    COMPONENTS="main restricted universe multiverse"
P
proller 已提交
110

P
proller 已提交
111 112 113
    OTHERMIRROR+="deb $MIRRORSITE $DIST-updates main restricted universe multiverse |"
    OTHERMIRROR+="deb $MIRRORSITE $DIST-security main restricted universe multiverse |"

P
proller 已提交
114 115
    case "$DIST" in
       "trusty" | "xenial" )
P
proller 已提交
116
           OTHERMIRROR+="deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/$OSNAME $DIST main |"
P
proller 已提交
117 118 119 120
           ALLOWUNTRUSTED=yes
           ;;
    esac

121 122 123 124 125 126 127 128
    # deb http://apt.llvm.org/zesty/ llvm-toolchain-zesty-5.0 main
else
    echo "Unknown distribution: $DIST"
    exit 1
fi

echo "using $NAME $OSNAME $DIST $ARCH $LOGNAME"

P
proller 已提交
129 130 131 132 133
case "$DIST" in
    "trusty")
        # ccache broken
        ;;
    *)
P
proller 已提交
134
        CCACHEDIR=${CCACHEDIR:="/var/cache/pbuilder/ccache"}
P
proller 已提交
135 136 137
        ;;
esac

P
proller 已提交
138
# old systems with default gcc <= 6
P
proller 已提交
139
case "$DIST" in
P
proller 已提交
140
    "trusty" | "xenial" | "stable" )
P
proller 已提交
141 142 143 144 145
        export DEB_CC=gcc-7
        export DEB_CXX=g++-7
        ;;
esac

146
case "$DIST" in
P
proller 已提交
147
    "bionic" | "artful" | "experimental" | "unstable" | "testing" )
148 149 150 151 152
        EXTRAPACKAGES+=" liblld-5.0-dev libclang-5.0-dev liblld-5.0 "
        export CMAKE_FLAGS="-DUSE_EMBEDDED_COMPILER=1 $CMAKE_FLAGS"
        ;;
esac

P
proller 已提交
153
# bundled zookeepeer have broken asm
P
proller 已提交
154 155 156 157 158 159
case "$ARCH" in
    "arm64")
        EXTRAPACKAGES+=" libzookeeper-mt-dev "
        ;;
esac

P
proller 已提交
160 161
# will test symbols
EXTRAPACKAGES+=" gdb "
162

163 164 165
export DEB_BUILD_OPTIONS=parallel=`nproc`

# Floating bug with permissions:
P
proller 已提交
166 167
[ -n "$CCACHEDIR" ] && sudo mkdir -p $CCACHEDIR
[ -n "$CCACHEDIR" ] && sudo chmod -R a+rwx $CCACHEDIR
P
proller 已提交
168
# chown -R $BUILDUSERID:$BUILDUSERID $CCACHEDIR
169 170

# echo "DEBOOTSTRAPOPTS = ${DEBOOTSTRAPOPTS[@]}"
171 172 173 174 175 176 177

# Use current dir to make package (by default should have src archive)
# echo "3.0 (native)" > debian/source/format
# OR
# pdebuild --debbuildopts "--source-option=--format=\"3.0 (native)\""
# OR
DEBBUILDOPTS="--source-option=--format=\"3.0 (native)\""
178 179

HOOKDIR="debian/pbuilder-hooks"