summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0dd91c70711a0b7b1705be1f5ca127c79f9a10e7 (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
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>

pkgname=apache-git
pkgver=2.4.59.r11582.g84ecd2f2b9
pkgrel=1
pkgdesc="Provides useful functions commonly found on BSD systems"
arch=('i686' 'x86_64')
url="https://httpd.apache.org/"
license=('Apache-2.0')
depends=('glibc' 'apr-util' 'libnghttp2' 'openssl' 'pcre2' 'zlib')
makedepends=('git' 'brotli' 'curl' 'db' 'jansson' 'libxml2' 'lua')
optdepends=('brotli: for mod_brotli module'
            'curl: for mod_md module'
            'jansson: for mod_md module'
            'libxml2: for mod_proxy_html, mod_xml2enc modules'
            'lua: for mod_lua module'
            'lynx: apachectl status'
            'perl: for apxs and dbmmanage'
            'uwsgi: for mod_proxy_uwsgi module')
provides=("apache=$pkgver")
conflicts=('apache')
backup=('etc/httpd/conf/httpd.conf'
        'etc/httpd/conf/extra'/httpd-{autoindex,dav,default,info,languages,manual,mpm,multilang-errordoc,ssl,userdir,vhosts}.conf
        'etc/httpd/conf/extra/proxy-html.conf'
        'etc/httpd/conf'/{mime.types,magic}
        'etc/logrotate.d/httpd')
source=("git+https://github.com/apache/httpd.git"
        "apache.tmpfiles.conf::https://gitlab.archlinux.org/archlinux/packaging/packages/apache/-/raw/main/apache.tmpfiles.conf"
        "arch.layout::https://gitlab.archlinux.org/archlinux/packaging/packages/apache/-/raw/main/arch.layout"
        "httpd.logrotate::https://gitlab.archlinux.org/archlinux/packaging/packages/apache/-/raw/main/httpd.logrotate"
        "httpd.service::https://gitlab.archlinux.org/archlinux/packaging/packages/apache/-/raw/main/httpd.service")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')


prepare() {
  cd "httpd"

  # set default user
  sed -e 's#User daemon#User http#' \
      -e 's#Group daemon#Group http#' \
      -i "docs/conf/httpd.conf.in"

  cat "$srcdir/arch.layout" >> "config.layout"
}

pkgver() {
  cd "httpd"

  _tag=$(git tag -l --sort -creatordate | grep -E '^[0-9\.]+' | head -n1)
  _rev=$(git rev-list --count $_tag..HEAD)
  _hash=$(git rev-parse --short HEAD)
  printf "%s.r%s.g%s" "$_tag" "$_rev" "$_hash" | sed 's/-/./g'
}

build() {
  cd "httpd"

  ./buildconf \
    --with-apr=apr-1-config
  ./configure \
    --prefix="/usr" \
    --sbindir="/usr/bin" \
    --enable-layout=Arch \
    --enable-mpms-shared=all \
    --enable-modules=all \
    --enable-mods-shared=all \
    --enable-so \
    --enable-suexec \
    --with-suexec-caller=http \
    --with-suexec-docroot="/srv/http" \
    --with-suexec-logfile="/var/log/httpd/suexec.log" \
    --with-suexec-bin="/usr/bin/suexec" \
    --with-suexec-uidmin=99 --with-suexec-gidmin=99 \
    --enable-ldap --enable-authnz-ldap --enable-authnz-fcgi \
    --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache \
    --enable-ssl --with-ssl \
    --enable-deflate --enable-cgi --enable-cgid \
    --enable-proxy --enable-proxy-connect \
    --enable-proxy-http --enable-proxy-ftp \
    --enable-dbd --enable-imagemap --enable-ident --enable-cern-meta \
    --enable-lua --enable-xml2enc --enable-http2 \
    --enable-proxy-http2 --enable-md --enable-brotli \
    --with-apr="/usr/bin/apr-1-config" \
    --with-apr-util="/usr/bin/apu-1-config" \
    --with-pcre="/usr/bin"
  make
}

package() {
  cd "httpd"

  make DESTDIR="$pkgdir" install
  install -Dm644 "LICENSE" -t "$pkgdir/usr/share/licenses/apache"

  install -Dm644 "$srcdir/httpd.logrotate" "$pkgdir/etc/logrotate.d/httpd"
  install -Dm644 "$srcdir/httpd.service" -t "$pkgdir/usr/lib/systemd/system"
  install -Dm644 "$srcdir/apache.tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/apache.conf"

  # set sane defaults
  sed -e 's#/usr/lib/httpd/modules/#modules/#' \
      -e 's|#\(LoadModule negotiation_module \)|\1|' \
      -e 's|#\(LoadModule include_module \)|\1|' \
      -e 's|#\(LoadModule userdir_module \)|\1|' \
      -e 's|#\(LoadModule slotmem_shm_module \)|\1|' \
      -e 's|#\(Include conf/extra/httpd-multilang-errordoc.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-autoindex.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-languages.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-userdir.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-default.conf\)|\1|' \
      -e 's|#\(Include conf/extra/httpd-mpm.conf\)|\1|' \
      -i "$pkgdir/etc/httpd/conf/httpd.conf"

  # cleanup
  rm -r "$pkgdir/etc/httpd/conf/original"
  rm -r "$pkgdir/run"
  rm -r "$pkgdir/srv"
}