OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Script to build binutils for both i386 and AMD64 Linux architectures. | 6 # Script to build binutils for both i386 and AMD64 Linux architectures. |
7 # Must be run on an AMD64 supporting machine which has debootstrap and sudo | 7 # Must be run on an AMD64 supporting machine which has debootstrap and sudo |
8 # installed. | 8 # installed. |
9 # Uses Ubuntu Lucid chroots as build environment. | 9 # Uses Ubuntu Lucid chroots as build environment. |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 # Verify the signature | 28 # Verify the signature |
29 wget -c -q http://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.bz2.sig | 29 wget -c -q http://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.bz2.sig |
30 if ! gpg --verify binutils-$VERSION.tar.bz2.sig; then | 30 if ! gpg --verify binutils-$VERSION.tar.bz2.sig; then |
31 echo "GPG Signature failed to verify." | 31 echo "GPG Signature failed to verify." |
32 echo "" | 32 echo "" |
33 echo "You may need to import the vendor GPG key with:" | 33 echo "You may need to import the vendor GPG key with:" |
34 echo "# gpg --keyserver pgp.mit.edu --recv-key 4AE55E93" | 34 echo "# gpg --keyserver pgp.mit.edu --recv-key 4AE55E93" |
35 exit 1 | 35 exit 1 |
36 fi | 36 fi |
37 | 37 |
38 if [ ! -d gperftools ]; then | |
39 git clone --branch gperftools-2.4 https://github.com/gperftools/gperftools | |
40 fi | |
41 | |
42 # Extract the source | 38 # Extract the source |
43 rm -rf binutils-$VERSION | 39 rm -rf binutils-$VERSION |
44 tar jxf binutils-$VERSION.tar.bz2 | 40 tar jxf binutils-$VERSION.tar.bz2 |
45 | 41 |
46 # Patch the source | 42 # Patch the source |
47 ( | 43 ( |
48 cd binutils-$VERSION | 44 cd binutils-$VERSION |
49 echo "long-plt.patch" | 45 echo "long-plt.patch" |
50 echo "==================================" | 46 echo "==================================" |
51 patch -p1 < ../long-plt.patch | 47 patch -p1 < ../long-plt.patch |
(...skipping 13 matching lines...) Expand all Loading... |
65 | 61 |
66 for ARCH in i386 amd64; do | 62 for ARCH in i386 amd64; do |
67 if [ ! -d precise-chroot-$ARCH ]; then | 63 if [ ! -d precise-chroot-$ARCH ]; then |
68 # Refresh sudo credentials | 64 # Refresh sudo credentials |
69 sudo -v | 65 sudo -v |
70 | 66 |
71 # Create the chroot | 67 # Create the chroot |
72 echo "" | 68 echo "" |
73 echo "Building chroot for $ARCH" | 69 echo "Building chroot for $ARCH" |
74 echo "=============================" | 70 echo "=============================" |
75 GPERFTOOLS_DEPS=autoconf,automake,libtool | |
76 sudo debootstrap \ | 71 sudo debootstrap \ |
77 --arch=$ARCH \ | 72 --arch=$ARCH \ |
78 --include=build-essential,flex,bison,$GPERFTOOLS_DEPS \ | 73 --include=build-essential,flex,bison \ |
79 precise precise-chroot-$ARCH | 74 precise precise-chroot-$ARCH |
80 echo "=============================" | 75 echo "=============================" |
81 fi | 76 fi |
82 | 77 |
83 BUILDDIR=precise-chroot-$ARCH/build | 78 BUILDDIR=precise-chroot-$ARCH/build |
84 | 79 |
85 # Clean up any previous failed build attempts inside chroot | 80 # Clean up any previous failed build attempts inside chroot |
86 if [ -d "$BUILDDIR" ]; then | 81 if [ -d "$BUILDDIR" ]; then |
87 sudo rm -rf "$BUILDDIR" | 82 sudo rm -rf "$BUILDDIR" |
88 fi | 83 fi |
89 | 84 |
90 # Copy data into the chroot | 85 # Copy data into the chroot |
91 sudo mkdir -p "$BUILDDIR" | 86 sudo mkdir -p "$BUILDDIR" |
92 sudo cp -a binutils-$VERSION "$BUILDDIR" | 87 sudo cp -a binutils-$VERSION "$BUILDDIR" |
93 sudo cp -a build-one.sh "$BUILDDIR" | 88 sudo cp -a build-one.sh "$BUILDDIR" |
94 sudo cp -a gperftools "$BUILDDIR" | |
95 | 89 |
96 # Do the build | 90 # Do the build |
97 PREFIX= | 91 PREFIX= |
98 case $ARCH in | 92 case $ARCH in |
99 i386) | 93 i386) |
100 PREFIX="setarch linux32" | 94 PREFIX="setarch linux32" |
101 ARCHNAME=i686-pc-linux-gnu | 95 ARCHNAME=i686-pc-linux-gnu |
102 ;; | 96 ;; |
103 amd64) | 97 amd64) |
104 PREFIX="setarch linux64" | 98 PREFIX="setarch linux64" |
(...skipping 10 matching lines...) Expand all Loading... |
115 | 109 |
116 # Copy data out of the chroot | 110 # Copy data out of the chroot |
117 sudo chown -R $(whoami) "$BUILDDIR/output/" | 111 sudo chown -R $(whoami) "$BUILDDIR/output/" |
118 | 112 |
119 # Strip the output binaries | 113 # Strip the output binaries |
120 strip "$BUILDDIR/output/$ARCHNAME/bin/"* | 114 strip "$BUILDDIR/output/$ARCHNAME/bin/"* |
121 | 115 |
122 # Copy them out of the chroot | 116 # Copy them out of the chroot |
123 cp -a "$BUILDDIR/output/$ARCHNAME" "$OUTPUTDIR" | 117 cp -a "$BUILDDIR/output/$ARCHNAME" "$OUTPUTDIR" |
124 | 118 |
125 # Copy plugin header out of the chroot | |
126 mkdir "$OUTPUTDIR/$ARCHNAME/include" | |
127 cp "$BUILDDIR/binutils-$VERSION/include/plugin-api.h" "$OUTPUTDIR/$ARCHNAME/in
clude/" | |
128 | |
129 # Clean up chroot | 119 # Clean up chroot |
130 sudo rm -rf "$BUILDDIR" | 120 sudo rm -rf "$BUILDDIR" |
131 done | 121 done |
132 | 122 |
133 echo "Check you are happy with the binaries in" | 123 echo "Check you are happy with the binaries in" |
134 echo " $OUTPUTDIR" | 124 echo " $OUTPUTDIR" |
135 echo "Then" | 125 echo "Then" |
136 echo " * upload to Google Storage using the upload.sh script" | 126 echo " * upload to Google Storage using the upload.sh script" |
137 echo " * roll dependencies" | 127 echo " * roll dependencies" |
OLD | NEW |