[Git][haskell-team/haskell-devscripts][master] Support Haskell packages without a Setup.hs file

Ilias Tsitsimpis gitlab at salsa.debian.org
Sat Jun 20 13:04:34 BST 2020



Ilias Tsitsimpis pushed to branch master at Debian Haskell Group / haskell-devscripts


Commits:
b1ce282a by Ilias Tsitsimpis at 2020-06-20T15:03:54+03:00
Support Haskell packages without a Setup.hs file

- - - - -


7 changed files:

- Dh_Haskell.sh
- + Setup-Configure.hs
- + Setup-Make.hs
- + Setup-Simple.hs
- debian/changelog
- debian/control
- debian/haskell-devscripts-minimal.install


Changes:

=====================================
Dh_Haskell.sh
=====================================
@@ -477,9 +477,25 @@ make_setup_recipe(){
       if test -e $setup
       then
         run ghc --make $setup -o ${DEB_SETUP_BIN_NAME}
-    exit 0
+        exit 0
       fi
     done
+    # Having a Setup.hs is considered good practice, but there are a few
+    # Haskell packages that don't, since cabal does not use it for build types
+    # other than 'Custom'. Find out the build type and use the corresponding
+    # standardized Setup.hs file. For more information, see
+    # https://www.haskell.org/cabal/users-guide/developing-packages.html#pkg-field-build-type
+    if grep -q '^build-type: \+Simple' ${CABAL_PACKAGE}.cabal; then
+        setup="/usr/share/haskell-devscripts/Setup-Simple.hs"
+    elif grep -q 'build-type: \+Configure' ${CABAL_PACKAGE}.cabal; then
+        setup="/usr/share/haskell-devscripts/Setup-Configure.hs"
+    elif grep -q 'build-type: \+Make' ${CABAL_PACKAGE}.cabal; then
+        setup="/usr/share/haskell-devscripts/Setup-Make.hs"
+    else
+        echo "Could not find a suitable Setup.hs file" >&2
+        exit 1
+    fi
+    run ghc --make $setup -o ${DEB_SETUP_BIN_NAME} -outputdir debian/tmp-setup-hs
     # PS4=$PS5
 }
 


=====================================
Setup-Configure.hs
=====================================
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMainWithHooks autoconfUserHooks


=====================================
Setup-Make.hs
=====================================
@@ -0,0 +1,2 @@
+import Distribution.Make
+main = defaultMain


=====================================
Setup-Simple.hs
=====================================
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+haskell-devscripts (0.16.0) unstable; urgency=medium
+
+  * Support Haskell packages without a Setup.hs file
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Sat, 20 Jun 2020 13:17:44 +0300
+
 haskell-devscripts (0.15.3) unstable; urgency=medium
 
   * Fix bug in install_doc_recipe() which wrongly assumed that


=====================================
debian/control
=====================================
@@ -45,7 +45,7 @@ Package: haskell-devscripts
 Architecture: all
 Depends: ${misc:Depends}
   , ghc (>= 8.2)
-  , haskell-devscripts-minimal
+  , haskell-devscripts-minimal (= ${source:Version})
   , hscolour
 Description: Tools to help Debian developers build Haskell packages
  This package provides a collection of scripts to help build Haskell


=====================================
debian/haskell-devscripts-minimal.install
=====================================
@@ -5,3 +5,6 @@ dh_haskell_extra_depends  usr/bin/
 dh_haskell_blurbs         usr/bin/
 Dh_Haskell.sh             usr/share/haskell-devscripts/
 hlibrary.mk               usr/share/cdbs/1/class
+Setup-Make.hs             usr/share/haskell-devscripts/
+Setup-Simple.hs           usr/share/haskell-devscripts/
+Setup-Configure.hs        usr/share/haskell-devscripts/



View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/commit/b1ce282a6d44d345a382c9df2f2903986bf778b3

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/commit/b1ce282a6d44d345a382c9df2f2903986bf778b3
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20200620/c27b5076/attachment-0001.html>


More information about the Pkg-haskell-commits mailing list