File: rules

package info (click to toggle)
gnat-gps 19.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 45,236 kB
  • sloc: ada: 366,795; python: 32,902; xml: 9,699; makefile: 1,025; ansic: 917; sh: 320; java: 17
file content (171 lines) | stat: -rwxr-xr-x 5,850 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
#!/usr/bin/make -f

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

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

DEB_BUILD_MAINT_OPTIONS := hardening=+all
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

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

ifneq (,$(wildcard /usr/bin/gnatgcc))
  # Avoid this part during -indep builds.

  gnat_version := $(shell gnatgcc -dumpversion)
  include /usr/share/ada/debian_packaging-$(gnat_version).mk

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

LIBS := -L/usr/lib/llvm-$(CLANG_VERSION)/lib -lclang

######################################################################
%:
	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 && python3 hooks.py
override_dh_auto_clean::
	rm -fr kernel/generated
	rm -f 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::
	$(MAKE) -C libclang clean

######################################################################
override_dh_auto_build-arch: | obj
	gprbuild $(BUILDER_OPTIONS) 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)`"
obj:
	mkdir $@
override_dh_auto_clean::
	rm -fr 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)

override_dh_auto_configure: VERSION.txt
VERSION.txt:
	echo '$(DEB_VERSION_UPSTREAM)' > $@
override_dh_auto_clean::
	rm -f VERSION.txt

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

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

######################################################################
.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*
  # libadalang is disabled because it is not packaged in Debian
	rm -f debian/gnat-gps-common/usr/share/gps/support/core/lal.py