-
Notifications
You must be signed in to change notification settings - Fork 218
/
Copy pathbuild.sh
executable file
·66 lines (46 loc) · 1.23 KB
/
build.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
SHELL=/bin/bash
eval "$(perlbrew init-in-bash)"
# source $HOME/perl5/perlbrew/etc/bashrc
wanted_perl_installation="perl-5.8.9@perlbrew"
perlbrew use ${wanted_perl_installation}
if [ $? -eq 0 ]; then
echo "--- Using ${wanted_perl_installation} for building."
else
echo "!!! Fail to use ${wanted_perl_installation} for building. Please prepare it first."
fi
cpanm File::Path App::FatPacker
cd $(dirname $0)/../
cpanm --installdeps .
cd $(dirname $0)
fatpack_path=$(which fatpack)
if [ ! -f "$fatpack_path" ]; then
echo "!!! fatpack is missing"
exit 2
else
echo "--- Found fatpack at $fatpack_path"
fi
rm -rf fatlib/
mkdir fatlib/
rm -rf lib/App
mkdir -p lib/App
./update-fatlib.pl
cp ../lib/App/perlbrew.pm lib/App/perlbrew.pm
cp -r ../lib/App/Perlbrew lib/App/
export PERL5LIB="lib":$PERL5LIB
cat - <<"EOF" > perlbrew
#!/usr/bin/perl
use strict;
use Config;
BEGIN {
my @oldinc = @INC;
@INC = ( $Config{sitelibexp}."/".$Config{archname}, $Config{sitelibexp}, @Config{qw<vendorlibexp vendorarchexp archlibexp privlibexp>} );
require Cwd;
@INC = @oldinc;
}
EOF
(fatpack file; cat ../script/perlbrew) >> perlbrew
chmod +x perlbrew
mv ./perlbrew ../
echo "+++ DONE: './perlbrew' is built."
exit 0;