summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ab976cc93d1fc17523cbe1de38a59d30f32e0f12 (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
# Maintainer: dreieck

_pkgname=perl-bareword-filehandles
pkgname="${_pkgname}-git"
pkgver=0.007.2+r38.20200501.g957063d
pkgrel=3
pkgdesc='disables bareword filehandles.'
arch=(
  'arm'
  'i686'
  'x86_64'
)
url='https://metacpan.org/pod/bareword::filehandles'
license=(
  'PerlArtistic'
)
depends=(
  'perl'
)
makedepends=(
  'git'
  'perl-b-hooks-op-check'
  'perl-extutils-depends'
  'perl-extutils-makemaker'
  'perl-extutils-makemaker-dist-zilla-develop' # for generating ppport.h
)
checkdepends=(
  'perl-test-pod-coverage'
)
provides=(
  "${_pkgname}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
)
options=('!emptydirs')
source=(
  "${_pkgname}::git+https://github.com/ilmari/bareword-filehandles.git"
  'Makefile.PL.MakeMaker'
  'Makefile.add-b-hooks-op-check-include.patch'
  'LICENSE.PerlArtistic.txt'
)
sha256sums=(
  'SKIP'
  'ff11afc581c683f2d904fa6fd3ab0ed4a22fed7653660b401b8ddf153fb0bd05'
  'fa351fddc0767e003b1b02f35f14dc65480bdf6c6fddd060278c3b68db8cd461'
  '916a330e64df209a924120bfddea0373db385eb3854e96d1a3dda6e0ea130c80'
)

prepare() {
  cd "${srcdir}/${_pkgname}"

  cp "${srcdir}/Makefile.PL.MakeMaker" .

  perl Makefile.PL # Use this to generate 'ppport.h'
  mv Makefile Makefile.dzil

  perl Makefile.PL.MakeMaker # Then use this to generate a makefile which does not need perl-dist-zilla.
  mv Makefile Makefile.MakeMaker
  patch -N -i "${srcdir}/Makefile.add-b-hooks-op-check-include.patch" Makefile.MakeMaker
  ln -s Makefile.MakeMaker Makefile # It is needed to keep a 'Makefile', otherwise it will be rebuild.
}

pkgver() {
  cd "${srcdir}/${_pkgname}"

  _descr="$(git describe --tags --long)"
  _ver="$(printf '%s' "${_descr}" | awk -F '-' '{print $1"."$2}' | sed 's|^v||')"
  _rev="r$(git rev-list --count HEAD)"
  _hash="$(printf '%s' "${_descr}" | awk -F '-' '{print $3}')"
  _date="$(git log -n 1 --format=tformat:%ci | awk '{print $1}' | tr -d '-')"
  printf '%s\n' "${_ver}+${_rev}.${_date}.${_hash}"
}

build() {
  cd "${srcdir}/${_pkgname}"

  make -f Makefile.MakeMaker
}

check() {
  cd "${srcdir}/${_pkgname}"

  make -f Makefile.dzil test
}

package() {
  cd "${srcdir}/${_pkgname}"

  make -f Makefile.MakeMaker DESTDIR="${pkgdir}" install

  # remove perllocal.pod and .packlist
  find "${pkgdir}" -name perllocal.pod -delete
  find "${pkgdir}" -name .packlist -delete

  for _docfile in Changes; do
    install -D -v -m644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done

  install -D -v -m644 "${srcdir}/LICENSE.PerlArtistic.txt" "${pkgdir}/usr/share/licenses/${pkgname}/COPYING.PerlArtistic.txt"
}