File: rules

package info (click to toggle)
gringo 5.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 13,656 kB
  • ctags: 22,349
  • sloc: cpp: 110,236; python: 1,758; ansic: 1,260; yacc: 871; sh: 94; makefile: 33
file content (73 lines) | stat: -rwxr-xr-x 2,625 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# 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)")

# 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, lua5.3, and python2.7
ifneq ($(if $(broken_exception_ptr),broken), broken)
	CONFIGPARMS += WITH_THREADS='posix' WITH_LUA='lua5.3' WITH_PYTHON='python2.7' CPPPATH='$${["/usr/include/lua5.3","/usr/include/python2.7"]}'
endif

#
# export CPPFLAGS, CXXFLAGS, and LDFLAGS for scons
#
# default to -O3 -std=c++11 -Wall -DNDEBUG and enable all hardening flags
#
DEB_CXXFLAGS_MAINT_APPEND = -std=c++11 -O3 -Wall
DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG
DEB_LDFLAGS_MAINT_APPEND =

ifeq ($(if $(broken_exception_ptr),broken), broken)
	DEB_CPPFLAGS_MAINT_APPEND += -DBROKEN_STD_EXCEPTION_PTR
endif

ifeq ($(and $(if $(arch),,atomic), $(if $(broken_exception_ptr),,atomic)), atomic)
	DEB_LDFLAGS_MAINT_APPEND += -latomic
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

# inject compiler and linker flags to scons variables
SCCXXFLAGS =  $(shell echo $(CXXFLAGS) $(CPPFLAGS) | sed -e 's/^/\$${["/;s/ -/","-/g;s/$$/"]}/')
SCLINKFLAGS = $(shell echo $(LDFLAGS) | sed -e 's/^/\$${["/;s/ -/","-/g;s/$$/"]}/')

%:
	dh $@

# 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)' || cat build/release.log build/release.py
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:
	scons --build-dir=release gringo clingo reify lpconvert

override_dh_auto_clean:
	rm -rf ./build .sconf_temp .sconsign.dblite

override_dh_installchangelogs:
	dh_installchangelogs CHANGES