Re: Install Script Feedback
James Lynes <[email protected]>
| Newsgroups | gmane.comp.lang.perl.wxperl |
|---|---|
| Message-ID | <CABPyseg4heRBuE+bZPMS-D=D3mRaB4BF=p7X+yfkLRCtatNPHA@mail.gmail.com> |
Hi Steve: Here is hopefully the final version of the script! I finally found/figured out how to do the logging the way that I wanted and I commented out the clean-up section as the default configuration. James On Sat, Oct 25, 2014 at 3:22 AM, Steve Cookson <[email protected]> wrote: > Hi James, > > Very nice. I ran it on my PC. > > I often thought about why I didn't do the whole install script in Perl. > > It just seemed too large a task, especially the error checking. > > Regards, > > Steve. > > > On 24/10/14 23:47, James Lynes wrote: > > Hi Steve: > > Came up with a short script to list the directories effected. > > The list I sent you before had been manually generated. > > Still working on logging options. > > James > > > On Thu, Oct 23, 2014 at 10:03 AM, Steve Cookson <[email protected]> > wrote: > >> >> On 23-10-2014 15:01, James Lynes wrote: >> >>> >>> This approach is probably safer than just the warning note that I put >>> in, but the list of files to be deleted is 21 printed pages, so it may not >>> be practical to have that scroll across the screen. You couldn't really >>> review it. >>> >> >> Could you not just show the directories, like you did to me? >> >> Steve. >> > > >
wxPerl-Installer.sh
(application/x-sh, 9.2 KB)
#!/bin/bash
#
# wxPerl Installation Script for Ubuntu 14.04LTS 64bit
#
# Author: Steve Cookson (Kbuntu 14.04LTS 64bit Version)
# Modified By: James M. Lynes, Jr.
# Created: October 9, 2014
# Last Modified: October 26, 2014
# Change Log: 10/20/14 - Moved install files to ~/Perl, changed root of find to /usr/local
# 10/21/14 - Added warning message about clean-up section, updated notes
# 10/24/14 - Added clean-up-check.pl script and loading of perl-doc module
# 10/25/14 - Fixed icon path in launcher code
# 10/26/14 - Fixed Logging, commented out the clean-up section
#
#
# To Install: Open a Terminal Window
# mkdir ~/Perl
# cd ~/Perl
# Save this file as ~/Perl/wxPerl-Installer.sh
# sudo -s
# sh -v wxPerl-Installer.sh 2>&1 >wxPerl-Installer.log | tee wxPerl-Installer.screen
#
# (Stdout(mass of compiler output) goes to .log, Stderr goes to the screen and .screen)
# (Script start/stop times go to .runtime)
# (sh wxPerl-Installer.sh if you don't want the log file created, about 2MB)
# (all output will then go only to your screen)
#
#
# Notes: This script uses your system Perl(v5.18.2 in 14.04LTS).
# The wxPerl Demo program installs into /usr/local/bin/wxperl_demo.pl
# Installation log saved in ~/Perl/wxPerl-Installer.log.
# Installation script running time saved in ~/Perl/wxPerl-Installer.runtime.
# Installs wxWidgets 3.0.1 below your ~/Perl directory.
# see the --wxWidgets-version=3.0.1 line below.
# see http://sourceforge.net/p/wxperl/code/HEAD/tree/ for current revisions.
# Modify this script to add any libraries or Perl Modules you require.
# Modify this script to put log files in other than ~/Perl/.
# Uncomment optional git sections below to create local
# repositories for wxWidgets and wxPerl.
# Uncomment the optional clean-up section below
# to clean-up from previous downloads. See WARNING below.
# root owns the files created by this script. Must be su to delete.
# See below for creating a Launcher for wxperl_demo.pl
# This script takes approximately 1 hour and 30 minutes to run
# the first time on an HP 15 with Intel 2.16 GHz Quadcore.
# Approximately 58 minutes there after since system libraries
# and cpan modules are installed/updated the first time.
#
#
# WARNING: On a new Ubuntu/wxPerl install, the clean-up section below deletes wx files from:
# /usr/local/lib, /usr/local/bin, and /usr/local/share
# If you have concerns about your specific installation, it is suggested that
# you run the clean-up-check.pl script below and check for any items that you don't
# want removed from your system and modify the find statement accordingly.
#
#
cd ~/Perl # Install into your ~/Perl directory
date # Note the start date/time
date > wxPerl-Installer.runtime # Log the start date/time
#
#
# OPTIONAL clean-up from a previous installation attempt.
# Not required for initial installation, comment out.
#
#rm -rf Alien-wxWidgets # Optional clean-up before install
#rm -rf wxPerl # |
#find /usr/local | grep -i wx | grep -v -i python | grep -v -i soffice > rm_wx.sh # | Collect wx files.
# # | Exclude wxpython, and soffice files
#sed -i -e 's/\/usr\//rm -rf \/usr\//g' rm_wx.sh # | Build a rm command
#sh rm_wx.sh # | Remove them
#
# Reset packages in case there was a previous crash.
#
dpkg --configure -a # Configure all unpacked packages
apt-get -y update # Resync package indexes
apt-get -y upgrade # Install newest version of packages
#
# Install the dependencies first
#
# Install the Development Environment
#
apt-get -y install make # Needed for cpan
apt-get -y install g++
apt-get -y install gcc
apt-get -y install subversion # Needed for official Alien-wxWidgets and wxPerl
apt-get -y install git # Needed for custom install Alien-wxWidgets and wxPerl
apt-get -y install libgconf2-dev # Needed as wxMediaCtrl dependency
apt-get -y install libgtk-3-dev # Needed as wxMediaCtrl dependency
apt-get -y install libexpat1-dev
apt-get -y install libtiff4-dev
apt-get -y install libpng12-dev
apt-get -y install libjpeg-dev
apt-get -y install libcairo2-dev
apt-get -y install libxmu-dev
apt-get -y install libwebkitgtk-dev
#
# Install the Video environment (wxMediaCtrl dependencies)
#
apt-get -y install libgstreamer0.10-dev # Needed for Alien-wxWidgets and wxPerl
apt-get -y install libgstreamer-plugins-base0.10-dev # Needed for Alien-wxWidgets and wxPerl
#
apt-get -y install cups-pdf # Needed for PDF printing
apt-get -y install apparmor-utils # Confine an application's resources
aa-complain cupsd # Report resource policy violations
#
# Install Perl modules
#
cpan -i ExtUtils::XSpp # Needed by wxPerl/Alien install
cpan -i ExtUtils::ParseXS # Needed by wxPerl Makefile.PL
cpan -i ExtUtils::MakeMaker # ?
cpan -i XSLoader # Needed by wxPerl/Alien install
cpan -i Encode # Needed for utf-8
cpan -i Test::Pod # ?
cpan -i Pod::Coverage # ?
cpan -i Test::Pod::Coverage # ?
#
# Install OpenGL and Dependencies
#
apt-get -y install libglu1-mesa-dev
apt-get -y install freeglut3-dev
apt-get -y install mesa-common-dev # Needed by OpenGL
apt-get -y install libsdl1.2-dev # ?
apt-get -y remove libwxgtk2.8-dev
apt-get -y install libwxgtk3.0-dev
apt-get autoremove # Remove packages no longer needed
cpan -i OpenGL
#
# Download Alien-wxWidgets(wxWidgets)
#
cd ~/Perl
svn co https://svn.code.sf.net/p/wxperl/code/Alien-wxWidgets/trunk Alien-wxWidgets
#git clone https://github.com/SteveBz/Alien-wxWidgets # Optional location
#
# Compile wxWidgets
#
cd ~/Perl/Alien-wxWidgets
perl Build.PL \
--wxWidgets-build=1 \
--wxWidgets-graphicscontext \
--wxWidgets-build-opengl=1 \
--wxWidgets-version=3.0.1 \
--wxWidgets-source=tar.bz2 \
--wxWidgets-unicode=1 \
--wx-unicode='yes' \
--wxWidgets-extraflags="--enable-graphics_ctx \
--disable-compat26 \
--enable-mediactrl \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-regex=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
--with-expat=builtin \
--with-libxpm=builtin \
--with-gtk=2\
--with-gtkprint"
#
# Build wxWidgets
#
perl Build
# Baseline Alien-wxWidgets on git. # Optional local wxWidgets repository
#git init # |
#git add * # |
#git commit -am "Adding Alien-wxWidgets baseline" # |
perl Build install
ldconfig # Configure dynamic linker run-time bindings
#
# Download wxPerl
#
cd ~/Perl
svn co https://svn.code.sf.net/p/wxperl/code/wxPerl/trunk wxPerl
#git clone https://github.com/SteveBz/wxPerl # Optional location
#
# Build wxPerl
#
cd ~/Perl/wxPerl
perl Makefile.PL
make
# Baseline wxPerl on git. # Optional local wxPerl repository
#git init # |
#git add ~/wxPerl # |
#git commit -am "Adding wxPerl baseline" # |
make install
#
# Install predecessors for Wx::PdfDocuments
#
cd ~
cpan -i Wx::GLCanvas
cpan -i Text::Patch
cpan -i Wx::PdfDocument
#
# Install wxDemo # Installs into /usr/local/bin/wxperl_demo.pl
#
cpan -i Wx::Demo
#
# Install Locally Needed Modules(modify for your environment)
#
cpan -i App::cpanminus
cpan -i Device::SerialPort
apt-get -y install php5-gd # Needed for GD
apt-get -y install libgd2-xpm-dev # Needed for GD
cpan -i GD
cpan -i GD::Text
cpan -i GD::Graph
apt-get -y install perl-doc # perl docs not installed in Ubuntu distro
#
# Done
#
date # Note the ending date/time
date >> ~/Perl/wxPerl-Installer.runtime # Log the ending date/time
#
# -----------------------------------------------------------------------------------
#
#! /usr/bin/perl
#
# clean-up-check.pl
#
# Script to list the directories effected by the wxPerl-Install.sh script clean-up section.
# Related "wx" files from these directories will be deleted by the clean-up process.
# Run this script prior to running the optional clean-up code in the installer.
#
# Created by: James M. Lynes, Jr
# Creation Date: October 24, 2014
# Last Modified: October 24,2014
#
#use strict;
#use warnings;
#use File::Basename;
#
#my %dirs; # Use a hash to remove duplicate directory entrys
#
# Execute the "find" command used by the wxPerl-Installer.sh script
# Each line is a path to a file that will be deleted
#
#my @lines = `find /usr/local | grep -i wx | grep -v -i python | grep -v -i soffice`;
#
#foreach my $line (@lines) {
# my $key=dirname($line);
# $dirs{$key} += 1; # build hash with directory paths as keys
#} # duplicate key counts aren't being used
#
#my @k = sort keys %dirs;
#foreach my $k (@k) {
# print ($k, "\n"); # Sort and print the keys(unique directory paths)
#}
#
# -----------------------------------------------------------------------------------------------
#
# To create a Launcher for wxperl_demo.pl
#
# Copy the lines below into ~/Perl/wxperl_demo.desktop
# (Without the leading # and tab)
# Make the file executable
# (icon changes to wxpl.ico)
# Drag the icon to the Launcher
# Click on the icon to Launch wxperl_demo.pl
#
#
# [Desktop Entry]
# Name=wxPerl_Demo
# Type=Application
# Terminal=false
# Icon=/home/your-user-name/Perl/wxPerl/wxpl.ico
# Exec=perl /usr/local/bin/wxperl_demo.pl
#