summaryrefslogtreecommitdiff
blob: beb2f4108baf25b7e081299f7e14a16f79b96788 (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
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
125
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lisp/cl-sql/cl-sql-1.8.7.ebuild,v 1.3 2004/06/24 23:55:14 agriffis Exp $

inherit common-lisp eutils

DEB_PV=1

DESCRIPTION="A multi-platform SQL interface for Common Lisp"
HOMEPAGE="http://clsql.med-info.com/ http://packages.debian.org/unstable/devel/cl-sql.html http://www.cliki.net/CLSQL"
SRC_URI="http://ftp.debian.org/debian/pool/main/c/cl-sql/cl-sql_${PV}.orig.tar.gz
	http://ftp.debian.org/debian/pool/main/c/cl-sql/cl-sql_${PV}-${DEB_PV}.diff.gz"

LICENSE="LLGPL-2.1"
SLOT="0"
KEYWORDS="~x86"
IUSE="postgres mysql"

DEPEND="dev-lisp/common-lisp-controller
	virtual/commonlisp
	dev-lisp/cl-md5
	dev-lisp/cl-uffi
	postgres? ( dev-db/postgresql )
	mysql? ( dev-db/mysql )"

S=${WORKDIR}/cl-sql-${PV}

modules='clsql-base clsql clsql-postgresql-socket clsql-uffi'

src_unpack() {
	unpack ${A}
	epatch cl-sql_${PV}-${DEB_PV}.diff
	# prevent shared-objects from being rebuilt -- we really need
	# portage help for reverse dependencies :(
	epatch ${FILESDIR}/${PV}-no-shared-object-asdf-gentoo.patch
}

src_compile() {
	make -C uffi
	use mysql && make -C db-mysql
	use postgres && make -C db-postgresql

	# db-postgresql-socket doesn't depend on libraries, so we build
	# support for it regardless of postgres USE flag
}

src_install() {
	local clsrc=/usr/share/common-lisp/source
	local clsys=/usr/share/common-lisp/systems

	dodir $clsys

	# cl-sql-base

	insinto $clsrc/clsql-base/base ; doins base/*.lisp
	insinto $clsrc/clsql-base ; doins clsql-base.asd
	dosym $clsrc/clsql-base/clsql-base.asd $clsys/clsql-base.asd

	# cl-sql-uffi

	exeinto /usr/lib/clsql/
	doexe uffi/uffi.so
	insinto $clsrc/clsql-uffi/uffi ; doins uffi/*.lisp uffi/uffi.c
	insinto $clsrc/clsql-uffi ; doins clsql-uffi.asd
	dosym $clsrc/clsql-uffi/clsql-uffi.asd $clsys/clsql-uffi.asd

	# cl-sql

	insinto $clsrc/clsql/sql ; doins sql/*.lisp
	insinto $clsrc/clsql ; doins clsql.asd
	dosym $clsrc/clsql/clsql.asd $clsys/clsql.asd

	# cl-sql-postgresql-socket

	insinto $clsrc/clsql-postgresql-socket/db-postgresql-socket ; doins db-postgresql-socket/*.lisp
	insinto $clsrc/clsql-postgresql-socket ; doins clsql-postgresql-socket.asd
	dosym $clsrc/clsql-postgresql-socket/clsql-postgresql-socket.asd \
		$clsys/clsql-postgresql-socket.asd

	# cl-sql-postgresql (UFFI interface)

	if use postgres; then
		insinto $clsrc/clsql-postgresql/db-postgresql ; doins db-postgresql/*.lisp
		insinto $clsrc/clsql-postgresql ; doins clsql-postgresql.asd
		dosym $clsrc/clsql-postgresql/clsql-postgresql.asd $clsys/clsql-postgresql.asd
	fi

	# cl-sql-mysql (UFFI interface)

	if use mysql; then
		insinto $clsrc/clsql-mysql/db-mysql; doins db-mysql/*.lisp db-mysql/mysql.c
		insinto $clsrc/clsql-mysql; doins clsql-mysql.asd
		dosym $clsrc/clsql-mysql/clsql-mysql.asd $clsys/clsql-mysql.asd
		exeinto /usr/lib/clsql
		doexe db-mysql/mysql.so
	fi

	dodoc COPYING* ChangeLog INSTALL NEWS README TODO
	tar xfz doc/html.tar.gz -C ${D}/usr/share/doc/${P}/
	do-debian-credits
}

pkg_postinst() {
	for i in $modules ; do
		/usr/sbin/register-common-lisp-source $i
	done
	use postgres && /usr/sbin/register-common-lisp-source clsql-postgresql
	use mysql && /usr/sbin/register-common-lisp-source clsql-mysql
}

pkg_prerm() {
	for i in $modules ; do
		/usr/sbin/unregister-common-lisp-source $i
	done
	use postgres && /usr/sbin/unregister-common-lisp-source clsql-postgresql
	use mysql && /usr/sbin/unregister-common-lisp-source clsql-mysql
}

pkg_preinst() {
	rm -rf /usr/lib/common-lisp/*/clsql* || true
}

pkg_postrm() {
	rm -rf /usr/lib/common-lisp/*/clsql* || true
}