File: rules

package info (click to toggle)
gnat-gps 18-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 45,716 kB
  • sloc: ada: 362,679; python: 31,031; xml: 9,597; makefile: 1,030; ansic: 917; sh: 264; java: 17
file content (200 lines) | stat: -rwxr-xr-x 7,380 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#!/usr/bin/make -f

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

# Copyright (c) 2003-2006, 2011-2014 Ludovic Brenta <lbrenta@debian.org>
# Copyright (c) 2010-2018 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.

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

.SUFFIXES:

########################
# Guess some variables.
########################

gnat_version := $(shell gnatgcc -dumpversion | sed 's/\..*//')

DEB_BUILD_MAINT_OPTIONS := hardening=+all
DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed -Wl,--no-allow-shlib-undefined \
  -Wl,--no-copy-dt-needed-entries -Wl,--no-undefined
include /usr/share/dpkg/default.mk
# Set CFLAGS (handling noopt from DEB_BUILD_OPTIONS), LDFLAGS,
# DEB_HOST_GNU_TYPE, DEB_HOST_ARCH, DEB_VERSION...
include /usr/share/ada/debian_packaging-$(gnat_version).mk

PKG_CONFIG_LIBRARIES := gtk+-3.0 glib-2.0 pygobject-3.0 python-2.7

CLANG_VERSION := $(shell dpkg -s libclang-dev \
  | sed -nr '/^Depends: libclang-(.*)-dev.*/{s//\1/p;q}')
LIBS := -L/usr/lib/llvm-$(CLANG_VERSION)/lib -lclang

PYTHON := python

######################################################################
%:
	dh $@

# Do not try to call an upstream configure or Makefile.
.PHONY: $(addprefix override_dh_auto_, \
  clean configure build-arch build-indep test install)

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

# Note: the script generates both Ada and Python sources, the latter
# are embedded into the users_guide.
override_dh_auto_build-arch: docs/users_guide/GPS/generated_hooks.py
docs/users_guide/_build: docs/users_guide/GPS/generated_hooks.py
docs/users_guide/GPS/generated_hooks.py: kernel/src/hooks.py
	rm -fr kernel/generated
	mkdir kernel/generated
	cd kernel/src && $(PYTHON) hooks.py
override_dh_auto_clean::
	rm -fr kernel/generated docs/users_guide/GPS/generated_hooks.py

override_dh_auto_build-arch: libclang/gen
libclang/gen:
	$(MAKE) -C libclang \
	  CLANG_SRC_DIR=/usr/lib/llvm-$(CLANG_VERSION) \
	  GCC_DUMPMACHINE=$(DEB_HOST_MULTIARCH)
override_dh_auto_clean::
	rm -fr libclang/gen

GNAT_SWITCHES_PY := share/support/core/gnat_switches.py
override_dh_auto_build-indep: $(GNAT_SWITCHES_PY)
$(GNAT_SWITCHES_PY): distrib/gnat_switches.py \
                     gnat/building_executable_programs_with_gnat.rst
	$(PYTHON) distrib/gnat_switches.py > $@
override_dh_auto_clean::
	rm -f $(GNAT_SWITCHES_PY)

######################################################################
override_dh_auto_build-arch:
	gprbuild $(BUILDER_OPTIONS) -k debian/build_gps.gpr \
	  $(foreach v,ADAFLAGS CFLAGS CPPFLAGS DEB_HOST_GNU_TYPE LDFLAGS LIBS,"-X$(v)=$($(v))") \
	  "-XPKG_CONFIG_CFLAGS=`pkg-config --cflags $(PKG_CONFIG_LIBRARIES)`" \
	  "-XPKG_CONFIG_LIBS=`pkg-config --libs $(PKG_CONFIG_LIBRARIES)`"
