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

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

Issue 2411423002: Linux build: Use sysroot when calculating dependencies (Closed)
Patch Set: Merge expected_deps changes into this CL 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 sysroot /path/to/sysroot"
131 echo "-h this help message" 132 echo "-h this help message"
132 } 133 }
133 134
134 # Check that the channel name is one of the allowable ones. 135 # Check that the channel name is one of the allowable ones.
135 verify_channel() { 136 verify_channel() {
136 case $CHANNEL in 137 case $CHANNEL in
137 stable ) 138 stable )
138 CHANNEL=stable 139 CHANNEL=stable
139 RELEASENOTES="http://googlechromereleases.blogspot.com/search/label/Stable %20updates" 140 RELEASENOTES="http://googlechromereleases.blogspot.com/search/label/Stable %20updates"
140 ;; 141 ;;
(...skipping 14 matching lines...) Expand all
155 * ) 156 * )
156 echo 157 echo
157 echo "ERROR: '$CHANNEL' is not a valid channel type." 158 echo "ERROR: '$CHANNEL' is not a valid channel type."
158 echo 159 echo
159 exit 1 160 exit 1
160 ;; 161 ;;
161 esac 162 esac
162 } 163 }
163 164
164 process_opts() { 165 process_opts() {
165 while getopts ":o:b:c:a:d:h" OPTNAME 166 while getopts ":s:o:b:c:a:d:h" OPTNAME
166 do 167 do
167 case $OPTNAME in 168 case $OPTNAME in
168 o ) 169 o )
169 OUTPUTDIR=$(readlink -f "${OPTARG}") 170 OUTPUTDIR=$(readlink -f "${OPTARG}")
170 mkdir -p "${OUTPUTDIR}" 171 mkdir -p "${OUTPUTDIR}"
171 ;; 172 ;;
172 b ) 173 b )
173 BUILDDIR=$(readlink -f "${OPTARG}") 174 BUILDDIR=$(readlink -f "${OPTARG}")
174 ;; 175 ;;
175 c ) 176 c )
176 CHANNEL="$OPTARG" 177 CHANNEL="$OPTARG"
177 ;; 178 ;;
178 a ) 179 a )
179 TARGETARCH="$OPTARG" 180 TARGETARCH="$OPTARG"
180 ;; 181 ;;
181 d ) 182 d )
182 BRANDING="$OPTARG" 183 BRANDING="$OPTARG"
183 ;; 184 ;;
185 s )
186 SYSROOT="$OPTARG"
187 ;;
184 h ) 188 h )
185 usage 189 usage
186 exit 0 190 exit 0
187 ;; 191 ;;
188 \: ) 192 \: )
189 echo "'-$OPTARG' needs an argument." 193 echo "'-$OPTARG' needs an argument."
190 usage 194 usage
191 exit 1 195 exit 1
192 ;; 196 ;;
193 * ) 197 * )
(...skipping 16 matching lines...) Expand all
210 DEB_CHANGELOG="${TMPFILEDIR}/changelog" 214 DEB_CHANGELOG="${TMPFILEDIR}/changelog"
211 DEB_FILES="${TMPFILEDIR}/files" 215 DEB_FILES="${TMPFILEDIR}/files"
212 DEB_CONTROL="${TMPFILEDIR}/control" 216 DEB_CONTROL="${TMPFILEDIR}/control"
213 CHANNEL="trunk" 217 CHANNEL="trunk"
214 # Default target architecture to same as build host. 218 # Default target architecture to same as build host.
215 if [ "$(uname -m)" = "x86_64" ]; then 219 if [ "$(uname -m)" = "x86_64" ]; then
216 TARGETARCH="x64" 220 TARGETARCH="x64"
217 else 221 else
218 TARGETARCH="ia32" 222 TARGETARCH="ia32"
219 fi 223 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 224
229 # call cleanup() on exit 225 # call cleanup() on exit
230 trap cleanup 0 226 trap cleanup 0
231 process_opts "$@" 227 process_opts "$@"
232 BUILDDIR=${BUILDDIR:=$(readlink -f "${SCRIPTDIR}/../../../../out/Release")} 228 BUILDDIR=${BUILDDIR:=$(readlink -f "${SCRIPTDIR}/../../../../out/Release")}
233 229
230 if [[ "$(basename ${SYSROOT})" = "debian_wheezy_"*"-sysroot" ]]; then
231 TARGET_DISTRO="wheezy"
232 elif [[ "$(basename ${SYSROOT})" = "debian_jessie_"*"-sysroot" ]]; then
233 TARGET_DISTRO="jessie"
234 else
235 echo "Debian package can only be built using the wheezy or jessie sysroot."
236 exit 1
237 fi
238
234 source ${BUILDDIR}/installer/common/installer.include 239 source ${BUILDDIR}/installer/common/installer.include
235 240
236 get_version_info 241 get_version_info
237 VERSIONFULL="${VERSION}-${PACKAGE_RELEASE}" 242 VERSIONFULL="${VERSION}-${PACKAGE_RELEASE}"
238 243
239 if [ "$BRANDING" = "google_chrome" ]; then 244 if [ "$BRANDING" = "google_chrome" ]; then
240 source "${BUILDDIR}/installer/common/google-chrome.info" 245 source "${BUILDDIR}/installer/common/google-chrome.info"
241 else 246 else
242 source "${BUILDDIR}/installer/common/chromium-browser.info" 247 source "${BUILDDIR}/installer/common/chromium-browser.info"
243 fi 248 fi
244 eval $(sed -e "s/^\([^=]\+\)=\(.*\)$/export \1='\2'/" \ 249 eval $(sed -e "s/^\([^=]\+\)=\(.*\)$/export \1='\2'/" \
245 "${BUILDDIR}/installer/theme/BRANDING") 250 "${BUILDDIR}/installer/theme/BRANDING")
246 251
247 verify_channel 252 verify_channel
248 253
249 # Some Debian packaging tools want these set. 254 # Some Debian packaging tools want these set.
250 export DEBFULLNAME="${MAINTNAME}" 255 export DEBFULLNAME="${MAINTNAME}"
251 export DEBEMAIL="${MAINTMAIL}" 256 export DEBEMAIL="${MAINTMAIL}"
252 257
253 # We'd like to eliminate more of these deps by relying on the 'lsb' package, but 258 # 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 259 # 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 260 # '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 261 # the LSB sub-packages, to avoid pulling in all that stuff that's not installed
257 # by default. 262 # by default.
258 263
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, 264 # Generate the dependencies,
267 # TODO(mmoss): This is a workaround for a problem where dpkg-shlibdeps was 265 # 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. 266 # resolving deps using some of our build output shlibs (i.e.
269 # out/Release/lib.target/libfreetype.so.6), and was then failing with: 267 # out/Release/lib.target/libfreetype.so.6), and was then failing with:
270 # dpkg-shlibdeps: error: no dependency information found for ... 268 # 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, 269 # 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. 270 # but it seems that we don't currently, so this is the most expediant fix.
273 SAVE_LDLP=${LD_LIBRARY_PATH:-} 271 SAVE_LDLP=${LD_LIBRARY_PATH:-}
274 unset LD_LIBRARY_PATH 272 unset LD_LIBRARY_PATH
275 DPKG_SHLIB_DEPS=$(dpkg-shlibdeps -O "$BUILDDIR/chrome" | \ 273 if [ ${TARGETARCH} == "x64" ]; then
Lei Zhang 2016/10/12 20:55:30 single = again
Tom (Use chromium acct) 2016/10/12 22:02:09 Done.
276 sed 's/^shlibs:Depends=//') 274 SHLIB_ARGS="-l${SYSROOT}/usr/lib/x86_64-linux-gnu"
275 SHLIB_ARGS="${SHLIB_ARGS} -l${SYSROOT}/lib/x86_64-linux-gnu"
276 else
277 SHLIB_ARGS="-l${SYSROOT}/usr/lib/i386-linux-gnu"
278 SHLIB_ARGS="${SHLIB_ARGS} -l${SYSROOT}/lib/i386-linux-gnu"
279 fi
280 SHLIB_ARGS="${SHLIB_ARGS} -l${SYSROOT}/usr/lib"
281 DPKG_SHLIB_DEPS=$(cd ${SYSROOT} && dpkg-shlibdeps ${SHLIB_ARGS:-} -O \
282 -e"$BUILDDIR/chrome" | sed 's/^shlibs:Depends=//')
277 if [ -n "$SAVE_LDLP" ]; then 283 if [ -n "$SAVE_LDLP" ]; then
278 LD_LIBRARY_PATH=$SAVE_LDLP 284 LD_LIBRARY_PATH=$SAVE_LDLP
279 fi 285 fi
280 286
281 # Format it nicely and save it for comparison. 287 # Format it nicely and save it for comparison.
282 # The grep -v is for a duplicate libc6 dep caused by Lucid glibc silliness. 288 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 289
286 # Compare the expected dependency list to the generate list. 290 # Compare the expected dependency list to the generated list.
287 BAD_DIFF=0 291 BAD_DIFF=0
288 diff -u "$SCRIPTDIR/expected_deps_${TARGETARCH}_${HOST_DISTRO}" actual || \ 292 diff -u "$SCRIPTDIR/expected_deps_${TARGETARCH}_${TARGET_DISTRO}" actual || \
289 BAD_DIFF=1 293 BAD_DIFF=1
290 if [ $BAD_DIFF -ne 0 ] && [ -z "${IGNORE_DEPS_CHANGES:-}" ]; then 294 if [ $BAD_DIFF -ne 0 ] && [ -z "${IGNORE_DEPS_CHANGES:-}" ]; then
291 echo 295 echo
292 echo "ERROR: Shared library dependencies changed!" 296 echo "ERROR: Shared library dependencies changed!"
293 echo "If this is intentional, please update:" 297 echo "If this is intentional, please update:"
294 echo "chrome/installer/linux/debian/expected_deps_ia32_precise" 298 echo "chrome/installer/linux/debian/expected_deps_ia32_jessie"
295 echo "chrome/installer/linux/debian/expected_deps_ia32_trusty" 299 echo "chrome/installer/linux/debian/expected_deps_ia32_wheezy"
296 echo "chrome/installer/linux/debian/expected_deps_x64_precise" 300 echo "chrome/installer/linux/debian/expected_deps_x64_jessie"
297 echo "chrome/installer/linux/debian/expected_deps_x64_trusty" 301 echo "chrome/installer/linux/debian/expected_deps_x64_wheezy"
298 echo 302 echo
299 exit $BAD_DIFF 303 exit $BAD_DIFF
300 fi 304 fi
301 rm -rf "$DUMMY_STAGING_DIR"
302 305
303 # Additional dependencies not in the dpkg-shlibdeps output. 306 # Additional dependencies not in the dpkg-shlibdeps output.
304 # ca-certificates: Make sure users have SSL certificates. 307 # ca-certificates: Make sure users have SSL certificates.
305 # fonts-liberation: Make sure users have compatible fonts for viewing PDFs. 308 # fonts-liberation: Make sure users have compatible fonts for viewing PDFs.
306 # libappindicator1: Make systray icons work in Unity. 309 # libappindicator1: Make systray icons work in Unity.
307 # libnss3: Pull a more recent version of NSS than required by runtime linking, 310 # libnss3: Pull a more recent version of NSS than required by runtime linking,
308 # for security and stability updates in NSS. 311 # for security and stability updates in NSS.
309 # libstdc++6: For C++11 support. 312 # libstdc++6: For C++11 support.
310 # lsb-base: Implies many other dependencies. 313 # lsb-base: Implies many other dependencies.
311 # xdg-utils: For OS integration. 314 # 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 349 # Only use the default REPOCONFIG if it's unset (e.g. verify_channel might have
347 # set it to an empty string) 350 # set it to an empty string)
348 REPOCONFIG="${REPOCONFIG-deb [arch=${ARCHITECTURE}] http://${BASEREPOCONFIG}}" 351 REPOCONFIG="${REPOCONFIG-deb [arch=${ARCHITECTURE}] http://${BASEREPOCONFIG}}"
349 # Allowed configs include optional HTTPS support and explicit multiarch 352 # Allowed configs include optional HTTPS support and explicit multiarch
350 # platforms. 353 # platforms.
351 REPOCONFIGREGEX="deb (\\\\[arch=[^]]*\\\\b${ARCHITECTURE}\\\\b[^]]*\\\\]" 354 REPOCONFIGREGEX="deb (\\\\[arch=[^]]*\\\\b${ARCHITECTURE}\\\\b[^]]*\\\\]"
352 REPOCONFIGREGEX+="[[:space:]]*) https?://${BASEREPOCONFIG}" 355 REPOCONFIGREGEX+="[[:space:]]*) https?://${BASEREPOCONFIG}"
353 stage_install_debian 356 stage_install_debian
354 357
355 do_package 358 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