CodeCommitsIssuesPull requestsActionsInsightsSecurity
dcd40d1d07425ec44d4db24e264a1d30d5887e93

Branches

Tags

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

Clone

HTTPS

Download ZIP

debian/.pbuilderrc

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