summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f9c217c78bc2de84d7c7868dddcbf520e3fca895 (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: Masato TOYOSHIMA <phoepsilonix@gmail.com>
# Maintainer: Iru Cai <mytbk920423@gmail.com>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>
# Contributor: Paul Préfontaine <paul+archlinuxaur@prefontaine.name>
# Contributor: HLFH
# Contributor: Wilhelm Schuster <wilhelm [aT] wilhelm [.] re>
# Contributor: The_Decryptor

_commit=959cf8fbfdcdc05ec0d9d838eb0a5c425406d24f
pkgname=h2o-git
pkgver=2.2.0.8110
pkgrel=2
pkgdesc="Optimized HTTP server with support for HTTP/1.x and HTTP/2"
arch=('i686' 'x86_64' 'aarch64')
# if you want websocket support, you'll also need aur/wslay
depends=('libuv' 'zlib' 'libwslay' 'libcap' 'brotli' 'bcc' 'sh' 'glibc' 'gcc-libs')
makedepends=('bison' 'cmake' 'libtool' 'make' 'pkg-config' 'ruby' 'libaegis' 'git')
url="https://github.com/h2o/h2o"
license=('MIT')
options=('lto')

#source=("git+https://github.com/h2o/h2o.git"
source=("git+https://github.com/h2o/h2o.git#commit=${_commit}?signed/"
#        "neverbleed-fix-when-lacking-engines.patch"
        'h2o.service')
sha256sums=('8130a50d34d55c335ca4e35da4261d8399fe2e35c5ddca9f568a15a0a749ec2e'
            '7fccdeb1a89134b48674764dc243f8967eb1234679e401af93e210fbf0934b62')
backup=('etc/h2o.conf')
provides=('h2o' 'libh2o')
conflicts=('h2o' 'libh2o')

pkgver() {
    cd "$srcdir/h2o"
    git describe --tags | sed -e 's/^v//g' -e 's/-g.*$//g' -e 's/-/./g'
}

prepare() {
    cd "$srcdir/h2o"

        git config core.autocrlf false
        git submodule update --init --recursive
        
        # libressl-3.8(OPENSSL_NO_ENGINE)
        #git apply ${srcdir}/neverbleed-fix-when-lacking-engines.patch

    # set CMake minimal version to 3.9 to set CMP0039 to new
    sed -i 's/VERSION 2.8.12/VERSION 3.9/g' CMakeLists.txt

    sed -i 's|example|/usr/share/doc/h2o/example|' examples/h2o/h2o.conf

        #if [[ "$CC" == "clang" ]] ;then
        #    export LD="clang"
        #fi
        export CFLAGS="$CFLAGS $LTOFLAGS"
        export CXXFLAGS="$CXXFLAGS $LTOFLAGS"
        #export LDFLAGS="$LDFLAGS $LTOFLAGS -Wl,-rpath,/usr/lib/libressl"
        export LDFLAGS="$LDFLAGS $LTOFLAGS"

        cmake \
                -DCMAKE_BUILD_TYPE=Release \
                -DCMAKE_INSTALL_PREFIX=/usr \
                -DCMAKE_INSTALL_LIBDIR=/usr/lib \
                -DCMAKE_INSTALL_SYSCONFDIR=/etc \
                -DCMAKE_C_FLAGS="$CPPFLAGS $CFLAGS" \
                -DCMAKE_CXX_FLAGS="$CPPFLAGS $CXXFLAGS" \
                -DCMAKE_LINKER="$LD" \
                -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
                -DCMAKE_MODULE_LINKER_FLAGS="$LDFLAGS" \
                -DCMAKE_REQUIRED_FLAGS="-c" \
                -DWITH_MRUBY=on \
                -DWITHOUT_LIBS=off \
                -DWITH_H2OLOG=on \
                -DBUILD_SHARED_LIBS=on \
                .

#                -DOPENSSL_ROOT_DIR=/usr/lib/libressl \
#                -DOPENSSL_INCLUDE_DIR=/usr/include/libressl \
#                -DOPENSSL_LIBRARIES=/usr/lib/libressl \
}

build() {
    cd "$srcdir/h2o"

    #if [[ "$CC" == "clang" ]] ;then
    #    export LD="clang"
    #fi
    if [[ "$GEM_HOME"=="" ]] ;then
        export GEM_HOME="$(gem env user_gemhome)"
        export PATH="$PATH:$GEM_HOME/bin"
    fi
    cmake --build . -j
}

package() {
    cd "$srcdir/h2o"

    install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/h2o-git/LICENSE"
    install -Dm 644 "$srcdir/h2o.service" "$pkgdir/usr/lib/systemd/system/h2o.service"
    install -Dm 644 examples/h2o/h2o.conf "$pkgdir/etc/h2o.conf"
    DESTDIR="$pkgdir" cmake --install .
}