cloudflare/ClickHouse
Publicmirrored fromhttps://github.com/cloudflare/ClickHouse
debian/.pbuilderrc
203lines · modecode
unknown
| 1 | # |
| 2 | # sudo apt install pbuilder fakeroot debhelper debian-archive-keyring debian-keyring |
| 3 | # |
| 4 | # ubuntu: |
| 5 | # prepare old (trusty or earlier) host system: |
| 6 | # sudo ln -s gutsy /usr/share/debootstrap/scripts/artful |
| 7 | # sudo ln -s gutsy /usr/share/debootstrap/scripts/bionic |
| 8 | # build ubuntu: |
| 9 | # sudo DIST=trusty pbuilder create --configfile debian/.pbuilderrc && DIST=trusty pdebuild --configfile debian/.pbuilderrc |
| 10 | # sudo DIST=xenial pbuilder create --configfile debian/.pbuilderrc && DIST=xenial pdebuild --configfile debian/.pbuilderrc |
| 11 | # sudo DIST=zesty pbuilder create --configfile debian/.pbuilderrc && DIST=zesty pdebuild --configfile debian/.pbuilderrc |
| 12 | # sudo DIST=artful pbuilder create --configfile debian/.pbuilderrc && DIST=artful pdebuild --configfile debian/.pbuilderrc |
| 13 | # sudo DIST=bionic pbuilder create --configfile debian/.pbuilderrc && DIST=bionic pdebuild --configfile debian/.pbuilderrc |
| 14 | # sudo DIST=devel pbuilder create --configfile debian/.pbuilderrc && DIST=devel pdebuild --configfile debian/.pbuilderrc |
| 15 | # build debian: |
| 16 | # sudo DIST=stable pbuilder create --configfile debian/.pbuilderrc && DIST=stable pdebuild --configfile debian/.pbuilderrc |
| 17 | # sudo DIST=testing pbuilder create --configfile debian/.pbuilderrc && DIST=testing pdebuild --configfile debian/.pbuilderrc |
| 18 | # sudo DIST=unstable pbuilder create --configfile debian/.pbuilderrc && DIST=unstable pdebuild --configfile debian/.pbuilderrc |
| 19 | # sudo DIST=experimental pbuilder create --configfile debian/.pbuilderrc && DIST=experimental pdebuild --configfile debian/.pbuilderrc |
| 20 | # build i386 experimental: |
| 21 | # sudo DIST=trusty ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=trusty ARCH=i386 pdebuild --configfile debian/.pbuilderrc |
| 22 | # sudo DIST=xenial ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=xenial ARCH=i386 pdebuild --configfile debian/.pbuilderrc |
| 23 | # sudo DIST=zesty ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=zesty ARCH=i386 pdebuild --configfile debian/.pbuilderrc |
| 24 | # sudo DIST=artful ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=artful ARCH=i386 pdebuild --configfile debian/.pbuilderrc |
| 25 | # sudo DIST=bionic ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=bionic ARCH=i386 pdebuild --configfile debian/.pbuilderrc |
| 26 | # sudo DIST=stable ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=stable ARCH=i386 pdebuild --configfile debian/.pbuilderrc |
| 27 | # sudo DIST=testing ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=testing ARCH=i386 pdebuild --configfile debian/.pbuilderrc |
| 28 | # sudo DIST=experimental ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=experimental ARCH=i386 pdebuild --configfile debian/.pbuilderrc |
| 29 | # use only clang: |
| 30 | # env DEB_CC=clang-5.0 DEB_CXX=clang++-5.0 EXTRAPACKAGES="clang-5.0" DIST=artful pdebuild --configfile debian/.pbuilderrc |
| 31 | # clang+asan: |
| 32 | # 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 |
| 33 | # clang+tsan: |
| 34 | # 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 |
| 35 | # without sse for old systems and some VM: |
| 36 | # 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 |
| 37 | |
| 38 | # Note: on trusty host creating some future dists can fail (debootstrap error). |
| 39 | |
| 40 | # Your packages built here: /var/cache/pbuilder/*-*/result |
| 41 | |
| 42 | # from https://wiki.debian.org/PbuilderTricks : |
| 43 | |
| 44 | # Codenames for Debian suites according to their alias. Update these when |
| 45 | # needed. |
| 46 | UNSTABLE_CODENAME="sid" |
| 47 | TESTING_CODENAME="buster" |
| 48 | STABLE_CODENAME="stretch" |
| 49 | STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports" |
| 50 | |
| 51 | # List of Debian suites. |
| 52 | DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $STABLE_BACKPORTS_SUITE |
| 53 | "experimental" "unstable" "testing" "stable") |
| 54 | |
| 55 | # List of Ubuntu suites. Update these when needed. |
| 56 | UBUNTU_SUITES=("bionic" "artful" "zesty" "xenial" "trusty" "devel") |
| 57 | |
| 58 | # Set a default distribution if none is used. Note that you can set your own default (i.e. ${DIST:="unstable"}). |
| 59 | HOST_DIST=`lsb_release --short --codename` |
| 60 | : ${DIST:="$HOST_DIST"} |
| 61 | |
| 62 | # Optionally change Debian codenames in $DIST to their aliases. |
| 63 | case "$DIST" in |
| 64 | $UNSTABLE_CODENAME) |
| 65 | DIST="unstable" |
| 66 | ;; |
| 67 | $TESTING_CODENAME) |
| 68 | DIST="testing" |
| 69 | ;; |
| 70 | $STABLE_CODENAME) |
| 71 | DIST="stable" |
| 72 | ;; |
| 73 | esac |
| 74 | |
| 75 | # Optionally set the architecture to the host architecture if none set. Note |
| 76 | # that you can set your own default (i.e. ${ARCH:="i386"}). |
| 77 | : ${ARCH:="$(dpkg --print-architecture)"} |
| 78 | |
| 79 | NAME="$DIST" |
| 80 | if [ -n "${ARCH}" ]; then |
| 81 | NAME="$NAME-$ARCH" |
| 82 | DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}") |
| 83 | fi |
| 84 | |
| 85 | BASETGZ=${SET_BASETGZ} |
| 86 | BASETGZ=${BASETGZ:="/var/cache/pbuilder/$NAME-base.tgz"} |
| 87 | DISTRIBUTION="$DIST" |
| 88 | BUILDRESULT=${SET_BUILDRESULT} |
| 89 | BUILDRESULT=${BUILDRESULT:="/var/cache/pbuilder/$NAME/result/"} |
| 90 | APTCACHE="/var/cache/pbuilder/$NAME/aptcache/" |
| 91 | BUILDPLACE="/var/cache/pbuilder/build/" |
| 92 | ALLOWUNTRUSTED=${SET_ALLOWUNTRUSTED:=${ALLOWUNTRUSTED}} |
| 93 | |
| 94 | #DEBOOTSTRAPOPTS=( '--variant=buildd' $SET_DEBOOTSTRAPOPTS ) |
| 95 | |
| 96 | |
| 97 | if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then |
| 98 | # Debian configuration |
| 99 | OSNAME=debian |
| 100 | MIRRORSITE=${SET_MIRRORSITE="http://deb.debian.org/$OSNAME/"} |
| 101 | COMPONENTS="main contrib non-free" |
| 102 | if $(echo "$STABLE_CODENAME stable" | grep -q $DIST); then |
| 103 | OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE $STABLE_BACKPORTS_SUITE $COMPONENTS" |
| 104 | fi |
| 105 | # APTKEYRINGS=/usr/share/keyrings/debian-archive-keyring.gpg |
| 106 | |
| 107 | case "$HOST_DIST" in |
| 108 | "trusty" ) |
| 109 | DEBOOTSTRAPOPTS+=( '--no-check-gpg' ) |
| 110 | ;; |
| 111 | *) |
| 112 | DEBOOTSTRAPOPTS+=( '--keyring' '/usr/share/keyrings/debian-archive-keyring.gpg' ) |
| 113 | # DEBOOTSTRAPOPTS+=( '--keyring' '/usr/share/keyrings/debian-keyring.gpg' ) |
| 114 | esac |
| 115 | elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then |
| 116 | # Ubuntu configuration |
| 117 | OSNAME=ubuntu |
| 118 | |
| 119 | if [[ "$ARCH" == "amd64" || "$ARCH" == "i386" ]]; then |
| 120 | MIRRORSITE=${SET_MIRRORSITE="http://archive.ubuntu.com/ubuntu/"} |
| 121 | else |
| 122 | MIRRORSITE=${SET_MIRRORSITE="http://ports.ubuntu.com/ubuntu-ports/"} |
| 123 | fi |
| 124 | |
| 125 | COMPONENTS="main restricted universe multiverse" |
| 126 | |
| 127 | OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE $DIST-updates main restricted universe multiverse" |
| 128 | OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE $DIST-security main restricted universe multiverse" |
| 129 | |
| 130 | case "$DIST" in |
| 131 | "trusty" | "xenial" ) |
| 132 | OTHERMIRROR="$OTHERMIRROR | deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/$OSNAME $DIST main" |
| 133 | ALLOWUNTRUSTED=yes |
| 134 | ;; |
| 135 | esac |
| 136 | |
| 137 | # deb http://apt.llvm.org/zesty/ llvm-toolchain-zesty-5.0 main |
| 138 | else |
| 139 | echo "Unknown distribution: $DIST" |
| 140 | exit 1 |
| 141 | fi |
| 142 | |
| 143 | echo "using $NAME $OSNAME $DIST $ARCH $LOGNAME $MIRRORSITE" |
| 144 | |
| 145 | case "$DIST" in |
| 146 | "trusty") |
| 147 | # ccache broken |
| 148 | ;; |
| 149 | *) |
| 150 | CCACHEDIR=${SET_CCACHEDIR:="/var/cache/pbuilder/ccache"} |
| 151 | ;; |
| 152 | esac |
| 153 | |
| 154 | # old systems with default gcc <= 6 |
| 155 | case "$DIST" in |
| 156 | "trusty" | "xenial" | "stable" ) |
| 157 | export DEB_CC=gcc-7 |
| 158 | export DEB_CXX=g++-7 |
| 159 | ;; |
| 160 | esac |
| 161 | |
| 162 | if [ "$ARCH" != arm64 ]; then |
| 163 | case "$DIST" in |
| 164 | "bionic" | "experimental" | "unstable" | "testing") |
| 165 | EXTRAPACKAGES+=" liblld-6.0-dev libclang-6.0-dev liblld-6.0 " |
| 166 | export CMAKE_FLAGS="-DLLVM_VERSION_POSTFIX=-6.0 $CMAKE_FLAGS" |
| 167 | ;; |
| 168 | "artful" ) |
| 169 | EXTRAPACKAGES+=" liblld-5.0-dev libclang-5.0-dev liblld-5.0 " |
| 170 | ;; |
| 171 | esac |
| 172 | else |
| 173 | export CMAKE_FLAGS="-DENABLE_EMBEDDED_COMPILER=0 $CMAKE_FLAGS" |
| 174 | fi |
| 175 | |
| 176 | # Will test symbols |
| 177 | #EXTRAPACKAGES+=" gdb " |
| 178 | |
| 179 | # For killall in pbuilder-hooks: |
| 180 | EXTRAPACKAGES+=" psmisc " |
| 181 | |
| 182 | [[ $CCACHE_PREFIX == 'distcc' ]] && EXTRAPACKAGES+=" $CCACHE_PREFIX " |
| 183 | |
| 184 | export DEB_BUILD_OPTIONS=parallel=`nproc` |
| 185 | |
| 186 | # Floating bug with permissions: |
| 187 | [ -n "$CCACHEDIR" ] && sudo mkdir -p $CCACHEDIR |
| 188 | [ -n "$CCACHEDIR" ] && sudo chmod -R a+rwx $CCACHEDIR || true |
| 189 | # chown -R $BUILDUSERID:$BUILDUSERID $CCACHEDIR |
| 190 | |
| 191 | |
| 192 | # Use current dir to make package (by default should have src archive) |
| 193 | # echo "3.0 (native)" > debian/source/format |
| 194 | # OR |
| 195 | # pdebuild --debbuildopts "--source-option=--format=\"3.0 (native)\"" |
| 196 | # OR |
| 197 | DEBBUILDOPTS="--source-option=--format=\"3.0 (native)\"" |
| 198 | |
| 199 | HOOKDIR="debian/pbuilder-hooks" |
| 200 | |
| 201 | #echo "DEBOOTSTRAPOPTS=${DEBOOTSTRAPOPTS[@]}" |
| 202 | #echo "ALLOWUNTRUSTED=${ALLOWUNTRUSTED} OTHERMIRROR=${OTHERMIRROR}" |
| 203 | #echo "EXTRAPACKAGES=${EXTRAPACKAGES}" |