override_dh_auto_clean::
	rm -f obj/*

database := kernel/generated/gps-kernel-properties-database.ads
override_dh_auto_build-arch: $(database)
$(database):
	cd $(dir $@) && gnatcoll_sqlite2ada -api=GPS.Kernel.Properties.Database -adacreate -dbmodel=../src/properties_schema.txt
override_dh_auto_clean::
	rm -f $(database)

######################################################################
configured := \
  common/core/src/config.ads \
  docs/gps-welcome.html \
  docs/gps-welcome-public.html \
  share/support/core/protocols.py
override_dh_auto_configure: $(configured)
$(configured): %: %.in
	sed \
	    -e 's/@CURRENT_YEAR@/20$(DEB_VERSION_UPSTREAM)/' \
	    -e 's/@GPS_VERSION@/$(DEB_VERSION_UPSTREAM)/' \
	    -e 's/@TARGET@/$(DEB_HOST_GNU_TYPE))/' \
	    -e 's/@TARGET_IS_DARWIN@/False/' \
	    -e 's!@prefix@!/usr!' \
	    -e 's/@HOST_TYPE@/Unix/' \
	    -e 's/@STRIP_CR@/False/' \
	    -e 's/@CAN_OUTPUT@/True/' \
	    -e 's!@EXEC_COMMAND@!/bin/sh -c!' \
	    -e 's/@DEFAULT_PS@/ps/' \
	    -e 's/@PRINT_CMD@/lpr/' \
	    -e 's/@OPAQUE_MDI@/True/' \
	    -e 's/@DIFF_CMD@/diff -u/' \
	    -e 's/@DIFF3_CMD@/diff3/' \
	    -e 's/@PATCH_CMD@/patch/' \
	    -e 's/@EXECUTION_WINDOW@/True/' \
	    -e 's/@CHARSET@/UTF-8/' \
	    -e 's/@SSH_ESCAPE@/~/' \
	    $< > $@
override_dh_auto_clean::
	rm -f $(configured)

######################################################################
DOCS := \
 docs/users_guide/_build \
 docs/tutorial/_build \
 docs/programmers_guide/_build \
 docs/release_notes/build \
 docs/release_notes_17/build \
 docs/release_notes_62/build \
 gnatdoc/docs/users_guide/_build

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
override_dh_auto_build-indep: $(DOCS)
  # Give distinct names to release notes.
	cd docs/release_notes_17/build/latex && cp -f ReleaseNotes.pdf ReleaseNotes_17.pdf
	cd docs/release_notes_62/build/latex && cp -f ReleaseNotes.pdf ReleaseNotes_62.pdf
  # Sphinx creates Python precompiled files in every imported module,
  # we do not want them installed.
	find . -name "*.pyc" -delete
	find . -type d -name "__pycache__" -print0 | xargs -r0 rmdir
endif

# Note: see docs/users_guide/GPS/generated_hooks.py above.
$(DOCS):
	$(MAKE) -C $(dir $@) html latexpdf SPHINXOPTS=-j$(BUILDER_JOBS)

override_dh_auto_clean::
	rm -fr $(DOCS)
	find . -name "*.pyc" -delete
	find . -type d -name "__pycache__" -print0 | xargs -r0 rmdir

# A logo referenced in index.rst but missing.
docs/release_notes/build: docs/release_notes/gps18.png
docs/release_notes/gps18.png:
	cd docs/release_notes && ln -s ../release_notes_62/gps6.png gps18.png
override_dh_auto_clean::
	rm -f docs/release_notes/gps18.png

######################################################################
# Mimic dh --with sphinxdoc with sphinx-common in Build-Depends-Indep.
.PHONY: override_dh_installdocs-indep
override_dh_installdocs-indep:
	dh_installdocs -i
	dh_sphinxdoc -i

.PHONY: override_dh_install-indep
override_dh_install-indep:
	dh_install -i
  # Documentation and license are not useful here.
	rm -f debian/gnat-gps-common/usr/share/gps/color_themes/themes/*/README.*
	rm -f debian/gnat-gps-common/usr/share/gps/color_themes/themes/*/LICENSE*
  # Should be a wishlist for dh_fixperms.
	chmod 644 debian/gnat-gps-common/usr/share/gps/icons/hicolor/scalable/16x16/gps-*.svg
	chmod 644 debian/gnat-gps-common/usr/share/gps/color_themes/themes/tomorrow/*.tmTheme
  # Probably errors in upstream package.
	chmod 644 debian/gnat-gps-common/usr/share/gps/plug-ins/spark2014.py
	chmod 644 debian/gnat-gps-common/usr/share/gps/support/core/gps_utils/internal/dialogs.py
  # Removed by upstream install process in Makefile.
	rm -f debian/gnat-gps-common/usr/share/gps/icons/hicolor/scalable/*sketch
  # libadalang is disabled because it is not packaged in Debian
	rm -f debian/gnat-gps-common/usr/share/gps/support/core/lal.py

# Mimic dh --with linktree, with dh-linktree in Build-Depends-Indep.
.PHONY: override_dh_link-indep
override_dh_link-indep:
	dh_link -i
	dh_linktree -i

.PHONY: override_dh_compress
override_dh_compress:
	dh_compress --all -X.xml -X.ads -X.adb -X.c -X.py