| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/sqlite/sqlite-3.7.13.ebuild,v 1.5 2012/08/04 13:39:08 ago Exp $
|
| 4 |
|
| 5 |
EAPI="4"
|
| 6 |
|
| 7 |
inherit autotools eutils flag-o-matic multilib versionator
|
| 8 |
|
| 9 |
SRC_PV="$(printf "%u%02u%02u%02u" $(get_version_components))"
|
| 10 |
# DOC_PV="$(printf "%u%02u%02u00" $(get_version_components $(get_version_component_range 1-3)))"
|
| 11 |
DOC_PV="${SRC_PV}"
|
| 12 |
|
| 13 |
DESCRIPTION="A SQL Database Engine in a C Library"
|
| 14 |
HOMEPAGE="http://sqlite.org/"
|
| 15 |
SRC_URI="doc? ( http://sqlite.org/${PN}-doc-${DOC_PV}.zip )
|
| 16 |
tcl? ( http://sqlite.org/${PN}-src-${SRC_PV}.zip )
|
| 17 |
!tcl? (
|
| 18 |
test? ( http://sqlite.org/${PN}-src-${SRC_PV}.zip )
|
| 19 |
!test? ( http://sqlite.org/${PN}-autoconf-${SRC_PV}.tar.gz )
|
| 20 |
)"
|
| 21 |
|
| 22 |
LICENSE="as-is"
|
| 23 |
SLOT="3"
|
| 24 |
KEYWORDS="~alpha amd64 arm hppa ~ia64 ~mips ppc ~ppc64 ~s390 ~sh ~sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
| 25 |
IUSE="debug doc +extensions +fts3 icu +readline secure-delete soundex tcl test +threadsafe unlock-notify"
|
| 26 |
|
| 27 |
RDEPEND="icu? ( dev-libs/icu )
|
| 28 |
readline? ( sys-libs/readline )
|
| 29 |
tcl? ( dev-lang/tcl )"
|
| 30 |
DEPEND="${RDEPEND}
|
| 31 |
doc? ( app-arch/unzip )
|
| 32 |
tcl? ( app-arch/unzip )
|
| 33 |
test? (
|
| 34 |
app-arch/unzip
|
| 35 |
dev-lang/tcl
|
| 36 |
)"
|
| 37 |
|
| 38 |
amalgamation() {
|
| 39 |
use !tcl && use !test
|
| 40 |
}
|
| 41 |
|
| 42 |
pkg_setup() {
|
| 43 |
if amalgamation; then
|
| 44 |
S="${WORKDIR}/${PN}-autoconf-${SRC_PV}"
|
| 45 |
else
|
| 46 |
S="${WORKDIR}/${PN}-src-${SRC_PV}"
|
| 47 |
fi
|
| 48 |
}
|
| 49 |
|
| 50 |
src_prepare() {
|
| 51 |
# At least ppc-aix, x86-interix and *-solaris need newer libtool.
|
| 52 |
use prefix && eautoreconf
|
| 53 |
|
| 54 |
epunt_cxx
|
| 55 |
}
|
| 56 |
|
| 57 |
src_configure() {
|
| 58 |
# `configure` from amalgamation tarball doesn't add -DSQLITE_DEBUG or -DNDEBUG flag.
|
| 59 |
if amalgamation; then
|
| 60 |
if use debug; then
|
| 61 |
append-cppflags -DSQLITE_DEBUG
|
| 62 |
else
|
| 63 |
append-cppflags -DNDEBUG
|
| 64 |
fi
|
| 65 |
fi
|
| 66 |
|
| 67 |
# Support column metadata, bug #266651
|
| 68 |
append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA
|
| 69 |
|
| 70 |
# Support R-trees, bug #257646
|
| 71 |
append-cppflags -DSQLITE_ENABLE_RTREE
|
| 72 |
|
| 73 |
if use icu; then
|
| 74 |
append-cppflags -DSQLITE_ENABLE_ICU
|
| 75 |
if amalgamation; then
|
| 76 |
sed -e "s/LIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed"
|
| 77 |
else
|
| 78 |
sed -e "s/TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed"
|
| 79 |
fi
|
| 80 |
fi
|
| 81 |
|
| 82 |
# Support FTS3, bug #207701
|
| 83 |
if use fts3; then
|
| 84 |
append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
|
| 85 |
fi
|
| 86 |
|
| 87 |
# Enable secure_delete pragma by default
|
| 88 |
if use secure-delete; then
|
| 89 |
append-cppflags -DSQLITE_SECURE_DELETE -DSQLITE_CHECK_PAGES -DSQLITE_CORE
|
| 90 |
fi
|
| 91 |
|
| 92 |
# Support soundex, bug #143794
|
| 93 |
if use soundex; then
|
| 94 |
append-cppflags -DSQLITE_SOUNDEX
|
| 95 |
fi
|
| 96 |
|
| 97 |
# Enable unlock notification
|
| 98 |
if use unlock-notify; then
|
| 99 |
append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY
|
| 100 |
fi
|
| 101 |
|
| 102 |
local extensions_option
|
| 103 |
if amalgamation; then
|
| 104 |
extensions_option="dynamic-extensions"
|
| 105 |
else
|
| 106 |
extensions_option="load-extension"
|
| 107 |
fi
|
| 108 |
|
| 109 |
# Starting from 3.6.23, SQLite has locking strategies that are specific to
|
| 110 |
# OSX. By default they are enabled, and use semantics that only make sense
|
| 111 |
# on OSX. However, they require gethostuuid() function for that, which is
|
| 112 |
# only available on OSX starting from 10.6 (Snow Leopard). For earlier
|
| 113 |
# versions of OSX we have to disable all this nifty locking options, as
|
| 114 |
# suggested by upstream.
|
| 115 |
if [[ "${CHOST}" == *-darwin[56789] ]]; then
|
| 116 |
append-cppflags -DSQLITE_ENABLE_LOCKING_STYLE="0"
|
| 117 |
fi
|
| 118 |
|
| 119 |
if [[ "${CHOST}" == *-mint* ]]; then
|
| 120 |
append-cppflags -DSQLITE_OMIT_WAL
|
| 121 |
fi
|
| 122 |
|
| 123 |
# `configure` from amalgamation tarball doesn't support
|
| 124 |
# --with-readline-inc and --(enable|disable)-tcl options.
|
| 125 |
econf \
|
| 126 |
--disable-static \
|
| 127 |
$(use_enable extensions ${extensions_option}) \
|
| 128 |
$(use_enable readline) \
|
| 129 |
$(use_enable threadsafe) \
|
| 130 |
$(amalgamation || echo --with-readline-inc="-I${EPREFIX}/usr/include/readline") \
|
| 131 |
$(amalgamation || use_enable debug) \
|
| 132 |
$(amalgamation || echo --enable-tcl)
|
| 133 |
}
|
| 134 |
|
| 135 |
src_compile() {
|
| 136 |
emake TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}"
|
| 137 |
}
|
| 138 |
|
| 139 |
src_test() {
|
| 140 |
if [[ "${EUID}" -eq 0 ]]; then
|
| 141 |
ewarn "Skipping tests due to root permissions"
|
| 142 |
return
|
| 143 |
fi
|
| 144 |
|
| 145 |
emake $(use debug && echo fulltest || echo test)
|
| 146 |
}
|
| 147 |
|
| 148 |
src_install() {
|
| 149 |
emake DESTDIR="${D}" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install
|
| 150 |
find "${ED}" -name "*.la" -exec rm -f {} +
|
| 151 |
|
| 152 |
doman sqlite3.1
|
| 153 |
|
| 154 |
if use doc; then
|
| 155 |
dohtml -r "${WORKDIR}/${PN}-doc-${DOC_PV}/"*
|
| 156 |
fi
|
| 157 |
}
|