Branch libreoffice-5-0-4
[LibreOffice.git] / bin / distro-install-file-lists
blobf011c0c80a32434a82c92366486257c0d4d9b111
1 #!/bin/sh
3 if test -z "${SRC_ROOT}"; then
4 echo "distro-install-clean-up: No environment set!"
5 exit 1
6 fi
8 BUILDDIR=`pwd`
9 FILELISTSDIR="$BUILDDIR/file-lists"
11 # remove installed file even from the file list
12 # Params: file_list file_to_remove
13 remove_file()
15 rm -f "$DESTDIR/$2"
16 perl -pi -e "s|^$2$||" "$1"
19 # move one file from one list of files to a second one
20 # Params: target_file_list source_file_list file_to_move
21 mv_file_between_flists()
23 if grep "^$3\$" $2 >/dev/null 2>&1 ; then
24 # \$3 can be regular expression
25 grep "^$3\$" $2 >>$1
26 perl -pi -e "s|^$3$||" $2
29 # add the directories from the source list of files to the target list of
30 # file which are used in the target list of files but are missing there
31 # Params: target_file_list source_file_list
32 add_used_directories()
34 sort -u -r $2 | sed -n "s|^%dir \(.*\)\$|s%^\\\\(\1\\\\).*%\\\\1%p|p" >$2.pattern
35 sed -n -f $2.pattern $1 | sort -u | sed "s|^|%dir |" >>$1
36 rm $2.pattern
37 sort -u $1 >$1.unique
38 mv $1.unique $1
41 # remove a duplicity between two filelist
42 # Params: filelist_with_original filelist_with_duplicity duplicit_path
43 remove_duplicity_from_flists()
45 if grep "$3" "$1" >/dev/null 2>&1 && \
46 grep "$3" "$2" >/dev/null 2>&1 ; then
47 perl -pi -e "s|^$3$||" $2
51 # merges one file list into another one
52 # Params: source_filelist dest_filelist replace_dest
53 merge_flists()
55 if test -f "$1" ; then
56 cat "$1" >>"$2"
57 sort -u "$2" >"$2".sorted
58 mv "$2".sorted "$2"
62 if ! test -f $DESTDIR/gid_Module_Root; then
63 echo "Error: Failed to generate package file lists";
64 echo " Have you defined DESTDIR?"
65 exit 1;
69 rm -rf "$FILELISTSDIR"
70 mkdir -p "$FILELISTSDIR"
72 cd $DESTDIR
74 if test "z$OOO_VENDOR" != "zDebian" ; then
76 echo "Generating package file lists for $OOO_VENDOR..."
78 rm -f common_list.txt
79 for module in gid_Module_Root gid_Module_Root_Brand \
80 gid_Module_Root_Files_[0-9] \
81 gid_Module_Filter \
82 gid_Module_Root_Hack \
83 gid_Module_Oo_Linguistic \
84 gid_Module_Root_Extension_Dictionary_* \
85 gid_Module_Root_Ure_Hidden ; do
86 merge_flists $module $FILELISTSDIR/common_list.txt
87 done
89 # it is not a real extension; it used to be in the main package...
90 merge_flists gid_Module_Optional_Extensions_Script_Provider_For_JS $FILELISTSDIR/common_list.txt
92 if test "$SPLIT_APP_MODULES" = "TRUE" ; then
93 merge_flists gid_Module_Prg_Base_Bin $FILELISTSDIR/base_list.txt
94 merge_flists gid_Module_Prg_Calc_Bin $FILELISTSDIR/calc_list.txt
95 merge_flists gid_Module_Prg_Draw_Bin $FILELISTSDIR/draw_list.txt
96 merge_flists gid_Module_Prg_Math_Bin $FILELISTSDIR/math_list.txt
97 merge_flists gid_Module_Prg_Impress_Bin $FILELISTSDIR/impress_list.txt
98 merge_flists gid_Module_Prg_Wrt_Bin $FILELISTSDIR/writer_list.txt
99 merge_flists gid_Module_Brand_Prg_Base $FILELISTSDIR/base_list.txt
100 merge_flists gid_Module_Brand_Prg_Calc $FILELISTSDIR/calc_list.txt
101 merge_flists gid_Module_Brand_Prg_Draw $FILELISTSDIR/draw_list.txt
102 merge_flists gid_Module_Brand_Prg_Math $FILELISTSDIR/math_list.txt
103 merge_flists gid_Module_Brand_Prg_Impress $FILELISTSDIR/impress_list.txt
104 merge_flists gid_Module_Brand_Prg_Wrt $FILELISTSDIR/writer_list.txt
105 merge_flists gid_Module_Reportbuilder $FILELISTSDIR/base_list.txt
106 merge_flists gid_Module_Pdfimport $FILELISTSDIR/draw_list.txt
108 # FIXME: small; low dependencies; why optional module?
109 merge_flists gid_Module_Optional_OGLTrans $FILELISTSDIR/impress_list.txt
110 else
111 merge_flists gid_Module_Prg_Base_Bin $FILELISTSDIR/common_list.txt
112 merge_flists gid_Module_Prg_Calc_Bin $FILELISTSDIR/common_list.txt
113 merge_flists gid_Module_Prg_Draw_Bin $FILELISTSDIR/common_list.txt
114 merge_flists gid_Module_Prg_Math_Bin $FILELISTSDIR/common_list.txt
115 merge_flists gid_Module_Prg_Impress_Bin $FILELISTSDIR/common_list.txt
116 merge_flists gid_Module_Prg_Wrt_Bin $FILELISTSDIR/common_list.txt
117 merge_flists gid_Module_Brand_Prg_Base $FILELISTSDIR/common_list.txt
118 merge_flists gid_Module_Brand_Prg_Calc $FILELISTSDIR/common_list.txt
119 merge_flists gid_Module_Brand_Prg_Draw $FILELISTSDIR/common_list.txt
120 merge_flists gid_Module_Brand_Prg_Math $FILELISTSDIR/common_list.txt
121 merge_flists gid_Module_Brand_Prg_Impress $FILELISTSDIR/common_list.txt
122 merge_flists gid_Module_Brand_Prg_Wrt $FILELISTSDIR/common_list.txt
123 merge_flists gid_Module_Reportbuilder $FILELISTSDIR/common_list.txt
124 merge_flists gid_Module_Pdfimport $FILELISTSDIR/common_list.txt
125 # FIXME: small; low dependencies; why optional module?
126 merge_flists gid_Module_Optional_OGLTrans $FILELISTSDIR/common_list.txt
129 if test "$SPLIT_APP_MODULES" = "TRUE" -a "$OOO_VENDOR" = "SUSE" ; then
130 # move the prebuilt icons into a hacky temporary package
131 # we want to repack them into a noarch package as soon as possible
132 # without the build dependency on the huge devel package
133 merge_flists gid_Module_Root_Files_Images $FILELISTSDIR/icon_themes_prebuilt.txt
134 else
135 merge_flists gid_Module_Root_Files_Images $FILELISTSDIR/common_list.txt
138 if test "$SPLIT_OPT_FEATURES" = "TRUE" ; then
139 if test "z$OOO_VENDOR" = "zMandriva" ; then
140 merge_flists gid_Module_Optional_Grfflt $FILELISTSDIR/draw_list.txt
141 merge_flists gid_Module_Optional_Headless $FILELISTSDIR/common_list.txt
142 merge_flists gid_Module_Optional_Pymailmerge $FILELISTSDIR/pyuno_list.txt
143 merge_flists gid_Module_Pyuno $FILELISTSDIR/pyuno_list.txt
144 merge_flists gid_Module_Script_Provider_For_Python $FILELISTSDIR/pyuno_list.txt
145 merge_flists gid_Module_Optional_Pyuno_LibreLogo $FILELISTSDIR/pyuno_list.txt
146 merge_flists gid_Module_Optional_Xsltfiltersamples $FILELISTSDIR/common_list.txt
147 else
148 merge_flists gid_Module_Optional_Grfflt $FILELISTSDIR/common_list.txt
149 merge_flists gid_Module_Optional_Headless $FILELISTSDIR/common_list.txt
150 merge_flists gid_Module_Optional_Pymailmerge $FILELISTSDIR/mailmerge_list.txt
151 merge_flists gid_Module_Pyuno $FILELISTSDIR/pyuno_list.txt
152 merge_flists gid_Module_Optional_Pyuno_LibreLogo $FILELISTSDIR/pyuno_list.txt
153 merge_flists gid_Module_Script_Provider_For_Python $FILELISTSDIR/pyuno_list.txt
154 merge_flists gid_Module_Optional_Xsltfiltersamples $FILELISTSDIR/filters_list.txt
156 else
157 merge_flists gid_Module_Optional_Grfflt $FILELISTSDIR/common_list.txt
158 merge_flists gid_Module_Optional_Headless $FILELISTSDIR/common_list.txt
159 merge_flists gid_Module_Optional_Pymailmerge $FILELISTSDIR/common_list.txt
160 merge_flists gid_Module_Pyuno $FILELISTSDIR/common_list.txt
161 merge_flists gid_Module_Optional_Pyuno_LibreLogo $FILELISTSDIR/common_list.txt
162 merge_flists gid_Module_Script_Provider_For_Python $FILELISTSDIR/common_list.txt
163 merge_flists gid_Module_Optional_Xsltfiltersamples $FILELISTSDIR/common_list.txt
166 # lang packs
167 for lang in `echo $WITH_LANG_LIST | sed -e s/-/_/g`; do
168 lang_lists=
169 if test "$OOO_VENDOR" = "Mandriva" -o \( "$OOO_VENDOR" = "SUSE" -a "$SPLIT_APP_MODULES" = "TRUE" \) ; then
170 test -f gid_Module_Langpack_Basis_$lang && lang_lists="$lang_lists gid_Module_Langpack_Basis_$lang" || :
171 test -f gid_Module_Langpack_Brand_$lang && lang_lists="$lang_lists gid_Module_Langpack_Brand_$lang" || :
172 test -f gid_Module_Langpack_Resource_$lang && lang_lists="$lang_lists gid_Module_Langpack_Resource_$lang" || :
173 test -f gid_Module_Langpack_Impress_$lang && lang_lists="$lang_lists gid_Module_Langpack_Impress_$lang" || :
174 test -f gid_Module_Langpack_Draw_$lang && lang_lists="$lang_lists gid_Module_Langpack_Draw_$lang" || :
175 test -f gid_Module_Langpack_Math_$lang && lang_lists="$lang_lists gid_Module_Langpack_Math_$lang" || :
176 test -f gid_Module_Langpack_Calc_$lang && lang_lists="$lang_lists gid_Module_Langpack_Calc_$lang" || :
177 test -f gid_Module_Langpack_Base_$lang && lang_lists="$lang_lists gid_Module_Langpack_Base_$lang" || :
178 test -f gid_Module_Langpack_Writer_$lang && lang_lists="$lang_lists gid_Module_Langpack_Writer_$lang" || :
179 # Place helps on dedicated packages.
180 test -f gid_Module_Helppack_Help_$lang && sort -u gid_Module_Helppack_Help_$lang > $FILELISTSDIR/help_${lang}_list.txt || :
181 else
182 test -f gid_Module_Langpack_Basis_$lang && lang_lists="$lang_lists gid_Module_Langpack_Basis_$lang" || :
183 test -f gid_Module_Langpack_Brand_$lang && lang_lists="$lang_lists gid_Module_Langpack_Brand_$lang" || :
184 test -f gid_Module_Langpack_Resource_$lang && lang_lists="$lang_lists gid_Module_Langpack_Resource_$lang" || :
185 test -f gid_Module_Langpack_Impress_$lang && lang_lists="$lang_lists gid_Module_Langpack_Impress_$lang" || :
186 test -f gid_Module_Langpack_Draw_$lang && lang_lists="$lang_lists gid_Module_Langpack_Draw_$lang" || :
187 test -f gid_Module_Langpack_Math_$lang && lang_lists="$lang_lists gid_Module_Langpack_Math_$lang" || :
188 test -f gid_Module_Langpack_Calc_$lang && lang_lists="$lang_lists gid_Module_Langpack_Calc_$lang" || :
189 test -f gid_Module_Langpack_Base_$lang && lang_lists="$lang_lists gid_Module_Langpack_Base_$lang" || :
190 test -f gid_Module_Langpack_Writer_$lang && lang_lists="$lang_lists gid_Module_Langpack_Writer_$lang" || :
191 test -f gid_Module_Helppack_Help_$lang && lang_lists="$lang_lists gid_Module_Helppack_Help_$lang" || :
193 if test -n "$lang_lists" ; then
194 # all files are installed below $INSTALLDIR/basis; we want to own also $INSTALLDIR
195 echo "%dir $INSTALLDIR" >$FILELISTSDIR/lang_${lang}_list.txt
196 cat $lang_lists | sort -u >>$FILELISTSDIR/lang_${lang}_list.txt
198 # some help files are in _Langpack_{Writer,Impress,...}_<lang>
199 # move them from -l10n to -help
200 if test "$OOO_VENDOR" = "Mandriva" -o \( "$OOO_VENDOR" = "SUSE" -a "$SPLIT_APP_MODULES" = "TRUE" \) ; then
201 for lang in `echo $WITH_LANG_LIST | sed -e s/-/_/g`; do
202 test -f $FILELISTSDIR/help_${lang}_list.txt || continue;
203 mv_file_between_flists $FILELISTSDIR/help_${lang}_list.txt $FILELISTSDIR/lang_${lang}_list.txt $INSTALLDIR/help/.*
204 add_used_directories $FILELISTSDIR/help_${lang}_list.txt $FILELISTSDIR/lang_${lang}_list.txt
205 done
207 done
209 if test -f $FILELISTSDIR/lang_en_US_list.txt -a "$OOO_VENDOR" = "SUSE" -a "$SPLIT_APP_MODULES" != "TRUE" ; then
210 cat $FILELISTSDIR/lang_en_US_list.txt >>$FILELISTSDIR/common_list.txt
211 rm $FILELISTSDIR/lang_en_US_list.txt
214 if test -f gid_Module_Root_SDK ; then
215 cp gid_Module_Root_SDK $FILELISTSDIR/sdk_list.txt
218 cd $FILELISTSDIR
220 # tde subpackage
221 test -f $DESTDIR/gid_Module_Optional_Tde && cp $DESTDIR/gid_Module_Optional_Tde tde_list.txt || :
222 mv_file_between_flists tde_list.txt common_list.txt $INSTALLDIR/program/tdefilepicker
223 mv_file_between_flists tde_list.txt common_list.txt $INSTALLDIR/program/fps_tdelo.so
224 mv_file_between_flists tde_list.txt common_list.txt $INSTALLDIR/program/libvclplug_tdel..so
225 mv_file_between_flists tde_list.txt common_list.txt $INSTALLDIR/program/libtdeab1l..so
226 mv_file_between_flists tde_list.txt common_list.txt $INSTALLDIR/program/libtdeabdrv1l..so
227 add_used_directories tde_list.txt common_list.txt
229 # kde subpackage
230 test -f $DESTDIR/gid_Module_Optional_Kde && cp $DESTDIR/gid_Module_Optional_Kde kde_list.txt || :
231 mv_file_between_flists kde_list.txt common_list.txt $INSTALLDIR/program/kdefilepicker
232 mv_file_between_flists kde_list.txt common_list.txt $INSTALLDIR/program/fps_kdelo.so
233 mv_file_between_flists kde_list.txt common_list.txt $INSTALLDIR/program/libvclplug_kdel..so
234 mv_file_between_flists kde_list.txt common_list.txt $INSTALLDIR/program/libkab1l..so
235 mv_file_between_flists kde_list.txt common_list.txt $INSTALLDIR/program/libkabdrv1l..so
236 add_used_directories kde_list.txt common_list.txt
238 # create kde4 subpackage
239 mv_file_between_flists kde4_list.txt kde_list.txt $INSTALLDIR/program/kde4be1lo.so
240 mv_file_between_flists kde4_list.txt common_list.txt $INSTALLDIR/program/libvclplug_kde4l..so
241 mv_file_between_flists kde4_list.txt common_list.txt $INSTALLDIR/program/fps_kde4lo.so
242 add_used_directories kde4_list.txt common_list.txt
244 # gnome subpackage
245 test -f $DESTDIR/gid_Module_Optional_Gnome && cp $DESTDIR/gid_Module_Optional_Gnome gnome_list.txt || :
246 mv_file_between_flists gnome_list.txt common_list.txt $INSTALLDIR/program/libevoab2.so
247 mv_file_between_flists gnome_list.txt common_list.txt $INSTALLDIR/program/libvclplug_gtk[0-9]*l..so
248 mv_file_between_flists common_list.txt gnome_list.txt $INSTALLDIR/program/ucpgvfs1lo.so
249 add_used_directories gnome_list.txt common_list.txt
251 # mono subpackage
252 mv_file_between_flists mono_list.txt common_list.txt $INSTALLDIR/program/cli_.*.dll
253 mv_file_between_flists mono_list.txt common_list.txt $INSTALLDIR/program/cli_.*.dll.config
254 mv_file_between_flists mono_list.txt common_list.txt $INSTALLDIR/program/policy.*.cli_.*.dll
255 mv_file_between_flists mono_list.txt common_list.txt $INSTALLDIR/program/cli_.*.dll
256 mv_file_between_flists mono_list.txt common_list.txt $INSTALLDIR/program/cli_.*.dll.config
257 mv_file_between_flists mono_list.txt common_list.txt $INSTALLDIR/program/policy.*.cli_.*.dll
258 mv_file_between_flists mono_list.txt common_list.txt $INSTALLDIR/program/libcli_.*.so
259 add_used_directories mono_list.txt common_list.txt
260 # add the files from GAC if it was installed
261 test -f mono_gac && cat mono_gac >>mono_list.txt
263 # postgresql subpackage
264 test -f $DESTDIR/gid_Module_Optional_PostgresqlSdbc && cp $DESTDIR/gid_Module_Optional_PostgresqlSdbc postgresql_list.txt || :
266 # mailmerge
267 if test "$SPLIT_OPT_FEATURES" = "TRUE" ; then
268 if test "z$OOO_VENDOR" = "zMandriva" ; then
269 flist=pyuno_list.txt
270 else
271 flist=mailmerge_list.txt
273 mv_file_between_flists $flist common_list.txt $INSTALLDIR/program/mailmerge.py
274 add_used_directories $flist common_list.txt
277 if test "z$OOO_VENDOR" = "zSUSE" ; then
278 # officebean subpackage
279 test -f $DESTDIR/gid_Module_Optional_Extensions_Script_Provider_For_BS && cp $DESTDIR/gid_Module_Optional_Extensions_Script_Provider_For_BS officebean_list.txt || :
280 mv_file_between_flists officebean_list.txt common_list.txt $INSTALLDIR/program/classes/officebean.jar
281 mv_file_between_flists officebean_list.txt common_list.txt $INSTALLDIR/program/libofficebean.so
282 add_used_directories officebean_list.txt common_list.txt
285 if test -f sdk_list.txt ; then
286 # in this case we move all entries including directories
287 mv_file_between_flists sdk_doc_list.txt sdk_list.txt "%dir $DOCDIR/sdk/docs.*"
288 mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$DOCDIR/sdk/docs.*"
289 mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$DOCDIR/sdk/examples"
290 mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$DOCDIR/sdk/index.html"
291 mv_file_between_flists sdk_doc_list.txt sdk_list.txt "%dir $INSTALLDIR/sdk/examples.*"
292 mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$INSTALLDIR/sdk/docs"
293 mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$INSTALLDIR/sdk/examples.*"
294 mv_file_between_flists sdk_doc_list.txt sdk_list.txt "$INSTALLDIR/sdk/index.html"
295 add_used_directories sdk_doc_list.txt sdk_list.txt
299 # Mandriva packaging
300 if test "$OOO_VENDOR" = "Mandriva"; then
301 # Not used
302 remove_file common_list.txt $INSTALLDIR/share/gallery/htmltheme.orig
303 remove_file common_list.txt $INSTALLDIR/share/dict/ooo/dictionary.lst
305 # And these are in -draw package
306 mv_file_between_flists draw_list.txt common_list.txt $INSTALLDIR/share/registry/modules/org/openoffice/TypeDetection/Filter/fcfg_drawgraphics_filters.xcu
307 mv_file_between_flists draw_list.txt common_list.txt $INSTALLDIR/share/registry/modules/org/openoffice/TypeDetection/Filter/fcfg_drawgraphics_types.xcu
309 # And these are in -impress package
310 mv_file_between_flists impress_list.txt common_list.txt $INSTALLDIR/share/registry/modules/org/openoffice/TypeDetection/Filter/fcfg_impressgraphics_filters.xcu
311 mv_file_between_flists impress_list.txt common_list.txt $INSTALLDIR/share/registry/modules/org/openoffice/TypeDetection/Types/fcfg_impressgraphics_types.xcu
313 # Split out the gallery
314 mv_file_between_flists gallery_list.txt common_list.txt "$INSTALLDIR/share/gallery.*"
315 test -r galleries.txt && cat galleries.txt >> gallery_list.txt
317 # Split out dtd-officedocument1.0
318 mv_file_between_flists dtd_list.txt common_list.txt "$INSTALLDIR/share/dtd/officedocument.*"
320 # Split out java stuff
321 mv_file_between_flists java_common_list.txt common_list.txt $INSTALLDIR/program/JREProperties.class
322 mv_file_between_flists java_common_list.txt common_list.txt "$INSTALLDIR/program/classes.*"
323 mv_file_between_flists java_common_list.txt common_list.txt $INSTALLDIR/program/libofficebean.so
324 mv_file_between_flists java_common_list.txt common_list.txt "$INSTALLDIR/share/Scripts/java.*"
325 mv_file_between_flists java_common_list.txt writer_list.txt $INSTALLDIR/program/classes/writer2latex.jar
327 # Move arch-dependent/dup files from common to core
328 for f in \
329 ".*\.so" \
330 ".*\.so\..*" \
331 "program/.*\.rdb" \
332 program/configimport.bin \
333 program/javaldx \
334 program/msfontextract \
335 program/oosplash.bin \
336 program/pagein \
337 program/pagein-calc \
338 program/pagein-common \
339 program/pagein-draw \
340 program/pagein-impress \
341 program/pagein-writer \
342 program/pkgchk.bin \
343 program/pluginapp.bin \
344 program/setofficelang.bin \
345 program/soffice.bin \
346 program/uno.bin \
347 program/unopkg.bin \
348 program/uri-encode
350 mv_file_between_flists core_list.txt common_list.txt "$INSTALLDIR/$f"
351 done
353 # Put gtk/gnome stuff into gnome package
354 mv_file_between_flists gnome_list.txt core_list.txt $INSTALLDIR/program/ucpgvfs1lo.so
356 # Ship ooqstart for gnome in gnome package
357 mv_file_between_flists gnome_list.txt core_list.txt "$INSTALLDIR/program/libqstart_gtk680.*"
359 # themes are included in other packages
360 # don't use remove_file as we don't want them removed from the buildroot.
361 mv_file_between_flists /dev/null common_list.txt $INSTALLDIR/share/config/images_crystal.zip
362 mv_file_between_flists /dev/null common_list.txt $INSTALLDIR/share/config/images_hicontrast.zip
363 mv_file_between_flists /dev/null common_list.txt $INSTALLDIR/share/config/images_industrial.zip
364 mv_file_between_flists /dev/null common_list.txt $INSTALLDIR/share/config/images_tango.zip
365 mv_file_between_flists /dev/null common_list.txt $INSTALLDIR/share/config/images.zip
368 # remove known duplicities to do not have files packaged in two packages
369 # the Bulgarian fixes can be removed after the issue #54110 is fixed
370 remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/arrowhd.soe
371 remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/classic.sog
372 remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/hatching.soh
373 remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/modern.sog
374 remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/palette.soc
375 remove_duplicity_from_flists common_list.txt lang_bg_list.txt $INSTALLDIR/presets/config/styles.sod
376 # the British fixes can be removed after the issue #54113 is fixed
377 remove_duplicity_from_flists common_list.txt lang_en-GB_list.txt $INSTALLDIR/presets/config/standard.sog
379 else
381 echo "Creating package directories..."
383 test -d pkg && rm -r pkg || :
385 # Create package tree (needed by Debian's dpkg)
386 # create_package_directory <list_file> <directory_name>
387 create_package_directory()
389 listfile=$1
390 directory="$2"
391 perl -nl \
392 -e " if(/^%dir (.*)/)
393 {system('mkdir', '-p', '-m', '755', \"$directory\".\$1);}
394 else
395 {rename('./'.\$_, \"$directory\".\$_);}
397 $listfile
400 create_package_directory gid_Module_Root_Ure_Hidden pkg/ure
402 create_package_directory gid_Module_Root pkg/libreoffice-common
403 create_package_directory gid_Module_Root_Brand pkg/libreoffice-common
404 create_package_directory gid_Module_Root_Files_Images pkg/libreoffice-common
405 create_package_directory gid_Module_Oo_Linguistic pkg/libreoffice-common
406 create_package_directory gid_Module_Optional_Xsltfiltersamples pkg/libreoffice-common
407 create_package_directory gid_Module_Filter pkg/libreoffice-common
408 create_package_directory gid_Module_Optional_Grfflt pkg/libreoffice-draw
409 create_package_directory gid_Module_Prg_Calc_Bin pkg/libreoffice-calc
410 create_package_directory gid_Module_Prg_Math_Bin pkg/libreoffice-math
411 create_package_directory gid_Module_Prg_Draw_Bin pkg/libreoffice-draw
412 create_package_directory gid_Module_Prg_Wrt_Bin pkg/libreoffice-writer
413 create_package_directory gid_Module_Prg_Impress_Bin pkg/libreoffice-impress
414 create_package_directory gid_Module_Prg_Base_Bin pkg/libreoffice-base
415 create_package_directory gid_Module_Brand_Prg_Calc pkg/libreoffice-calc
416 create_package_directory gid_Module_Brand_Prg_Math pkg/libreoffice-math
417 create_package_directory gid_Module_Brand_Prg_Draw pkg/libreoffice-draw
418 create_package_directory gid_Module_Brand_Prg_Wrt pkg/libreoffice-writer
419 create_package_directory gid_Module_Brand_Prg_Impress pkg/libreoffice-impress
420 create_package_directory gid_Module_Brand_Prg_Base pkg/libreoffice-base
421 create_package_directory gid_Module_Pyuno pkg/python-uno
422 create_package_directory gid_Module_Optional_Gnome pkg/libreoffice-gnome
423 create_package_directory gid_Module_Optional_Tde pkg/libreoffice-tde
424 create_package_directory gid_Module_Optional_Kde pkg/libreoffice-kde
426 create_package_directory gid_Module_Root_Files_2 pkg/libreoffice-common
427 create_package_directory gid_Module_Root_Files_3 pkg/libreoffice-common
428 create_package_directory gid_Module_Root_Files_4 pkg/libreoffice-common
429 create_package_directory gid_Module_Root_Files_5 pkg/libreoffice-common
430 create_package_directory gid_Module_Root_Files_6 pkg/libreoffice-common
431 create_package_directory gid_Module_Root_Files_7 pkg/libreoffice-common
432 if [ -e gid_Module_Optional_Pymailmerge ]; then
433 create_package_directory gid_Module_Optional_Pymailmerge pkg/libreoffice-emailmerge
434 else # post m26
435 mkdir -p pkg/libreoffice-emailmerge/$INSTALLDIR/program
436 mv pkg/libreoffice-common/$INSTALLDIR/program/mailmerge.py \
437 pkg/libreoffice-emailmerge/$INSTALLDIR/program/mailmerge.py
439 create_package_directory gid_Module_Optional_OGLTrans pkg/libreoffice-ogltrans
441 create_package_directory gid_Module_Root_SDK pkg/libreoffice-dev
443 for l in `echo $WITH_LANG_LIST`; do
444 for p in Impress Draw Math Calc Base Writer; do
445 create_package_directory gid_Module_Langpack_${p}_`echo $l | sed -e s/-/_/g` pkg/libreoffice-l10n-$l
446 done
447 create_package_directory gid_Module_Langpack_Basis_`echo $l | sed -e s/-/_/g` pkg/libreoffice-l10n-$l
448 create_package_directory gid_Module_Langpack_Brand_`echo $l | sed -e s/-/_/g` pkg/libreoffice-l10n-$l
449 create_package_directory gid_Module_Langpack_Resource_`echo $l | sed -e s/-/_/g` pkg/libreoffice-l10n-$l
450 create_package_directory gid_Module_Helppack_Help_`echo $l | sed -e s/-/_/g` pkg/libreoffice-help-$l
452 # some help files are in _Langpack_{Writer,Impress,...}_<lang>
453 # move them from -l10n to -help
454 if [ "$l" = "en-US" ]; then d=en; else d=$l; fi
455 mv pkg/libreoffice-l10n-$l/$INSTALLDIR/help/$d/* \
456 pkg/libreoffice-help-$l/$INSTALLDIR/help/$d && \
457 rmdir pkg/libreoffice-l10n-$l/$INSTALLDIR/help/$d
458 done
460 # move_wrappers <directory_name> <name> [...]
461 move_wrappers()
463 directory=$1
464 shift
465 mkdir -m755 -p "$directory"/usr/bin
466 while test -n "$1"; do
467 mv usr/*bin/"$1$BINSUFFIX" "$directory"/usr/bin
468 shift
469 done
471 move_wrappers pkg/libreoffice-common soffice unopkg
472 if test "$COMPAT_OOWRAPPERS" = "YES" ; then
473 move_wrappers pkg/libreoffice-common ooffice oofromtemplate
474 move_wrappers pkg/libreoffice-base oobase
475 move_wrappers pkg/libreoffice-writer oowriter ooweb
476 move_wrappers pkg/libreoffice-calc oocalc
477 move_wrappers pkg/libreoffice-impress ooimpress
478 move_wrappers pkg/libreoffice-math oomath
479 move_wrappers pkg/libreoffice-draw oodraw
481 move_wrappers pkg/libreoffice-common libreoffice lofromtemplate
482 move_wrappers pkg/libreoffice-base lobase
483 move_wrappers pkg/libreoffice-writer lowriter loweb
484 move_wrappers pkg/libreoffice-calc localc
485 move_wrappers pkg/libreoffice-impress loimpress
486 move_wrappers pkg/libreoffice-math lomath
487 move_wrappers pkg/libreoffice-draw lodraw
489 # Move all libraries, binaries, *.rdb from -common to -core
490 for d in $INSTALLDIR/program $INSTALLDIR/program; do \
491 if [ ! -d $DESTDIR/pkg/libreoffice-core/$d ]; then \
492 mkdir -p $DESTDIR/pkg/libreoffice-core/$d; \
493 fi &&
494 ( cd pkg/libreoffice-common/$d
495 find -maxdepth 1 \
496 -regex '\./\(.*\.so.*\|.*\.bin\|pagein\|tdefilepicker\|kdefilepicker\|msfontextract\|.*\.rdb\|javaldx\|uri-encode\)' \
497 -exec mv {} $DESTDIR/pkg/libreoffice-core/$d \;
498 ); \
499 done
501 # install additional ooo-build scripts & misc stuff
502 mkdir -p pkg/libreoffice-common/usr/share/man/man1
503 if test "$COMPAT_OOWRAPPERS" = "YES" ; then
504 mv usr/share/man/man1/openoffice$BINSUFFIX.1 \
505 pkg/libreoffice-common/usr/share/man/man1
507 mv usr/share/man/man1/libreoffice$BINSUFFIX.1 \
508 pkg/libreoffice-common/usr/share/man/man1
509 mkdir -p pkg/libreoffice-common/etc/bash_completion.d
510 if test "$COMPAT_OOWRAPPERS" = "YES" ; then
511 mv etc/bash_completion.d/ooffice$BINSUFFIX.sh \
512 pkg/libreoffice-common/etc/bash_completion.d
514 mv etc/bash_completion.d/libreoffice$BINSUFFIX.sh \
515 pkg/libreoffice-common/etc/bash_completion.d
516 mv .$INSTALLDIR/program/java-set-classpath \
517 pkg/libreoffice-common/$INSTALLDIR/program
518 if echo $WITH_LANG_LIST | grep -q en-US; then
519 for i in forms/resume.ott officorr/project-proposal.ott; do \
520 mkdir -p pkg/libreoffice-common/$INSTALLDIR/share/template/en-US/`dirname $i`; \
521 mv .$INSTALLDIR/share/template/en-US/$i \
522 pkg/libreoffice-common/$INSTALLDIR/share/template/en-US/$i; \
523 done; \
525 # Warn for any remaining files
526 find . -path './pkg' -prune -o -not -name 'gid_Module_*' -not -type d -exec echo "File not packaged: {}" \;
529 # mark the config files
530 RPM_CONFIG_FILE_TAGS=
531 if test "$OOO_VENDOR" = "SUSE" -o "$OOO_VENDOR" = "RedHat"; then
532 RPM_CONFIG_FILE_TAGS="%config"
533 elif test "$OOO_VENDOR" = "PLD" ; then
534 RPM_CONFIG_FILE_TAGS="%config(noreplace) %verify(not md5 size mtime)"
537 if test "z$RPM_CONFIG_FILE_TAGS" != "z" ; then
538 cd $FILELISTSDIR
539 perl -pi -e "s|^($INSTALLDIR/help/.*\.xsl)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
540 -e "s|^($INSTALLDIR/help/.*\.css)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
541 -e "s|^($INSTALLDIR/program/[a-zA-Z0-9_\.]*rc)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
542 -e "s|^($INSTALLDIR/program/.*\.xsl)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
543 -e "s|^($INSTALLDIR/share/config/[a-zA-Z0-9]*rc)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
544 -e "s|^($INSTALLDIR/share/dict/ooo/.*\.lst)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
545 -e "s|^($INSTALLDIR/share/psprint/.*\.conf)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
546 -e "s|^($INSTALLDIR/share/registry/.*\.xcu)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
547 -e "s|^($INSTALLDIR/share/registry/.*\.properties)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
548 -e "s|^($INSTALLDIR/share/registry/.*\.xcs)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
549 -e "s|^($INSTALLDIR/user/config/.*\.so.)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \
550 *_list.txt
553 mkdir -p $FILELISTSDIR/orig
554 mv -f $DESTDIR/gid_Module_* $FILELISTSDIR/orig