summaryrefslogtreecommitdiff
path: root/dev-libs/tre
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-03-24 23:59:54 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-03-24 23:59:54 +0000
commit401101f9c8077911929d3f2b60a37098460a5d89 (patch)
treec2bef4719f6787550f0916aeaa8f4f403a9296af /dev-libs/tre
parent4cbcc855382a06088e2f016f62cafdbcb7e40665 (diff)
gentoo resync : 25.03.2022
Diffstat (limited to 'dev-libs/tre')
-rw-r--r--dev-libs/tre/Manifest15
-rw-r--r--dev-libs/tre/files/0.8.0-CVE-2016-8559.patch7
-rw-r--r--dev-libs/tre/files/0.8.0-pkgcfg.patch2
-rw-r--r--dev-libs/tre/files/tre-chicken.patch20
-rw-r--r--dev-libs/tre/files/tre-issue37.patch11
-rw-r--r--dev-libs/tre/files/tre-issue50.patch11
-rw-r--r--dev-libs/tre/files/tre-issue55-part1.patch28
-rw-r--r--dev-libs/tre/files/tre-issue55-part2.patch11
-rw-r--r--dev-libs/tre/files/tre-python3.patch191
-rw-r--r--dev-libs/tre/files/tre-tests.patch10
-rw-r--r--dev-libs/tre/metadata.xml5
-rw-r--r--dev-libs/tre/tre-0.8.0_p20210321.ebuild112
12 files changed, 411 insertions, 12 deletions
diff --git a/dev-libs/tre/Manifest b/dev-libs/tre/Manifest
index c09ed5e1efa2..8398833e9118 100644
--- a/dev-libs/tre/Manifest
+++ b/dev-libs/tre/Manifest
@@ -1,5 +1,14 @@
-AUX 0.8.0-CVE-2016-8559.patch 2658 BLAKE2B 12a7d12d35e2d61457fbb9e368cfa738bad74ac490ce4ffa59d1494d879d9db481b89b0e3ef3a2a4601b8280ff8f1c54f4ccdc00716a904bff291923c4aaa02c SHA512 9f45299ccd21cc4e78946ad22963d4505e9cd430f49f275fbb742696029530e7e6eb848b0ae4bf55bb5e2a2ee77d3cf272b02e2a6a2ba7c3bd69f68816e300b2
-AUX 0.8.0-pkgcfg.patch 420 BLAKE2B 6b04ff4db2abc5dffdbca50bcbbe20974fdaa24ab25875f2538eca5af42921a729550e7ea5188225d3d73661e9ba05b96ff345fb4d931130ba4255b14c3944d2 SHA512 a6e4713aa0f9619abe256e9e1ea7c5bc8cbeb9ed173dd856972af70612ac435206e2b294ca5947e93223c17de875ba2620bf57949332b19ecff9965e2ee1a9e6
+AUX 0.8.0-CVE-2016-8559.patch 2445 BLAKE2B 1bde61db5aa46213c6d5dbaf6b97ba91fe50eb9c4c315be08b2964c2c3e5a85c2dd8933e1b69fd48294b6dcf5af3be7e386e55717e34c3ada9d30eea4675e112 SHA512 bae516a86ef0290a79eca283e4e6cc831255d1653b65f13714530811d358d0775b17711c54b1efab0c9d60829926123c70309aed30767eb7ac2a00ace1411766
+AUX 0.8.0-pkgcfg.patch 355 BLAKE2B 14b3ddb93249d827f64d1facd5d7f83d6d4b74d067b66bce405501a3195d230439dbc5036233c2242442e3fa56a771981be9c6e6cb8d668e5f0c293d4dcae1e4 SHA512 5c3df45b4c37d8923ed93ccd24e204fa42da7ac29fdcead81fffdd153d19fd71759ce4922cb55c09a34b21adbdf3d079339c15acc17b1c7d8e924db5b22a9e65
+AUX tre-chicken.patch 666 BLAKE2B 8f8f56a7a7cacb9bb0d43b993d51e6d936ffa09bbe866fee7e89299e6c6a3767147b8f340179c0f543da1b6d2554a6187b1a92ddf3bdc2b3d53abdbfb1d251de SHA512 6923a5ed08a2a9e08bc5e46028d2187deb5a62a756598125410a3c4704485b7bcbed2ad90002917474515065f2701f885c6ff462ebbf426135cced74343dfa74
+AUX tre-issue37.patch 311 BLAKE2B 315577adae015abf2719509e84554bd3631f777d94dabba0ca9070429e2be5785edc3a3e6a7612dd6fc792a6b03c6c3871954e39363d8f9e91dbe34f5f2bb576 SHA512 41f270e197d254da2ee742722a60324020ea98b3fd6498b6244aebe310587293b4eff7d80a793861f616a772e3bc1058b2f3bee487066e0bc712fdb34aad0720
+AUX tre-issue50.patch 419 BLAKE2B ffcbe398ed330a047ca3c9c011096261352885600a4e40399221681966d26f559df5242d5f6dac0076587680c71f54f4aa1a8d51abdb65071e917ccb8489f055 SHA512 dbadcc67b00992a0039ef927f3a756cd0425c082c926bd3e60cc9d137751508eca656ab8779bb05b27f0b0b891ea283208210e6a44dc7b06189d47491749c684
+AUX tre-issue55-part1.patch 685 BLAKE2B 45582ffee5ca731365c1cbeb41ccc3ce9dd58bbdb732a45896a986d308d94ba46db5bc119f902505a42e0fb16193cabe3f4c12fc0669472b0709123e5b7f24bf SHA512 e79c1a9f97eb2ef2f30d46238e30b1cdd8bf56259467b02dd47b89e88af6547e812107d32d15a5960e181982b16515ce3b8998de1033cf37de24a7ab3bee76ed
+AUX tre-issue55-part2.patch 335 BLAKE2B e4c67973f6565e918c17d733bd8d8a1c5e6e67ce0d5b8ce1781a8ef7aa8087249d8bb68d1e5df52703f91a37864b7201cff9551786810b4cb20b6f5f9f0d95e5 SHA512 76032f37f8750fa90ebcc81341b9141390080e3e3ce2627177676fe4a56dfe879bf3edf1a08991dcc5533b3a622da26115a138fc27efb45d980b08217b57eb21
+AUX tre-python3.patch 5186 BLAKE2B c9e08efa47fb8ad00385703c9c7cc9d240eaccacf472c47991426702d4c971857c7c6fd1cac47135153616e4358ccbe1fcd05c04973c3c9164639634926b9c8c SHA512 0fb84b2051b2082f3271e4d47d0bc666ba9e6deb8ea2dfe0201ef4f0708b94b6706726740bfbfcf1ae708f348c63850c1b175ed1f93200934817337a5d23f1d2
+AUX tre-tests.patch 235 BLAKE2B 11c601f9b352dee9e2d36e60c537a4c2969beefd04bdab21c1e00886611d243a6c818b4a8cb484b8a414d3ec07de3e3ce32fde4aaa096bcda307b66225e8179b SHA512 69373229743ad805d4bfbf41def35de930424baaf66c36f35b3cba04860c2de15051ff640d486ec75e85aa20a28863e7937c6876ec443418ba1391e9dbbf4047
DIST tre-0.8.0.tar.bz2 380714 BLAKE2B b2af6e805e9e19fd69debf2f881ddfb591317f69db4e29a04e1899eb69100b8ac7744f86fa438530509ca2ee8aa1d346d416c6391f13247cd9398f4c59c2ed85 SHA512 db7465993e0d25eee8e52f974427b8a040234cf0f017769eb94ee88bc6261821336aad7f762bfa82db7e2212d8449bc221592586f061c528a59a550773cbc263
+DIST tre-0.8.0_p20210321.tar.gz 146294 BLAKE2B d740bd0e99f50f5e4d8105f5260e43a81b6af9857a21e386e437ab8d48a9e0de23eae03e96cf6b9f4d2d37f72d0fa73ef7343086271ea80f166bdba3f04475a9 SHA512 950c81f681970fc737cfdd6815445f05a018fc742b964cea3ce19f0249c677dd715ece4ff8e543fa9f3fd23b503eafa00aea00dbae063af9bc7e08dc1bc33aed
EBUILD tre-0.8.0-r2.ebuild 1461 BLAKE2B bf3725fde8e7a6c740d958956ab2b8789abee70619576a41c863b8e7be744cdfd879b598a545f287613e241f21fb96b5e5397d3ae9dc4f287895b37e2a4acb47 SHA512 2a33c2871e81f7671d10aa6b2cb2de9397ea8d8e9ea9ec419c9450208124aa153e64cdb2c3b88e20aa128b2580b777c130ebcb5c88ee830416d8e745243dbda4
-MISC metadata.xml 354 BLAKE2B ebe62e551444e71cca88ebbdf04e1ad583c7b2ec5cc588e4f949f2f2f1ce60f666bf84cc5a45e08e2e7b83c6ea61e86f6de7b43ca84f7d93a338d72ef60b63ed SHA512 cb14e81dd473b72e816159e690939c1894cf5cca1fa37072e05b8ec24f0894e0a4d30e8397f5ee81372d53a8ffc3fcbce67a8923d4b220cb9e1dd5f3f3a970d0
+EBUILD tre-0.8.0_p20210321.ebuild 2424 BLAKE2B 64696db1ff19928e3f496bf8b2971eb059a0bfa23fd6ada59ff35b96cb94a29b3559607416c6871d8b2d5bebebdb4a76950869560fc8c32530c96ca30a7c87c6 SHA512 3a5d919d0ad4a7be44c364e5aad0c42b6dd5f90eda1da3931322ff9dac5defbfbaeecaf75009a026fe6998f8806f6b5d8dd59597fedd4e433f3af4b8dd61475a
+MISC metadata.xml 638 BLAKE2B 4e02f7673a19acc091ee21459551e6d40f6a78d5a25cbbffe877d46f0a181067e2163d1ac79d0f7d38ff383b8775abf6f69309ad97b25fd2af55b0ac2223ab40 SHA512 9f725eebbee4753cb05b0adcda1edec2aa50265257db359ca0ec4596761072ec335fffb5a5035cf5ec43c13b8c8a7dd7ed916bbf82acd57c6d8ee5e4c89cb622
diff --git a/dev-libs/tre/files/0.8.0-CVE-2016-8559.patch b/dev-libs/tre/files/0.8.0-CVE-2016-8559.patch
index 39ceae016446..923dbfbf3a2a 100644
--- a/dev-libs/tre/files/0.8.0-CVE-2016-8559.patch
+++ b/dev-libs/tre/files/0.8.0-CVE-2016-8559.patch
@@ -12,13 +12,6 @@ type, size_t, rather than int.
also improve comments, use calloc in place of malloc+memset, and
remove bogus casts.
----
- src/regex/regexec.c | 23 ++++++++++++++++++-----
- 1 file changed, 18 insertions(+), 5 deletions(-)
-
-Note: patch was modified to apply to tre, parts were taken from
-https://github.com/laurikari/tre/issues/37
-
--- a/lib/tre-match-parallel.c
+++ b/lib/tre-match-parallel.c
@@ -59,6 +59,7 @@
diff --git a/dev-libs/tre/files/0.8.0-pkgcfg.patch b/dev-libs/tre/files/0.8.0-pkgcfg.patch
index 82f803504282..7952619c9616 100644
--- a/dev-libs/tre/files/0.8.0-pkgcfg.patch
+++ b/dev-libs/tre/files/0.8.0-pkgcfg.patch
@@ -1,8 +1,6 @@
tre.pc.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
-diff --git a/tre.pc.in b/tre.pc.in
-index fdc45fa..b8d0676 100644
--- a/tre.pc.in
+++ b/tre.pc.in
@@ -6,5 +6,5 @@ includedir=@includedir@
diff --git a/dev-libs/tre/files/tre-chicken.patch b/dev-libs/tre/files/tre-chicken.patch
new file mode 100644
index 000000000000..6047f9ae80d3
--- /dev/null
+++ b/dev-libs/tre/files/tre-chicken.patch
@@ -0,0 +1,20 @@
+--- a/python/setup.py
++++ b/python/setup.py
+@@ -10,7 +10,8 @@ import shutil
+
+ version = "0.8.0"
+ data_files = []
+-include_dirs = ["../lib"]
++include_dirs = ["../include"]
++library_dirs = ["../lib/.libs"]
+ libraries = ["tre"]
+
+ if sys.platform == "win32":
+@@ -31,6 +32,7 @@ setup(name = "tre",
+ sources = ["tre-python.c"],
+ define_macros = [("HAVE_CONFIG_H", None)],
+ include_dirs = include_dirs,
++ library_dirs = library_dirs,
+ libraries = libraries
+ ),
+ ],
diff --git a/dev-libs/tre/files/tre-issue37.patch b/dev-libs/tre/files/tre-issue37.patch
new file mode 100644
index 000000000000..43b0cded7d26
--- /dev/null
+++ b/dev-libs/tre/files/tre-issue37.patch
@@ -0,0 +1,11 @@
+--- a/lib/tre-parse.c
++++ b/lib/tre-parse.c
+@@ -1480,6 +1480,8 @@ tre_parse(tre_parse_ctx_t *ctx)
+ ctx->re++;
+ while (ctx->re_end - ctx->re >= 0)
+ {
++ if (i == sizeof(tmp))
++ return REG_EBRACE;
+ if (ctx->re[0] == CHAR_RBRACE)
+ break;
+ if (tre_isxdigit(ctx->re[0]))
diff --git a/dev-libs/tre/files/tre-issue50.patch b/dev-libs/tre/files/tre-issue50.patch
new file mode 100644
index 000000000000..f233953ce28f
--- /dev/null
+++ b/dev-libs/tre/files/tre-issue50.patch
@@ -0,0 +1,11 @@
+--- a/lib/tre-parse.c
++++ b/lib/tre-parse.c
+@@ -1341,7 +1341,7 @@ tre_parse(tre_parse_ctx_t *ctx)
+
+ case CHAR_RPAREN: /* end of current subexpression */
+ if ((ctx->cflags & REG_EXTENDED && depth > 0)
+- || (ctx->re > ctx->re_start
++ || (!(ctx->cflags & REG_EXTENDED) && ctx->re > ctx->re_start
+ && *(ctx->re - 1) == CHAR_BACKSLASH))
+ {
+ DPRINT(("tre_parse: empty: '%.*" STRF "'\n",
diff --git a/dev-libs/tre/files/tre-issue55-part1.patch b/dev-libs/tre/files/tre-issue55-part1.patch
new file mode 100644
index 000000000000..8e12cf683030
--- /dev/null
+++ b/dev-libs/tre/files/tre-issue55-part1.patch
@@ -0,0 +1,28 @@
+--- a/lib/tre-parse.c
++++ b/lib/tre-parse.c
+@@ -582,16 +582,23 @@
+ tre_parse_int(const tre_char_t **regex, const tre_char_t *regex_end)
+ {
+ int num = -1;
++ int overflow = 0;
+ const tre_char_t *r = *regex;
+ while (r < regex_end && *r >= L'0' && *r <= L'9')
+ {
+ if (num < 0)
+ num = 0;
+- num = num * 10 + *r - L'0';
++ if (num <= (INT_MAX - 9) / 10) {
++ num = num * 10 + *r - L'0';
++ } else {
++ /* This digit could cause an integer overflow. We do not return
++ * directly; instead, consume all remaining digits. */
++ overflow = 1;
++ }
+ r++;
+ }
+ *regex = r;
+- return num;
++ return overflow ? -1 : num;
+ }
+
+
diff --git a/dev-libs/tre/files/tre-issue55-part2.patch b/dev-libs/tre/files/tre-issue55-part2.patch
new file mode 100644
index 000000000000..b28a7a5f4901
--- /dev/null
+++ b/dev-libs/tre/files/tre-issue55-part2.patch
@@ -0,0 +1,11 @@
+--- a/lib/tre-parse.c
++++ b/lib/tre-parse.c
+@@ -641,7 +641,7 @@ tre_parse_bound(tre_parse_ctx_t *ctx, tre_ast_node_t **result)
+ }
+
+ /* Check that the repeat counts are sane. */
+- if ((max >= 0 && min > max) || max > RE_DUP_MAX)
++ if ((max >= 0 && min > max) || max > RE_DUP_MAX || min > RE_DUP_MAX)
+ return REG_BADBR;
+
+
diff --git a/dev-libs/tre/files/tre-python3.patch b/dev-libs/tre/files/tre-python3.patch
new file mode 100644
index 000000000000..b3068519e1dd
--- /dev/null
+++ b/dev-libs/tre/files/tre-python3.patch
@@ -0,0 +1,191 @@
+--- a/python/example.py
++++ b/python/example.py
+@@ -1,7 +1,7 @@
+ import tre
+
+ fz = tre.Fuzzyness(maxerr = 3)
+-print fz
++print (fz)
+
+ pt = tre.compile("Don(ald( Ervin)?)? Knuth", tre.EXTENDED)
+ data = """
+@@ -16,5 +16,5 @@ typefaces.
+ m = pt.search(data, fz)
+
+ if m:
+- print m.groups()
+- print m[0]
++ print (m.groups())
++ print (m[0])
+--- a/python/tre-python.c
++++ b/python/tre-python.c
+@@ -86,9 +86,9 @@ TreFuzzyness_repr(PyObject *obj)
+ TreFuzzynessObject *self = (TreFuzzynessObject*)obj;
+ PyObject *o;
+
+- o = PyString_FromFormat("%s(delcost=%d,inscost=%d,maxcost=%d,subcost=%d,"
++ o = PyUnicode_FromFormat("%s(delcost=%d,inscost=%d,maxcost=%d,subcost=%d,"
+ "maxdel=%d,maxerr=%d,maxins=%d,maxsub=%d)",
+- self->ob_type->tp_name, self->ap.cost_del,
++ Py_TYPE(self)->tp_name, self->ap.cost_del,
+ self->ap.cost_ins, self->ap.max_cost,
+ self->ap.cost_subst, self->ap.max_del,
+ self->ap.max_err, self->ap.max_ins,
+@@ -118,8 +118,7 @@ static PyMemberDef TreFuzzyness_members[
+ };
+
+ static PyTypeObject TreFuzzynessType = {
+- PyObject_HEAD_INIT(NULL)
+- 0, /* ob_size */
++ PyVarObject_HEAD_INIT(NULL, 0)
+ TRE_MODULE ".Fuzzyness", /* tp_name */
+ sizeof(TreFuzzynessObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+@@ -193,7 +192,7 @@ PyTreMatch_groups(TreMatchObject *self,
+ }
+
+ static PyObject *
+-PyTreMatch_groupi(PyObject *obj, int gn)
++PyTreMatch_groupi(PyObject *obj, Py_ssize_t gn)
+ {
+ TreMatchObject *self = (TreMatchObject*)obj;
+ PyObject *result;
+@@ -220,7 +219,7 @@ PyTreMatch_group(TreMatchObject *self, P
+ PyObject *result;
+ long gn;
+
+- gn = PyInt_AsLong(grpno);
++ gn = PyLong_AsLong(grpno);
+
+ if (PyErr_Occurred())
+ return NULL;
+@@ -277,8 +276,7 @@ static PySequenceMethods TreMatch_as_seq
+ };
+
+ static PyTypeObject TreMatchType = {
+- PyObject_HEAD_INIT(NULL)
+- 0, /* ob_size */
++ PyVarObject_HEAD_INIT(NULL, 0)
+ TRE_MODULE ".Match", /* tp_name */
+ sizeof(TreMatchObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+@@ -380,8 +378,8 @@ PyTrePattern_search(TrePatternObject *se
+ }
+ else
+ {
+- targ = PyString_AsString(pstring);
+- tlen = PyString_Size(pstring);
++ targ = PyBytes_AsString(pstring);
++ tlen = PyBytes_Size(pstring);
+
+ rc = tre_reganexec(&self->rgx, targ, tlen, &mo->am, fz->ap, eflags);
+ }
+@@ -433,8 +431,7 @@ PyTrePattern_dealloc(TrePatternObject *s
+ }
+
+ static PyTypeObject TrePatternType = {
+- PyObject_HEAD_INIT(NULL)
+- 0, /* ob_size */
++ PyVarObject_HEAD_INIT(NULL, 0)
+ TRE_MODULE ".Pattern", /* tp_name */
+ sizeof(TrePatternObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+@@ -467,7 +464,7 @@ static PyTypeObject TrePatternType = {
+ };
+
+ static TrePatternObject *
+-newTrePatternObject()
++newTrePatternObject(void)
+ {
+ TrePatternObject *self;
+
+@@ -482,7 +479,7 @@ static PyObject *
+ PyTre_ncompile(PyObject *self, PyObject *args)
+ {
+ TrePatternObject *rv;
+- PyUnicodeObject *upattern = NULL;
++ PyObject *upattern = NULL;
+ char *pattern = NULL;
+ int pattlen;
+ int cflags = 0;
+@@ -537,9 +534,8 @@ static PyMethodDef tre_methods[] = {
+ { NULL, NULL }
+ };
+
+-static char *tre_doc =
+-"Python module for TRE library\n\nModule exports "
+-"the only function: compile";
++
++#define tre_doc "Python module for TRE library\n\nModule exports the only function: compile"
+
+ static struct _tre_flags {
+ char *name;
+@@ -556,40 +552,57 @@ static struct _tre_flags {
+ { NULL, 0 }
+ };
+
++
++static struct PyModuleDef moduledef = {
++ PyModuleDef_HEAD_INIT,
++ TRE_MODULE ".Module", /* m_name */
++ tre_doc, /* m_doc */
++ -1, /* m_size */
++ tre_methods, /* m_methods */
++ NULL, /* m_reload */
++ NULL, /* m_traverse */
++ NULL, /* m_clear */
++ NULL, /* m_free */
++};
++
++
+ PyMODINIT_FUNC
+-inittre(void)
++PyInit_tre(void)
+ {
+ PyObject *m;
+ struct _tre_flags *fp;
+
+ if (PyType_Ready(&TreFuzzynessType) < 0)
+- return;
++ return NULL;
+ if (PyType_Ready(&TreMatchType) < 0)
+- return;
++ return NULL;
+ if (PyType_Ready(&TrePatternType) < 0)
+- return;
++ return NULL;
+
+ /* Create the module and add the functions */
+- m = Py_InitModule3(TRE_MODULE, tre_methods, tre_doc);
++
++ m = PyModule_Create (&moduledef);
++
+ if (m == NULL)
+- return;
++ return NULL;
+
+ Py_INCREF(&TreFuzzynessType);
+ if (PyModule_AddObject(m, "Fuzzyness", (PyObject*)&TreFuzzynessType) < 0)
+- return;
++ return NULL;
+ Py_INCREF(&TreMatchType);
+ if (PyModule_AddObject(m, "Match", (PyObject*)&TreMatchType) < 0)
+- return;
++ return NULL;
+ Py_INCREF(&TrePatternType);
+ if (PyModule_AddObject(m, "Pattern", (PyObject*)&TrePatternType) < 0)
+- return;
++ return NULL;
+ ErrorObject = PyErr_NewException(TRE_MODULE ".Error", NULL, NULL);
+ Py_INCREF(ErrorObject);
+ if (PyModule_AddObject(m, "Error", ErrorObject) < 0)
+- return;
++ return NULL;
+
+ /* Insert the flags */
+ for (fp = tre_flags; fp->name != NULL; fp++)
+ if (PyModule_AddIntConstant(m, fp->name, fp->val) < 0)
+- return;
++ return NULL;
++ return m;
+ }
diff --git a/dev-libs/tre/files/tre-tests.patch b/dev-libs/tre/files/tre-tests.patch
new file mode 100644
index 000000000000..c39ff9fb268d
--- /dev/null
+++ b/dev-libs/tre/files/tre-tests.patch
@@ -0,0 +1,10 @@
+--- tre-0.7.6/tests/agrep/run-tests.sh.tests
++++ tre-0.7.6/tests/agrep/run-tests.sh
+@@ -2,6 +2,7 @@
+
+ set -e
+
++export LD_LIBRARY_PATH=$top_builddir/lib/.libs
+ agrep="$top_builddir/src/agrep"
+
+ echo "$builddir $top_builddir $srcdir"
diff --git a/dev-libs/tre/metadata.xml b/dev-libs/tre/metadata.xml
index 4d02215649f9..f77edd54bfa6 100644
--- a/dev-libs/tre/metadata.xml
+++ b/dev-libs/tre/metadata.xml
@@ -8,4 +8,9 @@
<upstream>
<remote-id type="github">laurikari/tre</remote-id>
</upstream>
+ <use>
+ <flag name="agrep">Build agrep tool</flag>
+ <flag name="alloca">Enable if you want TRE to use alloca() instead of malloc() when allocating memory needed for regexec operations</flag>
+ <flag name="approx">Enable the approximate matching functionality</flag>
+ </use>
</pkgmetadata>
diff --git a/dev-libs/tre/tre-0.8.0_p20210321.ebuild b/dev-libs/tre/tre-0.8.0_p20210321.ebuild
new file mode 100644
index 000000000000..15ab1ee38acf
--- /dev/null
+++ b/dev-libs/tre/tre-0.8.0_p20210321.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+COMMIT="6092368aabdd0dbb0fbceb2766a37b98e0ff6911"
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
+
+inherit autotools distutils-r1
+
+DESCRIPTION="Lightweight, robust, and efficient POSIX compliant regexp matching library"
+HOMEPAGE="
+ https://laurikari.net/tre/
+ https://github.com/laurikari/tre
+"
+SRC_URI="https://github.com/laurikari/tre/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-${COMMIT}"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~x86-solaris"
+IUSE="+agrep +alloca +approx debug nls profile python"
+
+RDEPEND="
+ agrep? (
+ !app-text/agrep
+ !dev-ruby/amatch
+ !app-misc/glimpse
+ )
+ python? ( ${PYTHON_DEPS} )
+"
+DEPEND="
+ ${RDEPEND}
+ nls? ( sys-devel/gettext )
+"
+BDEPEND="virtual/pkgconfig"
+
+REQUIRED_USE="
+ agrep? ( approx )
+ python? ( ${PYTHON_REQUIRED_USE} )
+"
+
+PATCHES=(
+ "${FILESDIR}/0.8.0-pkgcfg.patch"
+ "${FILESDIR}/0.8.0-CVE-2016-8559.patch"
+ "${FILESDIR}/${PN}-chicken.patch"
+ "${FILESDIR}/${PN}-issue37.patch"
+ "${FILESDIR}/${PN}-issue50.patch"
+ "${FILESDIR}/${PN}-issue55-part1.patch"
+ "${FILESDIR}/${PN}-issue55-part2.patch"
+ "${FILESDIR}/${PN}-python3.patch"
+ "${FILESDIR}/${PN}-tests.patch"
+)
+
+src_prepare() {
+ default
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=(
+ --disable-static
+ --disable-system-abi
+ --enable-multibyte
+ --enable-wchar
+ $(use_enable agrep)
+ $(use_enable approx)
+ $(use_enable debug)
+ $(use_enable nls)
+ $(use_enable profile)
+ $(use_with alloca)
+ )
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ if locale -a | grep -iq en_US.iso88591; then
+ emake -j1 check
+ else
+ ewarn "If you like to run the test,"
+ ewarn "please make sure en_US.ISO-8859-1 is installed."
+ die "en_US.ISO-8859-1 locale is missing"
+ fi
+}
+
+src_compile() {
+ default
+ if use python; then
+ pushd "python" || die
+ python_foreach_impl distutils-r1_python_compile
+ popd || die
+ fi
+}
+
+src_install() {
+ local HTML_DOCS=( doc/*.{css,html} )
+
+ default
+ use python && python_foreach_impl python_install
+}
+
+pkg_postinst() {
+ ewarn "app-misc/glimpse, app-text/agrep and this package all provide agrep."
+ ewarn "If this causes any unforeseen incompatibilities please file a bug"
+ ewarn "on https://bugs.gentoo.org."
+}
+
+python_install() {
+ pushd "python" || die
+ distutils-r1_python_install
+ popd || die
+}