packageit-msys.sh
author Ryan VanderMeulen <ryanvm@gmail.com>
Mon, 20 Feb 2012 10:41:13 +0900
changeset 140 a1bc3aa272a8
parent 134 6ca6ce04437d
child 165 15737da4f359
permissions -rw-r--r--
Bug 712841 - Include MSVC2011 support files in installer package. r=khuey
set -e

# This script expects these to be absolute paths in win32 format
if test -z "$MOZ_SRCDIR"; then
    echo "This script should be run from packageit.py (MOZ_SRCDIR missing)."
    exit 1
fi
if test -z "$MOZ_STAGEDIR"; then
    echo "This script should be run from packageit.py (MOZ_STAGEDIR missing)."
    exit 1
fi

MSYS_SRCDIR=$(cd "$MOZ_SRCDIR" && pwd)
MSYS_STAGEDIR=$(cd "$MOZ_STAGEDIR" && pwd)

rm -rf "${MSYS_STAGEDIR}"{MIME_Base64-3.07,Time-HiRes-1.9707,make-3.81.90,cvs-1.11.22}

tar -xzf "${MSYS_SRCDIR}/MIME-Base64-3.07.tar.gz" -C "${MSYS_STAGEDIR}"
pushd "${MSYS_STAGEDIR}/MIME-Base64-3.07"
perl Makefile.pl
make LD="gcc -shared"
make test
make install PREFIX="${MSYS_STAGEDIR}/mozilla-build/msys"
popd

tar -xzf "${MSYS_SRCDIR}/Time-HiRes-1.9707.tar.gz" -C "${MSYS_STAGEDIR}"
pushd "${MSYS_STAGEDIR}/Time-HiRes-1.9707"
perl Makefile.pl
make LD="gcc -shared"
# make test fails because of misconfigured virtual internal timers :-(
make install PREFIX="${MSYS_STAGEDIR}/mozilla-build/msys"
popd

# The make 3.81 shipping with msys is still broken, so continue shipping this.
tar -xjf "${MSYS_SRCDIR}/make-3.81.90.tar.bz2" -C "${MSYS_STAGEDIR}"
pushd "${MSYS_STAGEDIR}/make-3.81.90"
patch -p0 < "${MSYS_SRCDIR}/make-msys.patch"
./configure --prefix=/local
make
make install prefix="${MSYS_STAGEDIR}/mozilla-build/msys/local"
popd

# This CVS has issues, so disable building it for now.
# See bug 409260 for details.
#
# tar -xjf "${MSYS_SRCDIR}/cvs-1.11.22.tar.bz2" -C "${MSYS_STAGEDIR}"
# pushd "${MSYS_STAGEDIR}/cvs-1.11.22"
# ./configure --prefix=/local
# make
# make install prefix="${MSYS_STAGEDIR}/mozilla-build/msys/local"
# popd

# install a newer version of ssh. the one that comes with MSYS has hanging
# problems
tar -jvxf "${MSYS_SRCDIR}/minires-1.01-1-MSYS-1.0.11.tar.bz2" -C "${MSYS_STAGEDIR}/mozilla-build/msys"
tar -jvxf "${MSYS_SRCDIR}/openssh-4.6p1-MSYS-1.0.11.tar.bz2" -C "${MSYS_STAGEDIR}/mozilla-build/msys"
tar -jvxf "${MSYS_SRCDIR}/openssl-0.9.8e-3-MSYS-1.0.11.tar.bz2" -C "${MSYS_STAGEDIR}/mozilla-build/msys"
tar -jvxf "${MSYS_SRCDIR}/zlib-1.2.3-MSYS-1.0.11.tar.bz2" -C "${MSYS_STAGEDIR}/mozilla-build/msys"
# These tarballs extract to usr/; it's easiest if we just move all the files
# into /...
pushd "${MSYS_STAGEDIR}/mozilla-build/msys"
cp -R usr/* ./
rm -rf usr/
popd

# In order for this to actually work, we now need to rebase
# the DLL. Since I can't figure out how to rebase just one
# DLL to avoid conflicts with a set of others, we just
# rebase them all!
# Some DLLs won't rebase unless they are chmod 755
find "${MSYS_STAGEDIR}/mozilla-build/msys" -name "*.dll" | \
  xargs chmod 755

# Skip libW11.dll, since it doesn't rebase properly
find "${MSYS_STAGEDIR}/mozilla-build/msys" -name "*.dll" | \
  grep -v "libW11.dll" | \
  xargs rebase -d -b 60000000
# Now rebase msys-1.0.dll to a special place because it's finicky
rebase -b 60100000 "${MSYS_STAGEDIR}/mozilla-build/msys/bin/msys-1.0.dll"