summaryrefslogtreecommitdiff
path: root/core/perl/PKGBUILD
blob: ed8bdce526294ea0fb47c410fe3839e61a2aad58 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# $Id: PKGBUILD 182787 2013-04-15 10:15:37Z bluewind $
# Maintainer: Florian Pritz <bluewind@xinu.at>
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: kevin <kevin.archlinux.org>
# Contributor: judd <jvinet.zeroflux.org>
# Contributor: francois <francois.archlinux.org>

pkgname=perl
pkgver=5.16.3
pkgrel=2
pkgdesc="A highly capable, feature-rich programming language"
arch=(i686 x86_64 'mips64el')
license=('GPL' 'PerlArtistic')
url="http://www.perl.org"
groups=('base')
depends=('gdbm' 'db' 'coreutils' 'glibc' 'sh')
source=(http://www.cpan.org/src/5.0/perl-${pkgver}.tar.bz2
        cgi-cr-escaping.diff
        perlbin.sh
        perlbin.csh
		CVE-2012-6329.patch
        provides.pl)
install=perl.install
options=('makeflags' '!purge')
md5sums=('025102de0e4a597cf541e57da80c6aa3'
         '0486659c9eefe682364a3e364d814296'
         '5ed2542fdb9a60682f215bd33701e61a'
         '1f0cbbee783e8a6d32f01be5118e0d5e'
         '5dc374e095d896fb30618e414aeb9017'
         '999c3eea6464860704abbb055a0f0896')
# workaround to let the integrity check find the correct provides array
if [[ ${0##*/} = "parse_pkgbuilds.sh" ]]; then
	true && provides=($(bsdtar -q -O -xf "/srv/ftp/pool/packages/$pkgname-$pkgver-$pkgrel-$CARCH.pkg.tar.xz" .PKGINFO | sed -rn 's#^provides = (.*)#\1#p'))
fi

build() {
  cd ${srcdir}/${pkgname}-${pkgver}

  patch -i "$srcdir/cgi-cr-escaping.diff" -p1
  patch -i "$srcdir/CVE-2012-6329.patch" -p1

  if [ "${CARCH}" != "i686" ]; then
    arch_opts="-Dcccdlflags='-fPIC'"
  else
    # for i686
    arch_opts=""
  fi

  ./Configure -des -Dusethreads -Duseshrplib -Doptimize="${CFLAGS}" \
    -Dprefix=/usr -Dvendorprefix=/usr \
    -Dprivlib=/usr/share/perl5/core_perl \
    -Darchlib=/usr/lib/perl5/core_perl \
    -Dsitelib=/usr/share/perl5/site_perl \
    -Dsitearch=/usr/lib/perl5/site_perl \
    -Dvendorlib=/usr/share/perl5/vendor_perl \
    -Dvendorarch=/usr/lib/perl5/vendor_perl \
    -Dscriptdir=/usr/bin/core_perl \
    -Dsitescript=/usr/bin/site_perl \
    -Dvendorscript=/usr/bin/vendor_perl \
    -Dinc_version_list=none \
    -Dman1ext=1perl -Dman3ext=3perl ${arch_opts} \
    -Dlddlflags="-shared ${LDFLAGS}" -Dldflags="${LDFLAGS}"
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  TEST_JOBS=$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/') make test_harness
#  make test
}

package() {
  # hack to work around makepkg running the subshell in check_sanity()
  new_provides=($(cd "$srcdir/perl-$pkgver"; LD_PRELOAD=./libperl.so ./perl -Ilib "$srcdir/provides.pl" .))
  provides=(${new_provides[@]})

  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR="$pkgdir" install

  ### Perl Settings ###
  # Change man page extensions for site and vendor module builds.
  # Set no mail address since bug reports should go to the bug tracker
  # and not someone's email.
  sed -e '/^man1ext=/ s/1perl/1p/' -e '/^man3ext=/ s/3perl/3pm/' \
      -e "/^cf_email=/ s/'.*'/''/" \
      -e "/^perladmin=/ s/'.*'/''/" \
      -i ${pkgdir}/usr/lib/perl5/core_perl/Config_heavy.pl

  ### CPAN Settings ###
  # Set CPAN default config to use the site directories.
  sed -e '/(makepl_arg =>/   s/""/"INSTALLDIRS=site"/' \
      -e '/(mbuildpl_arg =>/ s/""/"installdirs=site"/' \
      -i ${pkgdir}/usr/share/perl5/core_perl/CPAN/FirstTime.pm

  ### CPANPLUS Settings ###
  # Set CPANPLUS default config to use the site directories.
  sed -e "/{'makemakerflags'}/ s/'';/'INSTALLDIRS=site';/" \
      -e "/{'buildflags'}/     s/'';/'installdirs=site';/" \
      -i ${pkgdir}/usr/share/perl5/core_perl/CPANPLUS/Config.pm

  # Profile script to set paths to perl scripts.
  install -D -m755 ${srcdir}/perlbin.sh \
                   ${pkgdir}/etc/profile.d/perlbin.sh
  # Profile script to set paths to perl scripts on csh. (FS#22441)
  install -D -m755 ${srcdir}/perlbin.csh \
                  ${pkgdir}/etc/profile.d/perlbin.csh

  (cd ${pkgdir}/usr/bin; mv perl${pkgver} perl)
  (cd ${pkgdir}/usr/bin/core_perl;  ln -sf c2ph pstruct; ln -sf s2p psed)

  # Remove all pod files *except* those under /usr/share/perl5/core_perl/pod/
  # (FS#16488)
  rm -f $pkgdir/usr/share/perl5/core_perl/*.pod
  for d in $pkgdir/usr/share/perl5/core_perl/*; do
    if [ -d $d -a $(basename $d) != "pod" ]; then
      find $d -name *.pod -delete
    fi
  done
  find $pkgdir/usr/lib -name *.pod -delete
  find $pkgdir -name .packlist -delete
}