aboutsummaryrefslogtreecommitdiffstats
path: root/databases/tdbc/Makefile
blob: 8bf1fd303529f9795beb95d2c21b3414796514e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Created by: Pietro Cerutti <gahr@FreeBSD.org>
# $FreeBSD$

PORTNAME=   tdbc
DISTVERSION=    1.0.0
CATEGORIES= databases
MASTER_SITES=   SF/tcl/Tcl/8.6.0
DISTFILES=  ${PORTNAME}${PORTVERSION}${EXTRACT_SUFX}

MAINTAINER= tcltk@FreeBSD.org
COMMENT=    The common database access interface for Tcl

OPTIONS_DEFINE= MYSQL PGSQL SQLITE ODBC

USES+=      tcl:86
USE_LDCONFIG=   yes
CONFIGURE_ARGS+=--with-tcl=${TCL_LIBDIR} --with-tcloo=${TCL_LIBDIR} \
        --prefix=${PREFIX} --exec-prefix=${PREFIX} \
        --with-tdbc=${WRKDIR}/tdbc${PORTVERSION} --enable-threads \
        --mandir=${PREFIX}/man
PLIST_SUB+= VERSION=${DISTVERSION} \
        TCL_MAJ=${TCL_VER:R} \
        TCL_VER=${TCL_VER}

MODULES=    tdbc

MAN3=   Tdbc_Init.3
MANN=   tdbc.n \
    tdbc_connection.n \
    tdbc_mapSqlState.n \
    tdbc_resultset.n \
    tdbc_statement.n \
    tdbc_tokenize.n

.include <bsd.port.options.mk>

#
# MySQL
#
.if ${PORT_OPTIONS:MMYSQL}
DISTFILES+= ${PORTNAME}mysql${PORTVERSION}${EXTRACT_SUFX}
MODULES+=   tdbcmysql
PLIST_SUB+= MYSQL=""
MANN+=      tdbc_mysql.n
USE_MYSQL=  client
.else
PLIST_SUB+= MYSQL="@comment "
.endif

#
# ODBC
#
.if ${PORT_OPTIONS:MODBC}
LIB_DEPENDS+=   odbc:${PORTSDIR}/databases/unixODBC
DISTFILES+= ${PORTNAME}odbc${PORTVERSION}${EXTRACT_SUFX}
MODULES+=   tdbcodbc
PLIST_SUB+= ODBC=""
MANN+=      tdbc_odbc.n
.else
PLIST_SUB+= ODBC="@comment "
.endif

#
# PostgreSQL
#
.if ${PORT_OPTIONS:MPGSQL}
USE_PGSQL=  client
DISTFILES+= ${PORTNAME}postgres${PORTVERSION}${EXTRACT_SUFX}
MODULES+=   tdbcpostgres
PLIST_SUB+= PGSQL=""
.else
PLIST_SUB+= PGSQL="@comment "
.endif

#
# SQLite
#
.if ${PORT_OPTIONS:MSQLITE}
DISTFILES+= ${PORTNAME}sqlite3-${PORTVERSION}${EXTRACT_SUFX}
MODULES+=   tdbcsqlite3
PLIST_SUB+= SQLITE="" \
        TCL_LIBDIR="${TCL_LIBDIR:S/${LOCALBASE}\///}"
MANN+=      tdbc_sqlite3.n
.else
PLIST_SUB+= SQLITE="@comment "
.endif

post-extract:
    if [ -d ${WRKDIR}/tdbcsqlite3-${PORTVERSION} ]; then \
        ${MV} ${WRKDIR}/tdbcsqlite3-${PORTVERSION} ${WRKDIR}/tdbcsqlite3${PORTVERSION}; \
    fi

do-configure:
.for module in ${MODULES}
    @echo "================================="
    @echo "Configuring ${module}"
    cd ${WRKDIR}/${module}${PORTVERSION} && ${SH} configure ${CONFIGURE_ARGS}
.endfor

post-configure:
    ${FIND} ${WRKDIR} -type f | ${XARGS} ${REINPLACE_CMD} -e 's|tdbcstub100|tdbcstub|g'

do-build:
.for module in ${MODULES}
    @echo "================================="
    @echo "Building ${module}"
    cd ${WRKDIR}/${module}${PORTVERSION} && ${MAKE} ${ALL_TARGET}
.endfor

do-install:
.for module in ${MODULES}
    @echo "================================="
    @echo "Installing ${module}"
    cd ${WRKDIR}/${module}${PORTVERSION} && ${MAKE} ${INSTALL_TARGET}
.endfor

test:
.for module in ${MODULES}
    @echo "================================="
    @echo "Testing ${module}"
    cd ${WRKDIR}/${module}${PORTVERSION} && ${MAKE} test
.endfor

.include <bsd.port.mk>