summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3e501bb02af0738d3ed9a3bdef2f1f5691a2bd5e (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
pkgname=nginx-http3
_rel=1
_maj=16
_min=1
pkgver=$_rel.$_maj.$_min
pkgrel=1
provides=('nginx')
conflicts=('nginx' 'nginx-unstable' 'nginx-svn' 'nginx-devel' 'nginx-custom-dev' 'nginx-full' 'nginx-libressl' 'nginx-mainline-boringssl') 
pkgdesc="Nginx with Cloudflare's http3 patсh on the top of quiche"
arch=('any')
makedepends=('git' 'cmake' 'make' 'gcc' 'go' 'perl' 'ninja' 'rust' 'patch')
depends=('geoip' 'pcre' 'zlib')
url="https://github.com/cloudflare/quiche/tree/master/extras/nginx"
license=('GPL3')
source=(
    "https://nginx.org/download/nginx-$pkgver.tar.gz"
    'git+https://github.com/cloudflare/quiche.git'
    'service'
    'logrotate'
    'http3.conf'
)
sha256sums=(
    'f11c2a6dd1d3515736f0324857957db2de98be862461b5a542a3ac6188dbe32b'
    'SKIP'
    '05fdc0c0483410944b988d7f4beabb00bec4a44a41bd13ebc9b78585da7d3f9b'
    'b9af19a75bbeb1434bba66dd1a11295057b387a2cbff4ddf46253133909c311e'
    'c5e473507bb727a1eb60cfa84b1bbec86cb5069bf51a6e2fcaf813941a0ef646'
)

_common_flags=(
    --with-pcre-jit
    --with-file-aio
    --with-http_addition_module
    --with-http_auth_request_module
    --with-http_dav_module
    --with-http_degradation_module
    --with-http_flv_module
    --with-http_geoip_module
    --with-http_gunzip_module
    --with-http_gzip_static_module
    --with-http_mp4_module
    --with-http_realip_module
    --with-http_secure_link_module
    --with-http_slice_module
    --with-http_ssl_module
    --with-http_stub_status_module
    --with-http_sub_module
    --with-http_v2_module
    --with-mail
    --with-mail_ssl_module
    --with-stream
    --with-stream_ssl_module
    --with-threads
)

_mainline_flags=(
    --with-stream_ssl_preread_module
    --with-stream_geoip_module
    --with-stream_realip_module
)

_http3_flags=(
    --with-openssl=../quiche/deps/boringssl
    --with-quiche=../quiche
    --with-http_v3_module
)

_nginx_paths=(
    --prefix=/etc/nginx
    --conf-path=/etc/nginx/nginx.conf
    --sbin-path=/usr/bin/nginx
    --pid-path=/run/nginx.pid
    --lock-path=/run/lock/nginx.lock
    --http-log-path=stdout
    --error-log-path=stderr
    --http-client-body-temp-path=/var/lib/nginx/client-body
    --http-proxy-temp-path=/var/lib/nginx/proxy
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi
    --http-scgi-temp-path=/var/lib/nginx/scgi
    --http-uwsgi-temp-path=/var/lib/nginx/uwsgi
)

package() {
    tar xzvf nginx-$pkgver.tar.gz
    cd quiche
    git submodule update --init --recursive
    cd ../nginx-$pkgver
    patch -p01 < ../quiche/extras/nginx/nginx-$_rel.$_maj.patch
    if [ $(uname -m) = 'aarch64' ]; then
        sed -i 's/alignas(64)/alignas(16)/g' ../quiche/deps/boringssl/crypto/cipher_extra/aead_test.cc
    fi
    ./configure \
        ${_nginx_paths[@]} \
        ${_common_flags[@]} \
        ${_mainline_flags[@]} \
        ${_http3_flags[@]}

    make
    make DESTDIR="$pkgdir/" install
    install -Dm644 ../logrotate "$pkgdir"/etc/logrotate.d/nginx
    install -Dm644 ../service "$pkgdir"/usr/lib/systemd/system/nginx.service
    install -d "$pkgdir"/var/lib/nginx
    install -dm700 "$pkgdir"/var/lib/nginx/proxy
    install -dm755 "$pkgdir"/var/log/nginx
    install -d "$pkgdir"/usr/share/nginx
    mv "$pkgdir"/etc/nginx/html/ "$pkgdir"/usr/share/nginx
    rmdir "$pkgdir"/run
    install -d "$pkgdir"/usr/share/man/man8/
    gzip -9c man/nginx.8 > "$pkgdir"/usr/share/man/man8/nginx.8.gz
    install -Dm644 ../http3.conf "$pkgdir"/etc/nginx/http3.conf.example
    rm "$pkgdir"/etc/nginx/*.default
}