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
|
#!/usr/bin/make -f
##############
# Legal stuff
##############
# Copyright (c) 2003-2009 Ludovic Brenta <lbrenta@debian.org>
# Copyright (c) 2009-2010 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.
##########################################
# Guess some variables from control file.
##########################################
# LIB_NAME and SOVERSION must be exported to upstream Makefile.
export LIB_NAME := $(shell sed -n -e "s/^Source: lib\(.\+\)$$/\1/p" debian/control)
ifndef LIB_NAME
$(error Could not guess LIB_NAME from debian/control)
endif
export SOVERSION := $(shell sed -n -e "s/^Package: lib$(LIB_NAME)\(.\+\)-dbg$$/\1/p" debian/control)
ifndef SOVERSION
$(error Could not guess SOVERSION from debian/control)
endif
ALIVERSION := $(shell sed -n -e "s/^Package: lib$(LIB_NAME)\(.\+\)-dev$$/\1/p" debian/control)
ifndef ALIVERSION
$(error Could not guess ALIVERSION from debian/control)
endif
SONAME := lib$(LIB_NAME).so.$(SOVERSION)
LIB_PKG := lib$(LIB_NAME)$(SOVERSION)
DBG_PKG := lib$(LIB_NAME)$(SOVERSION)-dbg
DEV_PKG := lib$(LIB_NAME)$(ALIVERSION)-dev
DOC_PKG := lib$(LIB_NAME)-doc
############################
# Ada Library Debian Helper
############################
# This a trick to use debhelper automation with external files,
# even if their names must match the package version.
# Each file named debian/ALDH.oldname is preprocessed and renamed
# according to these macros, before any build or install. The
# preprocessed file is removed before any clean.
ALDH_macros := LIB_NAME ALIVERSION SOVERSION SONAME LIB_PKG DBG_PKG DEV_PKG DOC_PKG
ALDH_sed := sed $(foreach macro,$(ALDH_macros),-e s/$(macro)/$($(macro))/g)
define ALDH_template
ALDH_targets += $(2)
$(2): $(1)
$(ALDH_sed) $(1) > $(2)
endef # ALDH_template
ALDH_targets :=
$(foreach template,$(wildcard debian/ALDH.*),\
$(eval $(call ALDH_template,\
$(template),\
$(shell echo $(template) | $(ALDH_sed) -e s/ALDH.//))))
build binary binary-arch binary-indep install: $(ALDH_targets)
clean: ALDH_clean
.PHONY: ALDH_clean
ALDH_clean:
rm -f $(ALDH_targets)
######################
# debhelper overrides
######################
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
.PHONY: build binary binary-arch binary-indep clean install
build binary binary-arch binary-indep clean install:
dh $@
override_dh_compress:
dh_compress --all --exclude=.ads --exclude=.adb --exclude=Makefile --exclude=.c --exclude=.h
override_dh_strip:
dh_strip --package=$(LIB_PKG) --dbg-package=$(DBG_PKG)
dh_strip --remaining-packages
override_dh_installdocs:
dh_installdocs --all --link-doc=$(LIB_PKG)
|