diff options
author | Lars Wendler <polynomial-c@gentoo.org> | 2018-09-19 11:35:50 +0200 |
---|---|---|
committer | Lars Wendler <polynomial-c@gentoo.org> | 2018-09-19 11:35:50 +0200 |
commit | 6df00c69826babb358006a8ca5f6936385ca8a1c (patch) | |
tree | 8ab61b0cc068a23cfaf8e0842b356080ea1a550c /sys-libs/libhugetlbfs | |
parent | msys-apps/less: Removed old. (diff) | |
download | gentoo-6df00c69826babb358006a8ca5f6936385ca8a1c.tar.gz gentoo-6df00c69826babb358006a8ca5f6936385ca8a1c.tar.bz2 gentoo-6df00c69826babb358006a8ca5f6936385ca8a1c.zip |
sys-libs/libhugetlbfs: Bump to version 2.21
Package-Manager: Portage-2.3.49, Repoman-2.3.10
Diffstat (limited to 'sys-libs/libhugetlbfs')
-rw-r--r-- | sys-libs/libhugetlbfs/Manifest | 1 | ||||
-rw-r--r-- | sys-libs/libhugetlbfs/libhugetlbfs-2.21.ebuild | 157 |
2 files changed, 158 insertions, 0 deletions
diff --git a/sys-libs/libhugetlbfs/Manifest b/sys-libs/libhugetlbfs/Manifest index 7184c0e8ae91..2d7527a8693c 100644 --- a/sys-libs/libhugetlbfs/Manifest +++ b/sys-libs/libhugetlbfs/Manifest @@ -1,3 +1,4 @@ DIST libhugetlbfs-2.18.tar.gz 181275 BLAKE2B 1f0ca8d73d9bdf05eb08706be4854f110b8cbe5b0c7554fdddb437fc9644e69d0bc42d9d8bedf23bf2dda4901977f093d0f46ed039304f8b5184b2fcac157d47 SHA512 6dcdbf571d6a723a40c15e10b24533f16d65f67fe149aa2d25bee48a034d003419d4cf4b6e55fcd385e1214fc4f6b4dda72ba429b9eea9b38be9b1a393528746 DIST libhugetlbfs-2.19.tar.gz 181504 BLAKE2B 27d5e5729e48b82311d6f4317f8c0bb5a04054242bca6fd9745265e2590f18ec49de6a9cdfa7ea28be47f794e91e70c5fcecdb418bf8e8cb0cb5b78d0948e563 SHA512 d21781fe68736eb3bbafeb8f36f4f34d30f290f2f6744b52c1a40161caf2e28b823cd8e9b9c74ec4e6d11f7d398d909f80eb736cc39a64ecc7bf571018bfec7c DIST libhugetlbfs-2.20.tar.gz 186750 BLAKE2B 758482a41254d6d14795efdfb2959248af2ff00bc6cafbae9b2002b7eaa50921a72ef928910bc0d2061a414e9c73346848eead108af077c96429870c734495aa SHA512 817fca3f8e3b127b9b877e0a03d0a94bf0c3ec481d3becf995986ce6ae0532629c5460100eb9f2ef3452ed59a3b9d3ac8362df8f87b387803c36d35ab7af0902 +DIST libhugetlbfs-2.21.tar.gz 173052 BLAKE2B a65fdeee3ed9ad8cb69f772847646befbf5deef0b82d6cb7338e5ff448d5c2461ceb1e381b9515e79f4243482589bb0203874cc52e5c8c6d98667df4eacffa8b SHA512 87fd95a826bedc2c53b1aa440f5db7ff3ece482d520545b597d4d1231cf84276103c312899b812166872444331bc7b6f1692f0d3b7cbff691efdcf9c2e99b1d0 diff --git a/sys-libs/libhugetlbfs/libhugetlbfs-2.21.ebuild b/sys-libs/libhugetlbfs/libhugetlbfs-2.21.ebuild new file mode 100644 index 000000000000..e7aae65f6050 --- /dev/null +++ b/sys-libs/libhugetlbfs/libhugetlbfs-2.21.ebuild @@ -0,0 +1,157 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 ) + +inherit multilib toolchain-funcs python-any-r1 + +DESCRIPTION="easy hugepage access" +HOMEPAGE="https://github.com/libhugetlbfs/libhugetlbfs" +SRC_URI="https://github.com/libhugetlbfs/libhugetlbfs/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~s390 ~x86" +IUSE="static-libs test" + +DEPEND="test? ( ${PYTHON_DEPS} )" + +PATCHES=( + "${FILESDIR}"/${PN}-2.6-fixup-testsuite.patch +) + +src_prepare() { + default + sed -i \ + -e '/^PREFIX/s:/local::' \ + -e '1iBUILDTYPE = NATIVEONLY' \ + -e '1iV = 1' \ + -e '/gzip.*MANDIR/d' \ + -e "/^LIB\(32\)/s:=.*:= $(get_libdir):" \ + -e '/^CC\(32\|64\)/s:=.*:= $(CC):' \ + -e 's@^\(ARCH\) ?=@\1 =@' \ + Makefile || die "sed failed" + if [ "$(get_libdir)" == "lib64" ]; then + sed -i \ + -e "/^LIB\(32\)/s:=.*:= lib32:" \ + Makefile + fi + + # Tarballs from github don't have the version set. + # https://github.com/libhugetlbfs/libhugetlbfs/issues/7 + [[ -f version ]] || echo "${PV}" > version +} + +src_compile() { + tc-export AR + emake CC="$(tc-getCC)" libs tools +} + +src_install() { + default + use static-libs || rm -f "${ED%/}"/usr/$(get_libdir)/*.a +} + +src_test_alloc_one() { + hugeadm="$1" + sign="$2" + pagesize="$3" + pagecount="$4" + ${hugeadm} \ + --pool-pages-max ${pagesize}:${sign}${pagecount} \ + && \ + ${hugeadm} \ + --pool-pages-min ${pagesize}:${sign}${pagecount} + return $? +} + +# die is NOT allowed in this src_test block after the marked point, so that we +# can clean up memory allocation. You'll leak at LEAST 64MiB per run otherwise. +src_test() { + [[ $UID -eq 0 ]] || die "Need FEATURES=-userpriv to run this testsuite" + einfo "Building testsuite" + emake -j1 tests || die "Failed to build tests" + + hugeadm='obj/hugeadm' + allocated='' + rc=0 + # the testcases need 64MiB per pagesize. + MIN_HUGEPAGE_RAM=$((64*1024*1024)) + + einfo "Planning allocation" + PAGESIZES="$(${hugeadm} --page-sizes-all)" + + # Need to do this before we can create the mountpoints. + for pagesize in ${PAGESIZES} ; do + # The kernel depends on the location :-( + mkdir -p /var/lib/hugetlbfs/pagesize-${pagesize} + addwrite /var/lib/hugetlbfs/pagesize-${pagesize} + done + addwrite /proc/sys/vm/ + addwrite /proc/sys/kernel/shmall + addwrite /proc/sys/kernel/shmmax + addwrite /proc/sys/kernel/shmmni + + einfo "Checking HugeTLB mountpoints" + ${hugeadm} --create-mounts || die "Failed to set up hugetlb mountpoints." + + # ----------------------------------------------------- + # --------- die is unsafe after this point. ----------- + # ----------------------------------------------------- + + einfo "Starting allocation" + for pagesize in ${PAGESIZES} ; do + pagecount=$((${MIN_HUGEPAGE_RAM}/${pagesize})) + einfo " ${pagecount} @ ${pagesize}" + addwrite /var/lib/hugetlbfs/pagesize-${pagesize} + src_test_alloc_one "$hugeadm" "+" "${pagesize}" "${pagecount}" + rc=$? + if [[ $rc -eq 0 ]]; then + allocated="${allocated} ${pagesize}:${pagecount}" + else + eerror "Failed to add ${pagecount} pages of size ${pagesize}" + fi + done + + einfo "Allocation status" + ${hugeadm} --pool-list + + if [[ -n "${allocated}" ]]; then + # All our allocations worked, so time to run. + einfo "Starting tests" + cd "${S}"/tests + TESTOPTS="-t func" + case $ARCH in + amd64|ppc64) + TESTOPTS="${TESTOPTS} -b 64" + ;; + x86) + TESTOPTS="${TESTOPTS} -b 32" + ;; + esac + # This needs a bit of work to give a nice exit code still. + ./run_tests.py ${TESTOPTS} + rc=$? + else + eerror "Failed to make HugeTLB allocations." + rc=1 + fi + + einfo "Cleaning up memory" + cd "${S}" + # Cleanup memory allocation + for alloc in ${allocated} ; do + pagesize="${alloc/:*}" + pagecount="${alloc/*:}" + einfo " ${pagecount} @ ${pagesize}" + src_test_alloc_one "$hugeadm" "-" "${pagesize}" "${pagecount}" + done + + # --------------------------------------------------------- + # --------- die is safe again after this point. ----------- + # --------------------------------------------------------- + + return $rc +} |