gentoo/dev-db/lmdb/lmdb-9999.ebuild

64 lines
1.8 KiB
Bash
Raw Normal View History

2017-01-25 15:11:23 +01:00
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
2017-01-25 15:11:23 +01:00
EAPI=6
2017-01-25 19:09:23 +01:00
inherit toolchain-funcs flag-o-matic multilib
if [[ ${PV} = "9999" ]] ; then
EGIT_REPO_URI="https://github.com/LMDB/lmdb.git"
inherit git-r3
KEYWORDS=""
else
SRC_URI="https://github.com/LMDB/lmdb/archive/LMDB_${PV}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
fi
DESCRIPTION="An ultra-fast, ultra-compact key-value embedded data store"
HOMEPAGE="http://symas.com/mdb/"
LICENSE="OPENLDAP"
SLOT="0/0.9.21"
IUSE="static-libs"
DEPEND=""
# =net-nds/openldap-2.4.40 installs lmdb files.
RDEPEND="!=net-nds/openldap-2.4.40"
S="${WORKDIR}/${P}/libraries/liblmdb"
src_prepare() {
2017-01-25 19:09:23 +01:00
local soname="-Wl,-soname,liblmdb$(get_libname 0)"
[[ ${CHOST} == *-darwin* ]] && \
soname="-dynamiclib -install_name ${EPREFIX}/usr/$(get_libdir)/liblmdb$(get_libname 0)"
2016-11-12 17:23:40 +01:00
sed -i -e "s!^CC.*!CC = $(tc-getCC)!" \
-e "s!^CFLAGS.*!CFLAGS = ${CFLAGS}!" \
-e "s!^AR.*!AR = $(tc-getAR)!" \
2017-01-25 19:09:23 +01:00
-e "s!^SOEXT.*!SOEXT = $(get_libname)!" \
2016-11-12 17:23:40 +01:00
-e "/^prefix/s!/usr/local!${EPREFIX}/usr!" \
-e "/^libdir/s!lib\$!$(get_libdir)!" \
2017-01-25 19:09:23 +01:00
-e "s!shared!shared ${soname}!" \
"${S}/Makefile" || die
2017-01-25 15:11:23 +01:00
eapply_user
}
src_configure() {
2017-12-21 15:11:32 +01:00
if [[ ${CHOST} == *-solaris* ]] ; then
# fdatasync lives in -lrt on Solaris 10
[[ ${CHOST#*-solaris2.} -le 10 ]] && append-ldflags -lrt
2017-01-25 15:11:23 +01:00
fi
}
src_compile() {
2016-11-12 17:23:40 +01:00
emake LDLIBS+=" -pthread"
}
src_install() {
2016-11-12 17:23:40 +01:00
emake DESTDIR="${D}" install
2017-01-25 19:09:23 +01:00
mv "${ED}"usr/$(get_libdir)/liblmdb$(get_libname) \
"${ED}"usr/$(get_libdir)/liblmdb$(get_libname 0) || die
dosym liblmdb$(get_libname 0) /usr/$(get_libdir)/liblmdb$(get_libname)
use static-libs || rm "${ED}"usr/$(get_libdir)/liblmdb.a || die
}