Skip to content

Instantly share code, notes, and snippets.

@rehevkor5
Forked from joekiller/gtk-firefox.sh
Last active December 14, 2015 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rehevkor5/5145245 to your computer and use it in GitHub Desktop.
Save rehevkor5/5145245 to your computer and use it in GitHub Desktop.
INSTALL FIREFOX ON AMAZON LINUX X86_64 COMPILING GTK+
#!/bin/bash
# GTK+ and Firefox for Amazon Linux
# Written by Joseph Lawson 2012-06-03
# http://joekiller.com
# http://joekiller.com/2012/06/03/install-firefox-on-amazon-linux-x86_64-compiling-gtk/
# Including changes from fork: https://gist.github.com/rehevkor5/5145245
# chmod 755 ./gtk-firefox.sh
# sudo ./gtk-firefox.sh
# Fail eagerly if not run as root.
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
TARGET=/usr/local
function init()
{
export installroot=$TARGET/src
export workpath=$TARGET
yum --assumeyes install make libjpeg-devel libpng-devel \
libtiff-devel gcc libffi-devel gettext-devel libmpc-devel \
libstdc++46-devel xauth gcc-c++ libtool libX11-devel \
libXext-devel libXinerama-devel libXi-devel libxml2-devel \
libXrender-devel libXrandr-devel libXt dbus-glib
mkdir -p $workpath
mkdir -p $installroot
cd $installroot
PKG_CONFIG_PATH="$workpath/lib/pkgconfig"
PATH=$workpath/bin:$PATH
export PKG_CONFIG_PATH PATH
bash -c "
cat << EOF > /etc/ld.so.conf.d/firefox.conf
$workpath/lib
$workpath/firefox
EOF
ldconfig
"
}
function finish()
{
cd $workpath
wget -r --timestamping --no-parent --accept "firefox*.tar.bz2" -nH --cut-dirs=7 http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/
rm -rf firefox
tar xvf firefox*.tar.bz2
rm firefox*.tar.bz2
cd bin
ln -s ../firefox/firefox
ldconfig
}
function install()
{
cd $installroot
wget --timestamping $1
FILE=`basename $1`
if [ ${FILE: -3} == ".xz" ]
then tar xvfJ $FILE
else tar xvf $FILE
fi
rm FILE
SHORT=${FILE:0:4}*
cd $SHORT
./configure --prefix=$workpath
make
make install
ldconfig
}
init
install ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
install http://download.savannah.gnu.org/releases/freetype/freetype-2.4.9.tar.gz
install http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.9.0.tar.gz
install http://ftp.gnome.org/pub/gnome/sources/glib/2.32/glib-2.32.3.tar.xz
install http://cairographics.org/releases/pixman-0.26.0.tar.gz
install http://cairographics.org/releases/cairo-1.12.2.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/pango/1.30/pango-1.30.0.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/atk/2.4/atk-2.4.0.tar.xz
install http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.26/gdk-pixbuf-2.26.1.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.10.tar.xz
finish
# adds the /usr/local/bin to your path by updating your .bashrc file.
cat << EOF >> ~/.bashrc
PATH=/usr/local/bin:\$PATH
export PATH
EOF
@rehevkor5
Copy link
Author

  • Fail eagerly if not run as root
  • Removes pre-existing Firefox so that expansion of the newly downloaded Firefox can succeed.
  • Cleans up downloaded compressed files.
  • Reduce dependence on cwd & reduce cd's to relative paths
  • Fixed some indenting

@rehevkor5
Copy link
Author

  • Avoid downloading more copies of tars... wget will overwrite or skip download based on timestamps.
  • Expected file name pattern is now passed to wget. Downloaded files are now more likely to match filename patterns in subsequent commands. It's till downloading robots.txt though, not sure how to prevent that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment