Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 8b59fee3fc62606ff643644ab6ca66528497355a @rsp committed Sep 16, 2010
Showing with 112 additions and 0 deletions.
  1. +19 −0 LICENSE
  2. +20 −0 README
  3. +73 −0 getperl
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Rafal Pocztarski
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
20 README
@@ -0,0 +1,20 @@
+
+Getperl - Copyright (c) 2010 Rafal Pocztarski
+This program comes with ABSOLUTELY NO WARRANTY.
+You may redistribute it under certain conditions.
+See LICENSE for details.
+
+Getperl downloads, configures, builds and tests perl.
+Project home page: http://github.com/rsp/getperl
+
+Usage: getperl VERSION
+ getperl VERSION PREFIX
+
+Downloads: http://www.cpan.org/src/5.0/perl-VERSION.tar.gz
+and builds for installation in PREFIX or /opt/perl by default.
+If PREFIX is 'v' or 'V' it is equivalent to /opt/perl-VERSION
+
+Examples: getperl 5.12.2
+ getperl 5.12.2 v
+ getperl 5.12.2 /usr/local
+
73 getperl
@@ -0,0 +1,73 @@
+#!/bin/bash
+# RSP 2010-09-16
+echo
+echo "Getperl - Copyright (c) 2010 Rafal Pocztarski"
+echo "This program comes with ABSOLUTELY NO WARRANTY."
+echo "You may redistribute it under certain conditions."
+echo "See LICENSE for details."
+echo
+echo "Getperl downloads, configures, builds and tests perl."
+echo "Project home page: http://github.com/rsp/getperl"
+echo
+if [ "$1" == "" ]; then
+ echo "Usage: getperl VERSION"
+ echo " getperl VERSION PREFIX"
+ echo
+ echo "Downloads: http://www.cpan.org/src/5.0/perl-VERSION.tar.gz"
+ echo "and builds for installation in PREFIX or /opt/perl by default."
+ echo "If PREFIX is 'v' or 'V' it is equivalent to /opt/perl-VERSION"
+ echo
+ echo "Examples: getperl 5.12.2"
+ echo " getperl 5.12.2 v"
+ echo " getperl 5.12.2 /usr/local"
+ echo
+ exit 1
+fi
+version="$1"
+dir="perl-$version"
+file="$dir.tar.gz"
+url="http://www.cpan.org/src/5.0/$file"
+if [ "$2" == "" ]; then
+ prefix="/opt/perl"
+elif [ "$2" == "v" ] || [ "$2" == "V" ]; then
+ prefix="/opt/perl-$version"
+else
+ prefix="$2"
+fi
+echo "Getperl is going to download:"
+echo " $url"
+echo "and build it for installation in:"
+echo " $prefix"
+
+d1=`date '+%Y-%m-%d %H:%M:%S'`
+if [ -d $dir ]; then
+ echo "Directory $dir already exists - remove manually"
+ echo
+ exit 2
+fi
+if [ -f $file ]; then
+ echo "File $file already exists - skipping download"
+else
+ wget $url
+fi
+if [ ! -f $file ]; then
+ echo "File $file not found - download failed"
+ echo
+ exit 2
+fi
+tar xzvf $file || (echo "Error extracting $file"; exit 2)
+if [ ! -d $dir ]; then
+ echo "Directory $dir not found - extraction failed"
+ echo
+ exit 2
+fi
+cd $dir
+sh Configure -Dprefix=$prefix -de \
+&& make && make test && echo DONE || (echo ERROR; exit 2)
+d2=`date '+%Y-%m-%d %H:%M:%S'`
+echo -e "From:\t$d1\nTo:\t$d2"
+echo
+echo "You can now run 'make install' or 'sudo make install'"
+echo "to install $dir in $prefix"
+echo
+

0 comments on commit 8b59fee

Please sign in to comment.