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
|
DEB_BUILD_MAINT_OPTIONS := hardening=+all
DEB_ADAFLAGS_MAINT_APPEND := -gnatwa -Wall -gnatn
DEB_LDFLAGS_MAINT_APPEND := \
-Wl,--no-undefined \
-Wl,--no-copy-dt-needed-entries \
-Wl,--no-allow-shlib-undefined
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/buildopts.mk
include $(wildcard /usr/share/ada/packaging.mk)
%:
dh $@
.PHONY: $(addprefix override_dh_auto_, \
configure build-arch build-indep test install-arch install-indep clean)
override_dh_auto_build-arch::
ln -fs gpr-util-put_resource_usage__unix.adb gpr/src/gpr-util-put_resource_usage.adb
mkdir -p obj
ada_build_deps := xmlada_schema xmlada_dom xmlada_sax xmlada_input xmlada_unicode
gnatmakeflags := $(GNATMAKEFLAGS) \
$(ada_build_deps:%=-aI/$(DEB_ADA_SOURCE_DIR)/%) \
$(ada_build_deps:%=-aO/$(DEB_ADA_LIB_INFO_DIR)/%)
shared_objects_so_far := $(ada_build_deps:%=-l%) \
-lgnarl-$(DEB_GNAT_VERSION) \
-lgnat-$(DEB_GNAT_VERSION)
define library_template
override_dh_auto_build-arch::
mkdir -p obj/shared_$1 obj/static_$1
gcc-$(DEB_GNAT_VERSION) -c $($1_SRCDIR)/gpr_imports.c \
$(CFLAGS) $(CPPFLAGS) -o obj/shared_$1/gpr_imports.o -fPIC
gnatmake -c `grep -L '^separate ' $($1_SRCDIR)/*.ad[bs] | grep -v __` \
$(gnatmakeflags) -D obj/shared_$1 -cargs $(ADAFLAGS) -fPIC
gcc-$(DEB_GNAT_VERSION) -shared \
-o obj/lib$1.so.$($1_SO_VERSION) \
-Wl,-soname,lib$1.so.$($1_SO_VERSION) \
$(LDFLAGS) obj/shared_$1/*.o $(shared_objects_so_far)
chmod 444 obj/shared_$1/*.ali
gcc-$(DEB_GNAT_VERSION) -c $($1_SRCDIR)/gpr_imports.c \
$(CFLAGS) $(CPPFLAGS) -o obj/static_$1/gpr_imports.o
gnatmake -c `grep -L '^separate ' $($1_SRCDIR)/*.ad[bs] | grep -v __` \
$(gnatmakeflags) -D obj/static_$1 -cargs $(ADAFLAGS)
ar rc obj/lib$1.a obj/static_$1/*.o
ranlib obj/lib$1.a
sed ' \
/@IMPORTS@/ { \
s//$($1_imported_projects:%=with "%.gpr";\n)/; \
s/\n /\n/g; }; \
s/@library@/$1/; \
s|@DEB_LIB_DIR@|$(DEB_LIB_DIR)|; \
s|@DEB_ADA_SOURCE_DIR@|$(DEB_ADA_SOURCE_DIR)|; \
s|@DEB_ADA_LIB_INFO_DIR@|$(DEB_ADA_LIB_INFO_DIR)|; \
' debian/template.gpr > obj/$1.gpr
override_dh_auto_install-arch::
install -m644 -Dtdebian/tmp/$(DEB_ADA_SOURCE_DIR)/$1 $($1_SRCDIR)/*.ad[bs] \
$($1_SRCDIR)/gpr_imports.c
install -m444 -Dtdebian/tmp/$(DEB_ADA_LIB_INFO_DIR)/$1 obj/shared_$1/*.ali
install -m644 -Dtdebian/tmp/$(DEB_GNAT_PROJECT_DIR) obj/$1.gpr
install -m644 -Dtdebian/tmp/$(DEB_LIB_DIR) \
obj/lib$1.so.$($1_SO_VERSION) obj/lib$1.a
ln -fs lib$1.so.$($1_SO_VERSION) debian/tmp/$(DEB_LIB_DIR)/lib$1.so
gnatmakeflags += -aI$($1_SRCDIR) -aOobj/shared_$1
shared_objects_so_far := obj/lib$1.so.$($1_SO_VERSION) \
$(shared_objects_so_far)
endef
gnatprj_SRCDIR := gpr/src
gnatprj_imported_projects := xmlada_schema xmlada_dom xmlada_sax xmlada_input
$(eval $(call library_template,gnatprj))
args_for_tools := \
-D obj $(gnatmakeflags) \
-cargs $(ADAFLAGS) \
-largs $(LDFLAGS) $(shared_objects_so_far)
override_dh_auto_build-arch::
gnatmake src/gprbind.adb -o obj/gprbind $(args_for_tools)
gnatmake src/gprbuild-main.adb -o obj/gprbuild $(args_for_tools)
gnatmake src/gprclean-main.adb -o obj/gprclean $(args_for_tools)
gnatmake src/gprconfig-main.adb -o obj/gprconfig $(args_for_tools)
gnatmake src/gprinstall-main.adb -o obj/gprinstall $(args_for_tools)
gnatmake src/gprlib.adb -o obj/gprlib $(args_for_tools)
gnatmake src/gprls-main.adb -o obj/gprls $(args_for_tools)
gnatmake src/gprname-main.adb -o obj/gprname $(args_for_tools)
gnatmake src/gprslave.adb -o obj/gprslave $(args_for_tools)
override_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
ln -fs /usr/share/sphinx/texinputs/sphinx.sty doc/share/sphinx.sty
$(MAKE) -C doc html pdf txt \
$(DEB_BUILD_OPTION_PARALLEL,%=SPHINXOPTS=-j%)
endif
override_dh_auto_clean:
$(MAKE) -Cdoc clean
execute_after_dh_install-arch:
dh_install --package=libgnatprj-dev debian/gpr.gpr \
$(DEB_GNAT_PROJECT_DIR)
|