2018-01-19 21:33:48 +00:00
|
|
|
#
|
|
|
|
# sudo apt install pbuilder fakeroot debhelper debian-archive-keyring debian-keyring
|
|
|
|
#
|
2017-08-23 16:03:26 +00:00
|
|
|
# ubuntu:
|
2017-11-03 17:12:55 +00:00
|
|
|
# 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
|
2017-08-30 15:20:42 +00:00
|
|
|
# build ubuntu:
|
2017-08-23 16:03:26 +00:00
|
|
|
# sudo DIST=trusty pbuilder create --configfile debian/.pbuilderrc && DIST=trusty pdebuild --configfile debian/.pbuilderrc
|
2017-10-23 17:35:43 +00:00
|
|
|
# sudo DIST=xenial pbuilder create --configfile debian/.pbuilderrc && DIST=xenial pdebuild --configfile debian/.pbuilderrc
|
2017-08-23 16:03:26 +00:00
|
|
|
# sudo DIST=zesty pbuilder create --configfile debian/.pbuilderrc && DIST=zesty pdebuild --configfile debian/.pbuilderrc
|
2017-08-30 14:08:19 +00:00
|
|
|
# sudo DIST=artful pbuilder create --configfile debian/.pbuilderrc && DIST=artful pdebuild --configfile debian/.pbuilderrc
|
2017-11-03 17:12:55 +00:00
|
|
|
# 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
|
2017-08-30 15:20:42 +00:00
|
|
|
# build debian:
|
2017-08-23 16:03:26 +00:00
|
|
|
# sudo DIST=stable pbuilder create --configfile debian/.pbuilderrc && DIST=stable pdebuild --configfile debian/.pbuilderrc
|
2017-09-01 21:18:33 +00:00
|
|
|
# sudo DIST=testing pbuilder create --configfile debian/.pbuilderrc && DIST=testing pdebuild --configfile debian/.pbuilderrc
|
2017-08-30 15:20:42 +00:00
|
|
|
# sudo DIST=unstable pbuilder create --configfile debian/.pbuilderrc && DIST=unstable pdebuild --configfile debian/.pbuilderrc
|
2017-09-01 21:18:33 +00:00
|
|
|
# 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
|
2017-10-23 17:35:43 +00:00
|
|
|
# sudo DIST=xenial ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=xenial ARCH=i386 pdebuild --configfile debian/.pbuilderrc
|
2017-09-01 21:18:33 +00:00
|
|
|
# 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
|
2017-11-03 17:12:55 +00:00
|
|
|
# sudo DIST=bionic ARCH=i386 pbuilder create --configfile debian/.pbuilderrc && DIST=bionic ARCH=i386 pdebuild --configfile debian/.pbuilderrc
|
2017-09-01 21:18:33 +00:00
|
|
|
# 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
|
2017-12-09 16:36:03 +00:00
|
|
|
# use only clang:
|
2018-01-15 18:57:10 +00:00
|
|
|
# env DEB_CC=clang-5.0 DEB_CXX=clang++-5.0 EXTRAPACKAGES="clang-5.0" DIST=artful pdebuild --configfile debian/.pbuilderrc
|
2017-12-13 19:07:12 +00:00
|
|
|
# clang+asan:
|
2018-01-15 18:57:10 +00:00
|
|
|
# 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
|
2017-12-29 18:20:03 +00:00
|
|
|
# clang+tsan:
|
2018-01-15 18:57:10 +00:00
|
|
|
# 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
|
2017-12-25 16:01:03 +00:00
|
|
|
# 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
|
2017-10-23 17:35:43 +00:00
|
|
|
|
2018-01-20 02:35:16 +00:00
|
|
|
# Note: on trusty host creating some future dists can fail (debootstrap error).
|
|
|
|
|
2017-10-23 17:35:43 +00:00
|
|
|
# Your packages built here: /var/cache/pbuilder/*-*/result
|
2017-08-23 16:03:26 +00:00
|
|
|
|
|
|
|
# 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.
|
2018-08-29 19:43:58 +00:00
|
|
|
UBUNTU_SUITES=("cosmic" "bionic" "artful" "zesty" "xenial" "trusty" "devel")
|
2017-08-23 16:03:26 +00:00
|
|
|
|
2017-11-03 17:12:55 +00:00
|
|
|
# Set a default distribution if none is used. Note that you can set your own default (i.e. ${DIST:="unstable"}).
|
2018-01-19 21:33:48 +00:00
|
|
|
HOST_DIST=`lsb_release --short --codename`
|
|
|
|
: ${DIST:="$HOST_DIST"}
|
2017-08-23 16:03:26 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2017-12-26 12:28:30 +00:00
|
|
|
BASETGZ=${SET_BASETGZ}
|
|
|
|
BASETGZ=${BASETGZ:="/var/cache/pbuilder/$NAME-base.tgz"}
|
2017-08-23 16:03:26 +00:00
|
|
|
DISTRIBUTION="$DIST"
|
2017-12-26 12:28:30 +00:00
|
|
|
BUILDRESULT=${SET_BUILDRESULT}
|
|
|
|
BUILDRESULT=${BUILDRESULT:="/var/cache/pbuilder/$NAME/result/"}
|
2017-08-23 16:03:26 +00:00
|
|
|
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
|
|
|
|
BUILDPLACE="/var/cache/pbuilder/build/"
|
2018-02-07 15:58:48 +00:00
|
|
|
ALLOWUNTRUSTED=${SET_ALLOWUNTRUSTED:=${ALLOWUNTRUSTED}}
|
|
|
|
|
|
|
|
#DEBOOTSTRAPOPTS=( '--variant=buildd' $SET_DEBOOTSTRAPOPTS )
|
|
|
|
|
2017-08-23 16:03:26 +00:00
|
|
|
|
|
|
|
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
|
|
|
|
# Debian configuration
|
|
|
|
OSNAME=debian
|
2018-11-30 22:30:34 +00:00
|
|
|
#MIRRORSITE=${SET_MIRRORSITE="http://deb.debian.org/$OSNAME/"}
|
|
|
|
MIRRORSITE=${SET_MIRRORSITE="http://mirror.yandex.ru/$OSNAME/"}
|
2017-08-23 16:03:26 +00:00
|
|
|
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
|
2018-01-19 21:33:48 +00:00
|
|
|
|
|
|
|
case "$HOST_DIST" in
|
|
|
|
"trusty" )
|
|
|
|
DEBOOTSTRAPOPTS+=( '--no-check-gpg' )
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
DEBOOTSTRAPOPTS+=( '--keyring' '/usr/share/keyrings/debian-archive-keyring.gpg' )
|
|
|
|
# DEBOOTSTRAPOPTS+=( '--keyring' '/usr/share/keyrings/debian-keyring.gpg' )
|
|
|
|
esac
|
2017-08-23 16:03:26 +00:00
|
|
|
elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then
|
|
|
|
# Ubuntu configuration
|
|
|
|
OSNAME=ubuntu
|
2018-05-05 12:31:47 +00:00
|
|
|
|
|
|
|
if [[ "$ARCH" == "amd64" || "$ARCH" == "i386" ]]; then
|
2018-11-30 22:30:34 +00:00
|
|
|
#MIRRORSITE=${SET_MIRRORSITE="http://archive.ubuntu.com/$OSNAME/"}
|
|
|
|
MIRRORSITE=${SET_MIRRORSITE="http://mirror.yandex.ru/$OSNAME/"}
|
2018-05-05 12:31:47 +00:00
|
|
|
else
|
|
|
|
MIRRORSITE=${SET_MIRRORSITE="http://ports.ubuntu.com/ubuntu-ports/"}
|
|
|
|
fi
|
|
|
|
|
2017-08-23 16:03:26 +00:00
|
|
|
COMPONENTS="main restricted universe multiverse"
|
2017-08-30 14:08:19 +00:00
|
|
|
|
2018-02-07 15:58:48 +00:00
|
|
|
OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE $DIST-updates main restricted universe multiverse"
|
|
|
|
OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE $DIST-security main restricted universe multiverse"
|
2018-11-30 22:30:34 +00:00
|
|
|
OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE $DIST-proposed main restricted universe multiverse"
|
2017-10-23 17:35:43 +00:00
|
|
|
|
2017-08-30 14:08:19 +00:00
|
|
|
case "$DIST" in
|
|
|
|
"trusty" | "xenial" )
|
2018-02-07 15:58:48 +00:00
|
|
|
OTHERMIRROR="$OTHERMIRROR | deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/$OSNAME $DIST main"
|
2017-08-30 14:08:19 +00:00
|
|
|
ALLOWUNTRUSTED=yes
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2017-08-23 16:03:26 +00:00
|
|
|
# deb http://apt.llvm.org/zesty/ llvm-toolchain-zesty-5.0 main
|
|
|
|
else
|
|
|
|
echo "Unknown distribution: $DIST"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-05-05 12:31:47 +00:00
|
|
|
echo "using $NAME $OSNAME $DIST $ARCH $LOGNAME $MIRRORSITE"
|
2017-08-23 16:03:26 +00:00
|
|
|
|
2017-08-30 14:08:19 +00:00
|
|
|
case "$DIST" in
|
|
|
|
"trusty")
|
|
|
|
# ccache broken
|
|
|
|
;;
|
|
|
|
*)
|
2018-02-08 14:38:36 +00:00
|
|
|
CCACHEDIR=${SET_CCACHEDIR:="/var/cache/pbuilder/ccache"}
|
2017-08-30 14:08:19 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2017-12-28 15:55:24 +00:00
|
|
|
# old systems with default gcc <= 6
|
2017-08-30 14:08:19 +00:00
|
|
|
case "$DIST" in
|
2017-12-28 15:55:24 +00:00
|
|
|
"trusty" | "xenial" | "stable" )
|
2017-08-30 14:08:19 +00:00
|
|
|
export DEB_CC=gcc-7
|
|
|
|
export DEB_CXX=g++-7
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2018-05-05 12:31:47 +00:00
|
|
|
if [ "$ARCH" != arm64 ]; then
|
2018-09-18 15:59:14 +00:00
|
|
|
case "$DIST" in
|
2018-11-20 15:10:28 +00:00
|
|
|
"experimental")
|
2018-11-10 20:09:07 +00:00
|
|
|
EXTRAPACKAGES+=" liblld-8-dev libclang-8-dev llvm-8-dev liblld-8 "
|
|
|
|
export CMAKE_FLAGS="-DLLVM_VERSION_POSTFIX=-8 $CMAKE_FLAGS"
|
|
|
|
;;
|
2018-11-20 15:10:28 +00:00
|
|
|
"cosmic" | "testing" | "unstable")
|
2018-11-10 20:09:07 +00:00
|
|
|
EXTRAPACKAGES+=" liblld-7-dev libclang-7-dev llvm-7-dev liblld-7 "
|
|
|
|
export CMAKE_FLAGS="-DLLVM_VERSION_POSTFIX=-7 $CMAKE_FLAGS"
|
|
|
|
;;
|
|
|
|
"bionic")
|
2018-02-07 15:58:48 +00:00
|
|
|
EXTRAPACKAGES+=" liblld-6.0-dev libclang-6.0-dev liblld-6.0 "
|
2018-05-05 12:31:47 +00:00
|
|
|
export CMAKE_FLAGS="-DLLVM_VERSION_POSTFIX=-6.0 $CMAKE_FLAGS"
|
2018-02-07 15:58:48 +00:00
|
|
|
;;
|
2018-05-05 12:31:47 +00:00
|
|
|
"artful" )
|
|
|
|
EXTRAPACKAGES+=" liblld-5.0-dev libclang-5.0-dev liblld-5.0 "
|
2017-12-25 16:01:03 +00:00
|
|
|
;;
|
2018-09-18 15:59:14 +00:00
|
|
|
esac
|
2018-05-05 12:31:47 +00:00
|
|
|
else
|
|
|
|
export CMAKE_FLAGS="-DENABLE_EMBEDDED_COMPILER=0 $CMAKE_FLAGS"
|
|
|
|
fi
|
|
|
|
|
2018-05-08 19:44:54 +00:00
|
|
|
# Will test symbols
|
2018-05-05 12:31:47 +00:00
|
|
|
#EXTRAPACKAGES+=" gdb "
|
2017-12-25 16:01:03 +00:00
|
|
|
|
2018-05-08 19:44:54 +00:00
|
|
|
# For killall in pbuilder-hooks:
|
|
|
|
EXTRAPACKAGES+=" psmisc "
|
|
|
|
|
2018-09-28 14:53:20 +00:00
|
|
|
[[ $CCACHE_PREFIX == 'distcc' ]] && EXTRAPACKAGES+=" $CCACHE_PREFIX " && USENETWORK=yes && export DISTCC_DIR=/var/cache/pbuilder/distcc
|
2018-02-07 15:58:48 +00:00
|
|
|
|
2017-08-23 16:03:26 +00:00
|
|
|
export DEB_BUILD_OPTIONS=parallel=`nproc`
|
|
|
|
|
|
|
|
# Floating bug with permissions:
|
2018-01-16 20:37:08 +00:00
|
|
|
[ -n "$CCACHEDIR" ] && sudo mkdir -p $CCACHEDIR
|
2018-03-23 16:05:14 +00:00
|
|
|
[ -n "$CCACHEDIR" ] && sudo chmod -R a+rwx $CCACHEDIR || true
|
2018-01-15 18:57:10 +00:00
|
|
|
# chown -R $BUILDUSERID:$BUILDUSERID $CCACHEDIR
|
2017-08-23 16:03:26 +00:00
|
|
|
|
2017-12-08 18:30:22 +00:00
|
|
|
|
2018-09-03 17:18:03 +00:00
|
|
|
# Do not create source package inside pbuilder (-b)
|
2017-12-08 18:30:22 +00:00
|
|
|
# Use current dir to make package (by default should have src archive)
|
|
|
|
# echo "3.0 (native)" > debian/source/format
|
|
|
|
# OR
|
2018-09-03 17:18:03 +00:00
|
|
|
# pdebuild -b --debbuildopts "--source-option=--format=\"3.0 (native)\""
|
2017-12-08 18:30:22 +00:00
|
|
|
# OR
|
2018-09-03 17:18:03 +00:00
|
|
|
DEBBUILDOPTS="-b --source-option=--format=\"3.0 (native)\""
|
2017-12-25 16:01:03 +00:00
|
|
|
|
|
|
|
HOOKDIR="debian/pbuilder-hooks"
|
2018-02-07 15:58:48 +00:00
|
|
|
|
|
|
|
#echo "DEBOOTSTRAPOPTS=${DEBOOTSTRAPOPTS[@]}"
|
|
|
|
#echo "ALLOWUNTRUSTED=${ALLOWUNTRUSTED} OTHERMIRROR=${OTHERMIRROR}"
|
|
|
|
#echo "EXTRAPACKAGES=${EXTRAPACKAGES}"
|