File: rules

package info (click to toggle)
libncursesada 6.0.20150808-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,092 kB
  • ctags: 3,832
  • sloc: ada: 10,330; sh: 3,138; makefile: 818; ansic: 662; awk: 45
file content (150 lines) | stat: -rwxr-xr-x 5,302 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/make -f

##############
# Legal stuff
##############

# Copyright (c) 2003-2009 Ludovic Brenta <lbrenta@debian.org>
# Copyright (c) 2009-2016 Nicolas Boulenguez <nicolas@debian.org>

# This build script is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# On Debian systems, the full text of the GPL is in the file
# /usr/share/common-licenses/GPL-3.

######################
# Set some variables #
######################

DEB_BUILD_MAINT_OPTIONS=hardening=+all
include /usr/share/dpkg/default.mk
include /usr/share/ada/debian_packaging*.mk

DEB_DATE := $(shell dpkg-parsechangelog -S date)

LIB_NAME := $(patsubst lib%,%,$(DEB_SOURCE))

SOVERSION := $(shell sed -n "/^Package: lib$(LIB_NAME)\([[:digit:]]\+\)$$/{s//\1/;p;q}" debian/control)
ifndef SOVERSION
  $(warning Could not guess SOVERSION from debian/control)
endif

######################
# debhelper overrides
######################

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

POLICY_TARGETS := binary binary-arch binary-indep build build-arch	\
  build-indep clean
.PHONY: $(POLICY_TARGETS)
$(POLICY_TARGETS):
	dh $@ --with ada-library

.PHONY: $(addprefix override_dh_auto_, \
  configure-arch configure-indep build-arch build-indep install clean)

AUTOCONF_AUXILIARY_FILES := \
 config.guess \
 config.sub \
 configure \
 install-sh

override_dh_auto_configure-arch: $(addsuffix .backup,$(AUTOCONF_AUXILIARY_FILES))
 # tests: samples/* will be installed into the -doc package, and used
 # by autopkgtest, but there is no point in compiling them now.
	dh_auto_configure -a -- \
          $(foreach v,ADAFLAGS CC CFLAGS CPPFLAGS LDFLAGS,"$(v)=$($(v))") \
          --without-tests \
          --with-shared --with-ada-sharedlib=libncursesada.so.$(SOVERSION)
 # with-ada-compiler="gprbuild $(BUILDER_OPTIONS)" actually has no effect.
# Up-to-date config.[guess|sub] are provided by autotools-dev.
config.guess.backup config.sub.backup: %.backup:
	mv $* $@
	ln -s /usr/share/misc/$*
# configure: generated by autoconf.
configure.backup: %.backup:
	mv $* $@
	autoconf-dickey
# install-sh: unused, but configure insists on seeing it.
install-sh.backup: %.backup:
	mv $* $@
	touch $*

override_dh_auto_clean:
	rm -f debian/build-lib-dynamic/* \
              debian/build-obj-dynamic/* \
              debian/build-lib-static/* \
              debian/build-obj-static/*
	dh_auto_clean
	for f in $(AUTOCONF_AUXILIARY_FILES); do \
	  if test -f $$f.backup; then mv $$f.backup $$f; fi; \
        done

NCURSES_MODULES := form menu panel ncurses
NCURSES_CFLAGS  := `pkg-config --cflags $(NCURSES_MODULES)`
LDLIBS          := `pkg-config --libs $(NCURSES_MODULES)`
PROJECT := debian/$(LIB_NAME).gpr
GPR_VARS := ADAFLAGS CFLAGS CPPFLAGS LDFLAGS NCURSES_CFLAGS LDLIBS SOVERSION

# Circumvent what seems to be a bug in gen/Makefile.in.
# ACTUAL_LDFLAGS	= @ADAGEN_LDFLAGS@
# But ADAGEN_LDFLAGS is never defined.
override_dh_auto_build-arch: ACTUAL_LDFLAGS := $(LDFLAGS)

override_dh_auto_build-arch:
	dh_auto_build -a -- -C include ncurses_def.h
	dh_auto_build -a -- -C gen $(foreach v,ACTUAL_LDFLAGS LIB_NAME,"$(v)=$($(v))")
 # The src/ build system ignores CFLAGS when building two versions of
 # the library. We only call it to generate a needed file.
	dh_auto_build -a -- -C src terminal_interface-curses-trace.adb

 # Ensure deterministic timestamps in ALI files.
	find . -depth -name "*.ad[bs]" -a -newermt '$(DEB_DATE)' -print0 | \
	  xargs -0r touch --no-dereference --date='$(DEB_DATE)'

	gprbuild $(PROJECT) $(BUILDER_OPTIONS) -XKIND=static \
	  $(foreach v,$(GPR_VARS),"-X$(v)=$($(v))")
	gprbuild $(PROJECT) $(BUILDER_OPTIONS) -XKIND=dynamic \
	  $(foreach v,$(GPR_VARS),"-X$(v)=$($(v))")

######################################################################

.PHONY: override_dh_ada_library-arch override_dh_ada_library-indep
override_dh_ada_library-arch:
	dh_ada_library KIND=dynamic \
	  $(foreach v,$(GPR_VARS),"$(v)=$($(v))") $(PROJECT)

# doc/ provides a -config script giving build flags for
# reverse dependencies. We ignore it as per Debian Ada Policy
# we prefer project files. It also contains HTML pages
# generated from the sources (make -C gen html). We do not
# regenerate them either because we do not want to install
# arch-dependant files into the -doc package. The
# arch-specific parts are identified in the comments anyway.

######################################################################

.PHONY: override_dh_installchangelogs
override_dh_installchangelogs:
	dh_installchangelogs --all NEWS

# samples/explain.txt is read by samples/sample-explanation.adb.
.PHONY: override_dh_compress
override_dh_compress:
	dh_compress --all \
          --exclude=.ads \
          --exclude=.adb \
          --exclude=explain.txt