[gringo] 02/03: debian/rules: fix C++11 threads
Thomas Krennwallner
tkren-guest at moszumanska.debian.org
Thu Dec 15 07:55:21 UTC 2016
This is an automated email from the git hooks/post-receive script.
tkren-guest pushed a commit to branch devel
in repository gringo.
commit d2f9ddb3164337d5a1f8fbda0bf4563c58af65a0
Author: Thomas Krennwallner <tkren at kr.tuwien.ac.at>
Date: Mon Dec 12 20:13:08 2016 +0100
debian/rules: fix C++11 threads
- link with libatomic on architectures that need it
- disable threads and define BROKEN_STD_EXCEPTION_PTR on armel
---
debian/rules | 41 ++++++++++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/debian/rules b/debian/rules
index 4186fe3..41c4068 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,21 +4,32 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
-# compile with c++11 threads only architectures with 64bit __atomic_exchange,
-# which seems to be unsupported on powerpc, powerpcspe, m68k, mips, mipsel, sh4.
-# see buildd log
-# https://buildd.debian.org/status/fetch.php?pkg=clasp&arch=mips&ver=3.2.1-1&stamp=1480664797
-# and
+# gringo requires c++11 threads with 64bit __atomic_exchange, we need to
+# link with libatomic on powerpc, powerpcspe, m68k, mips, mipsel, and
+# sh4, see also
# https://gcc.gnu.org/wiki/Atomic
# https://gcc.gnu.org/wiki/Atomic/GCCMM/LIbrary
arch = $(shell dpkg-architecture -qDEB_BUILD_ARCH | egrep -v -x "(powerpc|powerpcspe|m68k|mips|mipsel|sh4)")
-# force g++, lua5.3, and python2.7
-CONFIGPARMS = CXX='g++' WITH_LUA='lua5.3' WITH_PYTHON='python2.7' CPPPATH='$${["/usr/include/lua5.3","/usr/include/python2.7"]}'
+# currently, libstdc++ on armel does not support std::exception_ptr, see
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58938
+#
+# we define BROKEN_STD_EXCEPTION_PTR below to enable replacement code in
+# gringo-broken-std-exception_ptr.patch
+broken_exception_ptr = $(shell dpkg-architecture -qDEB_BUILD_ARCH | grep "armel")
+
+# force g++
+CONFIGPARMS = CXX='g++'
-# use c++11 threads
-ifeq ($(if $(arch),good), good)
- CONFIGPARMS += WITH_THREADS='posix'
+do_threads = $(and $(if $(arch),threads), $(if $(broken_exception_ptr),,threads))
+do_atomic = $(and $(if $(arch),,atomic), $(if $(broken_exception_ptr),,atomic))
+
+# use c++11 threads, lua5.3, and python2.7
+ifeq ($(do_threads), threads)
+ CONFIGPARMS += WITH_THREADS='posix' WITH_LUA='lua5.3' WITH_PYTHON='python2.7' CPPPATH='$${["/usr/include/lua5.3","/usr/include/python2.7"]}'
+endif
+ifeq ($(do_atomic), atomic)
+ CONFIGPARMS += WITH_THREADS='posix' LIBS='$${["atomic"]}' WITH_LUA='lua5.3' WITH_PYTHON='python2.7' CPPPATH='$${["/usr/include/lua5.3","/usr/include/python2.7"]}'
endif
#
@@ -28,6 +39,11 @@ endif
#
DEB_CXXFLAGS_MAINT_APPEND = -std=c++11 -O3 -Wall
DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG
+
+ifeq ($(if $(broken_exception_ptr),broken), broken)
+ DEB_CPPFLAGS_MAINT_APPEND += -DBROKEN_STD_EXCEPTION_PTR
+endif
+
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
@@ -40,9 +56,12 @@ SCLINKFLAGS = $(shell echo $(LDFLAGS) | sed -e 's/^/\$${["/;s/ -/","-/g;s/$$/"]}
%:
dh $@
-# configure with LUA, Python, and possibly TBB
+# configure with LUA, Python; forcibly turn off threads if std::exception_ptr is broken
override_dh_auto_configure:
scons configure --build-dir=release $(CONFIGPARMS) CXXFLAGS='$(SCCXXFLAGS)' LINKFLAGS='$(SCLINKFLAGS)'
+ifeq ($(if $(broken_exception_ptr),broken), broken)
+ sed -i -e 's/WITH_THREADS =.*/WITH_THREADS = None/' -e 's/WITH_LUA =.*/WITH_LUA = None/' -e 's/WITH_PYTHON =.*/WITH_PYTHON = None/' ./build/release.py
+endif
# build gringo clingo reify
override_dh_auto_build:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/gringo.git
More information about the debian-science-commits
mailing list