summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cddd34203bccf6eb2915d8f990d3f13df620411a (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
# Maintainer:  Caleb Maclennan <caleb@alerque.com>
# Contributor: Scott Dickson <scottfoesho@gmail.com>

pkgname=cops-mikespub-org
_name="cops"
_github_name="seblucas-cops"
provides=('cops')
conflicts=('cops')
pkgver=4.3.1
pkgrel=1
pkgdesc='Lightweight Calibre OPDS (and HTML) PHP Server (mikespub.org fork)'
arch=('any')
url="https://github.com/mikespub-org/$_github_name"
license=('GPL-2.0-or-later')
depends=(
  'php'
  'php-gd'
  'php-intl'
  'php-sqlite'
)
optdepends=(
  'apache: Web server to serve COPS with'
  'nginx: Web server to serve COPS with'
  'cherokee: Web server to serve COPS with'
)
makedepends=(
  'composer'
  'libxml2' # for xmllint
)
backup=("etc/webapps/${_name}/local.php")
install="${_name}.install"
source=("${pkgname}_${pkgver}.zip::${url}/archive/refs/tags/${pkgver}.zip")
sha256sums=('b9f1bdb75d7375a4663bb02db992548fa07ab0fbc2bb4a739b249717121be770')

prepare () {
    cd "${_github_name}-$pkgver"
    # The external packages are requirements, and they cause composer errors if
    # building in chroot, but we have them in deps so ignore them here
    composer update --no-dev \
	--ignore-platform-req=ext-gd \
	--ignore-platform-req=ext-intl \
	--ignore-platform-req=ext-pdo_sqlite \
	--ignore-platform-req=ext-iconv
}

build () {
    cd "${_github_name}-$pkgver"
    composer install --no-dev --optimize-autoloader \
	--ignore-platform-req=ext-gd \
	--ignore-platform-req=ext-intl \
	--ignore-platform-req=ext-pdo_sqlite \
	--ignore-platform-req=ext-iconv
}

package () {
    cd "${_github_name}-$pkgver"
    xmllint --xpath "//project/target/zip/fileset/exclude/@name" "build.xml" | \
        sed -e 's#^\s*name="##' -e 's#"$##' -e 's#/\*\*$##g' -e 's#\*\*#\*#g' | \
        while read -r exclude; do 
            echo "Removing $exclude"
	    rm -R $exclude || echo "This one does not exist, passing.";
        done
    install -d "$pkgdir/etc/webapps/${_name}/"
    install -d "$pkgdir/usr/share/webapps"
    cp -r ./ "$pkgdir/usr/share/webapps/${_name}"
    cp "$pkgdir/usr/share/webapps/${_name}/config/local.php.example" "$pkgdir/etc/webapps/${_name}/local.php"
    ln -s "/etc/webapps/${_name}/local.php" "$pkgdir/usr/share/webapps/${_name}/config/local.php"
    rm -R "${pkgdir}/usr/share/webapps/${_name}/tests" || echo "No tests folder to remove"
    rm -R "${pkgdir}/usr/share/webapps/${_name}/tools" || echo "No tools folder to remove"
}