r2755: move files
[clsql.git] / debian / rules
index 84910cc08a2b479b68b5251bdf1656ff536943c8..46cdd6333e7ed15c7c237c9566a037cfadc66514 100755 (executable)
@@ -6,26 +6,62 @@
 export DH_VERBOSE=1
 
 # This is the debhelper compatibility version to use.
-export DH_COMPAT=3
-
-pkg    := cl-uffi
-prefix := debian/$(pkg)
-
-INSTALL        := install
-INSTALLFLAGS   := -g root -o root -m 0644
-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
+export DH_COMPAT=4
+
+plain-pkg      := clsql
+
+pkg            := cl-sql
+pkg-base       := cl-sql-base
+pkg-uffi       := cl-sql-uffi
+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-uffi) $(pkg-mysql) $(pkg-pg) $(pkg-pg-socket) $(pkg-aodbc)
+
+
+UPSTREAM_VER   := $(shell sed -n -e "s/${pkg} (\(.*\)-[0-9A-Za-z\.]).*/\1/p" < debian/changelog |head -1)
+
+## Lisp sources
+srcs           := sql clsql.asd
+srcs-base      := $(wildcard base/*.cl) 
+srcs-uffi      := $(wildcard uffi/*.cl) $(wildcard uffi/*.c)
+srcs-uffi-so   := $(wildcard uffi/*.so)
+srcs-mysql     := $(wildcard db-mysql/*.cl) $(wildcard db-mysql/*.c)
+srcs-mysql-so  :=  $(wildcard db-mysql/*.so)
+srcs-pg                := $(wildcard db-postgresql/*.cl)
+srcs-pg-socket := $(wildcard db-postgresql-socket/*.cl)
+srcs-aodbc     := $(wildcard db-aodbc/*.cl)
+
+clc-base       := usr/share/common-lisp
+clc-source     := $(clc-base)/source
+clc-systems    := $(clc-base)/systems
+doc-dir                := usr/share/doc/cl-sql-base
+
+clc-clsql      := $(clc-source)/$(plain-pkg)
+
+clc-sql                := $(clc-source)/clsql
+lispdir-sql    := $(clc-sql)/sql
+clc-base       := $(clc-source)/clsql-base
+lispdir-base   := $(clc-base)/base
+clc-uffi        := $(clc-source)/clsql-uffi
+lispdir-uffi   := $(clc-uffi)/uffi
+sodir-uffi     := usr/lib/clsql
+clc-mysql      := $(clc-source)/clsql-mysql
+lispdir-mysql  := $(clc-mysql)/db-mysql
+sodir-mysql    := usr/lib/clsql
+clc-pg         := $(clc-source)/clsql-postgresql
+lispdir-pg     := $(clc-pg)/db-postgresql
+clc-socket     := $(clc-source)/clsql-postgresql-socket
+lispdir-pg-socket := $(clc-pg-socket)/db-postgresql-socket
+clc-aodbc      := $(clc-source)/clsql-aodbc
+lispdir-aodbc  := $(clc-aodbc)/db-aodbc
 
 
 configure: configure-stamp
 configure-stamp:
        dh_testdir
        # Add here commands to configure the package.
-
        touch configure-stamp
 
 
@@ -33,41 +69,90 @@ build: build-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)
+       dh_installdirs -p $(pkg) $(lispdir-sql)
+       dh_installdirs -p $(pkg-base) $(lispdir-base)
+       dh_installdirs -p $(pkg-uffi) $(lispdir-uffi) $(sodir-uffi)
+       dh_installdirs -p $(pkg-pg) $(lispdir-pg)
+       dh_installdirs -p $(pkg-pg-socket) $(lispdir-pg-socket)
+       dh_installdirs -p $(pkg-mysql) $(lispdir-mysql) $(sodir-mysql)
+       dh_installdirs -p $(pkg-aodbc) $(lispdir-aodbc)
+
+       # Main package
+       dh_install -p $(pkg) $(srcs) $(lispdir-sql)
+       dh_install -p $(pkg) clsql.asd $(clc-clsql)
+
+       # Base
+       dh_install -p $(pkg-base) $(srcs-base) $(lispdir-base)
+       dh_install -p $(pkg-base) clsql-base.asd $(clc-base)
+
+       # UFFI
+       dh_install -p $(pkg-uffi) $(srcs-uffi) $(lispdir-uffi)
+       dh_install -p $(pkg-uffi) $(srcs-uffi-so) $(sodir-uffi)
+       dh_install -p $(pkg-uffi) clsql-uffi.asd $(clc-uffi)
+
+       # Backends
+       dh_install -p $(pkg-mysql) $(srcs-mysql) $(lispdir-mysql)
+       dh_install -p $(pkg-mysql) clsql-mysql.asd $(clc-mysql)
+       dh_install -p $(pkg-mysql) $(srcs-mysql-so) $(sodir-mysql)
+       dh_install -p $(pkg-pg) $(srcs-pg) $(lispdir-pg)
+       dh_install -p $(pkg-pg) clsql-postgresql.asd $(clc-pg)
+       dh_install -p $(pkg-pg-socket) $(srcs-pg-socket) $(lispdir-pg-socket)
+       dh_install -p $(pkg-pg-socket) clsql-postgresql-socket.asd $(clc-pg-socket)
+       dh_install -p $(pkg-aodbc) $(srcs-aodbc) $(lispdir-aodbc)
+       dh_install -p $(pkg-aodbc) clsql-aodbc.asd $(clc-aodbc)
+
+       # CLC Systems
+       dh_link -p $(pkg) $(clc-clsql)/clsql.asd $(clc-systems)/clsql.asd
+       dh_link -p $(pkg-base) $(clc-base)/clsql-base.asd $(clc-systems)/clsql-base.asd
+       dh_link -p $(pkg-uffi) $(clc-uffi)/clsql-uffi.asd $(clc-systems)/clsql-uffi.asd
+       dh_link -p $(pkg-mysql) $(clc-mysql)/clsql-mysql.asd $(clc-systems)/clsql-mysql.asd
+       dh_link -p $(pkg-pg) $(clc-pg)/clsql-postgresql.asd $(clc-systems)/clsql-postgresql.asd
+       dh_link -p $(pkg-pg-socket) $(clc-pg-socket)/clsql-postgresql-socket.asd $(clc-systems)/clsql-postgresql-socket.asd
+       dh_link -p $(pkg-aodbc) $(clc-aodbc)/clsql-aodbc.asd $(clc-systems)/clsql-aodbc.asd
+
+       # Test suite
+       dh_installdirs -p $(pkg) $(doc-dir)/html $(doc-dir)/test-suite
+       dh_install -p $(pkg) test-suite/tester-clsql.cl test-suite/acl-compat-tester.cl $(doc-dir)/test-suite
+
+       # Documentation
+       rm -rf doc/html
+       (cd doc; tar xzf html.tar.gz; cd ..)
+       dh_install -p $(pkg) doc/html $(doc-dir)
+       rm -rf doc/html
+       cp doc/clsql.pdf doc/cl-sql.pdf
+       rm -f doc/cl-sql.pdf.gz
+       gzip doc/cl-sql.pdf
+       dh_install -p $(pkg) doc/cl-sql.pdf.gz $(doc-dir)
+       rm -f doc/cl-sql.pdf.gz
+
+       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/preinst.template > debian/$$p.preinst ;\
+               sed -e "s/%%/$$l/;" debian/prerm.template > debian/$$p.prerm ;\
+               sed -e "s/%%/$$l/;" debian/postinst.template > debian/$$p.postinst ;\
+               chown root.root debian/$$p.prerm debian/$$p.prerm debian/$$p.preinst; \
+               chmod +x debian/$$p.prerm debian/$$p.prerm debian/$$p.preinst; \
+       done
+
 
 # Build architecture-independent files here.
 binary-indep: build install
@@ -80,30 +165,18 @@ binary-arch: 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_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
-