Patch for haskell-devscripts to install executables into the corresponding debian package
Packages like happy and hsx have an Executable: section in their cabal file which specifies the name of a binary file generated by the package. The attached patch to the hlibrary.mk file in haskell-devscripts causes it to move the executable file into the debian package with the same name.
--- haskell-devscripts/hlibrary.mk~ 2009-07-13 07:00:37.000000000 -0700
+++ haskell-devscripts/hlibrary.mk 2009-07-22 22:35:51.000000000 -0700
@@ -20,6 +20,7 @@
DEB_CABAL_PACKAGE ?= $(shell cat *.cabal |\
perl -ne 'if (/^name:\s*(.*)$$/i) {$$_ = $$1; tr/A-Z/a-z/; print; exit 0;}')
CABAL_PACKAGE=$(DEB_CABAL_PACKAGE)
+CABAL_EXECS = $(shell sed 's/\r$$//' *.cabal | sed -n 's/^[Ee]xecutable[ \t:][ \t:]*\(.*\)\s*/\1/p')
ENABLE_PROFILING = $(shell egrep -qe '^Package: libghc6-.*-prof$$' debian/control && echo --enable-library-profiling; exit 0)
@@ -86,6 +87,9 @@
build/libghc6-$(CABAL_PACKAGE)-prof build/libghc6-$(CABAL_PACKAGE)-dev:: build-ghc6-stamp build-haddock-stamp
+# Make sure we get a build even when the package has no library
+$(patsubst %, build/%, $(CABAL_EXECS)):: build-ghc6-stamp
+
build-haddock-stamp:
mv dist-ghc6 dist
[ ! -x /usr/bin/haddock ] || $(DEB_SETUP_BIN_NAME) haddock $(DEB_HADDOCK_OPTS)
@@ -153,3 +157,20 @@
dh_haskell_depends -p$(notdir $@)
mv dist dist-hugs
+common-binary-fixup-arch::
+ # Move The executables into their respective packages. If
+ # there is a library deb, the packages will be part of the dev
+ # package, and we can just create a link. Otherwise we need
+ # to do the install here.
+ for EXEC in $(CABAL_EXECS); do \
+ if [ -f dist-ghc6/build/$${EXEC}/$${EXEC} ]; then \
+ DEBNAME=`echo $${EXEC} | tr 'A-Z' 'a-z'`; \
+ echo "Installing executable $${EXEC} into $${DEBNAME}..."; \
+ mkdir -p debian/$${DEBNAME}/usr/bin; \
+ if [ -d debian/libghc6-$(CABAL_PACKAGE)-dev ]; then \
+ cp -ax dist-ghc6/build/$${EXEC}/$${EXEC} debian/$${DEBNAME}/usr/bin/$${EXEC}; \
+ else \
+ install -m 755 dist-ghc6/build/$${EXEC}/$${EXEC} debian/$${DEBNAME}/usr/bin/$${EXEC}; \
+ fi; \
+ fi; \
+ done
Reply to: