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