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
|
#!/usr/bin/make -f
# Build script for Ada Web Server in Debian.
# Copyright (c) 2003-2013 Ludovic Brenta <lbrenta@debian.org>
# Copyright (c) 2014-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.
DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
include /usr/share/dpkg/default.mk
include /usr/share/ada/debian_packaging*.mk
DEB_DATE := $(shell dpkg-parsechangelog -S date)
SSL := $(shell sed debian/control -ne ' \
/^[ B].*\blibgnutls[0-9.]*-dev\b/ { s/.*/gnutls/ ; p; q };\
/^[ B].*\blibssl-dev\b/ { s/.*/openssl/; p; q };\
/^Package: / { s/.*/dummy/ ; p; q }')
soversion := $(shell sed debian/control -ne ' \
/^Package: $(DEB_SOURCE)\([^-]\+\)$$/ { s//\1/; p; q}')
ADAFLAGS += -gnatafno -gnatVa -gnatwa
CFLAGS += `pkg-config --cflags $(filter-out dummy,$(SSL)) zlib`
LDLIBS := `pkg-config --libs $(filter-out dummy,$(SSL)) zlib` -llber -lldap
soname := $(DEB_SOURCE).so.$(soversion)
# Circumvent #760211. Since LDFLAGS contains --as-needed, this setting
# only takes effect on architectures triggering the bug.
LDLIBS += -lpthread
.SUFFIXES:
######################################################################
POLICY_TARGETS := binary binary-arch binary-indep build build-arch \
build-indep clean
.PHONY: $(POLICY_TARGETS)
$(POLICY_TARGETS):
dh $@ --with ada-library
# Ignore upstream makefile (and ./configure, if ever).
.PHONY: $(addprefix override_dh_auto_,configure build-arch build-indep test install clean)
# Configure test install exist and are empty so that dh_auto_* does
# nothing. We will replace upstream makefiles with build-* and clean.
GPR_CONFIGURATION := default.cgpr
override_dh_auto_configure: $(GPR_CONFIGURATION)
$(GPR_CONFIGURATION):
gprconfig --batch --config=Ada --config=C,,,,gnatgcc
override_dh_auto_clean::
rm -f $(GPR_CONFIGURATION)
######################################################################
# See comments in aws-os_lib-tmplt.c.
build-aws-dynamic build-aws-static: src/core/aws-os_lib.ads
# Tell Make that the source must be created but never updated, even if
# its timestamp is tricked later for deterministic ALI files.
src/core/aws-os_lib.ads:|src/core/xoscons \
src/core/aws-os_lib-tmplt.i \
src/core/aws-os_lib-tmplt.s
cd src/core; ./xoscons aws-os_lib
src/core/xoscons: ADAFLAGS += -fPIE
src/core/xoscons: LDFLAGS += -fPIE -pie
src/core/xoscons: config/setup/xoscons.adb
gnatmake $(BUILDER_OPTIONS) $< -D src/core -o $@ -cargs $(ADAFLAGS) -largs $(LDFLAGS)
src/core/aws-os_lib-tmplt.s: %.s: %.i
$(CC) -S $(CFLAGS) $< -o $@
src/core/aws-os_lib-tmplt.i: config/setup/aws-os_lib-tmplt.c
$(CC) -C -E $(CPPFLAGS) -DTARGET=\"$(DEB_HOST_MULTIARCH)\" $< -o $@
override_dh_auto_clean::
rm -f src/core/aws-os_lib* src/core/xoscons* src/core/xutil.*
######################################################################
# Build both versions of the library.
override_dh_auto_build-arch: build-aws-dynamic build-aws-static
.PHONY: build-aws-dynamic build-aws-static
build-aws-static:
gprbuild $(BUILDER_OPTIONS) debian/build_aws.gpr -Xkind=static \
$(foreach v,ADAFLAGS CFLAGS CPPFLAGS SSL,"-X$(v)=$($(v))")
build-aws-dynamic:
# 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 $(BUILDER_OPTIONS) debian/build_aws.gpr -Xkind=dynamic \
$(foreach v,ADAFLAGS CFLAGS CPPFLAGS LDFLAGS LDLIBS soname SSL,"-X$(v)=$($(v))")
override_dh_auto_clean::
rm -f $(foreach d, lib obj,$(foreach k,dynamic static, \
debian/build_aws_$(d)_$(k)/*))
# An override is necessary because LDLIBS contains a shell escape.
# The projet should import directly xmlada.gpr and
# templates-parser.gpr (both are used by specs).
.PHONY: override_dh_ada_library-arch
override_dh_ada_library-arch:
dh_ada_library kind=dynamic \
$(foreach v,LDLIBS soname SSL,"$(v)=$($(v))") \
debian/build_aws.gpr
######################################################################
TOOLS_GPR := debian/tools.gpr
override_dh_auto_build-arch: build-tools
.PHONY: build-tools
build-tools: ADAFLAGS += -fPIE
build-tools: LDFLAGS += -fPIE -pie
build-tools: build-aws-dynamic
gprbuild $(BUILDER_OPTIONS) $(TOOLS_GPR) -Xkind=dynamic \
$(foreach v,ADAFLAGS LDFLAGS LDLIBS soname SSL,"-X$(v)=$($(v))")
override_dh_auto_clean::
rm -f debian/tools_obj/*
######################################################################
.PHONY: override_dh_compress
override_dh_compress:
dh_compress --package=libaws-doc -X.adb -X.ads -X.thtml -X.wsdl
dh_compress --remaining-packages
INSTALLED_EXAMPLES := debian/libaws-doc/usr/share/doc/libaws-doc/examples
.PHONY: override_dh_installexamples-indep
override_dh_installexamples-indep:
dh_installexamples --indep
# Fix permissions.
find $(INSTALLED_EXAMPLES) -type f -print0 | xargs -0r chmod 644
# Replace duplicate files with symlinks, then make the links relative.
rdfind -outputname /dev/null -makesymlinks true $(INSTALLED_EXAMPLES)
symlinks -crs $(INSTALLED_EXAMPLES)
######################################################################
# Documentation.
# ./makefile would recompute all makefile.conf variables, assume only
# HTML output format, and assume the existence of templates_parser/.
# Freeze the clock for deterministic PDF timestamps. The faketime API
# does not allow an explicit time zone, introducing an implicit
# dependency on its local value.
DEB_DATE_FAKETIME := $(shell date "+%F %T" -d "$(DEB_DATE)")
override_dh_auto_build-indep: ADAFLAGS += -fPIE
override_dh_auto_build-indep: LDFLAGS += -fPIE -pie
override_dh_auto_build-indep:
faketime -f "$(DEB_DATE_FAKETIME)" \
$(MAKE) -C docs html info latexpdf text style-guide.pdf \
SPHINXOPTS=-j$(BUILDER_JOBS) $(foreach v,ADAFLAGS LDFLAGS,"$(v)=$($(v))")
override_dh_auto_clean::
$(MAKE) -C docs clean
rm -f docs/source/*.pyc docs/source/confvars.py
######################################################################
# Mimic 'dh --with sphinxdoc', but without adding sphinx-common to
# Build-Depends for arch-only builds.
.PHONY: override_dh_installdocs-indep
override_dh_installdocs-indep:
dh_installdocs -i
dh_sphinxdoc
|