#!/usr/bin/make -f # Build script for Ada Web Server in Debian. # Copyright (c) 2003-2013 Ludovic Brenta # Copyright (c) 2014-2017 Nicolas Boulenguez # 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 . # On Debian systems, the full text of the GPL is in the file # /usr/share/common-licenses/GPL-3. $(foreach line,$(shell sed -n '\ s/^ gnat, gnat-\([0-9.]\+\),$$/ \ GNAT_VERSION:=\1 \ /p;\ s/^Package: libaws\([0-9.]\+\)$$/ \ soname:=libaws.so.\1 \ /p;\ s/^ libgnutls[0-9.]*-dev,$$/ \ SSL:=gnutls \ /p;\ s/^ libssl-dev,$$/ \ SSL:=openssl \ /p;\ ' debian/control),$(eval $(line))) DEB_BUILD_MAINT_OPTIONS := hardening=+all include /usr/share/dpkg/default.mk include /usr/share/ada/debian_packaging-$(GNAT_VERSION).mk ADAFLAGS += -gnatafno -gnatVa -gnatwa CFLAGS += `pkg-config --cflags $(filter-out dummy,$(SSL)) zlib` LDLIBS := `pkg-config --libs $(filter-out dummy,$(SSL)) zlib` -llber -lldap # Circumvent #760211. Since LDFLAGS contains --as-needed, this setting # only takes effect on architectures triggering the bug. LDLIBS += -lpthread ###################################################################### %: 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. ###################################################################### # 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: 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-static build-tools .PHONY: build-aws-dynamic build-tools build-aws-static: gprbuild -p $(BUILDER_OPTIONS) debian/build_aws.gpr \ $(foreach v,ADAFLAGS CFLAGS CPPFLAGS SSL,"-X$(v)=$($(v))") build-tools: gprbuild -p $(BUILDER_OPTIONS) debian/tools.gpr \ $(foreach v,ADAFLAGS CFLAGS CPPFLAGS LDFLAGS LDLIBS soname SSL,"-X$(v)=$($(v))") override_dh_auto_clean:: rm -fr $(foreach d,lib obj,$(foreach k,dynamic static, \ debian/build_aws_$(d)_$(k))) debian/tools_obj debian/tools_exe # 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 \ $(foreach v,LDLIBS soname SSL,"$(v)=$($(v))") \ debian/build_aws.gpr ###################################################################### .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 check_link = \ diff -q debian/libaws-doc/usr/share/doc/libaws-doc/examples/$(1) \ debian/libaws-doc/usr/share/doc/libaws-doc/examples/$(2) \ && dh_link -plibaws-doc usr/share/doc/libaws-doc/examples/$(1) \ usr/share/doc/libaws-doc/examples/$(2) .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. # (rdfind and symlinks are confused on pbuilder with /build->/tmp/build) # lintian detects things to add, diff detects thing to remove. $(call check_link,runme/adains.png,res_demo/adains.png) $(call check_link,runme/cert.pem,agent/cert.pem) $(call check_link,soap_disp/soap_client.adb,soap_demo/soap_client.adb) $(call check_link,upload/aws.ini,https/aws.ini) $(call check_link,web_block_ajax_templates/r_widget_counter.txml,web_block_ajax/r_widget_counter.txml) $(call check_link,web_block_ajax_templates/web_callbacks.ads,web_block_ajax/web_callbacks.ads) $(call check_link,ws/page1.html,web_elements/page1.html) $(call check_link,ws/ws.ini,wps/wps.ini) ###################################################################### # Documentation. # ./makefile would recompute all makefile.conf variables, assume only # HTML output format, and assume the existence of templates_parser/. # TODO: append SPHINXOPTS=-j$(BUILDER_JOBS) once #869098 is fixed. override_dh_auto_build-indep: ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) $(MAKE) -C docs html info latexpdf text style-guide.pdf \ $(foreach v,ADAFLAGS LDFLAGS,"$(v)=$($(v))") endif override_dh_auto_clean:: $(MAKE) -C docs clean rm -f docs/source/*.pyc docs/source/confvars.py rm -fr docs/source/__pycache__ ###################################################################### # 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