--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Multi-polynomial quadratic sieve for integer factorization"
+HOMEPAGE="https://github.com/sagemath/FlintQS"
+# The github tarball is missing the autotools stuff.
+SRC_URI="http://files.sagemath.org/spkg/upstream/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
+IUSE=""
+
+DEPEND="dev-libs/gmp:="
+RDEPEND="${DEPEND}"
+
+src_test() {
+ # Factor,
+ #
+ # 1000000000000000005490000000000000001989
+ #
+ # to get
+ #
+ # 10000000000000000051 * 100000000000000000039.
+ #
+ # The sed command deletes all lines up to the pattern match.
+ #
+ ACTUAL=$(echo 1000000000000000005490000000000000001989 | \
+ QuadraticSieve | \
+ sed '0,/FACTORS:/d' | \
+ sort --numeric | \
+ uniq |
+ tr '\n' ' ')
+ EXPECTED="10000000000000000051 100000000000000000039 "
+
+ [[ "${ACTUAL}" == "${EXPECTED}" ]] || die "test factorization failed"
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>mjo@gentoo.org</email>
+ </maintainer>
+ <!--
+ mjo: François maintained this package in the sage-on-gentoo overlay
+ long before I moved it into ::gentoo. You don't need an ACK from me
+ to merge his changes.
+ -->
+ <maintainer type="person">
+ <email>frp.bissey@gmail.com</email>
+ <name>François Bissey</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+
+ <upstream>
+ <remote-id type="github">sagemath/FlintQS</remote-id>
+ </upstream>
+</pkgmetadata>