stages/*: change license to Apache 2.0
[dragora.git] / stages / 1 / 11-perl
blob061125080887dabbb6e0f4f6e57c3a7c0b993b36
1 # Build script for perl and perl-cross.
2 # Perl-cross URL: http://arsv.github.io/perl-cross/
4 # Copyright (c) 2014-2017 Matias Fonzo, <selk@dragora.org>.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 #    http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 version=5.24.1
19 cross_ver=1.1.4
21 rm -rf -- "${TMPDIR}/perl-${version}" \
22           "${TMPDIR}/perl-cross-${cross_ver}"
23 untar "${worktree}/sources/perl-${version}.tar.gz" "$TMPDIR"
24 untar "${worktree}/sources/perl-cross-${cross_ver}.tar.gz" "$TMPDIR"
26 # Copy perl-cross files over perl-<version>
27 cd -- "$TMPDIR"
28 cp -f -r "perl-cross-${cross_ver}"/* "perl-${version}"
30 # Build instructions
31 cd "perl-${version}"
33 # Don't use -fstack-protector* (troubles)
34 sed -i 's/-fstack-protector/-fnostack-protector/g' ./Configure
36 ./configure \
37  --prefix=/tools \
38  --target=$target \
39  --all-static \
40  -Dprivlib=/tools/lib${libSuffix}/perl5 \
41  -Dsitelib=/tools/lib${libSuffix}/perl5/site_perl \
42  -A ldflags="$BTLDFLAGS -static"
44 make
46 mkdir -p -- "${rootdir}/tools/bin" "${rootdir}/tools/lib${libSuffix}/perl5"
48 cp -f perl cpan/podlators/scripts/pod2man "${rootdir}/tools/bin"
49 cp -R lib/* "${rootdir}/tools/lib${libSuffix}/perl5"
51 cleanup()
53     cd -- "$TMPDIR" && rm -rf "perl-${version}" "perl-cross-${cross_ver}"