# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 106246 2013-05-20 12:56:51Z stromnov@macports.org $

PortSystem          1.0

name                sqlite3
version             3.7.17
categories          databases
platforms           darwin
license             public-domain

maintainers         mww openmaintainer

description         an embedded SQL database engine

long_description    SQLite3 is an SQL database engine in a C library. \
                    Programs that link the SQLite3 library can have SQL \
                    database access without running a separate RDBMS \
                    process. The distribution comes with a standalone \
                    command-line access program (sqlite3) that can be used \
                    to administer an SQLite3 database and which serves as \
                    an example of how to use the SQLite3 library.

homepage            http://www.sqlite.org/
master_sites        ${homepage}2013

distname            sqlite-autoconf-[string range [subst [regsub -all {\.([0-9]+)} "${version}.0.0" {[format %02d \1]}]] 0 6]

checksums           rmd160  bf8dc7ac0148733f2890ac4a49be26b01e3083ba \
                    sha256  8ff46d0baa9e64c0815544e829e985f1161c096aa6344c8f430791dbeadc2baf

depends_lib         port:libedit

patchfiles          patch-configure.diff patch-shell.c.diff

configure.args      --enable-threadsafe \
                    --enable-dynamic-extensions \
                    --enable-readline

# search in worksrcpath for sqlite3.h first -- dont pick up an installed one!
configure.cppflags  "-DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -I${worksrcpath} -I${prefix}/include"

build.type          gnu

livecheck.type      regex
livecheck.url       http://www.sqlite.org/news.html
livecheck.regex     (3(?:\\.\[0-9\]+)+)

post-destroot {
    xinstall -m 644 ${worksrcpath}/${name}.1 ${destroot}${prefix}/share/man/man1
}

platform darwin 8 {
    configure.cppflags-append -DSQLITE_WITHOUT_ZONEMALLOC
}
