File: rules

package info (click to toggle)
libncursesada 5.9.20110404-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,872 kB
  • sloc: ada: 10,614; sh: 3,047; ansic: 1,491; makefile: 865; awk: 45
file content (129 lines) | stat: -rwxr-xr-x 4,351 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
#!/usr/bin/make -f

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

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

# 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, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

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

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

DPKG_EXPORT_BUILDFLAGS=True
include /usr/share/dpkg/default.mk
include /usr/share/ada/debian_packaging.mk

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

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

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

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

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

binary binary-arch binary-indep build build-arch build-indep clean:
	dh $@ --with ada-library

override_dh_auto_configure-indep:
override_dh_auto_configure-arch:
	dh_auto_configure
# No need to reconfigure for -indep targets.

override_dh_auto_build-indep:
# No need to build examples or cross-distro configuration script manpage.

LDLIBS := $(shell pkg-config --libs form menu panel ncurses)
PROJECT := debian/$(LIB_NAME).gpr
gnatmake = gprbuild $(PROJECT) $(BUILDER_OPTIONS) \
  -XKIND=$(1) $(foreach var,$(2),-X$(var)="$($(var))")
override_dh_auto_build-arch:
	$(MAKE) -C include
	$(MAKE) -C gen
	$(call gnatmake,static,ADAFLAGS CFLAGS CPPFLAGS)
	$(call gnatmake,dynamic,ADAFLAGS CFLAGS CPPFLAGS LDFLAGS LDLIBS SOVERSION)

override_dh_ada_library:
	dh_ada_library KIND=dynamic SOVERSION=ignored LDLIBS="$(LDLIBS)" $(PROJECT)

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

override_dh_auto_build-arch: src/terminal_interface-curses-trace.adb
src/terminal_interface-curses-trace.adb: %: %_p
	gnatprep -DADA_TRACE=FALSE -DPRAGMA_UNREF=TRUE $< $@

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

override_dh_auto_install: # Ignore upstream install target.

# According to dh_installdocs(1), debian/README.Debian should be
# installed automatically, but it is not.
override_dh_installdocs:
	dh_installdocs --package=$(LIB_PKG) debian/README.Debian
	dh_installdocs --package=$(DEV_PKG) --link-doc=$(LIB_PKG)
	dh_installdocs --remaining-packages

override_dh_installchangelogs:
	dh_installchangelogs --all NEWS

# samples/explain.txt is read by samples/sample-explanation.adb.
override_dh_compress:
	dh_compress --package=$(DEV_PKG) \
          --exclude=.ads \
          --exclude=.adb
	dh_compress --package=lib$(LIB_NAME)-doc \
          --exclude=.ads \
          --exclude=.adb \
          --exclude=explain.txt
	dh_compress --remaining-packages

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

GET_ORIG_FTP := ftp://invisible-island.net/AdaCurses/current
GET_ORIG_TGZ := AdaCurses.tar.gz

get-orig-source:
	wget $(GET_ORIG_FTP)/$(GET_ORIG_TGZ)
	@echo "The file $(GET_ORIG_TGZ) contains the latest snapshot of upstream sources."

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

RUN_TESTS_TMP := lib$(LIB_NAME)-run-tests-XXXXXXXXXX

run-tests:
	TMPDIR=$$(mktemp --tmpdir --directory $(RUN_TESTS_TMP)) && \
        export TMPDIR && \
        (cd $$TMPDIR && sh $(CURDIR)/debian/tests/link_with_shared); \
        if test $$? = 0; then echo ok; else echo ko; fi; \
        rm -f -r $$TMPDIR