Add libssl1.0.0:i386 to install-build-deps.sh for naclports

Previously we were installing and using libssl0.9.8:i386
which was actually a miss-match with the 1.0.0 headers
installed by libssl-dev.

TEST=local (remove links and run install-build-deps.sh)

Review URL: https://codereview.chromium.org/913183004

Cr-Commit-Position: refs/heads/master@{#316319}
diff --git a/build/install-build-deps.sh b/build/install-build-deps.sh
index cded452..43b5545 100755
--- a/build/install-build-deps.sh
+++ b/build/install-build-deps.sh
@@ -155,7 +155,7 @@
            libfontconfig1:i386 libgconf-2-4:i386 libglib2.0-0:i386 libgpm2:i386
            libgtk2.0-0:i386 libncurses5:i386 lib32ncurses5-dev
            libnss3:i386 libpango1.0-0:i386
-           libssl0.9.8:i386 libtinfo-dev libtinfo-dev:i386 libtool
+           libssl1.0.0:i386 libtinfo-dev libtinfo-dev:i386 libtool
            libxcomposite1:i386 libxcursor1:i386 libxdamage1:i386 libxi6:i386
            libxrandr2:i386 libxss1:i386 libxtst6:i386 texinfo xvfb
            ${naclports_list}"
@@ -352,7 +352,7 @@
     sudo dpkg --add-architecture i386
   fi
 fi
-sudo apt-get update
+#sudo apt-get update
 
 # We initially run "apt-get" with the --reinstall option and parse its output.
 # This way, we can find all the packages that need to be newly installed
@@ -416,14 +416,32 @@
   echo "Skipping installation of Chrome OS fonts."
 fi
 
+# $1 - target name
+# $2 - link name
+create_library_symlink() {
+  target=$1
+  linkname=$2
+  if [ -L $linkname ]; then
+    if [ "$(basename $(readlink $linkname))" != "$(basename $target)" ]; then
+      sudo rm $linkname
+    fi
+  fi
+  if [ ! -r $linkname ]; then
+    echo "Creating link: $linkname"
+    sudo ln -fs $target $linkname
+  fi
+}
+
 if test "$do_inst_nacl" = "1"; then
   echo "Installing symbolic links for NaCl."
-  if [ ! -r /usr/lib/i386-linux-gnu/libcrypto.so ]; then
-    sudo ln -fs libcrypto.so.0.9.8 /usr/lib/i386-linux-gnu/libcrypto.so
-  fi
-  if [ ! -r /usr/lib/i386-linux-gnu/libssl.so ]; then
-    sudo ln -fs libssl.so.0.9.8 /usr/lib/i386-linux-gnu/libssl.so
-  fi
+  # naclports needs to cross build python for i386, but libssl1.0.0:i386
+  # only contains libcrypto.so.1.0.0 and not the symlink needed for
+  # linking (libcrypto.so).
+  create_library_symlink /lib/i386-linux-gnu/libcrypto.so.1.0.0 \
+      /usr/lib/i386-linux-gnu/libcrypto.so
+
+  create_library_symlink /lib/i386-linux-gnu/libssl.so.1.0.0 \
+      /usr/lib/i386-linux-gnu/libssl.so
 else
   echo "Skipping symbolic links for NaCl."
 fi