File: rules

package info (click to toggle)
scilab 2024.1.0%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 383,124 kB
  • sloc: xml: 765,066; ansic: 282,051; cpp: 264,881; java: 172,629; fortran: 91,526; ml: 23,103; tcl: 16,853; makefile: 9,716; sh: 7,027; f90: 6,437; lex: 1,656; perl: 1,566; yacc: 1,308; php: 690; cs: 613; javascript: 50
file content (213 lines) | stat: -rwxr-xr-x 9,932 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CPPFLAGS_MAINT_APPEND = -DH5_USE_110_API
export CCACHE_DIR := $(CURDIR)/debian/ccache

CONFIGURE_ARGS += --prefix=/usr \
	--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	--with-fftw \
	--with-umfpack --enable-build-localization \
	--with-install-help-xml --enable-build-help \
	--with-tcl-library=/usr/lib/$(DEB_HOST_MULTIARCH) \
	--enable-mpi --disable-static-system-lib

ifneq ($(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial/libhdf5.so),)
  CONFIGURE_ARGS += --with-hdf5-include=/usr/include/hdf5/serial \
	        --with-hdf5-library=/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial
endif

# requires ocamlopt
ifneq (,$(filter $(DEB_HOST_ARCH),arm64 armel ppc64el mips mipsel s390x sparc))
  CONFIGURE_ARGS += --without-modelica
endif

ifneq (,$(findstring $(DEB_HOST_ARCH),amd64))
    ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
        DOC=1
    else
        DOC=0
    endif
else
    DOC=0
endif

%:
	dh $@ --sourcedirectory=scilab --with bash-completion,javahelper

# Do not run libtoolize because it can mess up with Scilab library
override_dh_autoreconf:
	# First, making backups of some files that will get changed during the build.
	for F in $$(find . -name "Makefile.in") scilab/aclocal.m4 scilab/configure scilab/etc/Info.plist.in scilab/modules/core/includes/machine.h.in scilab/modules/core/src/cpp/banner.cpp scilab/modules/windows_tools/src/c/scilab_windows/console.c; do \
	    cp $$F $${F}.save ;\
	done
	cd scilab && autoreconf

override_dh_auto_configure:
	cd scilab && ./configure $(CONFIGURE_ARGS)

override_dh_auto_build:
ifeq ($(DOC), 1)
	cd scilab && make all doc
else
	cd scilab && make all
endif

# doesn't work
override_dh_auto_test:

override_dh_installchangelogs:
	dh_installchangelogs scilab/CHANGES.md

override_dh_auto_install:
	make -C scilab install install-data install-html \
		prefix=$(CURDIR)/debian/tmp/usr \
		bindir=$(CURDIR)/debian/tmp/usr/bin \
		libdir=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) \
		datadir=$(CURDIR)/debian/tmp/usr/share \
		sharedir=$(CURDIR)/debian/tmp/usr/share \
		docdir=$(CURDIR)/debian/tmp/usr/share/doc

# Remove empty directories but not files (#907607: scilab-cli doesn't start)
	find debian/tmp/usr/share/scilab -type d -empty -delete
# Remove la files
	find debian/tmp/usr/lib/ -name '*.la' -delete
# Remove deps files
	rm -rf `find debian/tmp -type d -name .deps`
# Remove extra license files to make lintian happier
# See debian/copyright for them
	find debian/tmp/usr/share/scilab -type f -name "*license.txt" -delete
# Remove all readme files and the changelog (it is in /usr/share/doc/scilab/)
	find debian/tmp/usr/share/scilab -type f -iname "readme*" -delete
	find debian/tmp/usr/share/scilab -type f -name CHANGES.md -delete
# Remove COPYING file
	rm debian/tmp/usr/share/scilab/COPYING
# Remove Visual project files
	find debian/tmp/usr/share/scilab -name "*.sln" -delete
# Remove a font file which is already shipped in another package
	find debian/tmp/usr/share/scilab -name "*.ttf" -delete
# Remove dll files
	find debian/tmp -name "*.dll" -delete
	find debian/tmp -name "*.dll *" -delete
# Remove strange debug files
	find debian/tmp -name .build-id -type d -exec rm -r {} \;
# Remove git files
	find debian/tmp -name .gitignore -delete

# Remove dead code
	rm -rf debian/tmp/usr/share/scilab/modules/helptools/bin debian/tmp/usr/share/scilab/modules/tclsci/demos/tk/timer debian/tmp/usr/share/scilab/modules/intersci/examples/sedprov debian/tmp/usr/share/scilab/modules/macros

	mkdir -p $(CURDIR)/debian/scilab-cli/usr/share/icons/
	cp -R debian/tmp/usr/share/icons/hicolor/ $(CURDIR)/debian/scilab-cli/usr/share/icons/

# Management of the tests, help and demos
	for dir in debian/tmp/usr/share/scilab/modules/*; do \
		moduleName=`echo $$dir|sed -e "s|.*/\(.*\)|\1|"`; \
		target=$(CURDIR)/debian/scilab-doc/usr/share/scilab/modules/$$moduleName; \
		target_test=$(CURDIR)/debian/scilab-test/usr/share/scilab/modules/$$moduleName; \
		# Move tests in the right package; \
		if test -d $$dir/tests; then \
			mkdir -p $$target_test; \
			mv $$dir/tests $$target_test; \
		fi; \
		# Move the help in the right package; \
		if test -d $$dir/help/en_US; then \
			mkdir -p $$target/help; \
			mv $$dir/help/en_US $$target/help; \
		fi; \
		if test -d $$dir/demos; then \
			mv $$dir/demos $$target; \
		fi; \
		if test -d $$dir/help/fr_FR; then \
			mkdir -p $(CURDIR)/debian/scilab-doc-fr/usr/share/scilab/modules/$$moduleName/help; \
			mv $$dir/help/fr_FR $(CURDIR)/debian/scilab-doc-fr/usr/share/scilab/modules/$$moduleName/help/; \
		fi; \
		if test -d $$dir/help/pt_BR; then \
			mkdir -p $(CURDIR)/debian/scilab-doc-pt-br/usr/share/scilab/modules/$$moduleName/help; \
			mv $$dir/help/pt_BR $(CURDIR)/debian/scilab-doc-pt-br/usr/share/scilab/modules/$$moduleName/help/; \
		fi; \
		if test -d $$dir/help/ja_JP; then \
			mkdir -p $(CURDIR)/debian/scilab-doc-ja/usr/share/scilab/modules/$$moduleName/help; \
			mv $$dir/help/ja_JP $(CURDIR)/debian/scilab-doc-ja/usr/share/scilab/modules/$$moduleName/help/; \
		fi; \
	done
	# Remove empty directories
	find debian/tmp/usr/share/scilab -type d -empty -delete

ifeq ($(DOC), 1)
	mkdir $(CURDIR)/debian/scilab-doc/usr/share/scilab/modules/helptools/jar/
	EN_US_DOC=$(CURDIR)/debian/tmp/usr/share/scilab/modules/helptools/jar/scilab_en_US_help.jar; \
	mv $$EN_US_DOC $(CURDIR)/debian/scilab-doc/usr/share/scilab/modules/helptools/jar/

	mkdir $(CURDIR)/debian/scilab-doc-fr/usr/share/scilab/modules/helptools/jar/
	FR_FR_DOC=$(CURDIR)/debian/tmp/usr/share/scilab/modules/helptools/jar/scilab_fr_FR_help.jar; \
	mv $$FR_FR_DOC $(CURDIR)/debian/scilab-doc-fr/usr/share/scilab/modules/helptools/jar/

	mkdir $(CURDIR)/debian/scilab-doc-pt-br/usr/share/scilab/modules/helptools/jar/
	PT_BR_DOC=$(CURDIR)/debian/tmp/usr/share/scilab/modules/helptools/jar/scilab_pt_BR_help.jar; \
	mv $$PT_BR_DOC $(CURDIR)/debian/scilab-doc-pt-br/usr/share/scilab/modules/helptools/jar/

	mkdir -p $(CURDIR)/debian/scilab-doc-ja/usr/share/scilab/modules/helptools/jar/
	JA_DOC=$(CURDIR)/debian/tmp/usr/share/scilab/modules/helptools/jar/scilab_ja_JP_help.jar; \
	mv $$JA_DOC $(CURDIR)/debian/scilab-doc-ja/usr/share/scilab/modules/helptools/jar/
endif

	mkdir -p $(CURDIR)/debian/scilab-minimal-bin/usr/bin
	mv $(CURDIR)/debian/tmp/usr/bin/scilab-cli-bin $(CURDIR)/debian/scilab-minimal-bin/usr/bin/

# Move binaries
	mkdir -p $(CURDIR)/debian/scilab-full-bin/usr/bin
	mv $(CURDIR)/debian/tmp/usr/bin/scilab-bin $(CURDIR)/debian/scilab-full-bin/usr/bin/
	if test -s $(CURDIR)/debian/tmp/usr/bin/modelicac; then \
		chrpath -d $(CURDIR)/debian/tmp/usr/bin/modelicac $(CURDIR)/debian/tmp/usr/bin/XML2Modelica $(CURDIR)/debian/tmp/usr/bin/modelicat; \
		mv $(CURDIR)/debian/tmp/usr/bin/modelicac $(CURDIR)/debian/tmp/usr/bin/XML2Modelica $(CURDIR)/debian/tmp/usr/bin/modelicat $(CURDIR)/debian/scilab-full-bin/usr/bin/; \
	fi
# Move the javasci2 lib
	mkdir -p $(CURDIR)/debian/scilab-full-bin/usr/share/java/
	mkdir -p $(CURDIR)/debian/scilab-full-bin/usr/lib/jni/
	cp debian/tmp/usr/share/scilab/modules/javasci/jar/org.scilab.modules.javasci.jar $(CURDIR)/debian/scilab-full-bin/usr/share/java/
	mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/scilab/libjavasci2.so*  $(CURDIR)/debian/scilab-full-bin/usr/lib/jni/

execute_after_dh_install-arch:
	# Hiding the build path written in /usr/include/scilab/machine.h
	sed -i 's/\(ffile-prefix-map=\).*\(=\.\)/\1<builddir>\2/' debian/scilab-include/usr/include/scilab/machine.h

execute_after_dh_install-indep:
	# Converting encoding to UTF-8 for some files
	for F in usr/share/scilab/contrib/toolbox_skeleton/toolbox_skeleton_redist.iss usr/share/scilab/modules/graphics/tcl/ged/Axes.tcl; do \
	    iconv -f ISO_8859-1 debian/scilab-data/$$F > debian/scilab-data/$$F.temp;\
	    mv debian/scilab-data/$$F.temp debian/scilab-data/$$F;\
	done
	for F in usr/share/scilab/modules/differential_equations/demos/n_pendulum/demo_pendulum_eng.htm usr/share/scilab/modules/differential_equations/demos/n_pendulum/demo_pendulum_fr.htm; do \
	    iconv -f ISO_8859-1 debian/scilab-doc/$$F > debian/scilab-doc/$$F.temp;\
	    mv debian/scilab-doc/$$F.temp debian/scilab-doc/$$F;\
	done
	for F in usr/share/scilab/modules/elementary_functions/tests/unit_tests/asec.tst usr/share/scilab/modules/elementary_functions/tests/unit_tests/asecd.tst usr/share/scilab/modules/elementary_functions/tests/unit_tests/cosh.tst usr/share/scilab/modules/fileio/tests/nonreg_tests/bug_6449_ANSI.txt usr/share/scilab/modules/spreadsheet/tests/nonreg_tests/ticket_684.txt usr/share/scilab/modules/windows_tools/tests/nonreg_tests/text_ANSI.txt usr/share/scilab/modules/xml/tests/nonreg_tests/bug_10645.xml; do \
	    iconv -f ISO_8859-1 debian/scilab-test/$$F > debian/scilab-test/$$F.temp;\
	    mv debian/scilab-test/$$F.temp debian/scilab-test/$$F;\
	done

override_dh_fixperms-indep:
	dh_fixperms
	# Setting this script as executable
	chmod 755 debian/scilab-data/usr/share/scilab/modules/dynamic_link/src/scripts/ltmain.sh

override_dh_clean:
	# Removing .class and .jar files left by the build
	find . -name "*.class" -delete
	find . -name "*.jar" -delete
	# Removing the ccache dir, under debian/
	rm -rf $(CCACHE_DIR)
	# Saving four files that dh_clean will remove, to restore the orig source tree afterwards.
	for F in scilab/modules/atoms/tests/unit_tests/repositories.orig scilab/modules/cacsd/tests/unit_tests/dscr.tst.orig scilab/modules/differential_equations/src/patched_sundials/src/sunlinsol/lapackband/sunlinsol_lapackband.c.orig scilab/modules/differential_equations/src/patched_sundials/src/sunlinsol/lapackdense/sunlinsol_lapackdense.c.orig; do \
	    cp $$F $${F}.save ;\
	done
	dh_clean
	# Restoring files that are modified during the build.
	for F in $$(find . -name "*.save"); do \
	    if [ -e $$F ]; then \
	        mv $$F $${F%.save} ;\
	    fi \
	done