Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/installer/linux/debian/build.sh

Issue 2411423002: Linux build: Use sysroot when calculating dependencies (Closed)
Patch Set: Update expected_deps Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # TODO(mmoss) This currently only works with official builds, since non-official 7 # TODO(mmoss) This currently only works with official builds, since non-official
8 # builds don't add the "${BUILDDIR}/installer/" files needed for packaging. 8 # builds don't add the "${BUILDDIR}/installer/" files needed for packaging.
9 9
10 set -e 10 set -e
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 usage() { 123 usage() {
124 echo "usage: $(basename $0) [-c channel] [-a target_arch] [-o 'dir'] " 124 echo "usage: $(basename $0) [-c channel] [-a target_arch] [-o 'dir'] "
125 echo " [-b 'dir'] -d branding" 125 echo " [-b 'dir'] -d branding"
126 echo "-c channel the package channel (trunk, asan, unstable, beta, stable)" 126 echo "-c channel the package channel (trunk, asan, unstable, beta, stable)"
127 echo "-a arch package architecture (ia32 or x64)" 127 echo "-a arch package architecture (ia32 or x64)"
128 echo "-o dir package output directory [${OUTPUTDIR}]" 128 echo "-o dir package output directory [${OUTPUTDIR}]"
129 echo "-b dir build input directory [${BUILDDIR}]" 129 echo "-b dir build input directory [${BUILDDIR}]"
130 echo "-d brand either chromium or google_chrome" 130 echo "-d brand either chromium or google_chrome"
131 echo "-s dir /path/to/sysroot"
132 echo "-e dir /path/to/dpkg-dev"
131 echo "-h this help message" 133 echo "-h this help message"
132 } 134 }
133 135
134 # Check that the channel name is one of the allowable ones. 136 # Check that the channel name is one of the allowable ones.
135 verify_channel() { 137 verify_channel() {
136 case $CHANNEL in 138 case $CHANNEL in
137 stable ) 139 stable )
138 CHANNEL=stable 140 CHANNEL=stable
139 RELEASENOTES="http://googlechromereleases.blogspot.com/search/label/Stable %20updates" 141 RELEASENOTES="http://googlechromereleases.blogspot.com/search/label/Stable %20updates"
140 ;; 142 ;;
(...skipping 14 matching lines...) Expand all
155 * ) 157 * )
156 echo 158 echo
157 echo "ERROR: '$CHANNEL' is not a valid channel type." 159 echo "ERROR: '$CHANNEL' is not a valid channel type."
158 echo 160 echo
159 exit 1 161 exit 1
160 ;; 162 ;;
161 esac 163 esac
162 } 164 }
163 165
164 process_opts() { 166 process_opts() {
165 while getopts ":o:b:c:a:d:h" OPTNAME 167 while getopts ":e:s:o:b:c:a:d:h" OPTNAME
166 do 168 do
167 case $OPTNAME in 169 case $OPTNAME in
168 o ) 170 o )
169 OUTPUTDIR=$(readlink -f "${OPTARG}") 171 OUTPUTDIR=$(readlink -f "${OPTARG}")
170 mkdir -p "${OUTPUTDIR}" 172 mkdir -p "${OUTPUTDIR}"
171 ;; 173 ;;
172 b ) 174 b )
173 BUILDDIR=$(readlink -f "${OPTARG}") 175 BUILDDIR=$(readlink -f "${OPTARG}")
174 ;; 176 ;;
175 c ) 177 c )
176 CHANNEL="$OPTARG" 178 CHANNEL="$OPTARG"
177 ;; 179 ;;
178 a ) 180 a )
179 TARGETARCH="$OPTARG" 181 TARGETARCH="$OPTARG"
180 ;; 182 ;;
181 d ) 183 d )
182 BRANDING="$OPTARG" 184 BRANDING="$OPTARG"
183 ;; 185 ;;
186 s )
187 SYSROOT="$OPTARG"
188 ;;
189 e )
190 DPKG_DEV_DIR="$OPTARG"
191 ;;
184 h ) 192 h )
185 usage 193 usage
186 exit 0 194 exit 0
187 ;; 195 ;;
188 \: ) 196 \: )
189 echo "'-$OPTARG' needs an argument." 197 echo "'-$OPTARG' needs an argument."
190 usage 198 usage
191 exit 1 199 exit 1
192 ;; 200 ;;
193 * ) 201 * )
(...skipping 16 matching lines...) Expand all
210 DEB_CHANGELOG="${TMPFILEDIR}/changelog" 218 DEB_CHANGELOG="${TMPFILEDIR}/changelog"
211 DEB_FILES="${TMPFILEDIR}/files" 219 DEB_FILES="${TMPFILEDIR}/files"
212 DEB_CONTROL="${TMPFILEDIR}/control" 220 DEB_CONTROL="${TMPFILEDIR}/control"
213 CHANNEL="trunk" 221 CHANNEL="trunk"
214 # Default target architecture to same as build host. 222 # Default target architecture to same as build host.
215 if [ "$(uname -m)" = "x86_64" ]; then 223 if [ "$(uname -m)" = "x86_64" ]; then
216 TARGETARCH="x64" 224 TARGETARCH="x64"
217 else 225 else
218 TARGETARCH="ia32" 226 TARGETARCH="ia32"
219 fi 227 fi
220 if [[ "$(lsb_release -c)" = *"precise" ]]; then
221 HOST_DISTRO="precise"
222 elif [[ "$(lsb_release -c)" = *"trusty" ]]; then
223 HOST_DISTRO="trusty"
224 else
225 echo "Debian package can only be build on Ubuntu Precise or Trusty"
226 exit 1
227 fi
228 228
229 # call cleanup() on exit 229 # call cleanup() on exit
230 trap cleanup 0 230 trap cleanup 0
231 process_opts "$@" 231 process_opts "$@"
232 BUILDDIR=${BUILDDIR:=$(readlink -f "${SCRIPTDIR}/../../../../out/Release")} 232 BUILDDIR=${BUILDDIR:=$(readlink -f "${SCRIPTDIR}/../../../../out/Release")}
233 233
234 if [[ "$(basename ${SYSROOT})" = "debian_wheezy_"*"-sysroot" ]]; then
235 TARGET_DISTRO="wheezy"
236 elif [[ "$(basename ${SYSROOT})" = "debian_jessie_"*"-sysroot" ]]; then
237 TARGET_DISTRO="jessie"
238 else
239 echo "Debian package can only be built using the wheezy or jessie sysroot."
240 exit 1
241 fi
242
234 source ${BUILDDIR}/installer/common/installer.include 243 source ${BUILDDIR}/installer/common/installer.include
235 244
236 get_version_info 245 get_version_info
237 VERSIONFULL="${VERSION}-${PACKAGE_RELEASE}" 246 VERSIONFULL="${VERSION}-${PACKAGE_RELEASE}"
238 247
239 if [ "$BRANDING" = "google_chrome" ]; then 248 if [ "$BRANDING" = "google_chrome" ]; then
240 source "${BUILDDIR}/installer/common/google-chrome.info" 249 source "${BUILDDIR}/installer/common/google-chrome.info"
241 else 250 else
242 source "${BUILDDIR}/installer/common/chromium-browser.info" 251 source "${BUILDDIR}/installer/common/chromium-browser.info"
243 fi 252 fi
244 eval $(sed -e "s/^\([^=]\+\)=\(.*\)$/export \1='\2'/" \ 253 eval $(sed -e "s/^\([^=]\+\)=\(.*\)$/export \1='\2'/" \
245 "${BUILDDIR}/installer/theme/BRANDING") 254 "${BUILDDIR}/installer/theme/BRANDING")
246 255
247 verify_channel 256 verify_channel
248 257
249 # Some Debian packaging tools want these set. 258 # Some Debian packaging tools want these set.
250 export DEBFULLNAME="${MAINTNAME}" 259 export DEBFULLNAME="${MAINTNAME}"
251 export DEBEMAIL="${MAINTMAIL}" 260 export DEBEMAIL="${MAINTMAIL}"
252 261
253 # We'd like to eliminate more of these deps by relying on the 'lsb' package, but 262 # We'd like to eliminate more of these deps by relying on the 'lsb' package, but
254 # that brings in tons of unnecessary stuff, like an mta and rpm. Until that full 263 # that brings in tons of unnecessary stuff, like an mta and rpm. Until that full
255 # 'lsb' package is installed by default on DEB distros, we'll have to stick with 264 # 'lsb' package is installed by default on DEB distros, we'll have to stick with
256 # the LSB sub-packages, to avoid pulling in all that stuff that's not installed 265 # the LSB sub-packages, to avoid pulling in all that stuff that's not installed
257 # by default. 266 # by default.
258 267
259 # Need a dummy debian/control file for dpkg-shlibdeps.
260 DUMMY_STAGING_DIR="${TMPFILEDIR}/dummy_staging"
261 mkdir "$DUMMY_STAGING_DIR"
262 cd "$DUMMY_STAGING_DIR"
263 mkdir debian
264 touch debian/control
265
266 # Generate the dependencies, 268 # Generate the dependencies,
267 # TODO(mmoss): This is a workaround for a problem where dpkg-shlibdeps was 269 # TODO(mmoss): This is a workaround for a problem where dpkg-shlibdeps was
268 # resolving deps using some of our build output shlibs (i.e. 270 # resolving deps using some of our build output shlibs (i.e.
269 # out/Release/lib.target/libfreetype.so.6), and was then failing with: 271 # out/Release/lib.target/libfreetype.so.6), and was then failing with:
270 # dpkg-shlibdeps: error: no dependency information found for ... 272 # dpkg-shlibdeps: error: no dependency information found for ...
271 # It's not clear if we ever want to look in LD_LIBRARY_PATH to resolve deps, 273 # It's not clear if we ever want to look in LD_LIBRARY_PATH to resolve deps,
272 # but it seems that we don't currently, so this is the most expediant fix. 274 # but it seems that we don't currently, so this is the most expediant fix.
273 SAVE_LDLP=${LD_LIBRARY_PATH:-} 275 SAVE_LDLP=${LD_LIBRARY_PATH:-}
274 unset LD_LIBRARY_PATH 276 unset LD_LIBRARY_PATH
275 DPKG_SHLIB_DEPS=$(dpkg-shlibdeps -O "$BUILDDIR/chrome" | \ 277 if [ ${TARGETARCH} = "x64" ]; then
276 sed 's/^shlibs:Depends=//') 278 SHLIB_ARGS="-l${SYSROOT}/usr/lib/x86_64-linux-gnu"
279 SHLIB_ARGS="${SHLIB_ARGS} -l${SYSROOT}/lib/x86_64-linux-gnu"
280 else
281 SHLIB_ARGS="-l${SYSROOT}/usr/lib/i386-linux-gnu"
282 SHLIB_ARGS="${SHLIB_ARGS} -l${SYSROOT}/lib/i386-linux-gnu"
283 fi
284 SHLIB_ARGS="${SHLIB_ARGS} -l${SYSROOT}/usr/lib"
285 # TODO(thomasanderson): Unbundle dpkg-shlibdeps once the Precise->Trusty
286 # transition is complete by reverting CL 2411423002 and applying ps40001.
287 DPKG_SHLIB_DEPS=$(cd ${SYSROOT} && DPKG_DATADIR=${DPKG_DEV_DIR} \
288 perl -I ${DPKG_DEV_DIR}/scripts ${DPKG_DEV_DIR}/scripts/dpkg-shlibdeps.pl \
289 ${SHLIB_ARGS:-} -O -e"$BUILDDIR/chrome" | sed 's/^shlibs:Depends=//')
277 if [ -n "$SAVE_LDLP" ]; then 290 if [ -n "$SAVE_LDLP" ]; then
278 LD_LIBRARY_PATH=$SAVE_LDLP 291 LD_LIBRARY_PATH=$SAVE_LDLP
279 fi 292 fi
280 293
281 # Format it nicely and save it for comparison. 294 # Format it nicely and save it for comparison.
282 # The grep -v is for a duplicate libc6 dep caused by Lucid glibc silliness. 295 echo "$DPKG_SHLIB_DEPS" | sed 's/, /\n/g' | LANG=C sort > actual
283 echo "$DPKG_SHLIB_DEPS" | sed 's/, /\n/g' | \
284 grep -v '^libc6 (>= 2.3.6-6~)$' | LANG=C sort > actual
285 296
286 # Compare the expected dependency list to the generate list. 297 # Compare the expected dependency list to the generated list.
287 BAD_DIFF=0 298 BAD_DIFF=0
288 diff -u "$SCRIPTDIR/expected_deps_${TARGETARCH}_${HOST_DISTRO}" actual || \ 299 diff -u "$SCRIPTDIR/expected_deps_${TARGETARCH}_${TARGET_DISTRO}" actual || \
289 BAD_DIFF=1 300 BAD_DIFF=1
290 if [ $BAD_DIFF -ne 0 ] && [ -z "${IGNORE_DEPS_CHANGES:-}" ]; then 301 if [ $BAD_DIFF -ne 0 ] && [ -z "${IGNORE_DEPS_CHANGES:-}" ]; then
291 echo 302 echo
292 echo "ERROR: Shared library dependencies changed!" 303 echo "ERROR: Shared library dependencies changed!"
293 echo "If this is intentional, please update:" 304 echo "If this is intentional, please update:"
294 echo "chrome/installer/linux/debian/expected_deps_ia32_precise" 305 echo "chrome/installer/linux/debian/expected_deps_ia32_jessie"
295 echo "chrome/installer/linux/debian/expected_deps_ia32_trusty" 306 echo "chrome/installer/linux/debian/expected_deps_ia32_wheezy"
296 echo "chrome/installer/linux/debian/expected_deps_x64_precise" 307 echo "chrome/installer/linux/debian/expected_deps_x64_jessie"
297 echo "chrome/installer/linux/debian/expected_deps_x64_trusty" 308 echo "chrome/installer/linux/debian/expected_deps_x64_wheezy"
298 echo 309 echo
299 exit $BAD_DIFF 310 exit $BAD_DIFF
300 fi 311 fi
301 rm -rf "$DUMMY_STAGING_DIR"
302 312
303 # Additional dependencies not in the dpkg-shlibdeps output. 313 # Additional dependencies not in the dpkg-shlibdeps output.
304 # ca-certificates: Make sure users have SSL certificates. 314 # ca-certificates: Make sure users have SSL certificates.
305 # fonts-liberation: Make sure users have compatible fonts for viewing PDFs. 315 # fonts-liberation: Make sure users have compatible fonts for viewing PDFs.
306 # libappindicator1: Make systray icons work in Unity. 316 # libappindicator1: Make systray icons work in Unity.
307 # libnss3: Pull a more recent version of NSS than required by runtime linking, 317 # libnss3: Pull a more recent version of NSS than required by runtime linking,
308 # for security and stability updates in NSS. 318 # for security and stability updates in NSS.
309 # libstdc++6: For C++11 support. 319 # libstdc++6: For C++11 support.
310 # lsb-base: Implies many other dependencies. 320 # lsb-base: Implies many other dependencies.
311 # xdg-utils: For OS integration. 321 # xdg-utils: For OS integration.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 # Only use the default REPOCONFIG if it's unset (e.g. verify_channel might have 356 # Only use the default REPOCONFIG if it's unset (e.g. verify_channel might have
347 # set it to an empty string) 357 # set it to an empty string)
348 REPOCONFIG="${REPOCONFIG-deb [arch=${ARCHITECTURE}] http://${BASEREPOCONFIG}}" 358 REPOCONFIG="${REPOCONFIG-deb [arch=${ARCHITECTURE}] http://${BASEREPOCONFIG}}"
349 # Allowed configs include optional HTTPS support and explicit multiarch 359 # Allowed configs include optional HTTPS support and explicit multiarch
350 # platforms. 360 # platforms.
351 REPOCONFIGREGEX="deb (\\\\[arch=[^]]*\\\\b${ARCHITECTURE}\\\\b[^]]*\\\\]" 361 REPOCONFIGREGEX="deb (\\\\[arch=[^]]*\\\\b${ARCHITECTURE}\\\\b[^]]*\\\\]"
352 REPOCONFIGREGEX+="[[:space:]]*) https?://${BASEREPOCONFIG}" 362 REPOCONFIGREGEX+="[[:space:]]*) https?://${BASEREPOCONFIG}"
353 stage_install_debian 363 stage_install_debian
354 364
355 do_package 365 do_package
OLDNEW
« no previous file with comments | « chrome/installer/linux/BUILD.gn ('k') | chrome/installer/linux/debian/expected_deps_ia32_jessie » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698