[pkg-d-commits] [dh-dlang] 01/01: Add the dflags Makefile snippet for setting D build flags on Debian

Matthias Klumpp mak at moszumanska.debian.org
Thu Dec 14 18:03:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to branch master
in repository dh-dlang.

commit 5ea3ab0ee2eb87372e0eeb8b0e49e1750b0c9ce7
Author: Matthias Klumpp <matthias at tenstral.net>
Date:   Thu Dec 14 18:52:16 2017 +0100

    Add the dflags Makefile snippet for setting D build flags on Debian
---
 debian/control          | 16 +++++++++++++++-
 debian/dh-dlang.install |  1 +
 dlang-flags.mk          | 30 ++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index 31c80fd..6cce62f 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,21 @@ Standards-Version: 4.1.2
 Vcs-Git: https://anonscm.debian.org/git/pkg-d/dh-dlang.git
 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-d/dh-dlang.git
 
-Package: dcompiler
+Package: dh-dlang
+Architecture: all
+Depends: d-compiler,
+         debhelper (>= 10.4),
+         perl,
+         ${misc:Depends}
+Description: Packaging helpers for building D code
+ This package contains common code for building D software for
+ the Debian (and derivatives) archive.
+ .
+ It currently contains a debian/rules snippet for selecting the
+ appropriate D build flags based on the default D compiler set
+ for the current architecture.
+
+Package: d-compiler
 Architecture: amd64 arm64 armel armhf i386 ppc64 ppc64el x32
 Depends: gdc [arm64 armel ppc64el ppc64 x32],
          ldc [amd64 i386 armhf],
diff --git a/debian/dh-dlang.install b/debian/dh-dlang.install
new file mode 100644
index 0000000..37469c7
--- /dev/null
+++ b/debian/dh-dlang.install
@@ -0,0 +1 @@
+dlang-flags.mk /usr/share/dh-dlang/
diff --git a/dlang-flags.mk b/dlang-flags.mk
new file mode 100644
index 0000000..1dcf78e
--- /dev/null
+++ b/dlang-flags.mk
@@ -0,0 +1,30 @@
+#
+# Set the DFLAGS global variable matching the current default D compiler on the given architecture,
+# to apply the D flags we want for release builds in Debian.
+# This also applies arch-specific quirks, like not building with NEON on armhf when LDC is used.
+#
+# This script is supposed to be included by debian/rules directly
+#
+
+ifeq (,$(findstring not-installed, $(shell dpkg-query -W -f='$${Status}' ldc)))
+    DC_LDC_FOUND := yes
+endif
+
+ifeq (,$(findstring not-installed, $(shell dpkg-query -W -f='$${Status}' gdc)))
+    DC_GDC_FOUND := yes
+endif
+
+# by default, use GCC/GDC Debian optimization flags for D
+DFLAGS = $(CFLAGS)
+
+# set the right D flags on architectures where LDC is default
+ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 i386 armhf))
+    # only set LDC build flags if our compiler is LDC
+    ifeq ($(DC_LDC_FOUND),yes)
+        DFLAGS=-O -g -release -wi
+        ifeq ($(DEB_HOST_ARCH),armhf)
+            DFLAGS += -mattr=-neon
+        endif
+    endif
+endif
+export DFLAGS

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/dh-dlang.git



More information about the pkg-d-commits mailing list