backport Euro for lt-LT (including the euro wizard)
[pkg-openoffice/libreoffice.git] / rules
1 #!/usr/bin/make -f
2 ################################################################################
3 # LibreOffice source package rules file
4 #
5 # Please see debian/README for detailed documentation about the build system, and
6 # how to build LibreOffice.
7 ################################################################################
8 # Authors:
9 # Chris Halls <halls@debian.org>
10 # Rene Engelhard <rene@debian.org>
11 # Copyright 2002-2011 Software in the Public Interest, Inc.
12 # Portions Copyright 2010 Canonical Ltd. Author: Matthias Klose
13 # Licensed under the GNU General Public License, version 2.  See the file
14 # /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
15 ################################################################################
16
17 vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1)))
18
19 include /usr/share/dpkg/pkg-info.mk
20 CURDIR ?= $(realpath $(dir $(firstword $(MAKEFILE_LIST)))/..)
21 BASE_VERSION:=$(shell echo $(DEB_VERSION) | cut -d: -f1):$(DEB_VERSION_UPSTREAM)
22 BINARY_VERSION=$(DEB_VERSION)
23 #HELP_L10N_VIRTUAL_VERSION:=$(shell echo $(DEB_VERSION_UPSTREAM) | cut -d: -f2 | tr [~] [\\-])
24 HELP_L10N_VIRTUAL_VERSION:=3.5
25 #VER:=3
26 OOVER:=3.5
27 NEXT_OOVER:=$(shell echo "$(OOVER) + 0.1" | bc)
28
29 ARCH_INDEP_PACKAGES := $(shell dh_listpackages -i)
30 ARCH_DEP_PACKAGES := $(shell dh_listpackages -s)
31 PACKAGES := $(ARCH_INDEP_PACKAGES) $(ARCH_DEP_PACKAGES)
32
33 include /usr/share/dpkg/architecture.mk
34 include /usr/share/dpkg/vendor.mk
35 DISTREL := $(shell lsb_release -cs)
36 SHELL:=/bin/bash
37
38 SYSTEM_GCC_VERSION = $(shell gcc --version | sed -n '/^gcc/s/.*\(.\..\)\..$$/\1/p')
39
40 # Debian buildds run as user `buildd', other are using /CurrentlyBuilding
41 ON_BUILDD := $(shell if [ "`whoami`" = buildd -o -f /CurrentlyBuilding ] || echo $(CURDIR) | grep -q \/build\/buildd; then echo y; else echo n; fi)
42
43 PKGDIR:=debian/libreoffice$(VER)
44 OODIRNAME=libreoffice$(VER)
45 OODIR:=usr/lib/$(OODIRNAME)
46 OOUREDIR:=usr/lib/ure
47 OOSDKDIR:=$(OODIR)/sdk
48
49 # Figure out who's building this package.
50 OOO_VENDOR:=The Document Foundation/Debian
51 ifeq "$(DEB_VENDOR)" "Ubuntu"
52 OOO_VENDOR=The Document Foundation, Debian and Ubuntu
53 endif
54 export OOO_VENDOR
55
56 # debhelper
57 export DH_OPTIONS
58 export DH_ALWAYS_EXCLUDE=CVS:.svn:.bzr:.git
59 #export DH_VERBOSE=1
60 # quilt
61 export QUILT_PATCHES=debian/patches
62 export QUILT_OPTIONS="-p1 -F0"
63
64 SOURCE_TREE=.
65 STAMP_DIR=debian/stampdir
66 TARFILE_LOCATION=$(CURDIR)/src
67 export TARFILE_LOCATION
68 USE_SOURCE_TARBALLS=y
69 USE_GIT_TARBALLS=n
70 ifeq "$(USE_GIT_TARBALLS)" "y"
71 GIT_BASEURL:=git://anongit.freedesktop.org/libreoffice
72 lo_sources_ver=3.5.4.2
73 # NOT in proper libreoffice-3-5 branch
74 # use ./g checkout -b tag-libreoffice-3.5.4.2 libreoffice-3.5.4.2
75 GIT_TAG=libreoffice-$(lo_sources_ver)
76 GIT_BRANCH=tag-libreoffice-$(lo_sources_ver)
77 endif
78 ifeq "$(USE_SOURCE_TARBALLS)" "y"
79 lo_sources_ver=$(shell cat $(CURDIR)/sources.ver | cut -d= -f2)
80 endif
81
82 ifeq "$(DISTREL)" "squeeze"
83  SQUEEZE_BACKPORT=y
84 endif
85
86 #########
87 # Default package configuration
88 #
89 OOO_ARCHS = alpha amd64 armel armhf hppa i386 ia64 mips mipsel powerpc powerpcspe ppc64 s390 s390x sparc kfreebsd-amd64 kfreebsd-i386
90 PATCHSET=$(DEB_VENDOR)
91 BUILD_DEPS=
92
93 # These are components which can be built from internal copies, or used from the
94 # distribution. See configure --help for valid values (--with-system-<value>).
95 SYSTEM_STUFF = dicts
96
97 BUILD_PYUNO=y
98 ENABLE_PYTHON3=y
99 ifeq "$(BUILD_PYUNO)" "y"
100   ENABLE_SCRIPT_PROVIDER_PYTHON=y
101 endif
102 # THIS IS ONLY FOR TESTING. When building against a specified pythonX.Y
103 # this will work inside OOo but *not* from outside OOo unless the user
104 # uses pythonX.Y directly (and the dh_pycentral-created dependencies allow
105 # also the non-working default python then) - see e.g. #587402. Also
106 # note we are NOT working with python < 2.6 anymore!
107 PYTHON_VERSION=current
108 ifeq "$(PYTHON_VERSION)" "current"
109   PYTHON=python (>= 2.6)
110 export PYTHON=python
111 else
112   PYTHON=python$(PYTHON_VERSION)
113 export PYTHON=python$(PYTHON_VERSION)
114 endif
115 ifeq "$(ENABLE_PYTHON3)" "y"
116         PYTHON3_VERSION=current
117   ifeq "$(PYTHON3_VERSION)" "current"
118         PYTHON3=python3
119   else
120         PYTHON3=python$(PYTHON3_VERSION)
121   endif
122 endif
123 PACKAGE_TTF_OPENSYMBOL=y
124 BUILD_BINFILTERS=y
125 BUILD_ONLY_EN_US=n
126 ENABLE_JAVA=y
127 ifeq "$(ENABLE_JAVA)" "y"
128   JDK=openjdk
129   JAVA_MAINVER=6
130   ifneq (,$(filter hppa kfreebsd%, $(DEB_HOST_ARCH)))
131     JDK=gcj-jdk
132   endif
133 endif
134 JAVAHELPER_MIN_VERSION= (>= 0.37~)
135 SYSTEM_STUFF += hunspell
136 HUNSPELL_MIN_VER= (>= 1.1.5-2)
137 SYSTEM_STUFF += altlinuxhyph
138 USE_LIBHYPHEN=y
139 LIBALTLINUXHYPH_MINVER= (>= 0.1.1-11)
140 LIBHYPHEN_MINVER= (>= 2.4)
141 SYSTEM_STUFF += boost
142 BOOST_VERSION=default
143 ifeq "$(BOOST_VERSION)" "default"
144   BOOST_MINVER= (>= 1.38)
145 endif
146 ifeq "$(BOOST_VERSION)" "1.39"
147   BOOST_MINVER= (>= 1.39.0-2)
148 endif
149 SYSTEM_STUFF += mdds
150 SYSTEM_STUFF += vigra
151 USE_EXTERNAL_CXXLIBS=y
152 #SYSTEM_STUFF += sablot
153 SYSTEM_STUFF += mythes
154 SYSTEM_STUFF += icu
155 ICU_MINVER= (>= 4.0)
156 SYSTEM_STUFF += libwpd libwpg libwps
157 SYSTEM_STUFF += libvisio
158 #SYSTEM_STUFF += xmlsec
159 BUILD_CAIROCANVAS=y
160 SYSTEM_STUFF += cairo
161 CAIRO_FONTS_PATCH=y
162 BUILD_KDE=y
163 # not ported to KDE 4
164 ENABLE_KDEAB=n
165 ifeq "$(SYSTEM_GCC_VERSION)" "4.7"
166 # < 4.8 fails with gcc 4.7, see #667911
167 QT_MINVER= (>= 4:4.8)
168 else
169 QT_MINVER= (>= 4:4.5)
170 endif
171 KDELIBS_MINVER= (>= 4:4.3.4)
172 BUILD_DBG_PACKAGE=y
173 ifeq "$(BUILD_DBG_PACKAGE)" "y"
174   ENABLE_SYMBOLS=y
175   SMALL_SYMBOLS=y
176 endif
177 ifeq "$(ENABLE_JAVA)" "y"
178   # NOTE: If you change this while gcj/ant multiarch combo is still broken
179   # you need to disable bsh scripting engine completely (see disable-rhino.diff)
180   # See http://lists.debian.org/debian-java/2011/06/msg00108.html and replies
181   SYSTEM_STUFF += beanshell
182   SYSTEM_STUFF += hsqldb
183   HSQLDB_MINVER= (>> 1.8.0.10)
184   HSQLDB_TOONEWVER=1.8.1
185   # disabled because system-saxon breaks all kinds exports using XSLT transforms
186   # (e.g. M$ Word/Excel 2003 XML, Mediawiki, XHTML, UOF, ...)
187   # It does *NOT* fail with _plain_ saxon 9.0.0.8 built with OOos build.xml
188   # for UOF, but still for e.g. M$.
189   #SYSTEM_STUFF += saxon
190   SYSTEM_STUFF += lucene
191 endif
192 SYSTEM_STUFF += lpsolve
193 USE_SHARED_LPSOLVE=y
194 LPSOLVE_MIN_VERSION= (>= 5.5.0.13-5+b1)
195 USE_DBUS=y
196 USE_GSTREAMER=y
197 SYSTEM_STUFF += neon
198 NEON_SECTYPE=gnutls
199 NEONSONR=27
200 SYSTEM_STUFF += redland
201 PACKAGE_SDK=y
202 ifeq "$(ENABLE_JAVA)" "y"
203   ifeq "$(JDK)" "openjdk"
204     RUN_MAKE_CHECK=y
205     ENABLE_JUNIT4=y
206   endif
207 else
208   RUN_MAKE_CHECK=n
209   ENABLE_JUNIT4=n
210 endif
211 ifeq "$(ENABLE_JUNIT4)" "y"
212   JUNIT_MIN_VER= (>= 4.8.2-2)
213 endif
214 USE_LIBCURL4=y
215 CURL_SECTYPE=gnutls
216 USE_SYSTEM_DMAKE=y
217 USE_LIBSUITESPARSE=y
218 SUITESPARSE_MIN_VERSION= (>= 1:3.4.0)
219 PARALLEL_BUILD=y
220 ENABLE_LDAP=y
221 USE_OPENLDAP=y
222 ENABLE_OPENGL=y
223 SYSTEM_STUFF += openssl
224 NEW_DPKG_SHLIBDEPS=y
225 ifeq "$(ENABLE_JAVA)" "y"
226   ENABLE_REPORTDESIGN=y
227   SYSTEM_STUFF += jfreereport
228   ENABLE_MEDIAWIKI=y
229   SYSTEM_STUFF += apache-commons
230   ENABLE_SCRIPT_PROVIDER_BSH=y
231   ENABLE_SCRIPT_PROVIDER_JS=y
232 else
233   ENABLE_REPORTDESIGN=n
234   ENABLE_MEDIAWIKI=n
235   ENABLE_SCRIPT_PROVIDER_BSH=n
236   ENABLE_SCRIPT_PROVIDER_JS=n
237 endif
238 ENABLE_SDBC_POSTGRESQL=y
239 ENABLE_MINIMIZER=y
240 ENABLE_PRESENTER_CONSOLE=y
241 ENABLE_PDFIMPORT=y
242 BUILD_GTK=y
243 #ifeq "$(DEB_DISTRIBUTION)" "experimental"
244 BUILD_GTK3=y
245 #endif
246 ENABLE_EVO2=y
247 ENABLE_GVFS=n
248 ENABLE_GCONF=y
249 ENABLE_GIO=y
250 ENABLE_RANDR=y
251 ifeq "$(BUILD_GTK)" "y"
252   PACKAGE_NSPLUGIN=n
253   ifeq "$(PACKAGE_NSPLUGIN)" "y"
254         SYSTEM_STUFF += mozilla-headers
255   endif
256 endif
257 PACKAGE_BASE=y
258 ENABLE_GRAPHITE=y
259 SYSTEM_STUFF += graphite
260 ALLOC=system
261 SYSTEM_STUFF += libexttextcat
262 SYSTEM_STUFF += cppunit
263 ENABLE_LIBRSVG=y
264 SYSTEM_LIBRSVG=y
265 # when we have a package we want to have to be installed on older things with some older
266 # C++ ABI (like it was the case with libreoffice2), we need to set this. Don't touch
267 # otherwise
268 SYSTEM_STUFF += stdlibs
269 DEFAULT_IMAGE=galaxy
270 IMAGES:=$(DEFAULT_IMAGE) crystal hicontrast tango oxygen
271 ENABLE_MYSQLNATIVE=y
272 # cannot be disabled, unless you have a internal MySQL/PostgreSQL somewhere :-)
273 SYSTEM_STUFF += mysql mysql-cppconn
274 MYSQLCPPCONN_MINVER= (>= 1.1.0~r791)
275 SYSTEM_STUFF += postgresql
276 DICT_DIR=/usr/share/hunspell
277 HYPH_DIR=/usr/share/hyphen
278 THES_DIR=/usr/share/mythes
279 SYSTEM_STUFF += libcmis
280 SYSTEM_STUFF += jpeg
281 SYSTEM_STUFF += libxml
282 SYSTEM_STUFF += expat
283 SYSTEM_STUFF += odbc
284 SYSTEM_STUFF += curl
285 SYSTEM_STUFF += sane
286 SYSTEM_STUFF += xextensions-headers
287 SYSTEM_STUFF += mesa-headers
288 SYSTEM_STUFF += db
289 SYSTEM_STUFF += poppler
290 SYSTEM_STUFF += libpng
291 SYSTEM_STUFF += nss
292 SYSTEM_STUFF += sampleicc
293 PACKAGE_UNOWINREG_DLL=y
294 ifeq "$(DEB_VENDOR)" "Debian"
295 BUILD_UNOWINREG_DLL=y
296 endif
297
298 # Default flags to pass to configure
299 CONFIGURE_FLAGS= \
300                 --with-vendor='$(OOO_VENDOR)' \
301                 --with-install-dirname=$(OODIRNAME) \
302                 --prefix=/usr --mandir=/usr/share/man \
303                 --docdir=/usr/share/doc/libreoffice \
304                 --disable-strip-solver \
305                 --enable-lockdown \
306                 --libdir=/usr/lib \
307                 --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
308                 --enable-extension-integration \
309                 --disable-online-update \
310                 --disable-fetch-external \
311                 --enable-release-build \
312                 --without-fonts \
313                 --without-myspell-dicts
314
315 ifneq ($(ON_BUILDD),y)
316 CONFIGURE_FLAGS += --enable-verbose
317 endif
318
319 CONFIGURE_FLAGS += --with-alloc=$(ALLOC)
320
321 #############
322 # Architecture-specific changes
323
324 # helper to generate no_archs macros (pass name of source macro)
325 define gen_no_archs
326   _no_arch_macro = $(subst OOO_,OOO_NO_,$1)
327   _no_arch_tmp_$1 = $$(foreach _a,$$(filter-out $$(call $1),$(OOO_ARCHS)),!$$(_a))
328   $$(_no_arch_macro) = $$(if $$(_no_arch_tmp_$1),$$(_empty) [$$(_no_arch_tmp_$1)])
329 endef
330
331 PLATFORMID := $(shell grep PLATFORMID debian/vars.$(DEB_HOST_ARCH) | cut -d"=" -f2)
332
333 # ./configure defaults to STLport on i386 and we should keep it for
334 # ABI-compatability
335 OOO_STLPORT_ARCHS= i386
336 ifeq "$(DEB_HOST_ARCH)" "i386"
337         LINK_TO_STLPORT=y
338 endif
339
340 ifneq (,$(findstring mips,$(OOO_ARCHS)))
341         BUILD_DEPS += , gcc-4.4 [mips mipsel], g++-4.4 [mips mipsel]
342   ifneq (,$(findstring mips,$(DEB_HOST_ARCH)))
343         GCC_VERSION := 4.4
344   endif
345 endif
346
347 ifeq "$(ENABLE_OPENGL)" "y"
348   # doesn't make that much sense on armel and mips(el), does it? :)
349   OOO_OGLTRANS_ARCHS = $(filter-out armel mips%, $(OOO_ARCHS))
350   ifeq (,$(filter $(DEB_HOST_ARCH),$(OOO_OGLTRANS_ARCHS)))
351        ENABLE_OPENGL=n
352   endif
353   $(eval $(call gen_no_archs,OOO_OGLTRANS_ARCHS))
354 endif
355
356 ifneq (,$(findstring arm,$(DEB_HOST_ARCH)))
357   ifneq (stdlibs,$(findstring stdlibs,$(SYSTEM_STUFF)))
358   $(error sal does not build on arm with internal stdlibs!)
359   endif
360 endif
361
362 OOO_64BIT_ARCHS = $(filter alpha amd64 ia64 kfreebsd-amd64 ppc64 s390x, $(OOO_ARCHS))
363
364 # Java...
365 OOO_JAVA_ARCHS = $(OOO_ARCHS)
366 $(eval $(call gen_no_archs,OOO_JAVA_ARCHS))
367
368 OOO_GCJ_ARCHS = $(filter-out $(OOO_OPENJDK_ARCHS), $(OOO_JAVA_ARCHS))
369 $(eval $(call gen_no_archs,OOO_GCJ_ARCHS))
370
371 OOO_GCJ_JDK_ARCHS := hppa kfreebsd-i386 kfreebsd-amd64
372 OOO_OPENJDK_ARCHS := $(filter-out $(OOO_GCJ_JDK_ARCHS),$(OOO_JAVA_ARCHS))
373 $(eval $(call gen_no_archs,OOO_OPENJDK_ARCHS))
374
375 OOO_UNOWINREG_DLL_ARCHS := i386 amd64
376 ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),$(OOO_UNOWINREG_DLL_ARCHS)))
377         PACKAGE_UNOWINREG_DLL=n
378 endif
379
380 OOO_ARCH_DEP_EXTENSIONS_ARCHS := $(OOO_ARCHS)
381 OOO_EXTENSIONS_ARCHS := $(OOO_ARCH_DEP_EXTENSIONS_ARCHS)
382
383 OOO_BASE_ARCHS := $(OOO_JAVA_ARCHS)
384 $(eval $(call gen_no_archs,OOO_BASE_ARCHS))
385 OOO_REPORTDESIGN_ARCHS := $(filter-out $(OOO_GCJ_JDK_ARCHS),$(OOO_JAVA_ARCHS))
386 $(eval $(call gen_no_archs,OOO_REPORTDESIGN_ARCHS))
387
388 ifneq (,$(findstring $(DEB_HOST_ARCH),$(OOO_NO_BASE_ARCHS)))
389   ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),$(OOO_BASE_ARCHS)))
390         PACKAGE_BASE=n
391         ENABLE_SDBC_POSTGRESQL=n
392         ENABLE_MYSQLNATIVE=n
393         ENABLE_EVO2=n
394         ENABLE_KDEAB=n
395         ENABLE_REPORTDESIGN=n
396         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-base libreoffice$(VER)-base-core
397         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-evolution -Nlibreoffice$(VER)-kab
398         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-sdbc-postgresql -Nlibreoffice$(VER)-mysql-connector
399         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-report-builder-bin -Nlibreoffice$(VER)-report-builder
400   endif
401 endif
402
403 ifeq (,$(findstring $(DEB_HOST_ARCH),$(OOO_ARCH_DEP_EXTENSIONS_ARCHS)))
404         ENABLE_MINIMIZER=n
405         ENABLE_PDFIMPORT=n
406         ENABLE_PRESENTER_CONSOLE=n
407         ENABLE_MYSQLNATIVE=n
408         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-mysql-connector
409         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-report-builder-bin -Nlibreoffice$(VER)-report-builder
410         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-pdfimport -Nlibreoffice$(VER)-presentation-minimizer
411         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-presenter-console
412 endif
413 ifeq (,$(findstring $(DEB_HOST_ARCH),$(OOO_EXTENSIONS_ARCHS)))
414         ENABLE_MEDIAWIKI=n
415         ENABLE_REPORTDESIGN=n
416         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-report-builder-bin -Nlibreoffice$(VER)-report-builder
417         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-wiki-publisher -Nlibreoffice$(VER)-script-provider-python
418 endif
419
420 ifeq (,$(filter $(DEB_HOST_ARCH),$(OOO_JAVA_ARCHS)))
421         ENABLE_JAVA=n
422         ENABLE_REPORTDESIGN=n
423         ENABLE_MEDIAWIKI=n
424         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-wiki-publisher
425         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-report-builder-bin -Nlibreoffice$(VER)-report-builder
426 endif
427
428 ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),$(OOO_GCJ_JDK_ARCHS)))
429   ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),$(OOO_OPENJDK_ARCHS)))
430         ENABLE_REPORTDESIGN=n
431         SYSTEM_STUFF := $(filter-out jfreereport, $(SYSTEM_STUFF))
432         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-report-builder-bin -Nlibreoffice$(VER)-report-builder
433   endif
434 endif
435 # disable SRB on ia64 when building with internal jfreereport.
436 # fails to build. ("The system is out of resources."). FIXME.
437 ifeq (ia64,$(findstring ia64,$(OOO_OPENJDK_ARCHS)))
438   ifeq (,$(findstring jfreereport,$(SYSTEM_STUFF))) 
439     OOO_REPORTDESIGN_ARCHS := $(filter-out ia64,$(OOO_REPORTDESIGN_ARCHS))
440     ifeq "$(DEB_HOST_ARCH)" "ia64"
441         ENABLE_REPORTDESIGN=n
442     endif
443   endif
444 endif
445 ifneq (,$(filter $(DEB_HOST_ARCH),$(OOO_GCJ_ARCHS)))
446         BUILD_JARS_NATIVE=n
447 endif
448
449 ifeq "$(PACKAGE_NSPLUGIN)" "y"
450 OOO_NSPLUGIN_ARCHS = $(OOO_ARCHS)
451 else
452 OOO_NSPLUGIN_ARCHS=
453 endif
454 $(eval $(call gen_no_archs,OOO_NSPLUGIN_ARCHS))
455
456 # builds long and is for legacy filters. probably not needed on {arm,mips}{,el}
457 ifneq (,$(filter arm% mips% m68k, $(DEB_HOST_ARCH)))
458         BUILD_BINFILTERS=n
459 endif
460 OOO_BINFILTER_ARCHS:=$(filter-out arm% mips% m68k, $(OOO_ARCHS))
461
462 #############
463 # Distro-specific overrides
464
465 # Debian
466 ifeq "$(DEB_VENDOR)" "Debian"
467   # we don't need to build all languages and the thesaurus on the buildds;
468   # they do binary-only builds anyway
469   ifeq ($(ON_BUILDD),y)
470        BUILD_ONLY_EN_US=y
471   endif
472   CONFIGURE_FLAGS += --with-intro-progressbar-color=215,7,81
473 endif
474
475 # Debian Squeeze
476 ifeq "$(SQUEEZE_BACKPORT)" "y"
477   BUGS=mailto:debian-backports@lists.debian.org
478   SYSTEM_STUFF := $(filter-out libwpd libwpg libwps mythes mdds libexttextcat graphite jfreereport libvisio poppler libcmis, $(SYSTEM_STUFF))
479   JUNIT_MIN_VER=
480   PARALLEL_BUILD=n
481   ENABLE_PDFIMPORT=n
482 endif
483
484 CONFIGURE_FLAGS += $(foreach i, $(SYSTEM_STUFF),--with-system-$(i))
485
486 CC_PREFIX:=$(shell gcc -dumpmachine)-
487
488 ifneq "$(GCC_VERSION)" ""
489   ifneq "$(SYSTEM_GCC_VERSION)" "$(GCC_VERSION)"
490         BUILD_DEPS += , gcc-$(GCC_VERSION), g++-$(GCC_VERSION)
491   endif
492 endif
493
494         BUILDDEB_OPTIONS = -- -Zbzip2
495
496 ifneq "$(OOO_OGLTRANS_ARCHS)" ""
497   ifneq (,$(findstring mesa-headers,$(SYSTEM_STUFF)))
498         BUILD_DEPS += , libgl1-mesa-dev$(OOO_NO_OGLTRANS_ARCHS), libglu1-mesa-dev$(OOO_NO_OGLTRANS_ARCHS)
499   endif
500 endif
501 ifneq "$(ENABLE_OPENGL)" "y"
502         CONFIGURE_FLAGS += --disable-opengl
503 endif
504
505 ifneq "$(PACKAGE_SDK)" "y"
506         CONFIGURE_FLAGS += --disable-odk
507 endif
508
509 ifneq "$(ENABLE_MINIMIZER)" "y"
510         CONFIGURE_FLAGS += --disable-ext-presenter-minimizer
511 endif
512 ifneq "$(ENABLE_PRESENTER_CONSOLE)" "y"
513         CONFIGURE_FLAGS += --disable-ext-presenter-console
514 endif
515 ifeq "$(ENABLE_PDFIMPORT)" "y"
516         BUILD_DEPS += , libpoppler-dev (>= 0.8.0), libpoppler-private-dev, libpoppler-cpp-dev
517 else
518         CONFIGURE_FLAGS += --disable-ext-pdfimport
519 endif
520
521 # fails their tests
522 ifeq "$(DEB_HOST_ARCH)" "alpha"
523 ENABLE_GRAPHITE=n
524 SYSTEM_STUFF := $(filter-out graphite, $(SYSTEM_STUFF))
525 endif
526 ifeq "$(DEB_HOST_ARCH)" "armel"
527 ENABLE_GRAPHITE=n
528 SYSTEM_STUFF := $(filter-out graphite, $(SYSTEM_STUFF))
529 endif
530 ifeq "$(DEB_HOST_ARCH)" "sparc"
531 ENABLE_GRAPHITE=n
532 SYSTEM_STUFF := $(filter-out graphite, $(SYSTEM_STUFF))
533 endif
534
535 ifeq "$(ENABLE_GRAPHITE)" "y"
536   ifneq (,$(filter graphite, $(SYSTEM_STUFF)))
537         BUILD_DEPS += , libgraphite2-dev (>= 0.9.3) [!alpha !armel !sparc]
538   endif
539 else
540         CONFIGURE_FLAGS += --disable-graphite
541 endif
542
543
544 ifneq (,$(filter libexttextcat, $(SYSTEM_STUFF)))
545         BUILD_DEPS += , libexttextcat-dev (>= 3.1.1)
546         TEXTCAT_DATA_RECOMMENDS := libexttextcat-data
547 endif
548
549 ifneq (,$(filter jpeg, $(SYSTEM_STUFF)))
550        BUILD_DEPS += , libjpeg-dev
551 endif
552 ifneq (,$(filter libxml, $(SYSTEM_STUFF)))
553        BUILD_DEPS += , libxml2-dev
554        BUILD_DEPS += , libxslt1-dev
555        DBG_DBG_SUGGESTS+= , libxslt1-dbg
556 endif
557 ifneq (,$(filter expat, $(SYSTEM_STUFF)))
558        BUILD_DEPS += , libexpat1-dev
559 endif
560 ifneq (,$(filter odbc, $(SYSTEM_STUFF)))
561        BUILD_DEPS += , unixodbc-dev (>= 2.2.11)
562 endif
563 ifneq (,$(filter sane, $(SYSTEM_STUFF)))
564        BUILD_DEPS += , libsane-dev
565 endif
566 ifneq (,$(filter xextensions-headers, $(SYSTEM_STUFF)))
567        BUILD_DEPS += , libxrender-dev
568 endif
569 ifneq (,$(filter libpng, $(SYSTEM_STUFF)))
570        BUILD_DEPS += , libpng12-dev
571 endif
572
573 ifeq (,$(filter curl, $(SYSTEM_STUFF)))
574         BUILD_DEPS += , libcurl4-$(CURL_SECTYPE)-dev
575 endif
576
577 ifneq (,$(filter openssl, $(SYSTEM_STUFF)))
578         BUILD_DEPS += , libssl-dev
579   ifeq "$(SQUEEZE_BACKPORT)" "y"
580         DBG_DBG_SUGGESTS += , libssl$(shell readlink /usr/lib/libssl.so | cut -d"." -f3,4,5)-dbg
581   else
582         DBG_DBG_SUGGESTS += , libssl$(shell readlink /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/libssl.so | cut -d"." -f3,4,5)-dbg
583   endif
584 endif
585
586 ifneq "$(ENABLE_RSVG)" "y"
587   ifeq "$(SYSTEM_LIBRSVG)" "y"
588         BUILD_DEPS += , librsvg2-dev
589         CONFIGURE_FLAGS += --enable-librsvg=auto
590   else
591         CONFIGURE_FLAGS += --enable-librsvg=internal
592   endif
593 else
594         CONFIGURE_FLAGS += --enable-librsvg=no
595 endif
596
597 ifneq (,$(findstring db,$(SYSTEM_STUFF)))
598         BUILD_DEPS += , libdb-dev
599         DBG_DBG_SUGGESTS += , $(shell dpkg -s libdb-dev | grep Depends | awk '{ print $$2 }' | sed -e s/dev/dbg/)
600 endif
601
602 ifeq "$(BUILD_DBG_PACKAGE)" "y"
603   # {,kfreebsd-}{i386,amd64} should be big and fast (xz!) enough for this
604   ifneq (,$(findstring i386,$(DEB_HOST_ARCH)))
605         SMALL_SYMBOLS = n
606         USE_XZ_COMPRESS = y
607   else
608     ifneq (,$(findstring amd64,$(DEB_HOST_ARCH)))
609         SMALL_SYMBOLS = n
610         USE_XZ_COMPRESS = y
611     endif
612   endif
613         DBG_DBG_SUGGESTS+= , libc6.1-dbg [alpha ia64], libc0.1-dbg [kfreebsd-i386 kfreebsd-amd64], libc0.3-dbg [hurd-i386], libc6-dbg [!ia64 !alpha !kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], libatk1.0-dbg, libglib2.0-0-dbg, libgnomevfs2-0-dbg, libstdc++6-$(SYSTEM_GCC_VERSION)-dbg, libx11-6-dbg, libxext6-dbg, libxaw7-dbg, libxml2-dbg, libgtk2.0-0-dbg, libxau6-dbg, libice6-dbg, libsm6-dbg, libxinerama1-dbg, libfontconfig1-dbg, libhunspell-$(shell pkg-config --modversion hunspell | cut -d. -f1,2)-0-dbg, libcurl4-dbg
614 endif
615 ifeq "$(ENABLE_SYMBOLS)" "y"
616   # Small symbols?
617   ifeq "$(SMALL_SYMBOLS)" "y"
618         CONFIGURE_FLAGS += --enable-symbols=SMALL
619         CFLAGS := $(shell echo $(CFLAGS) | sed -e "s/-g/-g1/")
620         CXXFLAGS := $(shell echo $(CXXFLAGS) | sed -e "s/-g/-g1/")
621 export CFLAGS CXXFLAGS
622   else
623         CONFIGURE_FLAGS += --enable-symbols
624   endif
625 endif
626 ifeq (debug,$(findstring debug,$(DEB_BUILD_OPTIONS)))
627         CONFIGURE_FLAGS += --enable-debug
628 endif
629
630
631 # Build python depends from current python version
632 PYMAJOR:=$(shell python -c "import sys; print sys.version_info[0]")
633 PYMINOR:=$(shell python -c "import sys; print sys.version_info[1]")
634 PYMINORPLUS1:=$(shell python -c "import sys; print sys.version_info[1]+1")
635 PYTHON_SITE:=debian/python-uno/$(shell python -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())')
636 PY3MAJOR:=$(shell python3 -c "import sys; print (sys.version_info[0])")
637 PY3MINOR:=$(shell python3 -c "import sys; print (sys.version_info[1])")
638 PY3MINORPLUS1:=$(shell python3 -c "import sys; print (sys.version_info[1]+1)")
639 PYTHON3_SITE:=debian/python3-uno/$(shell python3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())')
640
641 ifeq "$(BUILD_PYUNO)" "y"
642         BUILD_DEPS += , python (>= 2.6.6-3+squeeze4)
643         DBG_DBG_SUGGESTS+= , python-dbg
644         BUILD_DEPS += , $(PYTHON)-dev (>= 2.6)
645   ifeq "$(ENABLE_PYTHON3)" "y"
646         BUILD_DEPS += , $(PYTHON3)-dev
647   endif
648 else
649         BUILD_DEPS += , python
650 endif
651
652         BUILD_DEPS += , debhelper (>= 7.2.3~)
653
654 ifeq "$(ENABLE_JAVA)" "y"
655   ifeq "$(BUILD_JARS_NATIVE)" "y"
656         STAMP_NATIVE_JARS = $(STAMP_DIR)/native-jars
657         JAVA_GCJ_DEPENDS = libgcj-common (>= 1:4.1.1-14)
658   endif
659 endif
660
661 ifeq "$(RUN_TESTTOOL)" "y"
662         CONFIGURE_FLAGS += --enable-hids
663 endif
664 ifneq (,$(filter cppunit, $(SYSTEM_STUFF)))
665         BUILD_DEPS += , libcppunit-dev (>= 1.12)
666 endif
667 ifeq "$(RUN_MAKE_CHECK)" "y"
668         BUILD_DEPS += , gdb
669   ifeq "$(ENABLE_JUNIT4)" "y"
670         BUILD_DEPS += , junit4 $(JUNIT_MIN_VER)
671   else
672         CONFIGURE_FLAGS += --without-junit
673   endif
674 else
675         CONFIGURE_FLAGS += --without-junit
676 endif
677
678 ifneq "$(BUILD_ONLY_EN_US)" "y"
679   ifeq (lang=,$(findstring lang=,$(DEB_BUILD_OPTIONS)))
680         ISOS=$(shell echo "$(DEB_BUILD_OPTIONS) " | sed -n 's/^.*lang=\([^\s].*\)\s.*/\1/p' | awk '{ print $$1 }' | sed -e 's/,/ /g')
681         HELPISOS=$(shell echo "$(DEB_BUILD_OPTIONS) " | sed -n 's/^.*lang=\([^\s].*\)\s.*/\1/p' | awk '{ print $$1 }' | sed -e 's/,/ /g')
682         LANGPACKISOS=$(shell echo "$(DEB_BUILD_OPTIONS) " | sed -n 's/^.*lang=\([^\s].*\)\s.*/\1/p' | awk '{ print $$1 }' | sed -e 's/,/ /g')
683   else
684         # Note that the first one here *has to be* en-US. the first one gets
685         # gid_Module_Root as filelist later and the rest gid_Module_Root.$iso
686         # but we can't/shouldn't do dynamic switching, so let en-US be the first
687         # one to that gid_Module_Root always is english and the other langpacks
688         # have gid_Module_Root.$iso
689         #ISOS=$(shell $(SOURCE_TREE)/bin/lo-xlate-lang -i all')
690         ISOS:=en-US af ar as ast be bg bn br bs ca ca-XV cs cy da de dz el \
691           en-GB en-ZA eo es et eu fa fi fr ga gl gu he hi hr hu id is it ja \
692           ka km ko ku lt lv mk mn ml mr nb ne nl nn nr nso oc om or \
693           pa-IN pl pt pt-BR ro ru rw si sk sl sr ss st sv \
694           ta te tg th tn tr ts ug uk uz ve vi xh zh-CN zh-TW zu
695         #HELPISOS:=$(shell $(SOURCE_TREE)/bin/lo-xlate-lang -i all') 
696         HELPISOS:=en-US ca ca-XV cs da de dz el en-GB es et eu fi fr gl hi hu it \
697           ja km ko nl om pl pt pt-BR ru sk sl sv zh-CN zh-TW
698         #LANGPACKISOS:=$(shell $(SOURCE_TREE)/bin/lo-xlate-lang -i all')
699         LANGPACKISOS:=en-US af ar as ast be bg bn br bs ca ca-XV cs cy da de dz el \
700           en-GB en-ZA eo es et eu fa fi fr ga gl gu he hi hr hu id is it ja \
701           ka km ko ku lt lv mk mn ml mr nb ne nl nn nr nso oc om or \
702           pa-IN pl pt pt-BR ro ru rw si sk sl sr ss st sv \
703           ta te tg th tn tr ts ug uk uz ve vi xh zh-CN zh-TW zu
704   endif
705 else
706         ISOS=en-US
707         HELPISOS=en-US
708         LANGPACKISOS=en-US
709 endif
710 BUILD_ISOS = $(ISOS)
711
712 ifneq "$(BUILD_ONLY_EN_US)" "y"
713   ifneq "$(BUILD_ISOS)" "en-US"
714         CONFIGURE_FLAGS += --with-lang="$(BUILD_ISOS)"
715   endif
716 endif
717
718 ifeq "$(ENABLE_JAVA)" "y"
719   ifeq "$(JDK)" "default"
720         JAVA_HOME=/usr/lib/jvm/default-java
721         BUILD_DEPS += , default-jdk$(OOO_NO_JAVA_ARCHS)
722   endif
723   ifeq "$(JDK)" "java-gcj-compat"
724         JAVA_HOME=/usr/lib/jvm/java-gcj
725     ifneq (,$(findstring armel,$(OOO_JAVA_ARCHS)))
726         BUILD_DEPS += , gcj-4.3 (>= 4.3.1-2) [armel]
727     endif
728   endif
729   ifeq "$(JDK)" "gcj-jdk"
730         JAVA_HOME=/usr/lib/jvm/java-gcj
731         BUILD_DEPS += , gcj-jdk$(OOO_NO_JAVA_ARCHS)
732   endif
733   ifeq "$(JDK)" "openjdk"
734     ifeq "$(SQUEEZE_BACKPORT)" "y"
735         BUILD_DEPS += , openjdk-$(JAVA_MAINVER)-jdk [$(filter-out $(OOO_GCJ_JDK_ARCHS),$(OOO_JAVA_ARCHS))]
736         JAVA_HOME=/usr/lib/jvm/java-$(JAVA_MAINVER)-openjdk
737     else
738       ifeq "$(JAVA_MAINVER)" "6"
739         BUILD_DEPS += , openjdk-$(JAVA_MAINVER)-jdk (>= 6b23~pre8-2) [$(filter-out ia64,$(filter-out $(OOO_GCJ_JDK_ARCHS),$(OOO_JAVA_ARCHS))])
740         BUILD_DEPS += , openjdk-7-jdk [ia64]
741         ifeq "$(DEB_HOST_ARCH)" "ia64"
742         JAVA_MAINVER=7
743         endif
744       else
745         BUILD_DEPS += , openjdk-$(JAVA_MAINVER)-jdk [$(filter-out $(OOO_GCJ_JDK_ARCHS),$(OOO_JAVA_ARCHS))]
746       endif
747         JAVA_HOME=/usr/lib/jvm/java-$(JAVA_MAINVER)-openjdk-$(DEB_HOST_ARCH)
748     endif
749         CONFIGURE_FLAGS += --with-java-target-version=1.5
750   endif
751         TEST_JAVA_HOME=$(JAVA_HOME)
752   ifneq "$(OOO_GCJ_JDK_ARCHS)" ""
753         BUILD_DEPS += , gcj-jdk [$(OOO_GCJ_JDK_ARCHS)]
754         BUILD_DEPS += , gcj-native-helper [$(OOO_GCJ_ARCHS)], libgcj-common (>= 1:4.4.1) [$(OOO_GCJ_ARCHS)]
755   endif
756   ifeq "$(ENABLE_MEDIAWIKI)" "y"
757         BUILD_DEPS += , ant (>= 1.7.0)$(OOO_NO_JAVA_ARCHS), ant-optional (>= 1.7.0)$(OOO_NO_JAVA_ARCHS)
758   else
759         BUILD_DEPS += , ant (>= 1.6.5)$(OOO_NO_JAVA_ARCHS)
760   endif
761         GCJ_VERSION = $(shell basename `readlink $(JAVA_HOME)/bin/gcj` | sed -e s/gcj-//)
762 ifeq "$(SQUEEZE_BACKPORT)" "y"
763         GCJ_JAWT_DEPENDS= $(shell dpkg -S /usr/lib/`readlink /usr/lib/libgcj_bc.so.1` | cut -d: -f1 | sed -e s/$$/-awt/)
764 else
765         GCJ_JAWT_DEPENDS= $(shell dpkg -S /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/gcj-$(GCJ_JDK_VERSION)-*/libgcj_bc.so.1 | cut -d: -f1 | sed -e s/$$/-awt/)
766 endif
767         DBG_DBG_SUGGESTS+= , $(shell echo $(GCJ_AWT_DEPENDS) | sed -e s/awt/dbg/)
768         JAVA_RUNTIME_DEPENDS = default-jre | gcj-jre | java-gcj-compat
769 #  ifneq (,$(GCJ_JAWT_DEPENDS))
770 #       JAVA_RUNTIME_DEPENDS += | $(GCJ_JAWT_DEPENDS)
771 #  endif
772   ifneq (,$(filter $(DEB_HOST_ARCH), $(OOO_OPENJDK_ARCHS)))
773     ifneq "$(DEB_HOST_ARCH)" "ia64"
774         JAVA_RUNTIME_DEPENDS += | openjdk-6-jre | openjdk-7-jre
775     else
776         JAVA_RUNTIME_DEPENDS += | openjdk-7-jre
777     endif
778   endif
779   ifneq (,$(filter $(DEB_HOST_ARCH), amd64 i386))
780         JAVA_RUNTIME_DEPENDS += | sun-java5-jre | sun-java6-jre
781   endif
782         JAVA_RUNTIME_DEPENDS += | java5-runtime
783         # Suns Java "packages"
784         JAVA_RUNTIME_DEPENDS += | jre
785         GCJ_JAWT_DIR=$(shell dirname `dpkg -L $(GCJ_JAWT_DEPENDS) | grep libjawt.so | head -n 1`)
786 export JAVA_HOME
787         CONFIGURE_FLAGS += --with-jdk-home=$(JAVA_HOME)
788         JAVA_COMMON_DEPENDS= , libreoffice$(VER)-java-common
789         JAVA_COMMON_DEPENDS_VERSION:= (>= $(BASE_VERSION)~)
790   ifneq (,$(filter saxon, $(SYSTEM_STUFF)))
791         CONFIGURE_FLAGS += --with-system-saxon --with-saxon-jar=/usr/share/java/saxonb.jar
792         BUILD_DEPS += , libsaxonb-java$(OOO_NO_JAVA_ARCHS)
793   endif
794   ifeq "$(PACKAGE_SDK)" "y"
795     ifeq "$(PACKAGE_UNOWINREG_DLL)" "y"
796       ifeq "$(BUILD_UNOWINREG_DLL)" "y"
797         CONFIGURE_FLAGS += --enable-build-unowinreg
798         ifeq "$(SQUEEZE_BACKPORT)" "y"
799         BUILD_DEPS += , gcc-mingw32 [$(OOO_UNOWINREG_DLL_ARCHS)], mingw32-runtime[$(OOO_UNOWINREG_DLL_ARCHS)]
800         CONFIGURE_FLAGS += --with-mingw-cross-compiler=i586-mingw32msvc-g++
801         else
802         BUILD_DEPS += , g++-mingw-w64-i686 [$(OOO_UNOWINREG_DLL_ARCHS)]
803         CONFIGURE_FLAGS += --with-mingw-cross-compiler=i686-w64-mingw32-g++
804         endif
805       endif
806     endif
807   endif
808   ifeq "$(ENABLE_MEDIAWIKI)" "y"
809         CONFIGURE_FLAGS += --enable-ext-wiki-publisher
810     ifneq (,$(filter apache-commons, $(SYSTEM_STUFF)))
811         MEDIAWIKI_BUILD_DEPS += , libcommons-codec-java$(OOO_NO_JAVA_ARCHS), libcommons-httpclient-java$(OOO_NO_JAVA_ARCHS), libcommons-lang-java$(OOO_NO_JAVA_ARCHS), libcommons-logging-java$(OOO_NO_JAVA_ARCHS)
812         MEDIAWIKI_JAR_DEPENDS := , libcommons-codec-java, libcommons-httpclient-java, libcommons-lang-java, libcommons-logging-java
813         BUILD_DEPS += $(MEDIAWIKI_BUILD_DEPS)
814         CONFIGURE_FLAGS += --with-commons-codec-jar=/usr/share/java/commons-codec.jar --with-commons-lang-jar=/usr/share/java/commons-lang.jar --with-commons-httpclient-jar=/usr/share/java/commons-httpclient.jar --with-commons-logging-jar=/usr/share/java/commons-logging.jar
815         CONFIGURE_FLAGS += --with-system-servlet-api
816       ifeq "$(SQUEEZE_BACKPORT)" "y"
817         BUILD_DEPS += (<< 1.1.1-9), $(shell dpkg -s libcommons-logging-java | grep Suggests | cut -d"," -f1 | sed -e s/^\ // | awk '{ print $$2 }')
818         CONFIGURE_FLAGS += --with-servlet-api-jar=$(shell dpkg -L `dpkg -s libcommons-logging-java | grep Suggests | cut -d"," -f1 | sed -e s/^\ // | awk '{ print $$2 }'` | grep servlet-api.*\.jar$ | head -n 1)
819       else
820         BUILD_DEPS += (>= 1.1.1-9), $(shell dpkg -s libcommons-logging-java | grep Suggests | cut -d"," -f5 | sed -e s/^\ // | awk '{ print $$1 }')
821         CONFIGURE_FLAGS += --with-servlet-api-jar=$(shell dpkg -L `dpkg -s libcommons-logging-java | grep Suggests | cut -d"," -f5 | sed -e s/^\ // | awk '{ print $$1 }'` | grep servlet-api.*\.jar$ | head -n 1)
822       endif
823     endif
824   endif
825   ifeq "$(ENABLE_REPORTDESIGN)" "y"
826         # report-builder
827     ifneq (,$(filter jfreereport, $(SYSTEM_STUFF)))
828         REPORT_BUILDER_BUILD_DEPS += , libbase-java$(OOO_NO_REPORTDESIGN_ARCHS), libsac-java$(OOO_NO_REPORTDESIGN_ARCHS), libxml-java (>= 1.1.6)$(OOO_NO_REPORTDESIGN_ARCHS), libflute-java (>= 1.1.6)$(OOO_NO_REPORTDESIGN_ARCHS), libpentaho-reporting-flow-engine-java (>= 0.9.4)$(OOO_NO_REPORTDESIGN_ARCHS), liblayout-java (>= 0.2.10)$(OOO_NO_REPORTDESIGN_ARCHS), libloader-java (>= 1.1.6)$(OOO_NO_REPORTDESIGN_ARCHS), libformula-java (>= 1.1.7)$(OOO_NO_REPORTDESIGN_ARCHS), librepository-java (>= 1.1.6)$(OOO_NO_REPORTDESIGN_ARCHS), libfonts-java (>= 1.1.6)$(OOO_NO_REPORTDESIGN_ARCHS), libserializer-java (>= 1.1.6)$(OOO_NO_REPORTDESIGN_ARCHS)
829         REPORT_BUILDER_JAR_DEPENDS := , libbase-java, libsac-java, libxml-java (>= 1.1.6), libflute-java (>= 1.1.6), libpentaho-reporting-flow-engine-java (>= 0.9.4), liblayout-java (>= 0.2.10), libloader-java (>= 1.1.6), libformula-java (>= 1.1.7), librepository-java (>= 1.1.6), libfonts-java (>= 1.1.6), libserializer-java (>= 1.1.6)
830         BUILD_DEPS += $(REPORT_BUILDER_BUILD_DEPS)
831         CONFIGURE_FLAGS += --with-libbase-jar=/usr/share/java/libbase.jar --with-libxml-jar=/usr/share/java/libxml.jar --with-flute-jar=/usr/share/java/flute.jar --with-jfreereport-jar=/usr/share/java/flow-engine.jar --with-liblayout-jar=/usr/share/java/liblayout.jar --with-libloader-jar=/usr/share/java/libloader.jar --with-libformula-jar=/usr/share/java/libformula.jar --with-librepository-jar=/usr/share/java/librepository.jar --with-libfonts-jar=/usr/share/java/libfonts.jar --with-libserializer-jar=/usr/share/java/libserializer.jar
832     endif
833     ifneq (,$(filter apache-commons, $(SYSTEM_STUFF)))
834         REPORT_BUILDER_BUILD_DEPS += , libcommons-logging-java$(OOO_NO_JAVA_ARCHS)
835         REPORT_BUILDER_JAR_DEPENDS += , libcommons-logging-java
836         CONFIGURE_FLAGS += --with-commons-logging-jar=/usr/share/java/commons-logging.jar
837       ifeq "$(SQUEEZE_BACKPORT)" "y"
838         BUILD_DEPS += (<< 1.1.1-9), $(shell dpkg -s libcommons-logging-java | grep Suggests | cut -d"," -f1 | sed -e s/^\ // | awk '{ print $$2 }')
839         CONFIGURE_FLAGS += --with-servlet-api-jar=$(shell dpkg -L `dpkg -s libcommons-logging-java | grep Suggests | cut -d"," -f1 | sed -e s/^\ // | awk '{ print $$2 }'` | grep servlet-api.*\.jar$ | head -n 1)
840       else
841         BUILD_DEPS += (>= 1.1.1-9), $(shell dpkg -s libcommons-logging-java | grep Suggests | cut -d"," -f5 | sed -e s/^\ // | awk '{ print $$1 }')
842         CONFIGURE_FLAGS += --with-servlet-api-jar=$(shell dpkg -L `dpkg -s libcommons-logging-java | grep Suggests | cut -d"," -f5 | sed -e s/^\ // | awk '{ print $$1 }'` | grep servlet-api.*\.jar$ | head -n 1)
843       endif
844     endif
845   else
846         CONFIGURE_FLAGS += --disable-ext-report-builder
847   endif
848         OOO_OFFICEBEAN_DEP = libreoffice$(VER)-officebean
849         BUILD_DEPS += , javahelper $(JAVAHELPER_MIN_VERSION)
850 else
851         CONFIGURE_FLAGS += --without-java
852         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-officebean -Nlibreoffice$(VER)-java-common -Nlibreoffice$(VER)-filter-mobiledev -Nlibreoffice$(VER)-gcj -Nlibreoffice$(VER)-script-provider-bsh -Nlibreoffice$(VER)-script-provider-js
853 endif
854
855 ifneq (,$(filter nss, $(SYSTEM_STUFF)))
856         BUILD_DEPS+= , libnss3-dev (>= 3.12.3)
857         DBG_DBG_SUGGESTS+= , libnss3-1d-dbg
858 endif
859 ifneq (,$(filter mozilla-headers, $(SYSTEM_STUFF)))
860         BUILD_DEPS+= , xulrunner-dev$(OOO_NO_NSPLUGIN_ARCHS)
861 endif
862         CONFIGURE_FLAGS += --disable-build-mozilla --disable-mozilla
863 ifeq (,$(findstring $(DEB_HOST_ARCH),$(OOO_NSPLUGIN_ARCHS)))
864         PACKAGE_NSPLUGIN=n
865         CONFIGURE_FLAGS += --disable-nsplugin
866 endif
867
868 ifeq "$(USE_SYSTEM_DMAKE)" "y"
869         BUILD_DEPS += , dmake (>= 1:4.11)
870 endif
871
872 ifneq (,$(filter hunspell, $(SYSTEM_STUFF)))
873         BUILD_DEPS += , libhunspell-dev $(HUNSPELL_MIN_VER)
874 endif
875         CONFIGURE_FLAGS += --with-external-dict-dir=$(DICT_DIR)
876
877 ifneq (,$(filter altlinuxhyph, $(SYSTEM_STUFF)))
878   ifeq "$(USE_LIBHYPHEN)" "y"
879         BUILD_DEPS += , libhyphen-dev $(LIBHYPHEN_MINVER)
880   else
881         BUILD_DEPS += , libaltlinuxhyph-dev $(LIBALTLINUXHYPH_MINVER)
882   endif
883 endif
884         CONFIGURE_FLAGS += --with-external-hyph-dir=$(HYPH_DIR)
885
886 ifneq "$(OOO_STLPORT_ARCHS)" ""
887         LIBSTLPORT_MINVER= (>= 4.6.2-3)
888         BUILD_DEPS += , libstlport4.6-dev $(LIBSTLPORT_MINVER) [$(OOO_STLPORT_ARCHS)]
889         CONFIGURE_FLAGS += --without-stlport
890 endif
891
892 ifneq (,$(filter boost, $(SYSTEM_STUFF)))
893   ifeq "$(BOOST_VERSION)" "1.34"
894     ifeq "$(SYSTEM_GCC_VERSION)" "4.4"
895         BUILD_DEPS += , libboost-dev (>= 1.34.1-15)
896     else
897         BUILD_DEPS += , libboost-dev
898     endif
899     ifeq "$(SYSTEM_GCC_VERSION)" "4.6"
900         BUILD_DEPS += , g++-4.6 (>= 4.6.2-12)
901     endif
902   else
903     ifneq "$(BOOST_VERSION)" "default"
904         BUILD_DEPS += , libboost$(BOOST_VERSION)-dev $(BOOST_MINVER)
905         #BUILD_DEPS += , libboost-thread$(BOOST_VERSION)-dev, libboost-program-options$(BOOST_VERSION)-dev
906     else
907         BUILD_DEPS += , libboost-dev $(BOOST_MINVER)
908         #BUILD_DEPS += , libboost-thread-dev, libboost-program-options-dev
909     endif
910   endif
911 endif
912
913 ifneq (,$(filter mdds, $(SYSTEM_STUFF)))
914         BUILD_DEPS += , libmdds-dev (>= 0.5.0)
915 endif
916
917 ifneq (,$(filter vigra, $(SYSTEM_STUFF)))
918         BUILD_DEPS += , libvigraimpex-dev
919 endif
920
921 ifneq (,$(filter sampleicc, $(SYSTEM_STUFF)))
922         BUILD_DEPS += , libsampleicc-dev, libicc-utils-dev
923 endif
924
925 ifeq "$(USE_EXTERNAL_CXXLIBS)" "y"
926   ifneq (,$(filter libwpd, $(SYSTEM_STUFF)))
927         BUILD_DEPS += , libwpd-dev (>= 0.9.0)
928   endif
929   ifneq (,$(filter sablot, $(SYSTEM_STUFF)))
930         BUILD_DEPS += , libsablot0-dev (>= 1.0.2-4)
931   endif
932   ifneq (,$(filter mythes, $(SYSTEM_STUFF)))
933         BUILD_DEPS += , libmythes-dev (>= 2:1.2)
934   endif
935   ifneq (,$(filter libwps, $(SYSTEM_STUFF)))
936         BUILD_DEPS += , libwps-dev (>= 0.2.0)
937   endif
938   ifneq (,$(filter libwpg, $(SYSTEM_STUFF)))
939         BUILD_DEPS += , libwpg-dev (>= 0.2.0)
940   endif
941   ifneq (,$(filter libvisio, $(SYSTEM_STUFF)))
942         BUILD_DEPS += , libvisio-dev
943   endif
944   ifneq (,$(filter libcmis, $(SYSTEM_STUFF)))
945         BUILD_DEPS += , libcmis-dev
946   endif
947 endif
948         CONFIGURE_FLAGS += --with-external-thes-dir=$(THES_DIR)
949
950 ifneq (,$(filter icu, $(SYSTEM_STUFF)))
951         BUILD_DEPS += , libicu-dev $(ICU_MINVER)
952 endif
953
954 ifneq (,$(filter xmlsec, $(SYSTEM_STUFF)))
955         BUILD_DEPS += , libxmlsec1-dev (>= 1.2.9), libxmlsec1-nss (>= 1.2.9), libxmlsec1-openssl (>= 1.2.9)
956 endif
957
958 ifeq "$(BUILD_CAIROCANVAS)" "y"
959   ifneq (,$(filter cairo, $(SYSTEM_STUFF)))
960         BUILD_DEPS+= , libcairo2-dev
961   endif
962 else
963         CONFIGURE_FLAGS+= --disable-cairo
964 endif
965
966 ifeq "$(BUILD_KDE)" "n"
967         CONFIGURE_FLAGS+= --disable-kde
968         CONFIGURE_FLAGS-= --disable-kde4
969         CONFIGURE_FLAGS+= --with-theme="$(patsubst $(DEFAULT_IMAGE),default,$(IMAGES))"
970 else
971         CONFIGURE_FLAGS += --disable-kde
972         CONFIGURE_FLAGS += --enable-kde4
973         KDE_ICONSET_DEP=libreoffice$(VER)-style-oxygen
974         BUILD_DEPS += , kdelibs5-dev $(KDELIBS_MINVER)
975         BUILD_DEPS += , libqt4-dev $(QT_MINVER)
976         DBG_DBG_SUGGESTS+= , kdelibs5-dbg, libqt4-dbg
977   ifeq "$(ENABLE_KDEAB)" "y"
978         ADDITIONAL_SECTIONS += KDE4Experimental
979         BUILD_DEPS += , kdepimlibs5-dev$(OOO_NO_BASE_ARCHS)
980   else
981         CONFIGURE_FLAGS+= --disable-kdeab
982   endif
983 endif
984
985 ifeq "$(ENABLE_MYSQLNATIVE)" "y"
986         CONFIGURE_FLAGS += --enable-ext-mysql-connector
987   ifneq (,$(filter mysql, $(SYSTEM_STUFF)))
988     ifneq (,$(filter mysql-cppconn, $(SYSTEM_STUFF)))
989         BUILD_DEPS += , libmysqlclient-dev
990     else
991         BUILD_DEPS += , libmysqlclient-dev (>= 5.5~)
992     endif
993   endif
994   ifneq (,$(filter mysql-cppconn, $(SYSTEM_STUFF)))
995         BUILD_DEPS += , libmysqlcppconn-dev $(MYSQLCPPCONN_MINVER)
996   endif
997 endif
998
999 ifeq "$(BUILD_GTK)" "n"
1000         CONFIGURE_FLAGS+= --disable-gtk
1001         DEBHELPER_OPTIONS+= -Nlibreoffice$(VER)-gtk -Nlibreoffice$(VER)-gnome
1002         CONFIGURE_FLAGS+= --with-theme="$(patsubst galaxy,default,$(IMAGES))"
1003 else
1004         BUILD_DEPS += , libgtk2.0-dev (>= 2.10)
1005 endif
1006 ifeq "$(BUILD_GTK3)" "y"
1007        BUILD_DEPS += , libgtk-3-dev (>= 3.2~)
1008        CONFIGURE_FLAGS+= --enable-gtk3
1009   ifneq (cairo,$(findstring cairo,$(SYSTEM_STUFF)))
1010   $(error GTK3 build fails without system-cairo!!)
1011   endif
1012 else
1013        DEBHELPER_OPTIONS+= -Nlibreoffice$(VER)-gtk3
1014 endif
1015
1016 ifeq "$(ENABLE_EVO2)" "n"
1017         CONFIGURE_FLAGS += --disable-evolution2
1018         DEBHELPER_OPTIONS += -Nlibreoffice-evolution
1019 else
1020         CONFIGURE_FLAGS += --enable-evolution2
1021         BUILD_DEPS += , libebook1.2-dev$(OOO_NO_BASE_ARCHS)
1022 endif
1023
1024 ifeq "$(ENABLE_SDBC_POSTGRESQL)" "y"
1025         BUILD_DEPS += , libpq-dev (>= 9.0~)
1026 else
1027         CONFIGURE_FLAGS += --disable-postgresql-sdbc
1028 endif
1029
1030 ifeq "$(ENABLE_RANDR)" "y"
1031         BUILD_DEPS += , libxrandr-dev
1032 else
1033         CONFIGURE_FLAGS += --disable-randr
1034 endif
1035
1036 ifeq "$(BUILD_BINFILTERS)" "y"
1037         CONFIGURE_FLAGS+= --enable-binfilter
1038         OOO_BINFILTER_DEP = libreoffice$(VER)-filter-binfilter
1039 endif
1040
1041 ifneq "$(BUILD_PYUNO)" "y"
1042         DEBHELPER_OPTIONS+= -Npython-uno -Npython3-uno -Nlibreoffice-script-provider-python
1043         CONFIGURE_FLAGS += --disable-python
1044 endif
1045
1046 ifeq "$(ENABLE_JAVA)" "y"
1047   ifneq (,$(filter lucene, $(SYSTEM_STUFF)))
1048         BUILD_DEPS += , liblucene2-java (>= 2.3.2)$(OOO_NO_JAVA_ARCHS)
1049         LUCENE_DEPENDS = liblucene2-java (>= 2.3.2)
1050         # safety measure; e.g. lucene 2.9 index cannot be handled by lucene 2.4
1051         LUCENE_CONFLICTS = liblucene2-java (<< $(shell dpkg -l liblucene2-java | grep ^ii | awk '{ print $$3 }' | cut -d. -f1,2)~)
1052         CONFIGURE_FLAGS += --with-lucene-core-jar=/usr/share/java/lucene-core.jar --with-lucene-analyzers-jar=/usr/share/java/lucene-analyzers.jar
1053   endif
1054   ifneq (,$(filter hsqldb, $(SYSTEM_STUFF)))
1055         BUILD_DEPS += , libhsqldb-java $(HSQLDB_MINVER)$(OOO_NO_JAVA_ARCHS)
1056         BASE_HSQLDB_DEPENDS = libhsqldb-java $(HSQLDB_MINVER), libhsqldb-java (<< $(HSQLDB_TOONEWVER)~)
1057         JAVA_GCJ_DEPENDS += , libhsqldb-java-gcj [$(OOO_GCJ_ARCHS)]
1058   else
1059     ifneq "$(JDK)" "openjdk"
1060         # hsqldb with jdk7 buildfix from jdk7.diff fails with gcj
1061         $(error hsqldb with jdk7 buildfix from jdk7.diff fails with gcj)
1062     endif
1063   endif
1064   ifeq "$(ENABLE_SCRIPT_PROVIDER_BSH)" "y"
1065     ifneq (,$(filter beanshell, $(SYSTEM_STUFF)))
1066         BUILD_DEPS += , bsh (>= 2.0b4)$(OOO_NO_JAVA_ARCHS)
1067         BSH_DEPENDS = bsh (>= 2.0b4)
1068         JAVA_GCJ_DEPENDS += , bsh-gcj [$(OOO_GCJ_ARCHS)]
1069     endif
1070         CONFIGURE_FLAGS += --enable-ext-scripting-beanshell
1071   else
1072         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-script-provider-bsh
1073   endif
1074   ifeq "$(ENABLE_SCRIPT_PROVIDER_JS)" "y"
1075         CONFIGURE_FLAGS += --enable-ext-scripting-javascript    
1076   else
1077         DEBHELPER_OPTIONS += -Nlibreoffice$(VER)-script-provider-js
1078   endif
1079 endif
1080
1081 ifneq (,$(filter lpsolve, $(SYSTEM_STUFF)))
1082   ifeq "$(USE_SHARED_LPSOLVE)" "y"
1083         BUILD_DEPS += , liblpsolve55-dev $(LPSOLVE_MIN_VERSION), lp-solve $(LPSOLVE_MIN_VERSION)
1084         LPSOLVE_DEP = lp-solve $(LPSOLVE_MIN_VERSION)
1085   else
1086         BUILD_DEPS += , liblpsolve55-dev $(LPSOLVE_MIN_VERSION)
1087   endif
1088   ifeq "$(USE_LIBSUITESPARSE)" "y"
1089         DBG_DBG_SUGGESTS+= , libsuitesparse-dbg
1090         BUILD_DEPS += , libsuitesparse-dev $(SUITESPARSE_MIN_VERSION)
1091   else
1092         DBG_DBG_SUGGESTS+= , libufsparse-dbg
1093         BUILD_DEPS += , libufsparse-dev
1094   endif
1095 endif
1096
1097 ifeq "$(USE_DBUS)" "y"
1098         BUILD_DEPS += , libdbus-glib-1-dev (>= 0.70)
1099         CONFIGURE_FLAGS += --enable-dbus
1100 endif
1101
1102 ifeq "$(USE_GSTREAMER)" "y"
1103         BUILD_DEPS += , libgstreamer-plugins-base0.10-dev
1104         GSTREAMER_PLUGINS_SUGGESTS += , gstreamer0.10-plugins-base, gstreamer0.10-plugins-good, gstreamer0.10-plugins-ugly, gstreamer0.10-plugins-bad, gstreamer0.10-ffmpeg
1105         DBG_DBG_SUGGESTS+= , libgstreamer0.10-0-dbg
1106 else
1107         CONFIGURE_FLAGS += --disable-gstreamer
1108 endif
1109
1110 ifneq (,$(filter neon, $(SYSTEM_STUFF)))
1111   ifneq "$(NEON_SECTYPE)" "openssl"
1112         BUILD_DEPS += , libneon$(NEONSONR)-$(NEON_SECTYPE)-dev
1113         DBG_DBG_SUGGESTS+= , libneon$(NEONSONR)-$(NEON_SECTYPE)-dbg
1114   else
1115         BUILD_DEPS += , libneon$(NEONSONR)-dev
1116         DBG_DBG_SUGGESTS+= , libneon$(NEONSONR)-dbg
1117   endif
1118 endif
1119
1120 ifeq "$(HELPISOS)" ""
1121         CONFIGURE_FLAGS += --without-helppack-integration
1122 endif
1123
1124 ifneq (,$(filter redland, $(SYSTEM_STUFF)))
1125         BUILD_DEPS += , librdf0-dev (>= 1.0.8)
1126         SHLIBS_OVERRIDE += -Xunordf
1127 endif
1128
1129 ifeq "$(ENABLE_GIO)" "y"
1130         CONFIGURE_FLAGS += --enable-gio --disable-gnome-vfs
1131         BUILD_DEPS += , libglib2.0-dev (>= 2.15.0)
1132 endif
1133
1134 ifeq "$(ENABLE_GVFS)" "y"
1135         BUILD_DEPS += , libgnomevfs2-dev
1136 else
1137         CONFIGURE_FLAGS += --disable-gnome-vfs
1138 endif
1139
1140 ifeq "$(ENABLE_GCONF)" "y"
1141         BUILD_DEPS += , libgconf2-dev, liborbit2-dev
1142 else
1143         CONFIGURE_FLAGS += --disable-gconf
1144 endif
1145         BUILD_DEPS += , gettext
1146
1147 ifeq "$(PACKAGE_TTF_OPENSYMBOL)" "y"
1148         BUILD_DEPS_INDEP += , fontforge
1149 endif
1150
1151 # Use compiler cache?  Include ccache in DEB_BUILD_OPTIONS for much faster rebuild times
1152 # A complete build uses about 9G of compiler cache.
1153 ifneq (ccache,$(findstring ccache,$(DEB_BUILD_OPTIONS)))
1154         CONFIGURE_FLAGS += --disable-ccache
1155 endif
1156
1157 ## Build n projects in parallel?
1158 ## DEB_BUILD_OPTIONS=parallel=<n>
1159 ## if not specified LibreOffices configure tries to find it out itself
1160 NUM_CPUS=$(shell echo "$(DEB_BUILD_OPTIONS) " | sed -n 's/^\(.* \)\?parallel=\([0-9]\+\).*$$/\2/p')
1161 AVAIL_CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
1162 ifeq "$(PARALLEL_BUILD)" "y"
1163         # http://bugs.debian.org/622644
1164         BUILD_DEPS += , make (>= 3.81-8.2)
1165   ifneq "$(NUM_CPUS)" "$(AVAIL_CPUS)"
1166         CONFIGURE_FLAGS += --with-num-cpus=$(NUM_CPUS)
1167   endif
1168 else
1169         CONFIGURE_FLAGS += --with-num-cpus=1
1170 endif
1171
1172
1173 ifeq ($(GCC_VERSION),)
1174         BUILD_PATH = /usr/lib/jvm/java-gcj/bin:$$PATH
1175 else
1176   ifeq ($(GCC_VERSION),snapshot)
1177         BUILD_PATH = /usr/lib/jvm/java-gcj/bin:/usr/lib/gcc-snapshot/bin:$$PATH
1178         BUILD_LD_LIBRARY_PATH = /usr/lib/gcc-snapshot/lib:$$LD_LIBRARY_PATH
1179         BUILD_DEPS += , gcc-snapshot
1180   else
1181         BUILD_PATH = /usr/lib/jvm/java-gcj/bin:$(CURDIR)/debian/usr/bin:$$PATH
1182   endif
1183 endif
1184 BUILD_PATH := $(CURDIR)/debian/usr/bin:$(BUILD_PATH)
1185 BUILD_LD_LIBRARY_PATH := $(BUILD_LD_LIBRARY_PATH):$(GCJ_JAWT_DIR)
1186
1187 ifeq "$(ENABLE_LDAP)" "y"
1188   ifeq "$(USE_OPENLDAP)" "y"
1189     BUILD_DEPS += , libldap2-dev
1190     LDAP_LIB := $(shell echo libldap-`grep LDAP_VENDOR_VERSION_M /usr/include/ldap_features.h | cut -d: -f2 | awk '{ print $$3 }' | xargs | sed -e "s/ /\./"`-`grep LDAP_VENDOR_VERSION_MAJOR /usr/include/ldap_features.h | cut -d: -f2 | awk '{ print $$3 }'`)
1191     CONFIGURE_FLAGS += --with-openldap
1192    endif
1193 else
1194   CONFIGURE_FLAGS += --disable-ldap
1195 endif
1196
1197 # Because of the stampdir magic, when you actually want to run a rule
1198 # over, you would have to remove the stamp manually.  Now, just do
1199 # 'debian/rules <target> <target> ... FORCE=1', and the stamp files
1200 # that match the given targets will be removed automagically.
1201 stampdir_targets=files.backup icons.scale patch.apply build.prepare.artwork 
1202 stampdir_targets+=build.prepare configure
1203 stampdir_targets+=setupins setup install install-arch install-indep
1204 stampdir_targets+=langpacks binary-common binary-arch binary-indep
1205 ifdef FORCE
1206  DUMMY:=$(shell rm -f $(patsubst %,$(STAMP_DIR)/%,$(filter $(stampdir_targets),$(MAKECMDGOALS))))
1207 endif
1208
1209 # If this is defined, then none of the 'long' commands will be run.  Useful
1210 # for testing.
1211 # test_rules=1
1212
1213 # Since the final stages use up a large amount of diskspace, provide targets to
1214 # remove them without needing a full rebuild
1215
1216 # Clean up the package directories (about 830M) 
1217 clean-debdir:
1218         dh_testdir
1219         rm -f debian/*.postinst debian/*.postrm debian/*.preinst debian/*.prerm debian/*.triggers
1220         dh_clean
1221
1222 clean:
1223         dh_testroot
1224         dh_testdir
1225
1226         # remove generated symlinks / java wrappers
1227         rm -rf debian/usr
1228
1229         if [ -f config.status ]; then \
1230                 $(MAKE) distclean; \
1231                 rm -f config.status; \
1232         fi
1233         find $(SOURCE_TREE)/solenv/gdb -name "*.pyc" -exec rm {} \;
1234         rm -rf */*.pro.obsolete
1235
1236         rm -rf $(SOURCE_TREE)/file-lists
1237         rm -rf $(SOURCE_TREE)/pyuno-py3
1238         rm -f configure aclocal.m4
1239         rm -f build_error.log
1240
1241 ifeq "$(HELPISOS)" ""
1242         rm -rf images*
1243 endif
1244
1245         # Files created in debian directory
1246         $(MAKE) -f debian/rules clean-debdir
1247         find debian -name "*.links" -exec rm {} \;
1248         if [ -d "$(STAMP_DIR)" ]; then rm -rf "$(STAMP_DIR)"; fi
1249         rm -f debian/shlibs.override.stdlibs
1250         rm -f debian/*.bug-script
1251         rm -f debian/scripts/aotcompile.py*
1252
1253         rm -f l10n.fdupes
1254         rm -f debian/shlibs.local
1255         rm -f debian/*.templates
1256
1257         rm -f debian/libreoffice-dev-doc.doc-base.*
1258         rm -f debian/*.menu
1259         for i in base calc core common draw impress math writer; do \
1260                 rm -f debian/libreoffice-$$i.lintian-overrides; \
1261         done
1262         rm -f debian/*.install debian/*.dirs debian/*.changelog
1263         rm -f debian/catalog.xml
1264         rm -f debian/openoffice.org-dtd-officedocument1.0.xmlcatalogs
1265         rm -f download.list
1266
1267         $(MAKE) -f debian/rules control
1268
1269
1270 # Generate control file, because we have so many different languages
1271 # Based on script by Martin Quinson <Martin.Quinson@tuxfamily.org>
1272 control: debian/control
1273 debian/control: $(wildcard debian/control*in) $(SOURCE_TREE)/bin/lo-xlate-lang  debian/rules
1274         chmod 755 $(SOURCE_TREE)/bin/lo-xlate-lang
1275         sed -e "s#libreofficeVER#libreoffice$(VER)#g" \
1276             -e "s#libreofficeVER#libreoffice$(VER)#g" \
1277             -e "s#%$(DEB_VENDOR)=\([^%]*\)%#, \1#g#" \
1278             -e "s#%[A-Za-z]*=[^%]*%##g#" \
1279             -e "s#%BUILD_DEPS%#$(strip $(BUILD_DEPS))#g" \
1280             -e "s#%BUILD_DEPS_INDEP%#$(strip $(BUILD_DEPS_INDEP))#g" \
1281             -e "s#@PYTHON_VERSION@#$(PYTHON_VERSION)#g" \
1282             -e "s#@BUGS@#$(BUGS)#g" \
1283             < debian/control.in > debian/control
1284
1285 ifeq "$(ENABLE_LDAP)" "y"
1286         # build-depends might not be satified when running debian/rules control. prevent bad subsitition with
1287         # nothing (libldap--)
1288         if [ ! -f /usr/include/ldap_features.h ]; then \
1289                 echo "/usr/include/ldap_features.h not found. Is libldap2-dev installed?"; \
1290                 echo 'Needed for properly setting $$(LDAP_LIB). Stopping,'; \
1291                 exit 1; \
1292         fi
1293 endif
1294
1295         for LNUM in $(filter-out en-US,$(LANGPACKISOS)) ; do \
1296             LNAME=`$(SOURCE_TREE)/bin/lo-xlate-lang -l $$LNUM | perl -e 'print ucfirst(<STDIN>);'`; \
1297             LCODE=`$(SOURCE_TREE)/bin/lo-xlate-lang -i $$LNUM | tr A-Z a-z`; \
1298             [ "$$LNUM" = ca-XV ] && continue; \
1299             CCODE=`echo $$LCODE | sed 's/-.*//'`; \
1300             case "$$LCODE" in \
1301                 bn|gu|pa-in|ml|or|te|ta) \
1302                         FONT_SUGGESTS=", ttf-`echo $$LNAME | tr A-Z a-z`-fonts"; \
1303                         ;; \
1304                 hi-in|ne|mr) \
1305                         FONT_SUGGESTS=", ttf-devanagari-fonts"; \
1306                         ;; \
1307                 he) \
1308                         FONT_SUGGESTS=", culmus"; \
1309                         ;; \
1310                 km) \
1311                         FONT_SUGGESTS=", ttf-khmeros"; \
1312                         ;; \
1313                 ar) \
1314                         FONT_SUGGESTS=", ttf-arabeyes"; \
1315                         ;; \
1316                 fa) \
1317                         FONT_SUGGESTS=", ttf-farsiweb"; \
1318                         ;; \
1319                 dz) \
1320                         FONT_SUGGESTS=", ttf-dzongkha"; \
1321                         ;; \
1322                 th) \
1323                         if [ "$(SQUEEZE_BACKPORT)" != "y" ]; then \
1324                         FONT_SUGGESTS=", fonts-thai-tlwg"; else \
1325                         FONT_SUGGESTS=", ttf-thai-tlwg"; fi; \
1326                         ;; \
1327                 *) \
1328                         FONT_SUGGESTS= ;; \
1329             esac; \
1330             case "$$LCODE" in \
1331                 rw) \
1332                         LOCALES_DEPENDS="locales (>= 2.3.6) | belocs-locales-data | locales-all (>= 2.3.6)" \
1333                         ;; \
1334                 ss|ts|km|ns|tn) \
1335                         LOCALES_DEPENDS="locales (>= 2.3.5-12) | belocs-locales-data | locales-all" \
1336                         ;; \
1337                 sr) \
1338                         LOCALES_DEPENDS="locales (>= 2.3.6.ds1-5) |  belocs-locales-data | locales-all" \
1339                         ;; \
1340                 as|or|nr) \
1341                         LOCALES_DEPENDS="locales (>= 2.3.6.ds1-1) | locales-all (>= 2.3.6.ds1-1)" \
1342                         ;; \
1343                 sw) \
1344                         LOCALES_DEPENDS="locales (>= 2.13-5) | locales-all (>= 2.13-5)" \
1345                         ;; \
1346                 *) \
1347                         LOCALES_DEPENDS="locales | belocs-locales-data | locales-all" \
1348                         ;; \
1349             esac; \
1350             sed -e "s|@LNAME@|$$LNAME|g" -e "s|@LCODE@|$$LCODE|g" \
1351                 -e "s|@CCODE@|$$CCODE|g" \
1352                 -e "s|@FONT_SUGGESTS@|$$FONT_SUGGESTS|g" \
1353                 -e "s:@LOCALES_DEPENDS@:$$LOCALES_DEPENDS:g" \
1354                         -e "s|libreofficeVER|libreoffice$(VER)|g" \
1355                 -e "s|@LDAP_LIB@|$(LDAP_LIB)|g" \
1356                 >> debian/control < debian/control.lang.in; \
1357         done
1358
1359 ifneq "$(HELPISOS)" ""
1360         for LNUM in $(HELPISOS) ; do \
1361             LNAME=`$(SOURCE_TREE)/bin/lo-xlate-lang -l $$LNUM | perl -e 'print ucfirst(<STDIN>);'`; \
1362             LCODE=`$(SOURCE_TREE)/bin/lo-xlate-lang -i $$LNUM | tr A-Z a-z`; \
1363             [ "$$LNUM" = ca-XV ] && continue; \
1364             CCODE=`echo $$LCODE | sed 's/-.*//'`; \
1365             sed -e "s|@LNAME@|$$LNAME|g" -e "s|@LCODE@|$$LCODE|g" \
1366                 -e "s|@CCODE@|$$CCODE|g" \
1367                         -e "s|libreofficeVER|libreoffice$(VER)|g" \
1368                 >> debian/control < debian/control.help.in; \
1369         done
1370         # en_US is in -common
1371         perl -pi -e 's|(Depends: libreoffice$(VER)-writer \| language-support-translations-en), libreoffice$(VER)-l10n-en-us|\1|' \
1372                 debian/control
1373         perl -pi -e 's|(Depends: libreoffice$(VER)-writer, libreoffice$(VER)-l10n-en-us)|\1, ttf-devanagari-fonts|' \
1374                 debian/control
1375 endif
1376         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1377                 >> debian/control < debian/control.ure.in
1378 ifeq "$(ENABLE_JAVA)" "y"
1379   ifneq "$(OOO_GCJ_JDK_ARCHS)" ""
1380     ifeq "$(BUILD_JARS_NATIVE)" "y"
1381         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1382                 >> debian/control < debian/control.gcj.in
1383     endif
1384   endif
1385 endif
1386 ifneq "$(OOO_NSPLUGIN_ARCHS)" ""
1387         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1388                 >> debian/control < debian/control.mozilla.in
1389 endif
1390 ifneq "$(OOO_OGLTRANS_ARCHS)" ""
1391         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1392                 >> debian/control < debian/control.ogltrans.in
1393 endif
1394 ifeq "$(ENABLE_JAVA)" "y"
1395   ifeq "$(ENABLE_MEDIAWIKI)" "y"
1396         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1397                 >> debian/control < debian/control.mediawiki.in
1398   endif
1399   ifeq "$(ENABLE_REPORTDESIGN)" "y"
1400         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1401                 >> debian/control < debian/control.reportdesign.in
1402   endif
1403 endif
1404 ifeq "$(ENABLE_MINIMIZER)" "y"
1405         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1406                 >> debian/control < debian/control.minimizer.in
1407 endif
1408 ifeq "$(ENABLE_PRESENTER_CONSOLE)" "y"
1409         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1410                 >> debian/control < debian/control.presenter.in
1411 endif
1412 ifeq "$(ENABLE_PDFIMPORT)" "y"
1413         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1414                 >> debian/control < debian/control.pdfimport.in
1415 endif
1416 ifeq "$(PACKAGE_TTF_OPENSYMBOL)" "y"
1417         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1418                 >> debian/control < debian/control.fonts.in
1419 endif
1420 ifeq "$(BUILD_DBG_PACKAGE)" "y"
1421         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1422                 >> debian/control < debian/control.debug.in
1423 endif
1424 ifeq "$(PACKAGE_SDK)" "y"
1425         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1426                 >> debian/control < debian/control.sdk.in
1427 endif
1428 ifeq "$(BUILD_KDE)" "y"
1429         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1430                 >> debian/control < debian/control.kde.in
1431           perl -pi -e 's/ libreoffice$(VER)-gnome,/ libreoffice-gnome | libreoffice$(VER)-kde,/' debian/control
1432 endif
1433 ifeq "$(ENABLE_SDBC_POSTGRESQL)" "y"
1434         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1435                 >> debian/control < debian/control.postgresql.in
1436 endif
1437 ifeq "$(ENABLE_MYSQLNATIVE)" "y"
1438         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1439                 >> debian/control < debian/control.mysql.in
1440 endif
1441 ifeq "$(ENABLE_EVO2)" "y"
1442         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1443                 >> debian/control < debian/control.evolution.in
1444 endif
1445 ifeq "$(BUILD_BINFILTERS)" "y"
1446         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1447                 >> debian/control < debian/control.binfilter.in
1448 endif
1449 ifeq "$(ENABLE_KDEAB)" "y"
1450         sed -e "s|libreofficeVER|libreoffice$(VER)|g" \
1451                 >> debian/control < debian/control.kab.in
1452 endif
1453
1454         perl -pi -e "s,%OOO_ARCHS%,$(OOO_ARCHS),g" debian/control
1455         perl -pi -e "s,%OOO_BASE_ARCHS%,$(OOO_BASE_ARCHS),g" debian/control
1456         perl -pi -e "s,%OOO_NO_BASE_ARCHS%,$(OOO_NO_BASE_ARCHS),"g debian/control
1457         perl -pi -e "s,%OOO_JAVA_ARCHS%,$(OOO_JAVA_ARCHS),g" debian/control
1458         perl -pi -e "s,%OOO_GCJ_ARCHS%,$(OOO_GCJ_ARCHS),g" debian/control
1459         perl -pi -e "s,%OOO_NSPLUGIN_ARCHS%,$(OOO_NSPLUGIN_ARCHS),g" debian/control
1460         perl -pi -e "s,%OOO_OGLTRANS_ARCHS%,$(OOO_OGLTRANS_ARCHS),g" debian/control
1461         perl -pi -e "s,%OOO_BINFILTER_ARCHS%,$(OOO_BINFILTER_ARCHS),g" debian/control
1462         perl -pi -e "s,%OOO_STLPORT_ARCHS%,$(OOO_STLPORT_ARCHS),g" debian/control
1463         perl -pi -e "s,%OOO_GCJ_JDK_ARCHS%,$(OOO_GCJ_JDK_ARCHS),g" debian/control
1464         perl -pi -e "s,%OOO_ARCH_DEP_EXTENSIONS_ARCHS%,$(OOO_ARCH_DEP_EXTENSIONS_ARCHS),g" debian/control
1465         perl -pi -e "s,%OOO_REPORTDESIGN_ARCHS%,$(OOO_REPORTDESIGN_ARCHS),g" debian/control
1466         perl -pi -e "s,%OOO_NO_REPORTDESIGN_ARCHS%,$(OOO_NO_REPORTDESIGN_ARCHS),g" debian/control
1467
1468 ifeq (sk,$(findstring sk,$(HELPISOS)))
1469         perl -pi -e 's/(Depends:.*)libreoffice-l10n-sk(.*)$$/\1libreoffice-l10n-sk, libreoffice-help-cs\2/' debian/control
1470 endif
1471 ifeq (pt-BR,$(findstring pt-BR,$(LANGPACKISOS)))
1472         perl -pi -e 's/libreoffice2-l10n-pt-br$$/libreoffice2-l10n-pt-br, broffice/' debian/control
1473         perl -pi -e 's/libreoffice2-l10n-pt-br$$/libreoffice2-l10n-pt-br, broffice/' debian/control
1474         perl -pi -e 's/libreoffice2-l10n-pt-br$$/libreoffice2-l10n-pt-br, broffice/' debian/control
1475 endif
1476         perl -pi -e 's/Package: libreoffice$(VER)-help-en-us/Package: libreoffice$(VER)-help-en-us\nReplaces: libreoffice$(VER)-common (<< 1:3.0.0~dev300m28)/' debian/control
1477
1478 ifeq "$(ENABLE_GIO)" "y"
1479         perl -pi -e 's/VFS/GIO/' debian/control
1480         # fix up "GNOME GIO"
1481         perl -pi -e 's/GNOME GIO/GIO/' debian/control
1482 endif
1483
1484 ifneq "$(SQUEEZE_BACKPORT)" "y" 
1485         perl -pi -e "s/(Build-Conflicts: .*)/\1, base-files (= 6.0), base-files (= 6.0squeeze1)/" debian/control
1486 endif
1487
1488 ifneq (,$(filter hsqldb, $(SYSTEM_STUFF)))
1489         perl -pi -e "s/(Build-Conflicts: .*)/\1, libhsqldb-java (>= $(HSQLDB_TOONEWVER)~)/" debian/control
1490 endif
1491
1492 ifeq (4.4,$(SYSTEM_GCC_VERSION))
1493         perl -pi -e 's/flex \|/flex (>= 2.5.25-7) |/' debian/control
1494 endif
1495
1496         python debian/scripts/joinctrl.py < debian/control > debian/control.tmp
1497         mv debian/control.tmp debian/control
1498
1499 ifeq "$(VER)" ""
1500         # no conflict with "universal Linux packages" as they have the version in their
1501         # names thankfully now
1502         perl -pi -e 's/libreoffice-unbundled, //' debian/control
1503 endif
1504
1505         # make -l10n-fi suggest libreoffice-spellcheck-fi to
1506         # match myspell-fi and libreoffice-soikko/-voikko
1507         perl -pi -e 's/myspell-dictionary-fi/myspell-dictionary-fi | libreoffice-spellcheck-fi/' debian/control
1508         # similar for tr (libreoffice-zemberek)
1509         perl -pi -e 's/myspell-dictionary-tr/myspell-dictionary-tr | libreoffice-spellcheck-tr/' debian/control
1510
1511 ifeq "$(BUILD_KDE)" "y"
1512         perl -pi -e 's/GConf backend$$/GConf backend\n  * libreoffice$(VER)-kde: KDE UI Plugin and KDE File Picker support/' debian/control
1513 endif
1514
1515 ifeq "$(ENABLE_LDAP)" "y"
1516         perl -pi -e 's/paperconf$$/paperconf\n  * $(LDAP_LIB): LDAP client library; needed for LibreOffice getting its\n    profiles from LDAP/' debian/control
1517 endif
1518
1519 ifneq "$(DICT_DIR)" "/usr/share/hunspell"
1520         perl -pi -e 's/^Breaks:.*myspell.*\n//' debian/control
1521 endif
1522
1523 .DELETE_ON_ERROR: debian/control
1524
1525 build: build-arch build-indep
1526 build-arch: $(STAMP_DIR)/build
1527 build-indep: $(STAMP_DIR)/build
1528
1529 # All 'important' targets have 2 lines.  The one that is run by
1530 # dpkg-buildpackage or the user, and the one that does the actual work.  This
1531 # indirection is needed so that the 'stamp' files that signify when a rule is
1532 # done can be located in a separate 'stampdir'.  Recall that make has no way to
1533 # know when a goal has been met for a phony target (like "build" or "install").
1534 #
1535 # At the end of each stampdir target, be sure to run the command 'touch $@'
1536 # so that the target will not be run again.  Removing the file will make
1537 # make run the target over.
1538
1539 config.status:
1540         dh_testdir
1541
1542         # Make sure needed scripts are executable
1543         set -e;\
1544         for FILE in debian/scripts/move-if-change \
1545                     debian/scripts/cleandupes \
1546                     debian/scripts/get_libebook_dep.sh \
1547                     autogen.sh; \
1548         do \
1549           chmod 755 $$FILE ;\
1550         done
1551
1552         mkdir -p $(STAMP_DIR)
1553
1554 ifneq ($(GCC_VERSION),)
1555   ifneq ($(GCC_VERSION),snapshot)
1556         # create links for gcc and g++ (and gij and gcj), ooo-build does not
1557         # honour overriding CC and CXX and we need to use gcc/g++ 4.0 or /
1558         # ant.mk wants gcj at the moment...
1559         mkdir -p $(CURDIR)/debian/usr/bin
1560         ln -sf /usr/bin/$(CC_PREFIX)gcc-$(GCC_VERSION) $(CURDIR)/debian/usr/bin/gcc
1561         ln -sf /usr/bin/$(CC_PREFIX)g++-$(GCC_VERSION) $(CURDIR)/debian/usr/bin/g++
1562         ln -sf /usr/bin/$(CC_PREFIX)gcc-$(GCC_VERSION) $(CURDIR)/debian/usr/bin/$(CC_PREFIX)gcc
1563         ln -sf /usr/bin/$(CC_PREFIX)g++-$(GCC_VERSION) $(CURDIR)/debian/usr/bin/$(CC_PREFIX)g++
1564         #ln -sf /usr/bin/$(CC_PREFIX)gcj-$(GCC_VERSION) $(CURDIR)/debian/usr/bin/gcj
1565         #ln -sf /usr/bin/gij-$(GCC_VERSION) $(CURDIR)/debian/usr/bin/gij
1566   else
1567     ifneq "$(CC_PREFIX)" ""
1568         mkdir -p $(CURDIR)/debian/usr/bin
1569         ln -sf /usr/lib/gcc-snapshot/bin/$(CC_PREFIX)gcc $(CURDIR)/debian/usr/bin/gcc
1570         ln -sf /usr/lib/gcc-snapshot/bin/$(CC_PREFIX)g++ $(CURDIR)/debian/usr/bin/g++
1571         ln -sf /usr/lib/gcc-snapshot/bin/$(CC_PREFIX)gcj $(CURDIR)/debian/usr/bin/gcj
1572         ln -sf /usr/lib/gcc-snapshot/bin/$(CC_PREFIX)gij $(CURDIR)/debian/usr/bin/gij
1573     endif
1574   endif
1575 endif
1576
1577         # Make sure we have /proc mounted - otherwise idlc will fail later.
1578         test -r /proc/version
1579
1580 ifneq "$(PACKAGE_UNOWINREG_DLL)" "y"
1581   ifneq "$(BUILD_UNOWINREG_DLL)" "y"
1582         # create fake file if file not there; we don't use it anyways.
1583         if [ ! -f $(TARFILE_LOCATION)/185d60944ea767075d27247c3162b3bc-unowinreg.dll ]; then \
1584                 touch $(TARFILE_LOCATION)/185d60944ea767075d27247c3162b3bc-unowinreg.dll; \
1585         fi
1586   endif
1587 endif
1588         # FIXME: Theoretically this should call ./configure instead of
1589         # it exists but that causes the configure flags NOT to be hnoured
1590         # somehow...
1591         PATH=$(BUILD_PATH) LD_LIBRARY_PATH=$(BUILD_LD_LIBRARY_PATH) ./autogen.sh $(CONFIGURE_FLAGS)
1592
1593         touch $@
1594
1595 build: $(STAMP_DIR)/build
1596 #$(STAMP_DIR)/build: config.status | src/fetch.log
1597 $(STAMP_DIR)/build: config.status
1598         dh_testdir
1599
1600         PATH=$(BUILD_PATH) LD_LIBRARY_PATH=$(BUILD_LD_LIBRARY_PATH) DEFAULT_TO_ENGLISH_FOR_PACKING=1 ARCH_FLAGS=$(ARCH_FLAGS) TMP=`mktemp -q -d` CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" $(MAKE) build gb_FULLDEPS= gb_Deliver_HARDLINK=T
1601
1602 ifeq "$(BUILD_PYUNO)" "y"
1603   ifeq "$(ENABLE_PYTHON3)" "y"
1604         # FIXME: won't work when pyuno is migrated to gbuild as all is directly in solver
1605         # then...
1606         rm -rf $(SOURCE_TREE)/pyuno-py3
1607         cp -ra $(SOURCE_TREE)/pyuno $(SOURCE_TREE)/pyuno-py3
1608         cd $(SOURCE_TREE)/pyuno-py3; \
1609                 rm -rf $(shell . $(SOURCE_TREE)/Env.Host.sh; echo $$OUTPATH$$PROEXT); \
1610                 . $(CURDIR)/$(SOURCE_TREE)/Env.Host.sh; \
1611                 PATH=$(BUILD_PATH) PYTHON=$(PYTHON3) PYTHON_CFLAGS=$(shell pkg-config --cflags python-$(PY3MAJOR).$(PY3MINOR)mu) PYTHON_LIBS=$(shell pkg-config --libs python-$(PY3MAJOR).$(PY3MINOR)mu) \
1612                 ../solenv/bin/build.pl  # NO DELIVER!
1613   endif
1614 endif
1615
1616 ifneq (nocheck,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
1617         $(CURDIR)/debian/rules check
1618 endif
1619
1620         touch $@
1621
1622 check: 
1623 ifeq "$(RUN_MAKE_CHECK)" "y"
1624 ifneq (,$(findstring $(DEB_HOST_ARCH),$(OOO_NO_BASE_ARCHS)))
1625         patch -p1 < $(CURDIR)/debian/patches/disable-db-tests.diff
1626 endif
1627 ifeq (,$(findstring $(DEB_HOST_ARCH),$(OOO_EXTENSIONS_ARCHS)))
1628         cd $(SOURCE_TREE)/smoketest && \
1629                 patch -p1 < $(CURDIR)/debian/patches/smoketest-disable-extension-tests.diff
1630 endif
1631
1632         t=`mktemp -q -d`; \
1633         cd $(SOURCE_TREE) && \
1634                 export PATH=$(BUILD_PATH); \
1635                 export TMPDIR=$$t; \
1636                 export HOME=$$t; \
1637                 export SAL_USE_VCLPLUGIN="svp"; \
1638                 if [ -x /usr/bin/gdb ]; then ulimit -c unlimited; fi && \
1639                 $(MAKE) -k check gb_FULLDEPS= gb_Deliver_HARDLINK=T && \
1640         rm -rf $$t
1641
1642 ifneq (,$(findstring $(DEB_HOST_ARCH),$(OOO_NO_BASE_ARCHS)))
1643         patch -p1 -R < $(CURDIR)/debian/patches/disable-db-tests.diff
1644 endif
1645 ifeq (,$(findstring $(DEB_HOST_ARCH),$(OOO_EXTENSIONS_ARCHS)))
1646         cd $(SOURCE_TREE)/smoketest && \
1647                 patch -p1 -R < $(CURDIR)/debian/patches/smoketest-disable-extension-tests.diff
1648 endif
1649 endif
1650
1651 install: $(STAMP_DIR)/install
1652 $(STAMP_DIR)/install: $(STAMP_DIR)/build
1653         dh_testdir
1654         dh_testroot
1655
1656         if [ -x /usr/bin/dh_prep ]; then dh_prep; else dh_clean -k; fi
1657         rm -f debian/*.install debian/*.dirs
1658
1659         # remove those for safety in case the languages might change on
1660         # testbuilds. then the /*/ in dh_installdocs in binary-* won't work
1661         # anymore (different dirs)
1662         rm -rf $(SOURCE_TREE)/instsetoo_native/util/LibreOffice
1663
1664         rm -rf $(SOURCE_TREE)/file-lists
1665
1666         # install LibreOffice.
1667         cd $(SOURCE_TREE)/; \
1668                  . $(CURDIR)/$(SOURCE_TREE)/Env.Host.sh; \
1669                  PATH=$(BUILD_PATH) \
1670                  DESTDIR=$(CURDIR)/debian/tmp \
1671                  $(MAKE) distro-pack-install
1672         export DESTDIR=$(CURDIR)/debian/tmp ;\
1673         export VERSION=$(OOVER); \
1674         export OOINSTBASE=$(OODIR); \
1675         export OOO_LANGS_LIST="$(ISOS)"; \
1676         $(CURDIR)/debian/scripts/gid2pkgdirs.sh
1677         
1678         # prepare install/dir files for dh
1679         for i in `cd $(CURDIR)/debian/tmp/pkg; ls -1 | xargs`; do \
1680                 echo "$${i}/usr/* usr" > debian/$$i.install; \
1681                 if [ "$$i" = "libreoffice-common" ]; then \
1682                         echo "$${i}/etc/* etc" >> debian/$$i.install; \
1683                 fi; \
1684                 (cd debian/tmp/pkg/$$i; find . -type d | sed -e "s,\./,,") \
1685                         > debian/$$i.dirs; \
1686         done
1687
1688         # the english resources should be in -common
1689         cat debian/libreoffice-l10n-en-US.dirs >> debian/libreoffice-common.dirs
1690         cat debian/libreoffice-l10n-en-US.install >> debian/libreoffice-common.install
1691         rm -f debian/libreoffice-l10n-en-US.dirs debian/libreoffice-l10n-en-US.install
1692
1693         # and ca-XV in -ca...
1694 ifeq (ca-XV,$(findstring ca-XV,$(LANGPACKISOS)))
1695         cat debian/libreoffice-l10n-ca-XV.dirs >> debian/libreoffice-l10n-ca.dirs
1696         cat debian/libreoffice-l10n-ca-XV.install >> debian/libreoffice-l10n-ca.install
1697         rm -f debian/libreoffice-l10n-ca-XV.dirs debian/libreoffice-l10n-ca-XV.install
1698 endif
1699 ifeq (ca-XV,$(findstring ca-XV,$(HELPISOS)))
1700         cat debian/libreoffice-help-ca-XV.dirs >> debian/libreoffice-help-ca.dirs
1701         cat debian/libreoffice-help-ca-XV.install >> debian/libreoffice-help-ca.install
1702         rm -f debian/libreoffice-help-ca-XV.dirs debian/libreoffice-help-ca-XV.install
1703 endif
1704
1705         # fixup case (-l10n-pt-BR -> l10n-pt-br etc.)
1706         for iso in $(ISOS); do \
1707                 pkgiso=`echo $$iso | tr A-Z a-z`; \
1708                 if [ "$$iso" != "$$pkgiso" ]; then \
1709                         if [ "$$iso" != "en-US" -a \
1710                           -e debian/libreoffice-l10n-$$iso.dirs -a \
1711                           -e debian/libreoffice-l10n-$$iso.install ]; then \
1712                                 mv debian/libreoffice-l10n-$$iso.dirs \
1713                                         debian/libreoffice-l10n-$$pkgiso.dirs; \
1714                                 mv debian/libreoffice-l10n-$$iso.install \
1715                                         debian/libreoffice-l10n-$$pkgiso.install; \
1716                         fi; \
1717                         if [ -e debian/libreoffice-help-$$iso.dirs -a \
1718                           -e debian/libreoffice-help-$$iso.install ]; then \
1719                                 mv debian/libreoffice-help-$$iso.dirs \
1720                                         debian/libreoffice-help-$$pkgiso.dirs; \
1721                                 mv debian/libreoffice-help-$$iso.install \
1722                                         debian/libreoffice-help-$$pkgiso.install; \
1723                         fi; \
1724                 fi; \
1725         done
1726
1727         # fix up still sneaking in ./. They break dh_install (it installs
1728         # but wrongly complains about it as not-installed files)
1729         perl -pi -e 's,\./,,' debian/libreoffice$(VER)-common.install
1730         perl -pi -e 's,\./,,' debian/ure.install
1731
1732 ifneq "$(HELPISOS)" ""
1733         # remove non-packaged localized help. This a) saves space 
1734         # and b) we need this for the following dh_install as there will be
1735         # no .install files created and dh_install will warn/fail due
1736         # to non-installed files.
1737         for iso in $(filter-out en-US,$(LANGPACKISOS)); do \
1738                 if ! `echo $(HELPISOS) | grep -q $$iso` || [ "$$iso" = "sk" ] ; then \
1739                         pkgiso=`echo $$iso | tr A-Z a-z`; \
1740                         rm -rf debian/tmp/pkg/libreoffice-help-$$iso; \
1741                         rm -f debian/libreoffice-help-$$pkgiso.dirs; \
1742                         rm -f debian/libreoffice-help-$$pkgiso.install; \
1743                 fi; \
1744         done
1745 endif
1746
1747 ifneq "$(BUILD_BINFILTERS)" "y"
1748         # somewhow there's a libreoffice-filter-binfilter here even when binfilter disabled.
1749         # go sure.
1750         rm -rf debian/tmp/pkg/libreoffice-filter-binfilter/usr/share/applications
1751 endif
1752
1753         dh_installdirs -A
1754         dh_install -A --sourcedir=debian/tmp/pkg --fail-missing
1755
1756         rm -rf debian/tmp/pkg
1757
1758         # move desktop files to their correct packages
1759         for i in base calc draw impress math writer binfilter; do \
1760                 if [ "$$i" = "binfilter" ]; then j=filter-binfilter; else j=$$i; fi; \
1761                 mkdir -p $(PKGDIR)-$$j/$(OODIR)/share/xdg; \
1762                 mv $(PKGDIR)-common/$(OODIR)/share/xdg/$$i.desktop \
1763                         $(PKGDIR)-$$j/$(OODIR)/share/xdg; \
1764         done
1765
1766         # move help to /usr/share
1767         for iso in $(HELPISOS); do \
1768                 pkgiso=`echo $$iso | tr A-Z a-z`; \
1769                 if [ -e $(PKGDIR)-help-$$pkgiso/usr ]; then \
1770                         mv $(PKGDIR)-help-$$pkgiso/usr/lib \
1771                                 $(PKGDIR)-help-$$pkgiso/usr/share; \
1772                 fi; \
1773         done
1774
1775 ifeq (sk,$(findstring sk,$(HELPISOS)))
1776         # add fake sk help
1777         mkdir -p $(PKGDIR)-help-sk/$(shell echo $(OODIR) | sed -e s/lib/share/)/help
1778         ln -s cs \
1779                 $(PKGDIR)-help-sk/$(shell echo $(OODIR) | sed -e s/lib/share/)/help/sk
1780 endif
1781
1782 ifeq "$(ENABLE_JAVA)" "y"
1783         # move officebean.jar into -officebean (They will be moved out of -core
1784         # in the install-arch target). Do the /usr/share move here already
1785         mkdir -p $(PKGDIR)-core/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes; \
1786         mv $(PKGDIR)-common/$(OODIR)/program/classes/officebean.jar \
1787                 $(PKGDIR)-core/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes
1788         # fix the classpath
1789         jh_classpath --classpath="ridl.jar unoil.jar jurt.jar juh.jar" \
1790                 $(PKGDIR)-core/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes/officebean.jar
1791         
1792   ifeq "$(PACKAGE_BASE)" "y"
1793         # move sdbc_hsqldb.jar into -base (do the move
1794         # to /usr/share/java here directly, we do it for the "rest"
1795         # later
1796         mkdir -p $(PKGDIR)-base/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes; \
1797         mkdir -p $(PKGDIR)-base/$(OODIR)/program/classes; \
1798         mv $(PKGDIR)-common/$(OODIR)/program/classes/sdbc_hsqldb.jar \
1799                 $(PKGDIR)-base/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes; \
1800         ln -s $(shell echo /$(OODIR) | sed -e s/lib/share/)/program/classes/sdbc_hsqldb.jar \
1801                 $(PKGDIR)-base/$(OODIR)/program/classes/sdbc_hsqldb.jar
1802
1803     ifeq (,$(filter hsqldb, $(SYSTEM_STUFF)))
1804         # we need this in -base. Otherwise we get unwanted package differences
1805         # in the unstable version and backports which might use internal hsqldb
1806         mkdir -p $(PKGDIR)-base/$(OODIR)/program/classes
1807         mv $(PKGDIR)-common/$(OODIR)/program/classes/hsqldb.jar \
1808                 $(PKGDIR)-base/$(OODIR)/program/classes
1809     endif
1810   else
1811         # remove sdbc_hsqldb.jar. otherwise ends up in -java-common
1812         rm -f $(PKGDIR)-common/$(OODIR)/program/classes/sdbc_hsqldb.jar
1813   endif
1814 endif
1815
1816 ifeq "$(BUILD_GTK)" "y"
1817         # Gtk quickstarter, so to -gtk (via -gnome)
1818         mkdir -p -m755 $(PKGDIR)-gnome/$(OODIR)/share/xdg
1819         mv $(PKGDIR)-common/$(OODIR)/share/xdg/qstart.desktop \
1820                 $(PKGDIR)-gnome/$(OODIR)/share/xdg
1821 endif
1822
1823 ifeq "$(PACKAGE_SDK)" "y"
1824         # move SDK documentation into own package
1825         rm -rf $(PKGDIR)-dev-doc
1826         mkdir -p $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev/docs
1827         mv $(PKGDIR)-dev/usr/share/doc/libreoffice/sdk/docs/* \
1828                 $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev/docs
1829         rmdir $(PKGDIR)-dev/usr/share/doc/libreoffice/sdk/docs
1830         mkdir -p $(PKGDIR)-dev-doc/$(OOSDKDIR)
1831         ln -sf /usr/share/doc/libreoffice-dev/docs \
1832                 $(PKGDIR)-dev/$(OOSDKDIR)/docs
1833         mv $(PKGDIR)-dev/$(OOSDKDIR)/examples \
1834                 $(PKGDIR)-dev-doc/$(OOSDKDIR)
1835 endif
1836
1837         # fixup ure-link symlink. The move is done in install-arch
1838         # but the link is in -common so we need to do it here.
1839         cd $(PKGDIR)-common/$(OODIR) && \
1840                 rm ure-link && ln -sf /$(OOUREDIR) ure-link
1841
1842 ifeq "$(ENABLE_EVO2)" "y"
1843         mkdir -p $(PKGDIR)-evolution/$(OODIR)/presets/database
1844         mkdir -p $(PKGDIR)-evolution/$(OODIR)/share/registry
1845         mv $(PKGDIR)-common/$(OODIR)/presets/database/evolocal.odb \
1846                 $(PKGDIR)-evolution/$(OODIR)/presets/database
1847 endif
1848
1849         find debian/tmp ! -perm -200 | xargs -r chmod u+w
1850
1851         touch $@
1852
1853 #
1854 # Generate maintainer scripts
1855 maintscripts: $(STAMP_DIR)/maintscripts
1856 $(STAMP_DIR)/maintscripts: $(wildcard debian/shell-lib*.sh) $(wildcard debian/*.preinst.in) $(wildcard debian/*.postinst.in) $(wildcard debian/*.prerm.in) $(wildcard debian/*.postrm.in) debian/vars.$(DEB_HOST_ARCH) debian/control
1857         dh_testdir
1858
1859         rm -f debian/*.{pre,post}{inst,rm}
1860
1861         # generate maintainer scripts from *.in
1862         for PKG in $(PACKAGES); do \
1863           for FILE in postinst postrm preinst prerm triggers; do \
1864             MAINTSCRIPT=debian/$$PKG.$$FILE ; \
1865             if [ -e $$MAINTSCRIPT.in ]; then \
1866               sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' < $$MAINTSCRIPT.in | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' > $$MAINTSCRIPT; \
1867               if echo $(ARCH_DEP_PACKAGES) | grep -q $$PKG && [ "$$FILE" != "triggers" ]; then \
1868                 grep PLATFORMID debian/vars.$(DEB_HOST_ARCH) >> $$MAINTSCRIPT; \
1869               fi; \
1870               echo "" >> $$MAINTSCRIPT; \
1871               if egrep -q "(add|remove|validate|sync)_extension" $$MAINTSCRIPT.in; then \
1872                  cat debian/shell-lib-extensions.sh >> $$MAINTSCRIPT; \
1873               fi; \
1874               sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' < $$MAINTSCRIPT.in | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >> $$MAINTSCRIPT; \
1875               perl -pi -e "s/\@LANGPACKISOS\@/$(LANGPACKISOS)/" $$MAINTSCRIPT; \
1876               perl -pi -e "s,\@OODIR\@,$(OODIR),g" $$MAINTSCRIPT; \
1877               perl -pi -e "s/\@VER\@/$(VER)/g" $$MAINTSCRIPT; \
1878             fi; \
1879           done; \
1880         done
1881
1882         touch $@
1883
1884 # Install files generated by setup into package directories
1885 langpacks: $(STAMP_DIR)/langpacks
1886 $(STAMP_DIR)/langpacks: $(STAMP_DIR)/install $(STAMP_DIR)/install-indep $(SOURCE_TREE)/bin/lo-xlate-lang
1887
1888         # remove empty uno_packages dirs somehow in the langpacks(?)
1889         for iso in `echo $(LANGPACKISOS) | tr A-Z a-z`; do \
1890                 rm -rf $(PKGDIR)-l10n-$$iso/$(OODIR)/share/uno_packages; \
1891         done
1892
1893         # remove ooo dirs somehow in the langpacks(?)
1894         for iso in `echo $(LANGPACKISOS) | tr A-Z a-z`; do \
1895                 rm -rf $(PKGDIR)-l10n-$$iso/$(OODIR)/share/dict/ooo; \
1896         done
1897
1898         # remove extra license files
1899         for iso in `echo $(LANGPACKISOS) | tr A-Z a-z`; do \
1900                 rm -rf $(PKGDIR)-l10n-$$iso/$(OODIR)/licenses; \
1901                 rm -f $(PKGDIR)-l10n-$$iso/$(OODIR)/share/readme/LICENSE*; \
1902         done
1903
1904         # remove extra readme files
1905         for iso in `echo $(LANGPACKISOS) | tr A-Z a-z`; do \
1906                 rm -rf $(PKGDIR)-l10n-$$iso/$(OODIR)/readmes; \
1907                 rm -f $(PKGDIR)-l10n-$$iso/$(OODIR)/share/readme/README*; \
1908         done
1909
1910         # remove empty help directories
1911         for iso in `echo $(LANGPACKISOS) | tr A-Z a-z`; do \
1912                 rm -rf $(PKGDIR)-l10n-$$iso/$(shell echo $(OODIR) | sed -e s/lib/share/)/help; \
1913                 rm -rf $(PKGDIR)-l10n-$$iso/$(OODIR)/help; \
1914         done
1915
1916         # install technical.dic
1917         for iso in $(LANGPACKISOS); do \
1918                 if [ "$$iso" = "en-US" ]; then pkg=common; \
1919                 elif [ "$$iso" = "ca-XV" ]; then pkg=l10n-ca; else pkg=l10n-`echo $$iso | tr A-Z a-z`; \
1920                 fi; \
1921                 mkdir -p $(PKGDIR)-$$pkg/$(OODIR)/share/wordbook/$$iso; \
1922                 install -m644 $(SOURCE_TREE)/extras/source/wordbook/technical.dic \
1923                         $(PKGDIR)-$$pkg/$(OODIR)/share/wordbook/$$iso/technical.dic; \
1924         done
1925
1926         # replace duplicate files in the langpacks with symlinks
1927         TMP=`mktemp -q`; \
1928                 fdupes --quiet --recurse --sameline --size \
1929                 debian/libreoffice$(VER)-common/$(OODIR) \
1930                 $(foreach d,$(shell echo $(filter-out en-US ca-XV,$(LANGPACKISOS)) | tr A-Z a-z),debian/libreoffice$(VER)-l10n-$(d)/$(OODIR)) \
1931                 > $$TMP && \
1932         debian/scripts/cleandupes --base=libreoffice$(VER) --prefix=debian < $$TMP && rm -f $$TMP
1933
1934 ifeq "$(DEB_VENDOR)" "Debian"
1935         # install Debian presentation template
1936         otps=`cd debian/templates; echo *.otp`; \
1937         for iso in $(LANGPACKISOS); do \
1938           [ "$$iso" = "en-US" ] && continue; \
1939           pkgiso=`echo $$iso | tr \[:upper:\] \[:lower:\]`; \
1940           [ "$$pkgiso" = "ca-xv" ] && pkgiso=ca; \
1941           mkdir -p $(PKGDIR)-l10n-$$pkgiso/$(OODIR)/share/template/$$iso/presnt; \
1942           for otp in $$otps; do \
1943             ln -sf ../../en-US/presnt/$$otp \
1944             $(PKGDIR)-l10n-$$pkgiso/$(OODIR)/share/template/$$iso/presnt/$$odt; \
1945           done; \
1946         done
1947 endif
1948
1949 ifeq (he,$(findstring he,$(LANGPACKISOS)))
1950         perl -pi -e 's#<prop oor:name="CTLSequenceChecking"><value>true</value></prop>#<prop oor:name="CTLSequenceChecking"><value>false</value></prop>#' $(PKGDIR)-l10n-he/$(OODIR)/share/registry/ctl_he.xcd
1951 endif
1952
1953         touch $@
1954
1955 native-jars: $(STAMP_NATIVE_JARS)
1956 $(STAMP_NATIVE_JARS): $(STAMP_DIR)/install
1957 ifeq "$(BUILD_JARS_NATIVE)" "y"
1958         rm -rf debian/tmp/native-jars
1959         mkdir -p debian/tmp/native-jars/gcj
1960         cp -a \
1961             $(PKGDIR)-common/$(OODIR)/program/classes/*.jar \
1962                 debian/tmp/native-jars/
1963         cp -a \
1964             $(PKGDIR)-core/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes/*.jar \
1965                 debian/tmp/native-jars/
1966 ifeq "$(PACKAGE_BASE)" "y"
1967         cp -a \
1968             $(PKGDIR)-base/$(OODIR)/program/classes/*.jar \
1969                 debian/tmp/native-jars/
1970 endif
1971         : # remove problematic ones
1972         rm -f debian/tmp/native-jars/ridl.jar
1973 ifneq "$(USE_SYSTEM_SAXON)" "y"
1974         rm -f debian/tmp/native-jars/saxon9.jar
1975 endif
1976         : # compile the others
1977         # the Debian i386 buildd, although having much ram still OOMs without
1978         # this (at unoil.jar).
1979         # Also the native jar build is MUCH faster with this. But it
1980         # won't be accepted into the official java-gcj-compat package so this
1981         # hack here is needed.
1982         if [ -e /usr/lib/gcc/aotcompile.py ]; then \
1983                 aotcompile_py=/usr/lib/gcc/aotcompile.py; \
1984         elif [ -e /usr/share/pyshared/aotcompile.py ]; then \
1985                 aotcompile_py=/usr/share/pyshared/aotcompile.py; \
1986         fi && \
1987         cp $$aotcompile_py debian/scripts
1988         cd debian/scripts && \
1989                 patch -p0 < $(CURDIR)/debian/aotcompile-256M-default.diff
1990         PYTHONPATH="debian/scripts:$(shell echo $(PYTHON_SITE) | sed -e s,debian/python-uno,,)" \
1991         AOT_MAKEFLAGS=-j$(NUM_CPUS) aot-compile -L /usr/lib/gcj/$(OODIRNAME) \
1992             debian/tmp/native-jars debian/tmp/native-jars/gcj
1993         gcj-dbtool -n debian/tmp/native-jars/tmp.db 64
1994         find debian/tmp/native-jars/gcj -name '*.db' -print0 \
1995             | xargs -r -0 \
1996                 gcj-dbtool -m debian/tmp/native-jars/tmp.db debian/tmp/native-jars/tmp.db || exit 1
1997         rm -f debian/tmp/native-jars/gcj/*.db
1998 endif
1999         touch $@
2000
2001 # Install files generated by setup into arch-dependent package directories
2002 install-arch: $(STAMP_DIR)/install-arch
2003 $(STAMP_DIR)/install-arch: $(STAMP_DIR)/install $(STAMP_NATIVE_JARS)
2004         dh_testdir
2005         dh_testroot
2006         umask 022
2007
2008         # move the URE to /usr/lib/ure
2009         mv debian/ure/$(OODIR)/ure debian/ure/usr/lib
2010         chmod 644 debian/ure/$(OOUREDIR)/lib/unorc
2011         rmdir debian/ure/$(OODIR)
2012         # move URE Java stuff to /usr/share/java
2013         mkdir -p debian/ure/usr/share/java
2014 ifeq "$(ENABLE_JAVA)" "y"
2015         mv debian/ure/$(OOUREDIR)/share/java/* \
2016                 debian/ure/usr/share/java
2017         cd debian/ure/$(OOUREDIR)/share/java && \
2018                 for i in $(CURDIR)/debian/ure/usr/share/java/*.jar; do \
2019                         ln -sf `echo $$i | sed -e 's,$(CURDIR)/debian/ure,,'` `basename $$i`; \
2020                 done
2021         # fix up Class-Path of jurt.jar to be able to find libjpipe.so.
2022         # See See http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=27765
2023         jh_classpath --classpath="ridl.jar unoloader.jar ../../lib /$(OOUREDIR)/lib/ ../bin/" \
2024                 $(CURDIR)/debian/ure/usr/share/java/jurt.jar
2025 endif
2026         # and the public libs to uno-libs3
2027         mkdir -p debian/uno-libs3/$(OOUREDIR)/lib
2028         for i in debian/ure/$(OOUREDIR)/lib/libuno_*so.3; do \
2029                 mv $$i debian/uno-libs3/$(OOUREDIR)/lib; \
2030                 ln -sf /$(OOUREDIR)/lib/`basename $$i` debian/uno-libs3/usr/lib/`basename $$i`; \
2031         done
2032
2033 ifeq "$(BUILD_KDE)" "y"
2034         # install files for KDEs "create new" ...
2035         mkdir -p $(PKGDIR)-kde/usr/share/templates/.source
2036         for i in $(SOURCE_TREE)/extras/source/shellnew/*; do \
2037                 cp $$i $(PKGDIR)-kde/usr/share/templates/.source/`basename $$i`; \
2038         done
2039         cat debian/templates/soffice-template.desktop.in \
2040                 | sed -e "s/@APP@/Writer/" \
2041                 | sed -e "s/@EXT@/odt/" \
2042                 | sed -e "s/@TYPE@/text/" \
2043                 > $(PKGDIR)-kde/usr/share/templates/soffice.odt.desktop
2044         cat debian/templates/soffice-template.desktop.in \
2045                 | sed -e "s/@APP@/Calc/" \
2046                 | sed -e "s/@EXT@/ods/" \
2047                 | sed -e "s/@TYPE@/spreadsheet/" \
2048                 > $(PKGDIR)-kde/usr/share/templates/soffice.ods.desktop
2049         cat debian/templates/soffice-template.desktop.in \
2050                 | sed -e "s/@APP@/Impress/" \
2051                 | sed -e "s/@EXT@/odp/" \
2052                 | sed -e "s/@TYPE@/presentation/" \
2053                 > $(PKGDIR)-kde/usr/share/templates/soffice.odp.desktop
2054         cat debian/templates/soffice-template.desktop.in \
2055                 | sed -e "s/@APP@/Draw/" \
2056                 | sed -e "s/@EXT@/odg/" \
2057                 | sed -e "s/@TYPE@/drawing/" \
2058                 > $(PKGDIR)-kde/usr/share/templates/soffice.odg.desktop
2059 endif
2060
2061         # split out gtk stuff
2062         rm -rf $(PKGDIR)-gtk
2063         mkdir -p -m755 $(PKGDIR)-gtk/$(OODIR)/program
2064 ifeq "$(BUILD_GTK3)" "y"
2065         rm -rf $(PKGDIR)-gtk3
2066         mkdir -p -m755 $(PKGDIR)-gtk3/$(OODIR)/program
2067         mv $(PKGDIR)-gnome/$(OODIR)/program/libvclplug_gtk3lo.so $(PKGDIR)-gtk3/$(OODIR)/program/
2068 endif
2069         mv $(PKGDIR)-gnome/$(OODIR)/program/* $(PKGDIR)-gtk/$(OODIR)/program/
2070 ifeq "$(BUILD_GTK)" "y"
2071         mkdir -p -m755 $(PKGDIR)-gtk/$(OODIR)/share
2072         mv $(PKGDIR)-gnome/$(OODIR)/share/xdg $(PKGDIR)-gtk/$(OODIR)/share
2073   ifeq "$(ENABLE_GIO)" "y"
2074         mv $(PKGDIR)-gtk/$(OODIR)/program/ucpgio1.uno.so \
2075                 $(PKGDIR)-gnome/$(OODIR)/program/
2076   endif
2077   ifeq "$(ENABLE_GVFS)" "y"
2078         mv $(PKGDIR)-gtk/$(OODIR)/program/ucpgvfs1.uno.so \
2079                 $(PKGDIR)-gnome/$(OODIR)/program/
2080   endif
2081   ifeq "$(ENABLE_GCONF)" "y"
2082         mv $(PKGDIR)-gtk/$(OODIR)/program/gconfbe* \
2083                 $(PKGDIR)-gnome/$(OODIR)/program
2084   endif
2085 endif
2086
2087 ifeq "$(ENABLE_EVO2)" "y"
2088         mkdir -p -m755 $(PKGDIR)-evolution/$(OODIR)/program
2089         mv $(PKGDIR)-gtk/$(OODIR)/program/libevoab*.so $(PKGDIR)-evolution/$(OODIR)/program
2090         mv $(PKGDIR)-gnome/$(OODIR)/share/registry/evoab.xcd \
2091                 $(PKGDIR)-evolution/$(OODIR)/share/registry
2092         # FIXME: When the rdb is correctly generated, move here, too.
2093 endif
2094
2095 ifeq "$(PACKAGE_NSPLUGIN)" "y"
2096         mkdir -p -m755 debian/mozilla-libreoffice$(VER)/$(OODIR)/program
2097         for f in libnpsoplugin.so nsplugin; do \
2098                 mv $(PKGDIR)-core/$(OODIR)/program/$$f debian/mozilla-libreoffice$(VER)/$(OODIR)/program; \
2099         done
2100         cd debian/mozilla-libreoffice$(VER) && \
2101                 mkdir -p usr/lib/mozilla/plugins && \
2102                         ln -sf /$(OODIR)/program/libnpsoplugin.so \
2103                            usr/lib/mozilla/plugins/libnpsoplugin.so
2104 endif
2105
2106 ifeq "$(PACKAGE_BASE)" "y"
2107         mkdir -p $(PKGDIR)-base-core/$(OODIR)/program
2108         mv $(PKGDIR)-base/$(OODIR)/program/libdbalo.so \
2109                 $(PKGDIR)-base-core/$(OODIR)/program
2110 endif
2111
2112 ifeq "$(ENABLE_JAVA)" "y"
2113   ifneq (,$(filter hsqldb, $(SYSTEM_STUFF)))
2114         # link to system hsqldb
2115         mkdir -p $(PKGDIR)-base/$(OODIR)/program/classes
2116         ln -sf /usr/share/java/hsqldb.jar \
2117                 $(PKGDIR)-base/$(OODIR)/program/classes/hsqldb.jar
2118   endif
2119 endif
2120
2121 ifeq "$(ENABLE_JAVA)" "y"
2122         rm -rf $(PKGDIR)-officebean
2123         mkdir -p -m755 $(PKGDIR)-officebean/$(OODIR)/program/classes
2124         mkdir -p -m755 $(PKGDIR)-officebean/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes
2125         mv $(PKGDIR)-core/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes/officebean.jar \
2126                 $(PKGDIR)-officebean/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes
2127         ln -s $(shell echo /$(OODIR) | sed -e s/lib/share/)/program/classes/officebean.jar \
2128                  $(PKGDIR)-officebean/$(OODIR)/program/classes/officebean.jar
2129         mv $(PKGDIR)-core/$(OODIR)/program/libofficebean.so \
2130                 $(PKGDIR)-officebean/$(OODIR)/program
2131 endif
2132
2133         mkdir -p -m755 $(PKGDIR)-base/usr/share/applications \
2134                        $(PKGDIR)-core/usr/share/applications
2135
2136         for f in `find debian -name 'xdg/*.desktop' ! -name "*soffice.od*"`; do \
2137                 if ! grep -q X-KDE-Protocols $$f; then \
2138                         echo 'X-KDE-Protocols=file,http,smb,ftp,webdav' >> $$f; \
2139                 fi; \
2140         done
2141         sed -i -e 's/Office;/Office;Graphics;/' $(PKGDIR)-draw/$(OODIR)/share/xdg/draw.desktop
2142         # invalid, according to lintian. make it shut up.
2143         for i in writer calc impress draw math base; do \
2144                 perl -pi -e 's/Application;//; s/X-Red-Hat-Base;//; s/X-SuSE-Core-Office;//; s/X-MandrivaLinux-.*;//;' $(PKGDIR)-$$i/$(OODIR)/share/xdg/$$i.desktop; \
2145         done
2146         perl -pi -e 's/Application;//' $(PKGDIR)-gtk/$(OODIR)/share/xdg/qstart.desktop
2147         # add version to .menu and .lintian-overrides
2148         for i in base calc draw impress math writer; do \
2149                 cat debian/libreoffice$(VER)-$$i.menu.in \
2150                         | sed -e s/@VER@/$(VER)/ \
2151                         > debian/libreoffice$(VER)-$$i.menu; \
2152         done; \
2153         for i in base calc core draw impress math writer; do \
2154                 cat debian/libreoffice$(VER)-$$i.lintian-overrides.in \
2155                         | sed -e s/@VER@/$(VER)/ \
2156                         > debian/libreoffice$(VER)-$$i.lintian-overrides; \
2157         done
2158
2159 ifeq "$(BUILD_PYUNO)" "y"
2160         # PyUNO packaging
2161         install -d $(PYTHON_SITE)
2162         mv debian/python-uno/$(OODIR)/program/uno.py $(PYTHON_SITE)
2163         mv debian/python-uno/$(OODIR)/program/unohelper.py $(PYTHON_SITE)
2164         touch debian/python-uno/$(OODIR)/program/pythonloader.unorc
2165         chmod u+w debian/python-uno/$(OODIR)/program/pythonloader.unorc
2166         ( echo '[Bootstrap]'; \
2167           echo 'PYTHONHOME=file:///usr/lib/python$(PYMAJOR).$(PYMINOR)' ;\
2168           echo 'PYTHONPATH=$$PYTHONHOME $$PYTHONHOME/site-packages $$PYTHONHOME/lib-dynload $$PYTHONHOME/lib-tk $$ORIGIN' \
2169         ) > debian/python-uno/$(OODIR)/program/pythonloader.unorc
2170         chmod u-w debian/python-uno/$(OODIR)/program/pythonloader.unorc
2171   ifeq "$(ENABLE_PYTHON3)" "y"
2172         install -d $(PYTHON3_SITE)
2173         cp $(PYTHON_SITE)/uno.py \
2174                 $(PYTHON3_SITE)
2175         cp $(PYTHON_SITE)/unohelper.py \
2176                 $(PYTHON3_SITE)
2177         mkdir -p debian/python3-uno/$(OODIR)/program
2178         mkdir -p debian/python3-uno/$(OODIR)/share/registry
2179         mkdir -p debian/python3-uno/$(OODIR)/share/Scripts
2180         cat debian/python-uno/$(OODIR)/program/pythonloader.unorc \
2181                 | sed -e "s/$(PYMAJOR).$(PYMINOR)/$(PY3MAJOR).$(PY3MINOR)/" \
2182                 > debian/python3-uno/$(OODIR)/program/pythonloader.unorc
2183         for i in pyuno.so pythonloader.uno.so libpyuno.so; do \
2184                 install -m644 $(SOURCE_TREE)/pyuno-py3/$(shell . $(SOURCE_TREE)/Env.Host.sh; echo $$OUTPATH$$PROEXT)/lib/$$i \
2185                         debian/python3-uno/$(OODIR)/program/$$i; \
2186         done
2187         cp debian/python-uno/$(OODIR)/program/pythonloader.py \
2188                 debian/python3-uno/$(OODIR)/program
2189         cp debian/python-uno/$(OODIR)/share/registry/pyuno.xcd \
2190                 debian/python3-uno/$(OODIR)/share/registry
2191         cp -r debian/python-uno/$(OODIR)/share/Scripts/python \
2192                 debian/python3-uno/$(OODIR)/share/Scripts
2193   endif
2194   ifeq "$(ENABLE_SCRIPT_PROVIDER_PYTHON)" "y"
2195         rm -f debian/libreoffice$(VER)-script-provider-python/$(OODIR)/share/extensions/script-provider-for-python/registration/LICENSE
2196   endif
2197
2198         mkdir -p debian/python-uno/usr/share/doc/python-uno
2199         cp -r $(SOURCE_TREE)/pyuno/demo \
2200           debian/python-uno/usr/share/doc/python-uno; \
2201         for i in $(SOURCE_TREE)/pyuno/doc/*; do \
2202                 cp $$i debian/python-uno/usr/share/doc/python-uno; \
2203         done
2204         cd debian/python-uno/usr/share/doc/python-uno && \
2205                 find . -type d -name "CVS" | xargs -r rm -rf
2206   ifeq "$(ENABLE_PYTHON3)" "y"
2207         mkdir -p debian/python3-uno/usr/share/doc/python3-uno
2208         cp -r $(SOURCE_TREE)/pyuno/demo \
2209           debian/python3-uno/usr/share/doc/python3-uno; \
2210         for i in $(SOURCE_TREE)/pyuno/doc/*; do \
2211                 cp $$i debian/python3-uno/usr/share/doc/python3-uno; \
2212         done
2213         cd debian/python3-uno/usr/share/doc/python3-uno && \
2214                 find . -type d -name "CVS" | xargs -r rm -rf
2215   endif
2216 endif
2217
2218         # should be empty now, remove if there
2219         rm -rf $(PKGDIR)-core/$(OODIR)/ure
2220
2221 ifeq "$(PACKAGE_SDK)" "y"
2222   ifeq "$(ENABLE_JAVA)" "y"
2223         # compat/safety symlink for SDK Java stuff moved to /usr/share
2224         rm -f $(PKGDIR)-dev/$(OOSDKDIR)/classes
2225         mkdir -p $(PKGDIR)-dev/$(OOSDKDIR)/classes/com/sun/star/lib/loader
2226         cd $(PKGDIR)-dev/$(OOSDKDIR)/classes/com/sun/star/lib/loader && \
2227                 for i in $(CURDIR)/$(PKGDIR)-dev/$(shell echo $(OOSDKDIR) | sed -e s/lib/share/)/classes/com/sun/star/lib/loader/*.class; do \
2228                         ln -s `echo $$i | sed -e 's,$(CURDIR)/$(PKGDIR)-dev,,'` `basename $$i`; \
2229                 done
2230     ifeq "$(PACKAGE_UNOWINREG_DLL)" "y"
2231         mkdir -p $(PKGDIR)-dev/$(OOSDKDIR)/classes/win
2232         chmod 644 $(PKGDIR)-dev/$(shell echo $(OOSDKDIR) | sed -e s/lib/share/)/classes/win/unowinreg.dll
2233         ln -s /$(shell echo $(OOSDKDIR) | sed -e s/lib/share/)/classes/win/unowinreg.dll \
2234                 $(PKGDIR)-dev/$(OOSDKDIR)/classes/win/unowinreg.dll
2235     else
2236         rm -rf $(PKGDIR)-dev/$(shell echo $(OOSDKDIR) | sed -e s/lib/share/)/classes/win 
2237     endif
2238   endif
2239         chmod 644 $(PKGDIR)-dev/$(OOSDKDIR)/configure.pl
2240         for i in csh csh.in; do \
2241                 perl -pi -e 's,/usr/bin/csh,/bin/csh,'\
2242                         $(PKGDIR)-dev/$(OOSDKDIR)/setsdkenv_unix.$$i; \
2243         done
2244         chmod 755 $(PKGDIR)-dev/$(OOSDKDIR)/setsdkenv_unix
2245         # create wrapper scripts
2246         cd $(PKGDIR)-dev/$(OOSDKDIR)/bin && \
2247         for i in *; do \
2248                 mv $$i $$i.bin && \
2249                 ( \
2250                   echo "#!/bin/sh"; \
2251                   echo "# wrapper script for OOos SDK programs"; \
2252                   echo ""; \
2253                   echo 'LD_LIBRARY_PATH=/$(OOUREDIR)/lib /$(OOSDKDIR)/bin/`basename $$0`.bin "$$@"'; \
2254                 ) > $$i; \
2255                 chmod 755 $$i; \
2256         done
2257         # remove symlink, it should be in -dev-doc
2258         cd $(PKGDIR)-dev/$(OOSDKDIR) && \
2259                 rm docs
2260
2261         # install gsicheck into -dev
2262         mkdir -p $(PKGDIR)-dev/$(OODIR)/program
2263         install -m755 $(SOURCE_TREE)/solver/$(shell . $(SOURCE_TREE)/Env.Host.sh; echo $$OUTPATH$$PROEXT)/bin/gsicheck \
2264                 $(PKGDIR)-dev/$(OODIR)/program/gsicheck.bin
2265         ( \
2266           echo '#! /bin/sh'; \
2267           echo 'LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}/$(OODIR)/program'; \
2268           echo 'export LD_LIBRARY_PATH'; \
2269           echo 'exec /$(OODIR)/program/gsicheck.bin "$$@"'; \
2270         ) > $(PKGDIR)-dev/$(OODIR)/program/gsicheck
2271         chmod 755 $(PKGDIR)-dev/$(OODIR)/program/gsicheck
2272
2273         # fix permissions
2274         find $(PKGDIR)-dev/usr/share/idl/$(OODIRNAME) -type f -exec chmod 644 {} \;
2275
2276 endif
2277
2278 ifeq "$(LINK_TO_STLPORT)" "y"
2279         rm -f debian/ure/$(OOUREDIR)/lib/libstlport*
2280         ln -s `readlink -f /usr/lib/libstlport_gcc.so` \
2281                 debian/ure/$(OOUREDIR)/lib/libstlport_gcc.so
2282 endif
2283
2284 ifeq "$(ENABLE_JAVA)" "y"
2285   ifeq "$(BUILD_JARS_NATIVE)" "y"
2286         rm -rf $(PKGDIR)-gcj/usr/lib/gcj
2287         mkdir -p $(PKGDIR)-gcj/usr/lib/gcj/$(OODIRNAME)
2288         cp -p debian/tmp/native-jars/gcj/* $(PKGDIR)-gcj/usr/lib/gcj/$(OODIRNAME)
2289         mkdir -p $(PKGDIR)-gcj/usr/share/gcj/classmap.d
2290         cp -p debian/tmp/native-jars/tmp.db \
2291                 $(PKGDIR)-gcj/usr/share/gcj/classmap.d/libreoffice.db
2292   endif
2293 endif
2294
2295 ifeq "$(PACKAGE_SDK)" "y"
2296   ifeq "$(ENABLE_JAVA)" "y"
2297         # install the UNO Java sources for e.g. eclipse
2298         mkdir -p $(CURDIR)/$(PKGDIR)-dev/usr/share/java
2299         cd $(SOURCE_TREE)/solver/$(shell . $(SOURCE_TREE)/*Env*.sh; echo $$OUTPATH$$PROEXT)/bin && \
2300                 for i in juh jurt jut ridl unoloader; do \
2301                         cp $${i}_src.zip \
2302                           $(CURDIR)/$(PKGDIR)-dev/usr/share/java; \
2303                 done
2304   endif
2305 endif
2306
2307 ifeq "$(ENABLE_JAVA)" "y"
2308         # hrmpf, again something like that, we really need to find the root cause for that
2309         ln -s libjava_uno.so \
2310                 debian/ure/$(OOUREDIR)/lib/libjava_uno
2311 endif
2312
2313         # remove empty resource directories
2314         for i in draw base writer impress calc math; do \
2315                 rm -rf $(PKGDIR)-$$i/$(OODIR)/program/resource; \
2316         done
2317
2318 ifneq "$(ENABLE_REPORTDESIGN)" "y"
2319         # unneeded. a no-Java arch, so the report-builder can't work anyway.
2320         # (and we need to remove it here anyway as it otherwise would end up
2321         # in -base)
2322         rm -f $(PKGDIR)-base/$(OODIR)/program/librpt*
2323 else
2324   ifeq "$(PACKAGE_BASE)" "y"
2325         # move rpt stuff into -report-builder-bin
2326         rm -rf $(PKGDIR)-report-builder-bin
2327         mkdir -p $(PKGDIR)-report-builder-bin/$(OODIR)/program
2328         mv $(PKGDIR)-base/$(OODIR)/program/librpt* \
2329                 $(PKGDIR)-report-builder-bin/$(OODIR)/program
2330   endif
2331 endif
2332
2333 ifeq "$(ENABLE_MINIMIZER)" "y"
2334         rm -f $(PKGDIR)-presentation-minimizer/$(OODIR)/share/extensions/presentation-minimizer/registration/LICENSE
2335 endif
2336
2337 ifeq "$(ENABLE_MYSQLNATIVE)" "y"
2338         rm -f $(PKGDIR)-mysql-connector/$(OODIR)/share/extensions/mysql-connector-ooo/registration/LICENSE
2339 endif
2340
2341 ifeq "$(ENABLE_PDFIMPORT)" "y"
2342         rm -f $(PKGDIR)-pdfimport/$(OODIR)/share/extensions/pdfimport/registration/LICENSE
2343 endif
2344
2345 ifeq "$(ENABLE_MEDIAWIKI)" "y"
2346         rm -f $(PKGDIR)-wiki-publisher/$(OODIR)/share/extensions/wiki-publisher/registration/LICENSE
2347 endif
2348
2349 #ifeq "$(PACKAGE_SDK)" "y"
2350 #       # install gengal stuff into -dev
2351 #       mkdir -p $(PKGDIR)-dev/$(OODIR)/program
2352 #       install -m755 $(SOURCE_TREE)/svx/$(shell . $(SOURCE_TREE)/*Env*.sh; echo $$OUTPATH$$PROEXT)/bin/gengal \
2353 #               $(PKGDIR)-dev/$(OODIR)/program/gengal
2354 #       install -m755 $(SOURCE_TREE)/svx/$(shell . $(SOURCE_TREE)/*Env*.sh; echo $$OUTPATH$$PROEXT)/bin/gengal.bin \
2355 #               $(PKGDIR)-dev/$(OODIR)/program/gengal.bin
2356 #endif
2357
2358         for i in $(ARCH_DEP_PACKAGES); do \
2359                 if [ -e debian/$$i.bug-script.in ]; then \
2360                         cat debian/$$i.bug-script.in \
2361                                 | sed -e "s/@PLATFORMID@/$(PLATFORMID)/" \
2362                                 > debian/$$i.bug-script; \
2363                 fi ;\
2364         done
2365         # generate .links files from *.in       
2366         for PKG in $(ARCH_DEP_PACKAGES); do \
2367           LINKS=debian/$$PKG.links ; \
2368           if [ -e $$LINKS.in ]; then \
2369             sed -e "s#\@OODIR\@#$(OODIR)#g" \
2370                 < $$LINKS.in > $$LINKS ; \
2371           fi; \
2372         done
2373         for PKG in $(ARCH_DEP_PACKAGES); do \
2374                 case $$PKG in \
2375                 python-uno|uno-libs*|ure*) \
2376                         ;; \
2377                 *) \
2378                         cat debian/changelog \
2379                         | sed -e '/^openoffice/,$$d' \
2380                         > debian/$$PKG.changelog; \
2381                         ;; \
2382                 esac; \
2383         done
2384
2385         touch $@
2386
2387 # Install files generated by setup into arch-independent package directories
2388 install-indep: $(STAMP_DIR)/install-indep
2389 #$(STAMP_DIR)/install-indep: debian/libreoffice$(VER).install 
2390 #$(STAMP_DIR)/install-indep: debian/libreoffice$(VER)-mimelnk.install 
2391 #$(STAMP_DIR)/install-indep: debian/libreoffice$(VER).dirs
2392 $(STAMP_DIR)/install-indep: $(STAMP_DIR)/install
2393         dh_testdir
2394         dh_testroot
2395
2396         # split out emailmerge stuff
2397         mkdir -p $(PKGDIR)-emailmerge/$(OODIR)/program
2398         for i in mailmerge msgbox officehelper; do \
2399                 mv $(PKGDIR)-common/$(OODIR)/program/$$i.py \
2400                         $(PKGDIR)-emailmerge/$(OODIR)/program; \
2401         done
2402
2403 ifneq "$(USE_GSTREAMER)" "y"
2404         # sound doesn't work anyway, remove the .wav files to save space
2405         rm -rf $(PKGDIR)-common/$(OODIR)/share/gallery/sounds
2406         rm -f $(PKGDIR)-common/$(OODIR)/share/gallery/sg9.*
2407 endif
2408
2409         rm -f $(PKGDIR)-common/$(OODIR)/program/oo_product.bmp
2410
2411         # install openoffice-xlate-lang
2412         install -d -m755 $(PKGDIR)-common/usr/share/$(OODIRNAME)/bin
2413         install -m755 $(SOURCE_TREE)/bin/lo-xlate-lang \
2414                 $(PKGDIR)-common/usr/share/$(OODIRNAME)/bin
2415
2416 ifeq "$(HELPISOS)" ""
2417         # when we don't build helpcontent2 here we are missing helpxsl.zip so
2418         # this file doesn't get installed either. Do it manually..
2419         mkdir -p -m755 $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/help && \
2420         cp $(SOURCE_TREE)/helpcontent2/source/auxiliary/main_transform.xsl \
2421                 $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/help
2422         cp $(SOURCE_TREE)/helpcontent2/source/auxiliary/idxcaption.xsl \
2423                 $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/help
2424         cp $(SOURCE_TREE)/helpcontent2/source/auxiliary/idxcontent.xsl \
2425                 $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/help
2426 endif
2427
2428 ifeq "$(PACKAGE_SDK)" "y"
2429         rm -f $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev-doc/LICENSE
2430         perl -pi -e 's,license.html,http://www.gnu.org/licenses/lgpl.html,' \
2431                 $(PKGDIR)-dev-doc/$(OOSDKDIR)/index.html
2432         find $(PKGDIR)-dev-doc/$(OODIR)/sdk/examples -type f -exec chmod 644 {} \;
2433 endif
2434
2435 ifeq "$(ENABLE_JAVA)" "y"
2436         # move common Java stuff to -java-common
2437         rm -rf $(PKGDIR)-java-common
2438         mkdir -p $(PKGDIR)-java-common/$(OODIR)/program/classes
2439         mkdir -p $(PKGDIR)-java-common/$(OODIR)/share/Scripts
2440         mkdir -p $(PKGDIR)-java-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes
2441         mv $(PKGDIR)-common/$(OODIR)/share/Scripts/java \
2442                 $(PKGDIR)-java-common/$(OODIR)/share/Scripts
2443         mv $(PKGDIR)-common/$(OODIR)/program/classes/* \
2444                 $(PKGDIR)-java-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes
2445         cd $(PKGDIR)-java-common/$(OODIR)/program/classes && \
2446                 for i in $(CURDIR)/$(PKGDIR)-java-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes/*; do \
2447                         case "`basename $$i`" in aportisdoc.jar|pexcel.jar|pocketword.jar) continue ;; \
2448                         *) ln -s `echo $$i | sed -e 's,$(CURDIR)/$(PKGDIR)-java-common,,'` `basename $$i` ;; esac; \
2449         done
2450
2451         # move into extra package
2452         rm -rf $(PKGDIR)-filter-mobiledev
2453         mkdir -p $(PKGDIR)-filter-mobiledev/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes
2454         mkdir -p $(PKGDIR)-filter-mobiledev/$(OODIR)/program/classes
2455         for i in aportisdoc pexcel pocketword; do \
2456           mv $(PKGDIR)-java-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes/$$i.jar \
2457                 $(PKGDIR)-filter-mobiledev/$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes; \
2458           ln -s /$(shell echo $(OODIR) | sed -e s/lib/share/)/program/classes/$$i.jar \
2459                 $(PKGDIR)-filter-mobiledev/$(OODIR)/program/classes; \
2460         done
2461         for i in pocketexcel palm pocketword; do \
2462           mkdir -p $(PKGDIR)-filter-mobiledev/$(OODIR)/share/registry && \
2463           mv $(PKGDIR)-common/$(OODIR)/share/registry/$$i.xcd \
2464                 $(PKGDIR)-filter-mobiledev/$(OODIR)/share/registry; \
2465         done
2466 endif
2467
2468         # fix permissions
2469         for i in editpic poll savepic show webcast; do \
2470                 chmod 755 $(PKGDIR)-common/$(OODIR)/share/config/webcast/$$i.pl; \
2471         done
2472         chmod 644 $(PKGDIR)-common/$(OODIR)/LICENSE.odt
2473         chmod 644 $(PKGDIR)-common/$(OODIR)/CREDITS.odt
2474
2475         rm -rf $(PKGDIR)-common/$(OODIR)/LICENSE
2476
2477         # move uno_packages/cache to /var and create symlink for for
2478         # documentation referencing it...
2479         rm -rf $(PKGDIR)-common/$(OODIR)/share/uno_packages/cache
2480         mkdir -p $(PKGDIR)-common/var/spool/$(OODIRNAME)/uno_packages/cache
2481         ln -s /var/spool/$(OODIRNAME)/uno_packages/cache \
2482                 $(PKGDIR)-common/$(OODIR)/share/uno_packages/cache
2483         perl -pi -e \
2484               's,\$$UNO_SHARED_PACKAGES/cache,file:///var/spool/$(OODIRNAME)/uno_packages/cache,g' \
2485                 $(PKGDIR)-common/$(OODIR)/program/unorc
2486         # FIXME: What is this? unorc per default only mentiones
2487         # share/uno_packages/cache...
2488         rm -rf $(PKGDIR)-common/$(OODIR)/presets/uno_packages
2489
2490         # move javasettingsunopkginstall.xml to /var/lib
2491         mkdir -p $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/usr/var/)/share/config
2492         mv $(PKGDIR)-common/$(OODIR)/share/config/javasettingsunopkginstall.xml \
2493                 $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/usr/var/)/share/config/javasettingsunopkginstall.xml
2494         ln -s /$(shell echo $(OODIR) | sed -e s/usr/var/)/share/config/javasettingsunopkginstall.xml \
2495                 $(PKGDIR)-common/$(OODIR)/share/config/javasettingsunopkginstall.xml
2496         # set PYTHONPATH in unopkg
2497         perl -pi -e 's,unset XENVIRONMENT,unset XENVIRONMENT\n\nexport PYTHONPATH=\"/$(OODIR)/program\"\n\n,' \
2498                 $(PKGDIR)-common/$(OODIR)/program/unopkg
2499
2500 ifeq "$(PACKAGE_TTF_OPENSYMBOL)" "y"
2501         mkdir -p debian/fonts-opensymbol/usr/share/fonts/truetype/openoffice
2502         mv $(PKGDIR)-common/$(OODIR)/share/fonts/truetype/opens___.ttf \
2503                 debian/fonts-opensymbol/usr/share/fonts/truetype/openoffice
2504         rm -rf $(PKGDIR)-common/$(OODIR)/share/fonts/truetype
2505 else
2506         rm -f $(PKGDIR)-common/$(OODIR)/share/fonts/truetype/opens___.ttf
2507 endif
2508
2509         # convert icons to xpm; we need them for the Debian menu policy...
2510         cd $(PKGDIR)-common/usr/share/icons/hicolor/32x32/apps && \
2511           for x in *.png; do convert $$x `basename $$x .png`.xpm; done
2512
2513 ifeq "$(ENABLE_JAVA)" "y"
2514   ifneq (,$(filter saxon, $(SYSTEM_STUFF)))
2515         ln -sf /usr/share/java/saxonb.jar \
2516                 $(PKGDIR)-java-common/$(OODIR)/program/classes/saxon9.jar
2517   endif
2518 endif
2519         # remove extra license files
2520         rm -rf $(PKGDIR)-common/$(OODIR)/licenses
2521         rm -f $(PKGDIR)-common/$(OODIR)/share/readme/LICENSE*
2522         rm -f $(PKGDIR)-common/$(OODIR)/THIRDPARTYLICENSEREADME.html
2523         rm -f $(PKGDIR)-common/$(OODIR)/LICENSE.html
2524
2525         # remove extra readme files
2526         rm -rf $(PKGDIR)-common/$(OODIR)/readmes
2527         rm -f $(PKGDIR)-common/$(OODIR)/share/readme/README*
2528         rm -f $(PKGDIR)-common/$(OODIR)/README.html
2529         rm -f $(PKGDIR)-common/$(OODIR)/README
2530
2531         # URE got moved to /usr/lib, so this is obsolete
2532         for i in ure/lib ure; do \
2533                 if [ -e $(PKGDIR)-common/$(OODIR)/$$i ]; then \
2534                         rmdir $(PKGDIR)-common/$(OODIR)/$$i; \
2535                 fi; \
2536         done
2537
2538         # move psprint.conf into /etc
2539         mkdir -p $(PKGDIR)-common/etc/$(OODIRNAME)
2540         mv $(PKGDIR)-common/$(OODIR)/share/psprint/psprint.conf \
2541                 $(PKGDIR)-common/etc/$(OODIRNAME)
2542         ln -s /etc/$(OODIRNAME)/psprint.conf \
2543                 $(PKGDIR)-common/$(OODIR)/share/psprint/psprint.conf
2544
2545         # prepare a fake sofficerc in the place where OOo expects it
2546         # which does nothing except reference the "normal" one
2547         # which we put into /etc
2548         mv $(PKGDIR)-common/$(OODIR)/program/sofficerc \
2549                 $(PKGDIR)-common/etc/$(OODIRNAME)/sofficerc
2550         ( \
2551           echo "# *DO NOT* CHANGE THIS FILE. IT ONLY TAKES THE SETTINGS FROM"; \
2552           echo "# /etc/$(OODIRNAME)/sofficerc. CHANGE THAT FILE IF YOU"; \
2553           echo "# REALLY WANT TO CHANGE SOMETHING."; \
2554           echo "FHS_CONFIG_FILE=file:///etc/$(OODIRNAME)/sofficerc"; \
2555           echo "" >> $(PKGDIR)-common/$(OODIR)/program/sofficerc; \
2556         ) > $(PKGDIR)-common/$(OODIR)/program/sofficerc
2557         cat $(PKGDIR)-common/etc/$(OODIRNAME)/sofficerc \
2558                 | perl -p -e 's/(.*)=(.*)/$$1=\$${\$$FHS_CONFIG_FILE:Bootstrap:$$1}/' \
2559                 >> $(PKGDIR)-common/$(OODIR)/program/sofficerc
2560         # except for URE_BOOTSTRAP...
2561         TMP=`mktemp -q`; \
2562                 grep -v URE_BOOTSTRAP $(PKGDIR)-common/$(OODIR)/program/sofficerc > $$TMP && mv $$TMP $(PKGDIR)-common/$(OODIR)/program/sofficerc && \
2563                 grep URE_BOOTSTRAP $(PKGDIR)-common/etc/$(OODIRNAME)/sofficerc >> $(PKGDIR)-common/$(OODIR)/program/sofficerc && \
2564                 grep -v URE_BOOTSTRAP $(PKGDIR)-common/etc/$(OODIRNAME)/sofficerc > $$TMP && mv $$TMP $(PKGDIR)-common/etc/$(OODIRNAME)/sofficerc
2565
2566         install -m 644 debian/soffice.sh \
2567           $(PKGDIR)-common/etc/$(OODIRNAME)/soffice.sh
2568
2569 ifeq "$(HELPISOS)" ""
2570         # the helpimgs are not included when we don't build with help here.
2571         # Add them now because libreoffice-help-* packaged in contrib or so
2572         # will need them
2573         set -e; \
2574         for i in $(IMAGES); do \
2575                 s=_$$i.zip; \
2576                 case "$$i" in $(DEFAULT_IMAGE)) s=.zip; esac; \
2577                 z=images$$s; \
2578                 echo "adding helpimgs to $$z..."; \
2579                 rm -rf $$z; mkdir $$z; \
2580                 cd $$z; \
2581                 unzip -q $(CURDIR)/$(PKGDIR)-common/$(OODIR)/share/config/$$z && \
2582                 cp -r $(CURDIR)/$(SOURCE_TREE)/default_images/res/helpimg res && \
2583                 chmod +w $(CURDIR)/$(PKGDIR)-common/$(OODIR)/share/config/$$z && \
2584                 zip -q -r $(CURDIR)/$(PKGDIR)-common/$(OODIR)/share/config/$$z *; \
2585                 cd ..; \
2586                 rm -rf $$z; \
2587         done
2588 endif
2589         set -e; \
2590         for i in $(IMAGES); do \
2591                 z=images_$$i.zip; p=$$i; \
2592                 case "$$i" in $(DEFAULT_IMAGE)) z=images.zip; esac; \
2593                 mkdir -p $(PKGDIR)-style-$$p/$(shell echo $(OODIR) | sed -e s/lib/share/)/share/config; \
2594                 mv $(PKGDIR)-common/$(OODIR)/share/config/$$z \
2595                         $(PKGDIR)-style-$$p/$(shell echo $(OODIR) | sed -e s/lib/share/)/share/config/; \
2596         done
2597
2598         rm -rf debian/openoffice.org-dtd-officedocument1.0
2599         mkdir -p debian/openoffice.org-dtd-officedocument1.0/$(shell echo $(OODIR) | sed -e s/libreoffice/openoffice/)/share/dtd
2600         mv $(PKGDIR)-common/$(OODIR)/share/dtd/officedocument \
2601                 debian/openoffice.org-dtd-officedocument1.0/$(shell echo $(OODIR) | sed -e s/libreoffice/openoffice/)/share/dtd
2602         cat debian/catalog.xml.in \
2603                 | sed -e "s,\@OODIR\@,$(shell echo $(OODIR) | sed -e s/libreoffice/openoffice/)," \
2604                 > debian/openoffice.org-dtd-officedocument1.0/$(shell echo $(OODIR) | sed -e s/libreoffice/openoffice/)/share/dtd/officedocument/1_0/catalog.xml
2605         cat debian/openoffice.org-dtd-officedocument1.0.xmlcatalogs.in \
2606                 | sed -e "s,\@OODIR\@,$(shell echo $(OODIR) | sed -e s/libreoffice/openoffice/)," \
2607                 > debian/openoffice.org-dtd-officedocument1.0.xmlcatalogs
2608         # symlink, as it's in a openoffice.org-* package
2609         cd debian/openoffice.org-dtd-officedocument1.0 && \
2610                 mkdir -p $(OODIR)/share/dtd && \
2611                 cd $(OODIR)/share/dtd && ln -s /$(shell echo $(OODIR) | sed -e s/libreoffice/openoffice/)/share/dtd/officedocument
2612
2613 ifeq "$(DEB_VENDOR)" "Debian"
2614         # install Debian presentation template
2615         mkdir -p $(PKGDIR)-common/$(OODIR)/share/template/en-US/presnt
2616         install -m644 debian/templates/*.otp $(PKGDIR)-common/$(OODIR)/share/template/en-US/presnt/
2617 endif
2618
2619 ifeq "$(PACKAGE_SDK)" "y"
2620         # add symlinks for docs and examples
2621         cd $(PKGDIR)-dev-doc/$(OOSDKDIR) && \
2622                 rm -rf docs && \
2623                 ln -sf /usr/share/doc/libreoffice-dev/docs docs
2624         mkdir -p $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev
2625         mkdir -p $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev-doc
2626         cd $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev-doc && \
2627                 ln -s /usr/share/doc/libreoffice-dev/docs docs
2628         cd $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev-doc && \
2629                 ln -s /$(OOSDKDIR)/examples examples
2630         cd $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev && \
2631                 ln -s /$(OOSDKDIR)/examples examples
2632         # and the index
2633         cd $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev && \
2634                 ln -s /$(OOSDKDIR)/index.html index.html
2635 endif
2636
2637 ifeq "$(ENABLE_JAVA)" "y"
2638   ifeq "$(ENABLE_SCRIPT_PROVIDER_BSH)" "y"
2639         mkdir -p $(PKGDIR)-script-provider-bsh/$(OODIR)/share/Scripts
2640         mv $(PKGDIR)-common/$(OODIR)/share/Scripts/beanshell \
2641                 $(PKGDIR)-script-provider-bsh/$(OODIR)/share/Scripts
2642   endif
2643
2644   ifeq "$(ENABLE_SCRIPT_PROVIDER_JS)" "y"
2645         mkdir -p $(PKGDIR)-script-provider-js/$(OODIR)/share/Scripts
2646         mv $(PKGDIR)-common/$(OODIR)/share/Scripts/javascript \
2647                 $(PKGDIR)-script-provider-js/$(OODIR)/share/Scripts
2648   endif
2649 endif
2650
2651 ifeq "$(ENABLE_REPORTDESIGN)" "y"
2652   ifeq "$(ENABLE_JAVA)" "y"
2653         for i in THIRDPARTYREADMELICENSE.html readme_en-US.html readme_en-US.txt \
2654                 registration/LICENSE; do \
2655                 rm -f $(PKGDIR)-report-builder/$(OODIR)/share/extensions/report-builder/$$i; \
2656         done
2657   endif
2658 endif
2659
2660 ifeq "$(ENABLE_MEDIAWIKI)" "y"
2661         rm -f $(PKGDIR)-wiki-publisher/$(OODIR)/share/extensions/wiki-publisher/license/THIRDPARTYLICENSEREADME.html
2662 endif
2663
2664         # unopkg creates stuff in there.
2665         mkdir -p $(PKGDIR)-common/$(OODIR)/share/prereg
2666         mkdir -p $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/usr/var/)/share/prereg/bundled
2667         ln -s /$(shell echo $(OODIR) | sed -e s/usr/var/)/share/prereg/bundled \
2668                 $(PKGDIR)-common/$(OODIR)/share/prereg/bundled
2669
2670         for i in $(ARCH_INDEP_PACKAGES); do \
2671                 if [ -e debian/$$i.bug-script.in ]; then \
2672                         cat debian/$$i.bug-script.in \
2673                                 | sed -e "s/@PLATFORMID@/$(PLATFORMID)/" \
2674                                 > debian/$$i.bug-script; \
2675                 fi ;\
2676         done
2677         # generate .links files from *.in       
2678         for PKG in $(ARCH_INDEP_PACKAGES); do \
2679           LINKS=debian/$$PKG.links ; \
2680           if [ -e $$LINKS.in ]; then \
2681             sed -e "s#\@OODIR\@#$(OODIR)#g" \
2682                 < $$LINKS.in > $$LINKS ; \
2683           fi; \
2684         done
2685         for PKG in $(ARCH_INDEP_PACKAGES); do \
2686                 case $$PKG in \
2687                 ttf-opensymbol|openoffice.org-dtd-officedocument1.0) \
2688                         ;; \
2689                 *) \
2690                         cat debian/changelog \
2691                         | sed -e '/^openoffice/,$$d' \
2692                         > debian/$$PKG.changelog; \
2693                         ;; \
2694                 esac; \
2695         done
2696
2697         # install extension shell lib for use by extensions not from here
2698         install -D -m644 debian/shell-lib-extensions.sh \
2699                 $(PKGDIR)-common/usr/share/$(OODIRNAME)/shell-lib-extensions.sh
2700
2701         # those are needed in /usr/share, too
2702         mkdir -p $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)
2703         mv $(PKGDIR)-common/$(OODIR)/help \
2704                 $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)
2705         # help is in /usr/share
2706         sed -i 's,$$(instpath)/help,/$(shell echo $(OODIR) | sed -e s/lib/share/)/help,' \
2707                 $(PKGDIR)-common/$(OODIR)/share/registry/main.xcd
2708
2709         # compat dirs, the split icons thing need it
2710         mkdir -p $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/program
2711         mkdir -p $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/program
2712         # three-layer symlinks also for /usr/share
2713         ln -s /$(OOUREDIR) \
2714                 $(PKGDIR)-common/$(shell echo $(OODIR) | sed -e s/lib/share/)/ure-link
2715
2716         # enable session handling and recovery
2717         perl -pi -e 's,<prop oor:name="DocumentStoreUIEnabled" oor:type="xs:boolean"><value>false</value></prop>,<prop oor:name="DocumentStoreUIEnabled" oor:type="xs:boolean"><value>true</value></prop>,' $(PKGDIR)-common/$(OODIR)/share/registry/main.xcd
2718
2719         # examples. move where they belong
2720         mkdir -p $(PKGDIR)-common/usr/share/doc/libreoffice-common/examples
2721         for i in oo-ldap.xcd.sample oo-ad-ldap.xcd.sample; do \
2722                 mv $(PKGDIR)-common/$(OODIR)/share/registry/$$i \
2723                         $(PKGDIR)-common/usr/share/doc/libreoffice-common/examples; \
2724                 ln -s /usr/share/doc/libreoffice-common/examples/$$i $(PKGDIR)-common/$(OODIR)/share/registry/$$i; \
2725         done
2726
2727         # install font config. Doesn't get installed with
2728         # --without-fonts.
2729         # FIXME: Shouldn't this be in /etc/fonts/conf.d with a symlink here?
2730         install -m644 -D $(SOURCE_TREE)/more_fonts/fonts/fc_local.conf \
2731                 $(PKGDIR)-common/$(OODIR)/share/fonts/truetype/fc_local.conf
2732
2733         # register technical.dic
2734         perl -pi -e 's/standard.dic;/standard.dic;technical.dic;/' $(PKGDIR)-common/$(OODIR)/share/registry/main.xcd
2735
2736 #ifeq "$(PACKAGE_SDK)" "y"
2737 #       # install gengal stuff into -dev
2738 #       mkdir -p $(PKGDIR)-dev/$(OODIR)/program
2739 #       install -m644 $(SOURCE_TREE)/svx/$(shell . $(SOURCE_TREE)/*Env*.sh; echo $$OUTPATH$$PROEXT)/bin/gengalrc \
2740 #               $(PKGDIR)-common/$(OODIR)/program/gengalrc
2741 #endif
2742         touch $@
2743
2744 binary-arch: $(STAMP_DIR)/binary-arch
2745 $(STAMP_DIR)/binary-arch: $(STAMP_DIR)/install-arch debian/control $(STAMP_DIR)/maintscripts
2746         dh_testdir
2747         dh_testroot
2748
2749         for pkg in $(ARCH_DEP_PACKAGES) ; do \
2750           rm -f debian/$$pkg.*.debhelper;\
2751           rm -rf debian/$$pkg/DEBIAN;\
2752         done
2753
2754         dh_installdocs -s -A debian/README.Debian
2755         dh_installdebconf -s
2756         dh_installman -s
2757         for i in writer calc draw base math impress; do \
2758                 for i in `find $(PKGDIR)-$$i -type l -name "lo*.1"`; do \
2759                         mv $$i $$i.gz; \
2760                         if [ "`readlink $$i`" != "libreoffice.1.gz" ]; then \
2761                                 ln -sf libreoffice.1.gz $$i.gz; \
2762                         fi; \
2763                 done; \
2764         done
2765         dh_installchangelogs -s -k
2766         dh_installmime -s
2767         dh_installmenu -s
2768 ifeq "$(ENABLE_JAVA)" "y"
2769   ifeq "$(BUILD_JARS_NATIVE)" "y"
2770         dh_nativejava -plibreoffice$(VER)-gcj -o
2771   endif
2772 endif
2773         dh_python2 -ppython-uno --no-guessing-versions --no-guessing-deps
2774 ifeq "$(ENABLE_PYTHON3)" "y"
2775         dh_python3 -ppython3-uno --no-guessing-deps
2776 endif
2777         dh_lintian -s
2778         dh_bugfiles -s -A
2779         dh_link -s
2780         dh_fixperms -s
2781 ifeq "$(BUILD_DBG_PACKAGE)" "y"
2782         dh_strip -s -Nure -Nuno-libs3 --dbg-package=libreoffice$(VER)-dbg
2783         dh_strip -pure --dbg-package=ure-dbg
2784         dh_strip -puno-libs3 --dbg-package=uno-libs3-dbg
2785         # dh_strip --dbg-package= is not idempotent, force copying of the binaries
2786         # again...
2787         rm -f $(STAMP_DIR)/install-arch
2788         # install .gdb-py
2789         for i in `find $(SOURCE_TREE)/solver/ -name "*-gdb.py"`; do \
2790                 if echo $$i | grep -q uno_; then pkg=uno-libs3; path=usr/lib/ure/lib; \
2791                 else pkg=libreoffice; path=usr/lib/libreoffice/program; fi; \
2792                 mkdir -p debian/$$pkg-dbg/usr/lib/debug/$$path && \
2793                 install -m644 $$i debian/$$pkg-dbg/usr/lib/debug/$$path/`basename $$i`; \
2794         done
2795 else
2796         dh_strip -s
2797 endif
2798         dh_icons -s
2799         dh_compress -s -X.py -X.mk -X.sxd
2800         dh_makeshlibs -puno-libs3 -V"uno-libs3 (>= $(shell grep UREPACKAGEVERSION $(SOURCE_TREE)/instsetoo_native/util/openoffice.lst | awk '{ print $$2 }')~), ure" -- -c0 -v`echo $(BINARY_VERSION) | cut -d: -f2`
2801         dh_makeshlibs -n -pure -V"ure (>= $(shell grep UREPACKAGEVERSION $(SOURCE_TREE)/instsetoo_native/util/openoffice.lst | awk '{ print $$2 }')~)" -- -v`echo $(BINARY_VERSION) | cut -d: -f2`
2802         # ugly hack, but why does that happen? It's not in .symbols...
2803         TMP=`mktemp -q`; \
2804         grep -v PRIVATE debian/uno-libs3/DEBIAN/symbols > $$TMP && \
2805         mv $$TMP debian/uno-libs3/DEBIAN/symbols && \
2806         chmod 644 debian/uno-libs3/DEBIAN/symbols
2807         dh_installdeb -s
2808 ifeq "$(BUILD_KFREEBSD)" "y"
2809         cat debian/shlibs.override.libc >> debian/shlibs.local
2810 endif
2811 ifeq (,$(filter icu, $(SYSTEM_STUFF)))
2812         cat debian/shlibs.override.icu >> debian/shlibs.local
2813 endif
2814 ifeq (,$(filter stdlibs, $(SYSTEM_STUFF)))
2815         cat debian/shlibs.override.stdlibs >> debian/shlibs.local
2816 endif
2817         # we need to do it in two steps. The new dpkg-shlibdeps doesn't find
2818         # /usr/lib/libgcj-bc.so when specifying -l$(GCJ_JAWT_DIR)
2819         # and therefore we must not use it for -gcj. But we *do* need it
2820         # for -officebean (libjawt.so is referenced there)
2821         LD_LIBRARY_PATH="debian/uno-libs3/$(OOUREDIR)/lib:debian/ure/$(OOUREDIR)/lib:$(PKGDIR)-core/$(OODIR)/program:$(PKGDIR)-base-core/$(OODIR)/program:$(PKGDIR)-base/$(OODIR)/program:$(PKGDIR)-writer/$(OODIR)/program" \
2822                 dh_shlibdeps -s -Nlibreoffice$(VER)-officebean \
2823                         -Lure -Luno-libs3 \
2824                         -ldebian/uno-libs3/$(OOUREDIR)/lib:debian/ure/$(OOUREDIR)/lib:$(PKGDIR)-core/$(OODIR)/program:$(PKGDIR)-base/$(OODIR)/program:$(shell dirname $(shell dpkg -L `echo $(GCJ_JAWT_DEPENDS) | sed -e s/-awt//` | grep _bc)) \
2825                         $(SHLIBS_OVERRIDE)
2826 ifneq (,$(filter redland, $(SYSTEM_STUFF)))
2827         # dpkg-shlibdeps "in practice" always will look for this in
2828         # /usr/lib/openoffice/basisX.Y/program due to the RPATH and the
2829         # dh_shlibdeps would fail. It's excluded, and we now need to do it
2830         # manually. Saves us a versioned build-conflict with ourselves
2831         # which quickly can get outdated
2832         perl -pi -e 's/(shlibs.*$$)/$$1, $(shell cat /var/lib/dpkg/info/$(shell dpkg -S /usr/lib/`objdump -p $(PKGDIR)-core/$(OODIR)/program/libunordf*.so | grep NEEDED | grep librdf | awk '{ print $$2 }'` | cut -d: -f1).shlibs | awk '{ print $$3,$$4,$$5 }')/' $(PKGDIR)-core.substvars
2833 endif
2834 ifeq "$(ENABLE_LIBRSVG)" "y"
2835   ifeq "$(SYSTEM_LIBRSVG)" "y"
2836         # dlopen()'ed only for some weird reason (even when --with-librsvg=internal!)
2837         perl -pi -e 's/(shlibs.*$$)/$$1, $(shell cat /var/lib/dpkg/info/librsvg*.shlibs | awk '{ print $$3,$$4,$$5 }')/' $(PKGDIR)-core.substvars
2838   endif
2839 endif
2840         # don't make uno-libs3 depend on ure...
2841         perl -pi -e 's/, ure$$//' debian/uno-libs3.substvars
2842         # .. and prevent ure to depend on itself..
2843         perl -pi -e 's/, ure \(.*\)$$//' debian/ure.substvars
2844 ifeq "$(ENABLE_JAVA)" "y"
2845         LD_LIBRARY_PATH="debian/uno-libs3/$(OOUREDIR)/lib:debian/ure/$(OOUREDIR)/lib:$(PKGDIR)-core/$(OODIR)/program" \
2846                 dh_shlibdeps -plibreoffice$(VER)-officebean \
2847                         -Lure -Luno-libs3 \
2848                         -ldebian/uno-libs3/$(OOUREDIR)/lib:debian/ure/$(OOUREDIR)/lib:$(PKGDIR)-core/$(OODIR)/program:$(GCJ_JAWT_DIR) \
2849                         $(SHLIBS_OVERRIDE)
2850 endif
2851 ifeq "$(LINK_TO_STLPORT)" "y"
2852         perl -pi -e 's/(shlibs.*$$)/$$1, $(shell cat /var/lib/dpkg/info/libstlport4.6*.shlibs | awk '{ print $$3,$$4,$$5 }')/' debian/ure.substvars
2853 endif
2854 ifeq "$(ENABLE_JAVA)" "y"
2855         jh_depends -s -Xlibreoffice$(VER)-gcj -Xlibreoffice$(VER)-dbg -Xure
2856   ifeq "$(PACKAGE_BASE)" "y"
2857         perl -pi -e "s/libhsqldb-java/$(BASE_HSQLDB_DEPENDS)/" \
2858                 debian/libreoffice$(VER)-base.substvars
2859         perl -pi -e "s/base-files,//" \
2860                 debian/libreoffice$(VER)-base.substvars
2861   endif
2862         # jh_depends adds ure (${source:Version}) entries. They are overly strict
2863         # and do not fit anyway given ure has a different versioning scheme. Excluded
2864         # above, readd here  unversioned
2865         perl -pi -e 's/^(java:Depends.*$$)/\1, ure/' \
2866                 debian/libreoffice$(VER)-officebean.substvars
2867 endif
2868 # This switch to dh_shlibdeps reduces the 'libXXX not found' warnings but
2869 # causes ldd crashes sometimes when used with fakeroot:
2870 #          -l $(PKGDIR)-core/$(OPENOFFICEDIR)/program
2871         dh_gencontrol -s $(DEBHELPER_OPTIONS) -Nure -Nure-dbg -Nuno-libs3 -Nuno-libs3-dbg \
2872                 -Nlibreoffice$(VER)-presentation-minimizer \
2873                 -Nlibreoffice$(VER)-presenter-console \
2874                 -Nlibreoffice$(VER)-pdfimport \
2875                 -Nlibreoffice$(VER)-mysql-connector -- \
2876                 -V"ure:Version=$(shell grep UREPACKAGEVERSION $(SOURCE_TREE)/instsetoo_native/util/openoffice.lst | awk '{ print $$2 }')" \
2877                 -V'base-version=$(BASE_VERSION)' \
2878                 -V'oover=$(OOVER)' \
2879                 -V'next-oover=$(NEXT_OOVER)' \
2880                 -V'help-l10n-virtual-version=$(HELP_L10N_VIRTUAL_VERSION)' \
2881                 -V'base-hsqldb-depends=$(BASE_HSQLDB_DEPENDS)' \
2882                 -V'java-common-depends=$(JAVA_COMMON_DEPENDS) $(JAVA_COMMON_DEPENDS_VERSION)' \
2883                 -V'java-runtime-depends=$(JAVA_RUNTIME_DEPENDS)' \
2884                 -V'java-gcj-depends=$(JAVA_GCJ_DEPENDS)' \
2885                 -V'lucene-depends=$(LUCENE_DEPENDS)' \
2886                 -V'Binary-Version=$(BINARY_VERSION)' \
2887                 -V'ooo-binfilter-dep=$(OOO_BINFILTER_DEP)' \
2888                 -V'ooo-officebean-dep=$(OOO_OFFICEBEAN_DEP)' \
2889                 -V'kde-iconset-dep=$(KDE_ICONSET_DEP)' \
2890                 -V'lpsolve-dep=$(LPSOLVE_DEP)' \
2891                 -V'gstreamer-plugins-suggests=$(GSTREAMER_PLUGINS_SUGGESTS)' \
2892                 -V'libebook-dep=$(shell debian/scripts/get_libebook_dep.sh)' \
2893                 -V'libldap-suggests=$(LDAP_LIB)' \
2894                 -V'dbg-dbg-suggests=$(DBG_DBG_SUGGESTS)' \
2895                 -v$(BINARY_VERSION)
2896 ifeq "$(ENABLE_JAVA)" "y"
2897         perl -pi -e "s/java-gcj-compat/java-gcj-compat (>= 1.0.77-4)/" \
2898                 debian/libreoffice$(VER)-officebean/DEBIAN/control
2899 endif
2900 ifneq (,$(findstring $(DEB_HOST_ARCH),$(OOO_ARCH_DEP_EXTENSIONS_ARCHS)))
2901 ifeq "$(ENABLE_PDFIMPORT)" "y"
2902         dh_gencontrol -plibreoffice$(VER)-pdfimport -- \
2903                 -v$(shell grep "<version" $(SOURCE_TREE)/sdext/source/pdfimport/description.xml | perl -pi -e 's,<version.*value=\"(.*)\" />,\1,; s/^\s+//')+LibO`echo $(BINARY_VERSION) | cut -d: -f2`
2904 endif
2905 ifeq "$(ENABLE_MINIMIZER)" "y"
2906         dh_gencontrol -plibreoffice$(VER)-presentation-minimizer -- \
2907                 -v$(shell grep "<version" $(SOURCE_TREE)/sdext/source/minimizer/description.xml | perl -pi -e 's,<version value=\"(.*)\"/>,\1,; s/^\s+//')+LibO`echo $(BINARY_VERSION) | cut -d: -f2`
2908 endif
2909 ifeq "$(ENABLE_PRESENTER_CONSOLE)" "y"
2910         dh_gencontrol -plibreoffice$(VER)-presenter-console -- \
2911                 -v$(shell grep "<version" $(SOURCE_TREE)/sdext/source/presenter/description.xml | perl -pi -e 's,<version value=\"(.*)\" />,\1,; s/^\s+//')+LibO`echo $(BINARY_VERSION) | cut -d: -f2`
2912 endif
2913 ifeq "$(PACKAGE_BASE)" "y"
2914   ifeq "$(ENABLE_MYSQLNATIVE)" "y"
2915         dh_gencontrol -plibreoffice$(VER)-mysql-connector -- \
2916                 -v$(shell grep "<version" $(SOURCE_TREE)/mysqlc/$(shell . $(SOURCE_TREE)/Env.Host.sh; echo $$OUTPATH$$PROEXT)/misc/description.xml | perl -pi -e 's,<version value=\"(.*)\" />,\1,; s/^\s+//; s/\s+$$//')+LibO`echo $(BINARY_VERSION) | cut -d: -f2`
2917   endif
2918 endif
2919 endif
2920         dh_gencontrol -pure -pure-dbg -puno-libs3 -puno-libs3-dbg -- \
2921                 -V"ure:Version=`echo $(BINARY_VERSION) | cut -d: -f2`" \
2922                 -v"`echo $(BINARY_VERSION) | cut -d: -f2`"
2923         dh_md5sums -s
2924 ifeq "$(USE_XZ_COMPRESS)" "y"
2925         dh_builddeb -Nlibreoffice$(VER)-dbg -s $(DEBHELPER_OPTIONS) $(BUILDDEB_OPTIONS)
2926         dh_builddeb -plibreoffice$(VER)-dbg $(DEBHELPER_OPTIONS) $(filter-out -Zbzip2 -Zlzma,$(BUILDDEB_OPTIONS)) -Zxz
2927 else
2928         dh_builddeb -s $(DEBHELPER_OPTIONS) $(BUILDDEB_OPTIONS)
2929 endif
2930
2931         touch $@
2932
2933 binary-indep: $(GSI_EXPORT_STAMP) $(STAMP_DIR)/binary-indep
2934 $(STAMP_DIR)/binary-indep: $(STAMP_DIR)/install-indep debian/control $(STAMP_DIR)/maintscripts $(STAMP_DIR)/langpacks
2935 ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),$(OOO_JAVA_ARCHS)))
2936         echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
2937         echo "For uploads with binary-all packages, please use arches where Java is enabled!!!!!"
2938         echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
2939 endif
2940         dh_testdir
2941         dh_testroot
2942
2943         for pkg in $(ARCH_INDEP_PACKAGES) ; do \
2944           rm -f debian/$$pkg.*.debhelper;\
2945           rm -rf debian/$$pkg/DEBIAN;\
2946         done
2947
2948 ifeq "$(PACKAGE_SDK)" "y"
2949         . $(SOURCE_TREE)/solenv/inc/udkversion.mk && \
2950         for i in common cpp java; do \
2951                 cat debian/udk-$$i-ref.in \
2952                         | sed -e "s/@UDK_MAJOR@/$$UDK_MAJOR/" \
2953                               -e "s/@UDK_MINOR@/$$UDK_MINOR/" \
2954                               -e "s/@UDK_MICRO@/$$UDK_MICRO/" \
2955                               -e "s/@VER@/$(VER)/" \
2956                         > debian/libreoffice-dev-doc.doc-base.udk-$$i-ref; \
2957         done
2958         # remove Autodoc_DiagnosticMessages.txt
2959         find $(PKGDIR)-dev-doc/usr/share/doc/libreoffice-dev \
2960                 -name "Autodoc_DiagnosticMessages.txt" -exec rm {} \;
2961         UDK_CPP_FILES=`find $(CURDIR)/debian/libreoffice-dev-doc/usr/share/doc/libreoffice-dev/docs/cpp/ref | sed -e 's,$(CURDIR)/debian/libreoffice-dev-doc,,g' | xargs`; \
2962         echo "Files: $$UDK_CPP_FILES" >> debian/libreoffice-dev-doc.doc-base.udk-cpp-ref
2963   ifeq "$(ENABLE_JAVA)" "y"
2964         UDK_JAVA_FILES=`find $(CURDIR)/debian/libreoffice-dev-doc/usr/share/doc/libreoffice-dev/docs/java/ref | sed -e 's,$(CURDIR)/debian/libreoffice-dev-doc,,g' | xargs`; \
2965         echo "Files: $$UDK_JAVA_FILES" >> debian/libreoffice-dev-doc.doc-base.udk-java-ref
2966   endif
2967         # xargs strips the many files here so we need to post-process it.
2968         UDK_COMMON_FILES=`find $(CURDIR)/debian/libreoffice-dev-doc/usr/share/doc/libreoffice-dev/docs/common/ref | sed -e 's,$(CURDIR)/debian/libreoffice-dev-doc,,g' | xargs`; \
2969         TMP=`mktemp -q`; \
2970         cp debian/libreoffice-dev-doc.doc-base.udk-common-ref $$TMP; \
2971         echo "Files: $$UDK_COMMON_FILES" >> $$TMP; \
2972         cat $$TMP | perl -e 'while(<>) { if (/^Files/) {$$f=1;} if ($$f eq "1") { chomp(); } print $$_; }' > debian/libreoffice-dev-doc.doc-base.udk-common-ref; \
2973         rm -f $$TMP
2974         # no idea why this happens; afais this can't come from above
2975         # since it doesn't affect the files at the end of the lines...
2976         # But fix it..
2977         perl -pi -e 's,html/,html /,g' debian/libreoffice-dev-doc.doc-base.udk-common-ref
2978 endif
2979         dh_installdocs -i -A debian/README.Debian
2980         dh_installman -i
2981         for i in `find $(PKGDIR)-common -type l -name "lo*.1"`; do \
2982                 mv $$i $$i.gz; \
2983                 if [ "`readlink $$i`" != "libreoffice.1.gz" ]; then \
2984                         ln -sf libreoffice.1.gz $$i.gz; \
2985                 fi; \
2986         done
2987         dh_installchangelogs -i -k
2988         dh_installmime -i
2989         dh_lintian -i
2990         dh_bugfiles -i -A
2991         dh_link -i
2992         dh_fixperms -i
2993         dh_icons -i
2994         dh_installxmlcatalogs -i
2995         dh_compress -i -X.py -X.mk -X.sxd -X.xcd.sample
2996         dh_installdeb -i
2997 ifeq "$(ENABLE_JAVA)" "y"
2998         # the help recommends lucene. this is enough. no need for a hard depend in
2999         # -common, IMHO
3000         jh_depends -i -Xlibreoffice$(VER)-gcj -Xlibreoffice$(VER)-dbg -Xliblucene2-java
3001 endif
3002         dh_gencontrol -i $(DEBHELPER_OPTIONS) \
3003                 -Nlibreoffice$(VER)-report-builder \
3004                 -Nlibreoffice$(VER)-wiki-publisher \
3005                 -Nttf-opensymbol \
3006                 -Nfonts-opensymbol \
3007                 -Nopenoffice.org-dtd-officedocument1.0 -- \
3008                 -V'base-version=$(BASE_VERSION)' \
3009                 -V'oover=$(OOVER)' \
3010                 -V'next-oover=$(NEXT_OOVER)' \
3011                 -V'help-l10n-virtual-version=$(HELP_L10N_VIRTUAL_VERSION)' \
3012                 -V'bsh-depends=$(BSH_DEPENDS)' \
3013                 -V'java-common-depends=$(JAVA_COMMON_DEPENDS)' \
3014                 -V'java-runtime-depends=$(JAVA_RUNTIME_DEPENDS)' \
3015                 -V'lucene-depends=$(LUCENE_DEPENDS)' \
3016                 -V'lucene-conflicts=$(LUCENE_CONFLICTS)' \
3017                 -V'textcat-data-recommends=$(TEXTCAT_DATA_RECOMMENDS)' \
3018                 -V'Binary-Version=$(BINARY_VERSION)' \
3019                 -V'ooo-binfilter-dep=$(OOO_BINFILTER_DEP)' \
3020                 -V'dbg-dbg-suggests=$(DBG_DBG_SUGGESTS)' \
3021                 -v$(BINARY_VERSION)
3022 ifeq "$(PACKAGE_TTF_OPENSYMBOL)" "y"
3023         dh_gencontrol -pttf-opensymbol -pfonts-opensymbol -- \
3024                 -v$(shell echo `echo $(BINARY_VERSION) | cut -d: -f1` + 1 | bc):$(shell fontforge -lang=ff -c 'Open($$1); Print ($$fontversion); Quit(0);' debian/fonts-opensymbol/usr/share/fonts/truetype/openoffice/opens___.ttf)+LibO`echo $(BINARY_VERSION) | cut -d: -f2`
3025 endif
3026 ifeq "$(ENABLE_MEDIAWIKI)" "y"
3027         dh_gencontrol -plibreoffice$(VER)-wiki-publisher -- \
3028                 -V'mediawiki-jar-depends=$(MEDIAWIKI_JAR_DEPENDS)' \
3029                 -V'lucene-depends=$(LUCENE_DEPENDS)' \
3030                 -V'java-runtime-depends=$(JAVA_RUNTIME_DEPENDS)' \
3031                 -v$(shell grep "<version" $(SOURCE_TREE)/swext/mediawiki/src/description.xml | perl -pi -e 's,<version value=\"(.*)\"/>,\1,; s/^\s+//')+LibO`echo $(BINARY_VERSION) | cut -d: -f2`
3032 endif
3033 ifeq "$(ENABLE_REPORTDESIGN)" "y"
3034         dh_gencontrol -plibreoffice$(VER)-report-builder -- \
3035                 -V'base-version=$(BASE_VERSION)' \
3036                 -V'report-builder-jar-depends=$(REPORT_BUILDER_JAR_DEPENDS)' \
3037                 -V'java-runtime-depends=$(JAVA_RUNTIME_DEPENDS)' \
3038                 -v`echo $(BINARY_VERSION) | cut -d: -f1`:$(shell grep "<version" $(SOURCE_TREE)/reportbuilder/$(shell . $(SOURCE_TREE)/Env.Host.sh; echo $$OUTPATH$$PROEXT)/misc/description.xml | perl -pi -e 's,<version value=\"(.*)\"/>,\1,; s/^\s+//')+LibO`echo $(BINARY_VERSION) | cut -d: -f2`
3039 endif
3040         dh_gencontrol -popenoffice.org-dtd-officedocument1.0 -- \
3041                 -v$(shell echo `echo $(BINARY_VERSION) | cut -d: -f1` + 1 | bc):1.0+LibO`echo $(BINARY_VERSION) | cut -d: -f2`
3042         dh_md5sums -i -Xjavasettingsunopkginstall.xml
3043         dh_builddeb -i $(DEBHELPER_OPTIONS) $(BUILDDEB_OPTIONS)
3044
3045         touch $@
3046
3047 binary: binary-arch binary-indep
3048
3049 ifeq "$(USE_GIT_TARBALLS)" "y"
3050
3051 # $(1) is the upstream name of the repo
3052 # $(2) is the name of the tarball
3053 # $(3) is the path to archive (empty for everything)
3054 #
3055 # according to policy get-orig-source has to download to the current dir, thus
3056 # should not require a dh_testdir. However, like this we can have clean deps
3057 # from build and download the source, configure, build, pack in on piece. As
3058 # get-orig-source is an optional target anyway, we stick to support only this
3059 # case and not random dirs. see also: debian bug 494141
3060 # also, we need to run configure to create the src tarball anyway
3061
3062 GIT_INSTALLED:=$(shell which git >/dev/null 2>/dev/null && echo "y")
3063
3064 get_orig_tarball=$(CURDIR)/../libreoffice_$(DEB_VERSION_UPSTREAM).orig$(1).tar.xz
3065
3066 define pack_gittarball
3067 $(if $(GIT_INSTALLED),,$(error You need git.))
3068 dh_testdir
3069 TMPD=`mktemp -d $(if $(TMP),-p $(TMP))` && \
3070 mkdir $${TMPD}/archive && \
3071 git clone --bare $(GIT_BASEURL)/$(1) $${TMPD}/repo -b $(GIT_BRANCH) && \
3072 git archive --remote $${TMPD}/repo --format=tar --prefix libreoffice-$(DEB_VERSION_UPSTREAM)/ $(GIT_TAG) |tar x -C $${TMPD}/archive && \
3073 tar cvJf $(2) -C $${TMPD}/archive/$(3) --transform 's,./,,' . && \
3074 rm -rf $${TMPD}
3075 endef
3076
3077 define unpack_gittarball
3078 dh_testdir
3079 mkdir -p $(CURDIR)/$(1)
3080 test -f $(CURDIR)/$(1)/.gitignore || tar xvJf $(2) -C $(CURDIR)/$(1) $(3)
3081 endef
3082
3083 ifneq ($(filter get-orig-source unpack,$(MAKECMDGOALS)),)
3084 $(call get_orig_tarball):
3085         $(call pack_gittarball,core,$@,)
3086
3087 $(call get_orig_tarball,-helpcontent2):
3088         $(call pack_gittarball,help,$@,libreoffice-$(DEB_VERSION_UPSTREAM)/helpcontent2)
3089
3090 $(call get_orig_tarball,-%):
3091         $(call pack_gittarball,$*,$@,libreoffice-$(DEB_VERSION_UPSTREAM)/$*)
3092
3093 # Get upstream external sources
3094 $(call get_orig_tarball,-src): binfilter/no_localization dictionaries/en/README.txt helpcontent2/makefile.pmk translations/makefile.mk .gitignore
3095         dh_testdir
3096         rm -rf $(TARFIILE_LOCATION)
3097         mkdir -p $(TARFILE_LOCATION)
3098         ./autogen.sh
3099         ./download
3100         tar cvJf $@ -C $(TARFILE_LOCATION) --transform 's,./,,' .
3101
3102 # using flag files for unpacking
3103 .gitignore: $(call get_orig_tarball)
3104         $(call unpack_gittarball,,$<,--strip-components=1)
3105
3106 binfilter/no_localization: $(call get_orig_tarball,-binfilter)
3107         $(call unpack_gittarball,binfilter,$<,)
3108
3109 dictionaries/en/README.txt: $(call get_orig_tarball,-dictionaries)
3110         $(call unpack_gittarball,dictionaries,$<,)
3111
3112 translations/makefile.mk:  $(call get_orig_tarball,-translations)
3113         $(call unpack_gittarball,translations,$<,)
3114
3115 helpcontent2/makefile.pmk:  $(call get_orig_tarball,-helpcontent2)
3116         $(call unpack_gittarball,helpcontent2,$<,)
3117
3118 src/fetch.log: $(call get_orig_tarball,-src) patched
3119         $(call unpack_gittarball,src,$<,)
3120
3121 get-orig-source: $(call get_orig_tarball,-src) src/fetch.log
3122         dh_testdir
3123
3124 unpack: src/fetch.log
3125         dh_testdir
3126 endif
3127 endif
3128
3129
3130 .PHONY: control
3131 .PHONY: clean-debdir clean-instsetoo clean-objectdirs clean default configure
3132 .PHONY: build build-indep build-arch install-arch install-indep
3133 .PHONY: get-orig-source unpack patched
3134 .PHONY: $(stampdir_targets)
3135
3136 # vim:set noet ai sts=8 sw=8 tw=0: