File: rules

package info (click to toggle)
ncbi-blast%2B 2.16.0%2Bds-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 143,172 kB
  • sloc: cpp: 985,828; ansic: 303,887; sh: 14,536; xml: 5,050; javascript: 3,442; python: 2,958; perl: 2,612; java: 2,284; makefile: 1,453; awk: 162; pascal: 72
file content (220 lines) | stat: -rwxr-xr-x 8,011 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#!/usr/bin/make -f
# -*- makefile -*-

include /usr/share/dpkg/architecture.mk

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export HOME=$(CURDIR)/fakehome

NUMJOBS=1
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  ifneq (sh4,$(DEB_BUILD_ARCH))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  endif
endif

DEB_CONFIGURE_COMMON_FLAGS=--without-autodep --without-makefile-auto-update \
    --with-flat-makefile --without-caution --without-dbapi --without-lzo \
    --without-debug --without-sse42
DEB_CONFIGURE_EXTRA_FLAGS=$(DEB_CONFIGURE_COMMON_FLAGS) --with-dll --with-mt \
    --with-runpath=/usr/lib/ncbi-blast+ --with-build-root=BUILD \
    --with-mbedtls --with-pcre2

ifneq (,$(filter amd64 arm64 x32,$(DEB_HOST_ARCH)))
 VDB_SUBTREES=os/$(DEB_HOST_ARCH_OS) os/unix cc/gcc/$(DEB_HOST_GNU_CPU) cc/gcc
 VDB_INC=-I/usr/include/ncbi-vdb
 VDB_INCLUDE=$(VDB_INC) $(VDB_SUBTREES:%=$(VDB_INC)/%)
 DEB_CONFIGURE_COMMON_FLAGS += --with-vdb=/usr VDB_INCLUDE="$(VDB_INCLUDE)"
else
 DEB_CONFIGURE_COMMON_FLAGS += --without-downloaded-vdb
endif


proj=algo/blast/ app/ objmgr/ objtools/align_format/ objtools/blast/

#ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
DEB_CONFIGURE_EXTRA_FLAGS += --without-strip --with-symbols
#endif

#export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie reproducible=-timeless
export DEB_CFLAGS_MAINT_APPEND=-Wall -pedantic

ifeq ($(DEB_HOST_ARCH_BITS),32)
  ifeq (,$(filter armhf %i386 x32,$(DEB_HOST_ARCH)))
    export LIBS=-latomic
  endif
endif

ifeq (alpha,$(DEB_HOST_ARCH))
  export DEB_CFLAGS_MAINT_APPEND   += -fsection-anchors
  export DEB_CXXFLAGS_MAINT_APPEND += -fsection-anchors
endif
ifeq (hppa,$(DEB_HOST_ARCH))
  export DEB_CFLAGS_MAINT_APPEND   += -ffunction-sections
  export DEB_CXXFLAGS_MAINT_APPEND += -ffunction-sections
endif
# Down to mips64el in practice, but easy enough to generalize
ifneq (,$(findstring mips,$(DEB_HOST_ARCH)))
  export DEB_CFLAGS_MAINT_APPEND   += -mxgot
  export DEB_CXXFLAGS_MAINT_APPEND += -mxgot
endif

include /usr/share/dpkg/buildflags.mk

ifneq (,$(filter mips%,$(DEB_HOST_ARCH)))
CXXFLAGS := $(CXXFLAGS:-O%=-O)
DEB_CONFIGURE_EXTRA_FLAGS += FAST_CXXFLAGS=-O
endif
ifeq (sh4,$(DEB_HOST_ARCH))
DEB_CONFIGURE_COMMON_FLAGS += --without-optimization
endif

export CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MAKE

# used for run_with_lock
DEB_CONFIGURE_COMMON_FLAGS +=  CFLAGS_FOR_BUILD="$(CFLAGS) -fPIE"
DEB_CONFIGURE_COMMON_FLAGS += LDFLAGS_FOR_BUILD="$(LDFLAGS)"

ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
NATIVE=.native
DEB_CONFIGURE_EXTRA_FLAGS += --build=$(DEB_BUILD_GNU_TYPE) \
    --host=$(DEB_HOST_GNU_TYPE)
NATIVE_BINDIR=$(CURDIR)/c++/BUILD$(NATIVE)/bin
PREBUILT_DATATOOL_EXE=$(NATIVE_BINDIR)/datatool
PREBUILT_PTB_EXE=$(NATIVE_BINDIR)/project_tree_builder
export PREBUILT_DATATOOL_EXE PREBUILT_PTB_EXE

$(PREBUILT_DATATOOL_EXE):
	cd c++  &&  PREBUILT_PTB_EXE=bootstrap \
            ./configure $(DEB_CONFIGURE_COMMON_FLAGS) --without-objects \
            --without-algo --without-app --with-build-root=BUILD.native  ||  \
            (tail -v -n +0 config.log BUILD.native/status/config.log; exit 1)
	make -j$(NUMJOBS) -C c++/BUILD$(NATIVE)/build -f Makefile.flat \
	    datatool.exe
endif

override_dh_autoreconf:
	cd c++  && \
	    autoheader2.69 -Isrc/build-system src/build-system/configure.ac \
	    &&  cd src/build-system  &&  autoconf2.69

override_dh_auto_configure-indep:;
override_dh_auto_configure-arch: $(PREBUILT_DATATOOL_EXE)
	mkdir -p $(HOME)
	cd c++  &&  CONFIG_SHELL=/bin/bash \
            ./configure $(DEB_CONFIGURE_EXTRA_FLAGS) \
	    ||  (tail -v -n +0 config.log BUILD/status/config.log; exit 1)

override_dh_auto_build-arch:
	cd c++/BUILD/build  && \
	    make -j$(NUMJOBS) -f Makefile.flat all_projects="$(proj)"
#	   make all_r

override_dh_auto_build-indep:
	echo "Save time and do nothing for architecture independent builds"

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	-dh_auto_test
	-c++/BUILD/build/check.sh concat_err
	-cat c++/BUILD/build/check.sh.out_err
endif

instroot = debian/ncbi-blast+/usr
leg_bin = debian/ncbi-blast+-legacy/usr/bin
override_dh_auto_install-arch:
	# cp c++/BUILD/lib/*.so $(instroot)/lib/ncbi-blast+/
	cp c++/BUILD/bin/*    $(instroot)/bin/

override_dh_auto_install-indep:
	echo "Nothing to do for architecture independant installs"

override_dh_install-arch:
	# dh_install
	mv $(instroot)/bin/rpsblast $(instroot)/bin/rpsblast+
	mv $(instroot)/bin/seedtop $(instroot)/bin/seedtop+
	mv $(instroot)/bin/get_species_taxids.sh \
	    $(instroot)/bin/get_species_taxids
	mv $(instroot)/bin/cleanup-blastdb-volumes.py \
	    $(instroot)/bin/cleanup-blastdb-volumes
	mv $(instroot)/bin/legacy_blast.pl   $(instroot)/bin/legacy_blast
	mv $(instroot)/bin/update_blastdb.pl $(instroot)/bin/update_blastdb
	sed -e '1s/$$/3/' $(instroot)/bin/windowmasker_2.2.22_adapter.py \
	   > $(instroot)/bin/windowmasker_2.2.22_adapter
	chmod +x $(instroot)/bin/windowmasker_2.2.22_adapter
	rm $(instroot)/bin/windowmasker_2.2.22_adapter.py*
# Clean up tests, demos, and internal build tools
	rm -f $(instroot)/bin/*test* $(instroot)/bin/seqdb_demo \
	    $(instroot)/bin/datatool $(instroot)/bin/run_with_lock \
	    $(instroot)/bin/project_tree_builder
	mkdir c++/BUILD/lib.observed
	d=$(instroot)/bin; \
	while :; do \
	    (for x in $$d/*; do \
	        readelf -d $$x 2>/dev/null \
	        | sed -ne 's/.*NEEDED.* \[\(.*\)]$$/\1/p'; \
            done; rm -f c++/BUILD/lib.observed/*) | sort -u | while read l; do \
	        [ -f $(instroot)/lib/ncbi-blast+/$$l \
	          -o \! -f c++/BUILD/lib/$$l ]  || \
	            cp -av c++/BUILD/lib/$$l c++/BUILD/lib.observed/; \
	    done; \
	    [ -n "$$(ls c++/BUILD/lib.observed)" ] || break; \
	    echo ------------------------------------------------------------; \
	    cp -a c++/BUILD/lib.observed/* $(instroot)/lib/ncbi-blast+; \
	    d=c++/BUILD/lib.observed; \
	done

override_dh_install-indep:
	#if test -d $(leg_bin); then cp debian/legacy/legacy.sh $(leg_bin)/; fi
	for x in blastall megablast blastpgp bl2seq rpsblast fastacmd formatdb \
	         seedtop; do \
	    sed -e "s/.{.*}/$$x/" debian/legacy/legacy.sh > $(leg_bin)/$$x; \
	    chmod +x $(leg_bin)/$$x; \
	done

NEW_MODULE = $(CURDIR)/c++/BUILD$(NATIVE)/build/new_module.sh
override_dh_clean:
	cp c++/src/util/lmdb/Makefile.orig c++/src/util/lmdb/Makefile.orig.save
	cp c++/src/util/lmdbxx/Makefile.orig c++/src/util/lmdbxx/Makefile.orig.save
	cp c++/src/util/lmdbxx/lmdb++.h.orig c++/src/util/lmdbxx/lmdb++.h.orig.save

	cp c++/configure.orig configure.orig.save
	dh_clean
	#Tricky - for each module directory there may be several module files
	#or there may be none but then there is still a module named after the
	#directory.  Clean everything!
	-for x in c++/src/objects/* ; do \
	    (cd "$$x"  && ( \
		mods="`echo *.module`" ; \
		[ "$${mods#*\*}" = "$$mods" ] || mods="`basename $$x`" ; \
		for mod in $$mods ; do \
	            $(NEW_MODULE) $$mod purge_sources ; \
		done ) ; \
	    ) ; \
	done
	-for x in c++/src/objtools/eutils/* ; do \
	    (cd "$$x"  && ( \
		mods="`echo *.module`" ; \
		[ "$${mods#*\*}" = "$$mods" ] || mods="`basename $$x`" ; \
		for mod in $$mods ; do \
	            $(NEW_MODULE) --dtd $$mod purge_sources ; \
		done ) ; \
	    ) ; \
	done
	-cd c++/src/objtools/eutils/efetch  && \
	     $(NEW_MODULE) --xsd efetch purge_sources
	rm -rf c++/compilers/dll c++/config.log c++/Makefile
	rm -f c++/configure.lineno c++/src/objects/blastxml/blastxml.module
	rm -f c++/include/common/ncbi_revision.h
	find -name check_exec.pid -delete
	rm -rf c++/BUILD c++/BUILD.native fakehome
	mv configure.orig.save c++/configure.orig
	mv c++/src/util/lmdb/Makefile.orig.save c++/src/util/lmdb/Makefile.orig
	mv c++/src/util/lmdbxx/Makefile.orig.save c++/src/util/lmdbxx/Makefile.orig
	mv c++/src/util/lmdbxx/lmdb++.h.orig.save c++/src/util/lmdbxx/lmdb++.h.orig

%:
	dh $@ --sourcedirectory=c++ --with-autoreconf