aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Retornaz <gentoo@retornaz.com>2021-01-17 22:03:02 +0100
committerQuentin Retornaz <gentoo@retornaz.com>2021-01-26 01:21:45 +0100
commit56a15f3386d90925602efc1f27555318fbce2312 (patch)
tree8a146e787864a8493ff16f36536b8bcdf71a724a
parentwww-servers/apache: new package (diff)
downloadlibressl-56a15f3386d90925602efc1f27555318fbce2312.tar.gz
libressl-56a15f3386d90925602efc1f27555318fbce2312.tar.bz2
libressl-56a15f3386d90925602efc1f27555318fbce2312.zip
www-servers/h2o: new package
Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Quentin Retornaz <gentoo@retornaz.com>
-rw-r--r--www-servers/h2o/Manifest1
-rw-r--r--www-servers/h2o/files/h2o-2.2-libressl-2.7.patch23
-rw-r--r--www-servers/h2o/files/h2o-2.2-mruby.patch57
-rw-r--r--www-servers/h2o/files/h2o.conf17
-rw-r--r--www-servers/h2o/files/h2o.initd37
-rw-r--r--www-servers/h2o/files/h2o.logrotate11
-rw-r--r--www-servers/h2o/files/h2o.service13
-rw-r--r--www-servers/h2o/h2o-2.2.6.ebuild108
-rw-r--r--www-servers/h2o/metadata.xml20
9 files changed, 287 insertions, 0 deletions
diff --git a/www-servers/h2o/Manifest b/www-servers/h2o/Manifest
new file mode 100644
index 0000000..710248b
--- /dev/null
+++ b/www-servers/h2o/Manifest
@@ -0,0 +1 @@
+DIST h2o-2.2.6.tar.gz 16257760 BLAKE2B 8474751ca9832ddae2022710654ca58a93ebf9ca01afe934950209b04357b7548b05c598c49fe92684b2910fd6309d6fc3923a0b01cdeeb4b0dc65b08842255f SHA512 f2f28905c01782a0432c9dfdb2f21054e0a4741ac4c5f26802d4b439d0172840aa215aba5dc7c9af62275dcc24de105674a3819384dc38246e43ce3e8263eb20
diff --git a/www-servers/h2o/files/h2o-2.2-libressl-2.7.patch b/www-servers/h2o/files/h2o-2.2-libressl-2.7.patch
new file mode 100644
index 0000000..02942b4
--- /dev/null
+++ b/www-servers/h2o/files/h2o-2.2-libressl-2.7.patch
@@ -0,0 +1,23 @@
+From db50d885a87985310e65159a705b45de8646dc26 Mon Sep 17 00:00:00 2001
+From: AIZAWA Hina <hina@bouhime.com>
+Date: Fri, 23 Mar 2018 22:50:51 +0900
+Subject: [PATCH] Add supporting LibreSSL 2.7
+
+Signed-off-by: AIZAWA Hina <hina@bouhime.com>
+---
+ deps/neverbleed/neverbleed.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/deps/neverbleed/neverbleed.c b/deps/neverbleed/neverbleed.c
+index 29b35a9..42356a6 100644
+--- a/deps/neverbleed/neverbleed.c
++++ b/deps/neverbleed/neverbleed.c
+@@ -547,7 +547,7 @@ static int sign_stub(struct expbuf_t *buf)
+ return 0;
+ }
+
+-#if !OPENSSL_1_1_API
++#if !OPENSSL_1_1_API && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2070000fL)
+
+ static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
+ {
diff --git a/www-servers/h2o/files/h2o-2.2-mruby.patch b/www-servers/h2o/files/h2o-2.2-mruby.patch
new file mode 100644
index 0000000..92e7a8e
--- /dev/null
+++ b/www-servers/h2o/files/h2o-2.2-mruby.patch
@@ -0,0 +1,57 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -157,6 +157,19 @@
+ SET(WSLAY_LIBRARIES -lwslay)
+ ENDIF (NOT WSLAY_FOUND)
+
++IF (PKG_CONFIG_FOUND)
++ PKG_CHECK_MODULES(ONIG onigmo)
++ IF (NOT ONIG_FOUND)
++ PKG_CHECK_MODULES(ONIG oniguruma)
++ ENDIF (NOT ONIG_FOUND)
++ IF (ONIG_FOUND)
++ LINK_DIRECTORIES(${ONIG_LIBRARY_DIRS})
++ ENDIF (ONIG_FOUND)
++ENDIF (PKG_CONFIG_FOUND)
++IF (NOT ONIG_FOUND AND WITH_MRUBY)
++ MESSAGE(FATAL_ERROR "Onigmo/Oniguruma not found")
++ENDIF (NOT ONIG_FOUND AND WITH_MRUBY)
++
+ IF (ZLIB_FOUND)
+ INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
+ LINK_DIRECTORIES(${ZLIB_LIBRARY_DIRS})
+@@ -460,7 +473,7 @@
+ ELSE ()
+ SET(MRUBY_TOOLCHAIN "gcc")
+ ENDIF ()
+- ADD_CUSTOM_TARGET(mruby MRUBY_TOOLCHAIN=${MRUBY_TOOLCHAIN} MRUBY_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/misc/mruby_config.rb MRUBY_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}/mruby ruby minirake
++ ADD_CUSTOM_TARGET(mruby MRUBY_TOOLCHAIN=${MRUBY_TOOLCHAIN} MRUBY_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/misc/mruby_config.rb MRUBY_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}/mruby ruby minirake -v
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mruby)
+ LIST(APPEND STANDALONE_SOURCE_FILES
+ lib/handler/mruby.c
+@@ -491,7 +504,7 @@
+ # note: the paths need to be determined before libmruby.flags.mak is generated
+ TARGET_LINK_LIBRARIES(h2o
+ "${CMAKE_CURRENT_BINARY_DIR}/mruby/host/lib/libmruby.a"
+- "${CMAKE_CURRENT_BINARY_DIR}/mruby/host/mrbgems/mruby-onig-regexp/onigmo-6.1.1/.libs/libonigmo.a"
++ ${ONIG_LIBRARIES}
+ "m")
+ ADD_DEPENDENCIES(h2o mruby)
+ ENDIF (WITH_MRUBY)
+--- a/misc/mruby_config.rb
++++ b/misc/mruby_config.rb
+@@ -15,13 +15,7 @@
+ # use mrbgems
+ Dir.glob("../mruby-*/mrbgem.rake") do |x|
+ g = File.basename File.dirname x
+- if g == 'mruby-onig-regexp'
+- conf.gem "../deps/#{g}" do |c|
+- c.bundle_onigmo
+- end
+- else
+- conf.gem "../deps/#{g}"
+- end
++ conf.gem "../deps/#{g}"
+ end
+
+ # include all the core GEMs
diff --git a/www-servers/h2o/files/h2o.conf b/www-servers/h2o/files/h2o.conf
new file mode 100644
index 0000000..23f2d76
--- /dev/null
+++ b/www-servers/h2o/files/h2o.conf
@@ -0,0 +1,17 @@
+user: h2o
+pid-file: /run/h2o.pid
+access-log: /var/log/h2o/access.log
+error-log: /var/log/h2o/error.log
+
+hosts:
+ "localhost":
+ listen:
+ port: 80
+ listen:
+ port: 443
+ ssl:
+ certificate-file: /etc/ssl/h2o/server.crt
+ key-file: /etc/ssl/h2o/server.key
+ paths:
+ "/":
+ file.dir: /var/www/localhost/htdocs
diff --git a/www-servers/h2o/files/h2o.initd b/www-servers/h2o/files/h2o.initd
new file mode 100644
index 0000000..7c7cb20
--- /dev/null
+++ b/www-servers/h2o/files/h2o.initd
@@ -0,0 +1,37 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+description_checkconfig="Check the configuration file"
+description_reload="Reload the configuration file"
+
+: ${h2o_config:="/etc/${RC_SVCNAME}/${RC_SVCNAME}.conf"}
+
+start_stop_daemon_args="--group ${RC_SVCNAME}"
+command="/usr/bin/${RC_SVCNAME}"
+command_args="-m daemon -c \"${h2o_config}\""
+pidfile="$(grep pid-file "${h2o_config}" | cut -d' ' -f2)"
+name="H2O"
+
+depend() {
+ need net
+ use dns
+}
+
+checkconfig() {
+ "${command}" -m test -c "${h2o_config}" || return 1
+}
+
+start_pre() {
+ checkconfig || return 1
+}
+
+reload() {
+ checkconfig || return 1
+ ebegin "Reloading ${name:-${RC_SVCNAME}}"
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend ${?}
+}
diff --git a/www-servers/h2o/files/h2o.logrotate b/www-servers/h2o/files/h2o.logrotate
new file mode 100644
index 0000000..166b6e7
--- /dev/null
+++ b/www-servers/h2o/files/h2o.logrotate
@@ -0,0 +1,11 @@
+# h2o logrotate script for Gentoo
+
+/var/log/h2o/*.log {
+ missingok
+ notifempty
+ sharedscripts
+ delaycompress
+ postrotate
+ /bin/kill -HUP $(grep pid-file "/etc/h2o/h2o.conf" | cut -d' ' -f2 | cat) 2>/dev/null || true
+ endscript
+}
diff --git a/www-servers/h2o/files/h2o.service b/www-servers/h2o/files/h2o.service
new file mode 100644
index 0000000..0ea3f45
--- /dev/null
+++ b/www-servers/h2o/files/h2o.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=H2O - the optimized HTTP/1, HTTP/2 server
+After=network.target remote-fs.target nss-lookup.target
+
+[Service]
+ExecStartPre=/usr/bin/h2o -m test -c /etc/h2o/h2o.conf
+ExecStart=/usr/bin/h2o -m master -c /etc/h2o/h2o.conf
+ExecReload=/bin/kill -HUP ${MAINPID}
+ExecStop=/bin/kill -TERM ${MAINPID}
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/www-servers/h2o/h2o-2.2.6.ebuild b/www-servers/h2o/h2o-2.2.6.ebuild
new file mode 100644
index 0000000..89bd359
--- /dev/null
+++ b/www-servers/h2o/h2o-2.2.6.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+CMAKE_MAKEFILE_GENERATOR="emake"
+SSL_DEPS_SKIP=1
+USE_RUBY="ruby24 ruby25 ruby26"
+
+inherit cmake-utils ruby-single ssl-cert systemd toolchain-funcs user
+
+DESCRIPTION="H2O - the optimized HTTP/1, HTTP/2 server"
+HOMEPAGE="https://h2o.examp1e.net/"
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="libh2o libressl +mruby"
+
+RDEPEND="dev-lang/perl
+ sys-libs/zlib
+ libh2o? ( dev-libs/libuv )
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl:0= )"
+DEPEND="${RDEPEND}
+ libh2o? ( virtual/pkgconfig )
+ mruby? (
+ ${RUBY_DEPS}
+ || (
+ dev-libs/onigmo
+ dev-libs/oniguruma
+ )
+ sys-devel/bison
+ virtual/pkgconfig
+ )"
+RDEPEND+="
+ !sci-libs/libh2o"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.2-libressl-2.7.patch
+ "${FILESDIR}"/${PN}-2.2-mruby.patch
+)
+
+pkg_setup() {
+ enewgroup ${PN}
+ enewuser ${PN} -1 -1 -1 ${PN}
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+
+ local ruby="ruby"
+ if use mruby; then
+ for ruby in ${RUBY_TARGETS_PREFERENCE}; do
+ if has_version dev-lang/ruby:${ruby:4:1}.${ruby:5}; then
+ break
+ fi
+ ruby=
+ done
+ [[ -z ${ruby} ]] && die "no suitable ruby version found"
+ fi
+
+ sed -i \
+ -e "/INSTALL/s:\(/doc/${PN}\) :\1/html :" \
+ -e "/INSTALL/s:\(/doc\)/${PN}:\1/${PF}:" \
+ -e "s: ruby: ${ruby}:" \
+ CMakeLists.txt
+
+ sed -i "s:pkg-config:$(tc-getPKG_CONFIG):g" deps/mruby/lib/mruby/gem.rb
+ tc-export CC
+ export LD="$(tc-getCC)"
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_SYSCONFDIR="${EPREFIX}"/etc/${PN}
+ -DWITH_MRUBY=$(usex mruby)
+ -DWITHOUT_LIBS=$(usex !libh2o)
+ -DBUILD_SHARED_LIBS=$(usex libh2o)
+ )
+ cmake-utils_src_configure
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ keepdir /var/www/localhost/htdocs
+
+ insinto /etc/${PN}
+ doins "${FILESDIR}"/${PN}.conf
+
+ newinitd "${FILESDIR}"/${PN}.initd ${PN}
+ systemd_dounit "${FILESDIR}"/${PN}.service
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/${PN}.logrotate ${PN}
+
+ keepdir /var/log/${PN}
+ fowners ${PN}:${PN} /var/log/${PN}
+ fperms 0750 /var/log/${PN}
+}
+
+pkg_postinst() {
+ if [[ ! -f "${EROOT}"etc/ssl/${PN}/server.key ]]; then
+ install_cert /etc/ssl/${PN}/server
+ chown ${PN}:${PN} "${EROOT}"etc/ssl/${PN}/server.*
+ fi
+}
diff --git a/www-servers/h2o/metadata.xml b/www-servers/h2o/metadata.xml
new file mode 100644
index 0000000..dab1128
--- /dev/null
+++ b/www-servers/h2o/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>hattya@gentoo.org</email>
+ <name>Akinori Hattori</name>
+ </maintainer>
+ <longdescription lang="en">
+ H2O is a new generation HTTP server. Not only is it very fast,
+ it also provides much quicker response to end-users
+ when compared to older generations of HTTP servers.
+ </longdescription>
+ <use>
+ <flag name="libh2o">Build and install libh2o</flag>
+ <flag name="mruby">Enable support for mruby</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">h2o/h2o</remote-id>
+ </upstream>
+</pkgmetadata>