summaryrefslogtreecommitdiff
path: root/databases/unixodbc/Makefile
blob: 8fa4c564f5c6506b0788c85c5a18695a8a18be86 (plain)
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
# $NetBSD: Makefile,v 1.29 2010/05/10 16:52:22 taca Exp $

DISTNAME=	unixODBC-2.3.0
PKGNAME=	${DISTNAME:S/ODBC/odbc/}
CATEGORIES=	databases
MASTER_SITES=	http://www.unixodbc.org/

MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	http://www.unixodbc.org/
COMMENT=	ODBC 2.x/3.x driver manager
LICENSE=	gnu-lgpl-v2.1

PKG_DESTDIR_SUPPORT=	user-destdir

CONFLICTS+=		iodbc-[0-9]*

USE_LIBTOOL=		YES
GNU_CONFIGURE=		YES
CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+=	--enable-driverc
CONFIGURE_ARGS+=	--enable-drivers
CONFIGURE_ARGS+=	--enable-threads
PTHREAD_OPTS+=		require

# Override the local definitions that point to the self-contained libtool
# convenience library.  We want the one installed by pkgsrc.  Also override
# the variable pointing to the (static) libfl.a, which won't link with a
# shared library.  The sources define all the relevant symbols (yywrap), so
# libfl.a isn't needed.
#
MAKE_FLAGS+=		LEXLIB=""
MAKE_ENV+=		AM_MAKEFLAGS=${MAKE_FLAGS:Q}

UNIXODBC_DRIVERS_DIR=	lib/unixodbc

post-patch: fix-ltdl-and-lexlib

fix-driver-installation:
	cd ${WRKSRC};						\
	files=`${FIND} DRVConfig Drivers -name Makefile.in -print`;\
	for file in $${files}; do				\
		sed -e "s|^\(libdir =\).*|\1 ${PREFIX}/${UNIXODBC_DRIVERS_DIR}|g" \
			$${file} >> $${file}.fixed;		\
		mv -f $${file}.fixed $${file};			\
	done

fix-ltdl-and-lexlib:
	cd ${WRKSRC};						\
	files=`${FIND} . -name Makefile.in -print`;		\
	for file in $${files}; do				\
		sed	-e "/DEPENDENCIES/s|\$$(LIBLTDL)||g"	\
			-e "/LIBADD/s|@LEXLIB@|\$$(LEXLIB)|g"	\
			$${file} >> $${file}.fixed;		\
		mv -f $${file}.fixed $${file};			\
	done

.include "../../mk/pthread.buildlink3.mk"

.if defined(PTHREAD_TYPE) && (${PTHREAD_TYPE} == "pth")
CONFIGURE_ARGS+=	--enable-gnuthreads
CONFIGURE_ARGS+=	--with-pth=${PTHREADBASE:Q}
.endif
USE_TOOLS+=		flex yacc # to get libodbctxt.la
CONFIGURE_ARGS+=	--disable-gui

PLIST_SUBST+=		UNIXODBC_DRIVERS_DIR=${UNIXODBC_DRIVERS_DIR}
FILES_SUBST+=		UNIXODBC_DRIVERS_DIR=${UNIXODBC_DRIVERS_DIR}

EGDIR=			${PREFIX}/share/examples/${PKGBASE}

CONF_FILES=		${EGDIR}/odbc.ini ${PKG_SYSCONFDIR}/odbc.ini
OWN_DIRS=		${PKG_SYSCONFDIR}/ODBCDataSources

SUBST_CLASSES+=		paths
SUBST_FILES.paths=	${WRKDIR}/odbc.ini
SUBST_SED.paths+=	-e 's,@PREFIX@,${PREFIX},g'
SUBST_SED.paths+=	-e 's,@UNIXODBC_DRIVERS_DIR@,${UNIXODBC_DRIVERS_DIR},g'
SUBST_STAGE.paths=	post-patch

INSTALLATION_DIRS=	${EGDIR}

post-patch: fix-driver-installation

post-extract:
	${CP} ${FILESDIR}/odbcinst.ini.in ${WRKDIR}/odbc.ini

post-install:
	${INSTALL_DATA} ${WRKDIR}/odbc.ini ${DESTDIR}${EGDIR}/odbc.ini

.include "../../devel/libltdl/buildlink3.mk"
.include "../../devel/readline/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"