summaryrefslogtreecommitdiff
path: root/dev-php/snuffleupagus
diff options
context:
space:
mode:
Diffstat (limited to 'dev-php/snuffleupagus')
-rw-r--r--dev-php/snuffleupagus/Manifest3
-rw-r--r--dev-php/snuffleupagus/metadata.xml11
-rw-r--r--dev-php/snuffleupagus/snuffleupagus-0.7.1-r1.ebuild74
3 files changed, 88 insertions, 0 deletions
diff --git a/dev-php/snuffleupagus/Manifest b/dev-php/snuffleupagus/Manifest
new file mode 100644
index 000000000000..57f35901ff3d
--- /dev/null
+++ b/dev-php/snuffleupagus/Manifest
@@ -0,0 +1,3 @@
+DIST snuffleupagus-0.7.1.tar.gz 11962220 BLAKE2B 8504721ca08e727a5a6fa58c216a5dac7be3fe6e5a98cffcb17e44a2235628c26f02afd2159e9b1fbe8e40e26bc7c4e34a4ff027ee27b8ec29cf89865dbb8514 SHA512 21510e214f94dd50a4aa05226188c9433a6a261c0bd3d58973ed4536754b3e12356e3f625480c370b66c570482694c25d336a771fbbbeb27e1d524b1f82c7869
+EBUILD snuffleupagus-0.7.1-r1.ebuild 2192 BLAKE2B b8f98065f4cc3fa01e646a95b9812549ac8d79ac0d37ff223760caaa48ebf98890c310199b6b8507a4cfeeff7d4b49de7acbc3383fa3fea4537101d0e8308ec8 SHA512 0d41440c35452876ccb56522265bb906cc061fa8929714e34c0bd011d1beba5a45feadb3f11285074c322678e4a04c925343439a7d17279a5d0be12c215251ee
+MISC metadata.xml 336 BLAKE2B 6684e51a28675df71f8171c0bb5b7469a47fbd334920dfa846e0e45d6b6d8c1b92aaeb469e6d371537a9521d5e0dda4dd0d1a9e349a999d3a4c0fca4b1e81fe5 SHA512 775fcf5192683d3a69a426ffa9b3e9f0ef5ae34ac69fc19258995db89a18fad9ae1d87358260d234af6fa45054f68980296434874cc125aa8f5ccf37fbe2a983
diff --git a/dev-php/snuffleupagus/metadata.xml b/dev-php/snuffleupagus/metadata.xml
new file mode 100644
index 000000000000..6cb8e5e502b5
--- /dev/null
+++ b/dev-php/snuffleupagus/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>php-bugs@gentoo.org</email>
+ <name>PHP</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">jvoisin/snuffleupagus</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-php/snuffleupagus/snuffleupagus-0.7.1-r1.ebuild b/dev-php/snuffleupagus/snuffleupagus-0.7.1-r1.ebuild
new file mode 100644
index 000000000000..d18383730d41
--- /dev/null
+++ b/dev-php/snuffleupagus/snuffleupagus-0.7.1-r1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PHP_EXT_NAME="${PN}"
+PHP_EXT_INI="yes"
+PHP_EXT_ZENDEXT="no"
+PHP_EXT_ECONF_ARGS=( --enable-${PN} )
+PHP_EXT_S="${S}/src"
+
+USE_PHP="php7-4 php8-0"
+
+inherit php-ext-source-r3
+
+KEYWORDS="~amd64"
+
+DESCRIPTION="A PHP module to drastically raise the cost of attacks against websites"
+HOMEPAGE="https://snuffleupagus.readthedocs.io/index.html"
+SRC_URI="https://github.com/jvoisin/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-3 PHP-3.01"
+SLOT="0"
+
+src_prepare() {
+ # fix file locations tests look for
+ ln -s "${P}/config" "${WORKDIR}/config" || die
+ # Fix path dependent tests
+ sed -i -e 's~src/tests/~~' \
+ src/tests/session_encryption/crypt_session_read_uncrypt.phpt || die
+ sed -i -e 's~%a/src~%a~' \
+ src/tests/disable_function/disabled_functions_runtime.phpt || die
+ php-ext-source-r3_src_prepare
+}
+
+src_install() {
+ addtoinifile() {
+ local inifile="${WORKDIR}/${1}"
+ local inidir="${inifile%/*}"
+
+ mkdir -p "${inidir}" || die "failed to create INI directory ${inidir}"
+
+ local my_added="${2}=${3}"
+ echo "${my_added}" >> "${inifile}" || die "failed to append to ${inifile}"
+ einfo "Added '${my_added}' to /${1}"
+
+ insinto "/${1%/*}"
+ doins "${inifile}"
+ }
+ einstalldocs
+ local slot x cfgdir
+ php-ext-source-r3_src_install
+ # Add the rules file which vary by install version
+ for slot in $(php_get_slots); do
+ php_init_slot_env "${slot}"
+ for x in ${PHP_EXT_SAPIS} ; do
+ cfgdir="/etc/php/${x}-${slot}"
+ if [[ -f "${ED}${cfgdir}/ext/${PHP_INI_NAME}.ini" ]]; then
+ addtoinifile "${cfgdir#/}/ext/${PHP_INI_NAME}.ini" \
+ "sp.configuration_file" "${cfgdir}/${PN}.rules"
+ insinto "${cfgdir}"
+ case ${PHP_CURRENTSLOT:0:1} in
+ 8) newins "${S}/config/default_php8.rules" "${PN}.rules" ;;
+ *) newins "${S}/config/default.rules" "${PN}.rules" ;;
+ esac
+ fi
+ done
+ done
+}
+
+pkg_postinst() {
+ elog "This extension is configured with recommended rules enabled by default."
+ elog "Feel free to customize as necessary. Please test outside of production first."
+ elog "Failure to test may cause unexpected results to loosely coded sites."
+}