export DH_VERBOSE=1
# This is the debhelper compatibility version to use.
-export DH_COMPAT=3
-
-pkg := cl-uffi
-prefix := debian/$(pkg)
+export DH_COMPAT=4
+
+pkg := cl-sql
+pkg-base := cl-sql-base
+pkg-mysql := cl-sql-mysql
+pkg-pg := cl-sql-postgresql
+pkg-pg-socket := cl-sql-postgresql-socket
+pkg-aodbc := cl-sql-aodbc
+all-pkgs := $(pkg) $(pkg-base) $(pkg-mysql) $(pkg-pg) $(pkg-pg-socket) $(pkg-aodbc)
+
+prefix := debian/$(pkg)
+prefix-base := debian/$(pkg-base)
+prefix-mysql := debian/$(pkg-mysql)
+prefix-pg := debian/$(pkg-pg)
+prefix-pg-socket := debian/$(pkg-pg-socket)
+prefix-aodbc := debian/$(pkg-aodbc)
+
+UPSTREAM_VER := $(shell sed -n -e "s/${pkg} (\(.*\)-[0-9.]).*/\1/p" < debian/changelog |head -1)
+
+## Lisp sources
+srcs := $(wildcard sql/*.cl)
+srcs-base := $(wildcard base/*.cl)
+srcs-base-uffi := $(wildcard interfaces/clsql-uffi/*.cl)
+srcs-base-uffi-so:= $(wildcard interfaces/clsql-uffi/*.so)
+srcs-mysql := $(wildcard interfaces/mysql/*.cl)
+srcs-mysql-so := $(wildcard interfaces/mysql/*.so)
+srcs-pg := $(wildcard interfaces/postgresql/*.cl)
+srcs-pg-socket := $(wildcard interfaces/postgresql-socket/*.cl)
+srcs-aodbc := $(wildcard interfaces/aodbc/*.cl)
INSTALL := install
INSTALLFLAGS := -g root -o root -m 0644
+INSTALLEXECFLAGS := -g root -o root -m 0755
INSTALLDIRFLAGS := -d -g root -o root -m 0755
-SOURCEDIR := $(prefix)/usr/share/common-lisp/source
-REPOSITORYDIR := $(prefix)/usr/share/common-lisp/repositories/uffi
-SYSDIR := $(prefix)/usr/share/common-lisp/systems
-DOCDIR := $(prefix)/usr/share/doc/cl-uffi
+clc-base := usr/share/common-lisp
+clc-source := $(clc-base)/source
+clc-systems := $(clc-base)/systems
+doc-dir := $(prefix)/usr/share/doc/cl-sql
+
+clc-clsql := $(clc-source)/$(pkg)-$(UPSTREAM_VER)
+
+lispdir := $(prefix)/$(clc-clsql)
+lispdir-sql := $(prefix)/$(clc-clsql)/sql
+lispdir-base := $(prefix-base)/$(clc-clsql)/base
+lispdir-base-uffi := $(prefix-base)/$(clc-clsql)/interfaces/clsql-uffi
+lispdir-mysql := $(prefix-mysql)/$(clc-clsql)/mysql
+lispdir-pg := $(prefix-pg)/$(clc-clsql)/postgresql
+lispdir-pg-socket := $(prefix-pg-socket)/$(clc-clsql)/postgresql-socket
+lispdir-aodbc := $(prefix-aodbc)/$(clc-clsql)/aodbc
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
-
touch configure-stamp
build-stamp: configure-stamp
dh_testdir
-
- # Add here commands to compile the package.
- $(MAKE) doc
- #/usr/bin/docbook-to-man debian/uffi.sgml > uffi.1
-
+ # Compile helper libraries
+ $(MAKE)
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
-
# Add here commands to clean up after the build process.
- -$(MAKE) clean
-
+ $(MAKE) clean
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
- dh_installdirs
-
- # Add here commands to install the package into debian/uffi.
- $(INSTALL) $(INSTALLDIRFLAGS) $(REPOSITORYDIR) $(REPOSITORYDIR)/mcl $(SYSDIR) $(DOCDIR) $(DOCDIR)/html $(SOURCEDIR)
- $(INSTALL) $(INSTALLFLAGS) uffi.system.debian $(SYSDIR)
- mv $(SYSDIR)/uffi.system.debian $(SYSDIR)/uffi.system
- $(INSTALL) $(INSTALLFLAGS) $(shell echo src/*.cl) $(REPOSITORYDIR)
- $(INSTALL) $(INSTALLFLAGS) $(shell echo src/mcl/*.cl) $(REPOSITORYDIR)/mcl
- $(INSTALL) $(INSTALLFLAGS) doc/html/* $(DOCDIR)/html
- cp doc/uffi.ps doc/cl-uffi.ps
- rm -f doc/cl-uffi.ps.gz
- gzip doc/cl-uffi.ps
- $(INSTALL) $(INSTALLFLAGS) doc/cl-uffi.ps.gz $(DOCDIR)
- rm -f doc/cl-uffi.ps.gz
+ dh_installdirs --all $(clc-systems) $(clc-source)
+
+ $(INSTALL) $(INSTALLDIRFLAGS) $(lispdir) $(lispdir-base) \
+ $(lispdir-base-uffi) $(lispdir-pg) $(lispdir-pg-socket) \
+ $(lispdir-mysql) $(lispdir-sql) $(lispdir-aodbc)
+
+ # Main package
+ $(INSTALL) $(INSTALLDIRFLAGS) $(lispdir) $(lispdir-int)
+ $(INSTALL) $(INSTALLFLAGS) $(srcs) $(lispdir-sql)
+
+ # Base
+ $(INSTALL) $(INSTALLFLAGS) $(srcs-base) $(lispdir-base)
+ $(INSTALL) $(INSTALLFLAGS) $(srcs-base-uffi) $(lispdir-base-uffi)
+ $(INSTALL) $(INSTALLEXECFLAGS) $(srcs-base-uffi-so) $(lispdir-base-uffi)
+
+ $(INSTALL) $(INSTALLFLAGS) $(srcs-mysql) $(lispdir-mysql)
+ $(INSTALL) $(INSTALLEXECFLAGS) $(srcs-mysql-so) $(lispdir-mysql)
+ $(INSTALL) $(INSTALLFLAGS) $(srcs-pg) $(lispdir-pg)
+ $(INSTALL) $(INSTALLFLAGS) $(srcs-pg-socket) $(lispdir-pg-socket)
+ $(INSTALL) $(INSTALLFLAGS) $(srcs-aodbc) $(lispdir-aodbc)
+
+ # CLC Systems
+ $(INSTALL) $(INSTALLFLAGS) clsql.system $(prefix)/$(clc-systems)
+ $(INSTALL) $(INSTALLFLAGS) clsql-base.system clsql-uffi.system $(prefix-base)/$(clc-systems)
+ $(INSTALL) $(INSTALLFLAGS) clsql-mysql.system $(prefix-mysql)/$(clc-systems)
+ $(INSTALL) $(INSTALLFLAGS) clsql-postgresql.system $(prefix-pg)/$(clc-systems)
+ $(INSTALL) $(INSTALLFLAGS) clsql-postgresql-socket.system $(prefix-pg-socket)/$(clc-systems)
+ $(INSTALL) $(INSTALLFLAGS) clsql-aodbc.system $(prefix-aodbc)/$(clc-systems)
+
+ # Test suite
+ $(INSTALL) $(INSTALLDIRFLAGS) $(doc-dir)/html $(doc-dir)/test-suite
+
+ $(INSTALL) $(INSTALLFLAGS) test-suite/tester-clsql.cl test-suite/acl-compat-tester.cl $(doc-dir)/test-suite
+
+ # Documentation
+ $(INSTALL) $(INSTALLFLAGS) doc/html/* $(doc-dir)/html
+ cp doc/clsql.pdf doc/cl-sql.pdf
+ rm -f doc/cl-sql.pdf.gz
+ gzip doc/cl-sql.pdf
+ $(INSTALL) $(INSTALLFLAGS) doc/cl-sql.pdf.gz $(doc-dir)
+ rm -f doc/cl-sql.pdf.gz
+
+# From UncommonSQL Debian package: build prerm postinst from templates
+ set -e ;\
+ for p in $(all-pkgs); do \
+ echo "processing maintainer scripts for $$p" ;\
+ l=`echo $$p | sed -e "s/^cl-/cl/;"` ;\
+ sed -e "s/%%/$$l/;" debian/prerm.template > debian/$$p.prerm ;\
+ sed -e "s/%%/$$l/;" debian/postinst.template > debian/$$p.postinst ;\
+ done
+
# Build architecture-independent files here.
binary-indep: build install
dh_testroot
# dh_installdebconf
dh_installdocs
- dh_installexamples examples/*.cl
-# dh_installmenu
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_installinit
-# dh_installcron
-# dh_installman
-# dh_installinfo
-# dh_undocumented
+# dh_installexamples
dh_installchangelogs ChangeLog
- dh_link
+ dh_link -p $(pkg-base) $(clc-clsql) $(clc-source)/clsql-base
+ dh_link -p $(pkg-mysql) $(clc-clsql) $(clc-source)/clsql-mysql
+ dh_link -p $(pkg-pg) $(clc-clsql) $(clc-source)/clsql-postgresql
+ dh_link -p $(pkg-pg-socket) $(clc-clsql) $(clc-source)/clsql-postgresql-socket
+ dh_link -p $(pkg-aodbc) $(clc-clsql) $(clc-source)/clsql-aodbc
dh_strip
dh_compress
dh_fixperms
# dh_makeshlibs
dh_installdeb
# dh_perl
-# dh_shlibdeps
+ dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
-