Net-FullAuto

 view release on metacpan or  search on metacpan

lib/Net/FullAuto/FA_Core.pm  view on Meta::CPAN

   import FA_Core;

   # http://joekiller.com/2012/06/03/ \
   # install-firefox-on-amazon-linux-x86_64-compiling-gtk/

   # https://forums.aws.amazon.com/thread.jspa?messageID=224857

   # http://raspberrypi.stackexchange.com/questions/1719/ \
   # x11-connection-rejected-because-of-wrong-authentication

   # https://wiki.archlinux.org/index.php/Running_X_apps_as_root

   print "\n";
   my $c='sudo 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 '.
         'pandgo pango-devel';
   open(AWS,"$c|");
   while (my $line=<AWS>) {
      print $line;
   }
   close AWS;
   $ENV{PKG_CONFIG_PATH}='/usr/local/lib/pkgconfig';

   my @creds=();
   open(AWS,"(sudo -u ec2-user xauth list 1>&2) 2>&1|");
   while (my $line=<AWS>) {
      print "WHAT IS THE VALUE=$line\n";
      chomp $line;
      push @creds, $line;
   }
   close AWS;
   foreach my $cred (@creds) {
      system("sudo xauth add $cred");
   }

   # for gcc compiles (building a program with Gcc and a simple "make"):
   # Code: -Wl,-rpath,$(DEFAULT_LIB_INSTALL_PATH)
   # This is a good link:
   # http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

   $c=<<'END';
bash -c "
cat << EOF > /etc/ld.so.conf.d/gtk.conf
/usr/local/lib
EOF
ldconfig
"
END
   open(AWS,"$c|");
   while (my $line=<AWS>) {
      print $line;
   }
   close AWS;
   system("sudo chmod 444 /etc/ld.so.conf.d/gtk.conf");
   my @urls=(
      'ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz',
      'http://download.savannah.gnu.org/releases/freetype/freetype-2.4.9.tar.gz',
      'http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.9.0.tar.gz',
      'http://cairographics.org/releases/pixman-0.26.0.tar.gz',
      'http://cairographics.org/releases/cairo-1.12.2.tar.xz',
      'http://ftp.gnome.org/pub/gnome/sources/pango/1.30/pango-1.30.0.tar.xz',
      'http://ftp.gnome.org/pub/gnome/sources/atk/2.4/atk-2.4.0.tar.xz',
      'http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.26/gdk-pixbuf-2.26.1.tar.xz',
      'http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.10.tar.xz',
   );
   my $pkg_config='export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/';
   foreach my $url (@urls) {
      my $file=$url;
      $file=~s/^.*\/(.*)$/$1/;
      my $base=$file;
      $base=~s/\.tar\..z$//;
      unless (-d $base) {
         system("sudo wget $url");
      } else { next }
      if ($file=~/.xz$/) {
         system("sudo tar xvfJ $file");
      } else {
         system("sudo tar zxvf $file");
      }
      chdir $base;
      system("sudo bash -lc \'$pkg_config;./configure\'");
      system("sudo make");
      system("sudo make install");
      if (-1<index $url,'gtk+') {
         chdir 'demos/gtk-demo';
         system("sudo make install");
         chdir '..';
         system("sudo make install");
         chdir '..';
         system('sudo chmod 755 /usr/local/lib/pkgconfig');
         system('sudo cp gtk+-2.0.pc /usr/local/lib/pkgconfig');
         my $missing_pc=<<'END';
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
target=x11

Name: GDK
Description: GTK+ Drawing Kit (${target} target)
Version: 2.24.10
Requires: pango pangocairo gdk-pixbuf-2.0
Libs: -L${libdir} -lgdk-${target}-2.0
Cflags: -I${includedir}/gtk-2.0 -I${libdir}/gtk-2.0/include
END
         open(FH,">gdk-x11-2.0.pc");
         print FH $missing_pc;
         close FH;
         system('sudo cp gdk-x11-2.0.pc /usr/local/lib/pkgconfig');
      }
      system("sudo ldconfig");
      chdir '..';
   }
   system('sudo chmod -Rv 755 /usr/local/lib/pango');
   system('sudo chmod -Rv 755 /usr/local/etc/*');
   system('sudo bash -lc '.
          '"export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig;'.
          'perl -MCPAN -e \'install Fatal\'"');



( run in 0.778 second using v1.01-cache-2.11-cpan-39bf76dae61 )