CodeCommitsIssuesPull requestsActionsInsightsSecurity
389cf9fceecccf44bd1d6860c7173277b11624d6

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

debian/.pbuilderrc

226lines · modecode

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