summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f6e3d95460ffcf75ebc00e062cfb5b924b10e3c7 (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
# Maintainer:  Chris Severance aur.severach aATt spamgourmet dott com
# From AUR phing
# Contributor: Benjamin A. Shelton <zancarius@gmail.com>
# Source: https://github.com/zancarius/archlinux-pkgbuilds

# I couldn't get AUR phing to work. php_basedir error. I fixed that and came up with a better way to enable extension phar without enabling it systemwide.

set -u
_pkgname='phing'
pkgname="php-${_pkgname}-bin"
pkgver='2.16.3'
pkgrel='1'
pkgdesc='PHP project build system based on Apache Ant'
arch=('any')
#url='http://pear.phing.info'
#url='https://github.com/phingofficial/phing'
url='https://www.phing.info/'
license=('LGPL')
depends=('php')
provides=("${_pkgname}=${pkgver}" "php-${_pkgname}=${pkgver}")
conflicts=("${_pkgname}" "php-${_pkgname}")
options=('!strip')
_verwatch=('http://pear.phing.info/feed.xml' '\s\+<title>phing \([0-9\.]\+\) (stable)</title>.*' 'f')
source=("${url}/get/${_pkgname}-${pkgver}.phar")
sha256sums=('e08fb564db7362d6b4d4c91f0995142f9b99e8246fc6f6fe5325e868186cd7a9')

package() {
  set -u
  # While it's rude to enable phar.so systemwide, it's necessary because phing calls many things that use phar.
  # However it's not necessary because phing calls many other things that require other modules. You must provide for those so provide for phar too.
  #install -Dpm0644 <(echo $'extension=phar.so') "${pkgdir}/etc/php/conf.d/phar.ini"
  install -Dpm0755 "${srcdir}/${_pkgname}-${pkgver}.phar" "${pkgdir}/usr/bin/${_pkgname}.phar"

  # Command line launchers
  local _phing="#!/usr/bin/bash
# Installed by ${_pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
# https://aur.archlinux.org/
%1
php -d 'open_basedir=NULL' -d 'phar.readonly=0' -d 'extension=phar.so' %2 \\
  '/usr/bin/${_pkgname}.phar' \"\$@\"
"

  local _phing1="${_phing//%1/}" # Almost as much trouble as The Cat in the Hat Thing1 and Thing2
        _phing1="${_phing1// %2/}"

  local _cr=$'\n'
  local _phing2="${_phing//%1/extracmd=\"\$1\"${_cr}shift}"
        _phing2="${_phing2// %2/ \$\{extracmd\}}"

  # Command line launchers
  install -d "${pkgdir}/usr/bin/"
  echo "${_phing1}" > "${pkgdir}/usr/bin/${_pkgname}"; chmod 755 "${pkgdir}/usr/bin/${_pkgname}"
  echo "${_phing2}" > "${pkgdir}/usr/bin/${_pkgname}.sh"; chmod 755 "${pkgdir}/usr/bin/${_pkgname}.sh"

  set +u
}
set +u