forked from skaji/relocatable-perl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac.sh
executable file
·30 lines (23 loc) · 929 Bytes
/
mac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Usage:
# ./mac.sh --perl_version 5.20.1
# ./mac.sh --tarball ~/perl-5.20.1.tar.gz
HAVE_GDBM=NO
PERL_PREFIX=/opt/perl
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
for cmd in gcp gtar curl; do
if ! type $cmd >/dev/null 2>&1; then echo missing $cmd; exit 1; fi
done
set -ex
if [ -e $PERL_PREFIX ]; then echo already exists $PERL_PREFIX; exit 1; fi
sudo mkdir $PERL_PREFIX
sudo chown $USER:staff $PERL_PREFIX
if [ -f /usr/local/lib/libgdbm.dylib ]; then brew unlink gdbm; HAVE_GDBM=YES; fi
perl ./relocatable-perl-build --prefix $PERL_PREFIX "$@"
if [ $HAVE_GDBM = "YES" ]; then brew link gdbm; fi
curl -sL http://cpanmin.us | $PERL_PREFIX/bin/perl - -qn --no-man-pages App::cpanminus App::ChangeShebang
$PERL_PREFIX/bin/change-shebang -f $PERL_PREFIX/bin/*
NAME=perl-`$PERL_PREFIX/bin/perl -MConfig -e 'print $Config{archname}'`
gcp -r /opt/perl ./$NAME
gtar czf $NAME.tar.gz $NAME
rm -rf $NAME