Skip to content

Commit

Permalink
app-crypt/rhash: Install libs, respect flags, nls, openssl, tests
Browse files Browse the repository at this point in the history
* Install the shared and (optionally) static libraries.
* Multilib support for the libraries.
* Respect CC, CFLAGS, LDFLAGS.
* gettext support via nls flag.
* Additional hash support via openssl.
* Passing test suite.
* Disable debug by default.

These changes were made with sbraz's blessing. Thanks to Raimonds
Cicans for the initial work behind this.

Package-Manager: portage-2.3.0
  • Loading branch information
chewi committed Sep 16, 2016
1 parent aafda8d commit c7c3e65
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 19 deletions.
3 changes: 3 additions & 0 deletions app-crypt/rhash/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<remote-id type="github">rhash/RHash</remote-id>
<bugs-to>https://github.com/rhash/RHash/issues</bugs-to>
</upstream>
<use>
<flag name='openssl'>Add support for hashes from dev-libs/openssl</flag>
</use>
<longdescription lang="en">
RHash is a console utility for calculation and verification of magnet links and a wide range of hash sums like CRC32, MD4, MD5, SHA1, SHA256, SHA512, SHA3, AICH, ED2K, Tiger, DC++ TTH, BitTorrent BTIH, GOST R 34.11-94, RIPEMD-160, HAS-160, EDON-R, Whirlpool and Snefru.
</longdescription>
Expand Down
59 changes: 59 additions & 0 deletions app-crypt/rhash/rhash-1.3.3-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit toolchain-funcs multilib-minimal

DESCRIPTION="Console utility and library for computing and verifying file hash sums"
HOMEPAGE="http://rhash.anz.ru/"
SRC_URI="mirror://sourceforge/${PN}/${P}-src.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug nls openssl static-libs"

RDEPEND="openssl? ( dev-libs/openssl:0=[${MULTILIB_USEDEP}] )"

DEPEND="${RDEPEND}
nls? ( sys-devel/gettext )"

src_prepare() {
default

# Exit on test failure or src_test will always succeed.
sed -i "s/return 1/exit 1/g" tests/test_rhash.sh || die

multilib_copy_sources
}

multilib_src_compile() {
local ADDCFLAGS=(
$(use debug || echo -DNDEBUG)
$(use nls && echo -DUSE_GETTEXT)
$(use openssl && echo -DOPENSSL_RUNTIME -rdynamic)
)

local ADDLDFLAGS=(
$(use openssl && echo -ldl)
)

emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC="$(tc-getCC)" \
ADDCFLAGS="${ADDCFLAGS[*]}" ADDLDFLAGS="${ADDLDFLAGS[*]}" \
$(multilib_is_native_abi && echo build-shared || echo lib-shared) \
$(use static-libs && echo lib-static)
}

multilib_src_install() {
emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr LIBDIR='$(PREFIX)'/$(get_libdir) \
install-lib-shared $(multilib_is_native_abi && echo install-shared) \
$(use static-libs && echo install-lib-static) \
$(use nls && multilib_is_native_abi && echo install-gmo)
}

multilib_src_test() {
cd tests || die
./test_rhash.sh --full ../rhash_shared || die "tests failed"
}
19 changes: 0 additions & 19 deletions app-crypt/rhash/rhash-1.3.3.ebuild

This file was deleted.

0 comments on commit c7c3e65

Please sign in to comment.