summaryrefslogtreecommitdiffstats
path: root/bin/distro-install-desktop-integration
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.cz>2011-07-08 12:01:56 +0200
committerPetr Mladek <pmladek@suse.cz>2011-07-11 20:30:31 +0200
commit8124bdf39b719c66e61355c0bc64f8235c4fbec0 (patch)
treea7a8f52492191bdea7e142358698fab5a2081817 /bin/distro-install-desktop-integration
parentbin/unpack-sources: new helper script for packaging LO (diff)
downloadcore-8124bdf39b719c66e61355c0bc64f8235c4fbec0.tar.gz
core-8124bdf39b719c66e61355c0bc64f8235c4fbec0.zip
better support for distro packaging
This is port from the build repo. The main differences are: + splits package-ooo into several scripts (bin/distro-install-*) + renames many variables to avoid OOO prefix and to better fit the variables produced by the current bootstrap configure.in + uses OOO_VENDOR from bootstrap/configure.in to add distro specific hacks; the conditions have been updated only for "Novell, inc." + install most of the desktop integration from sysui using sysui/desktop/share/create_tree.sh + do not install two extra templates: $OOINSTBASE/basis$VERSION/share/template/en-US/forms/resume.ott $OOINSTBASE/basis$VERSION/share/template/en-US/officorr/project-proposal.ott should get merged with other templates + do not install pyunorc-update64; it is needed only when you want to run 32-bit LO on 64-bit system; is anyone using it? + do not call install-dictionaries: + do not call build-galleries: is anyone using them? + do not install ootool and ooconfig is anyone using them? are they still working? Signed-off-by: Michael Meeks <michael.meeks@novell.com> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Bjoern Michaelsen <bjoern.michaelsen@gmail.com>
Diffstat (limited to 'bin/distro-install-desktop-integration')
-rwxr-xr-xbin/distro-install-desktop-integration180
1 files changed, 180 insertions, 0 deletions
diff --git a/bin/distro-install-desktop-integration b/bin/distro-install-desktop-integration
new file mode 100755
index 000000000000..c00c8c6754fb
--- /dev/null
+++ b/bin/distro-install-desktop-integration
@@ -0,0 +1,180 @@
+#!/bin/sh
+
+. ./*[Ee]nv.[Ss]et.sh
+
+PRODUCTVERSION_NODOT=`echo $PRODUCTVERSION | sed -e "s/\.//"`
+
+mkdir -p $DESTDIR$PREFIXDIR/bin
+
+
+create_wrapper()
+{
+ echo "Install $PREFIXDIR/bin/$1"
+
+ mkdir -p $DESTDIR$PREFIXDIR/bin
+ cat <<EOT >$DESTDIR$PREFIXDIR/bin/$1
+#!/bin/sh
+$INSTALLDIR/program/$2 $3 "\$@"
+EOT
+ chmod 755 $DESTDIR$PREFIXDIR/bin/$1
+ # put into file list
+ test -f "$DESTDIR/$4" && echo "$PREFIXDIR/bin/$1" >>$DESTDIR/$4
+}
+
+create_man_link()
+{
+ echo "Install $MANDIR/man1/$1.1.gz"
+
+ mkdir -p $DESTDIR$MANDIR/man1
+ echo ".so man1/$2.1" >| $DESTDIR$MANDIR/man1/$1.1
+ gzip -f $DESTDIR$MANDIR/man1/$1.1
+ test -f "$DESTDIR/$3" && echo "$MANDIR/man1/$1.1.gz" >>"$DESTDIR/$3"
+}
+
+install_man()
+{
+ echo "Install $MANDIR/man1/$1.1.gz"
+
+ mkdir -p $DESTDIR$MANDIR/man1
+ cp sysui/desktop/man/$1.1 $DESTDIR$MANDIR/man1 || exit 1;
+ gzip -f $DESTDIR$MANDIR/man1/$1.1
+ test -f "$DESTDIR/$2" && echo "$MANDIR/man1/$1.1.gz" >>"$DESTDIR/$2"
+}
+
+
+add_wrapper()
+{
+ lowrapper_name="$1"
+ target_binary="$2"
+ target_option_1="$3"
+ used_man_page="$4"
+ desktop_file="$5"
+ file_list="$6"
+
+ # do we want compat oowrapper?
+ oowrapper_name=""
+ if test "$WITH_COMPAT_OOWRAPPERS" == 'YES' ; then
+ oowrapper_name=`echo "$lowrapper_name" | sed -e "s/^lo/oo/"`
+ # "oo" prefix only for wrappers stating with "lo" prefix
+ test "$oowrapper_name" = "$lowrapper_name" && oowrapper_name=
+ fi
+
+ # wrappers
+ create_wrapper "$lowrapper_name" "$target_binary" "$target_option_1" "$file_list"
+ test -n "$oowrapper_name" && create_wrapper "$oowrapper_name" "$target_binary" "$target_option_1" "$file_list"
+
+ # man pages
+ if test "$used_man_page" = "$lowrapper_name" ; then
+ # need to install the manual page
+ install_man "$lowrapper_name" "$file_list"
+ else
+ # just link the manual page
+ create_man_link "$lowrapper_name" "$used_man_page" "$file_list"
+ fi
+ test -n "$oowrapper_name" && create_man_link "$oowrapper_name" "$used_man_page" "$file_list"
+
+ # add desktop file to the right file list
+ test -n "$desktop_file" -a -f "$DESTDIR/$file_list" && echo "/usr/share/applications/$desktop_file" >>"$DESTDIR/$file_list"
+}
+
+# install desktop integration from plain packages
+sysui_temp=`mktemp -d /tmp/distro-pack-desktop-integration-XXXXXX`
+cp -a sysui/unxlng*/misc/libreoffice/* "$sysui_temp"
+cp -a sysui/desktop/share/create_tree.sh "$sysui_temp"
+builddir=`pwd`
+cd $sysui_temp
+# we want non-versioned stuff in the distro packages
+for file in * ; do
+ sed -e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION_NODOT/\1/" \
+ -e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION/\1/" \
+ -e "s/\($PRODUCTNAME\) $PRODUCTVERSION/\1/" \
+ "$file" >"$file.new"
+ mv "$file.new" "$file"
+done
+# call in subshell to do not malfrom PRODUCTVERSION, ...
+(
+ export OFFICE_PREFIX=$LIBDIR
+ export PREFIX=$INSTALLDIRNAME
+ export ICON_PREFIX=$INSTALLDIRNAME
+ export ICON_SOURCE_DIR=$builddir/sysui/desktop/icons
+ export PRODUCTVERSION=
+ export KDEMAINDIR=/usr
+ export GNOMEDIR=/usr
+ export GNOME_MIME_THEME=hicolor
+ /bin/bash ./create_tree.sh
+)
+cd -
+rm -rf $sysui_temp
+
+# we do not want some stuff from the plain packages
+rm -f $DESTDIR/$PREFIXDIR/bin/$INSTALLDIRNAME*
+rm -f $DESTDIR/usr/share/applications/libreoffice-javafilter.desktop
+rm -f $DESTDIR/usr/share/applications/libreoffice-printeradmin.desktop
+if test -d $DESTDIR/opt ; then
+ rm -f $DESTDIR/opt/$INSTALLDIRNAME
+ rmdir --ignore-fail-on-non-empty $DESTDIR/opt
+fi
+
+# we want non-versioned desktop files
+cd $DESTDIR/$INSTALLDIR/share/xdg
+# we want non-versioned stuff in the distro packages
+for file in *.desktop ; do
+ sed -e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION_NODOT/\1/" \
+ -e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION/\1/" \
+ -e "s/\($PRODUCTNAME\) $PRODUCTVERSION/\1/" \
+ "$file" >"$file.new"
+ mv "$file.new" "$file"
+done
+cd -
+
+# put the stuff installed by create_tree.sh into the right file lists
+# desktop files will be added by the corresponding add_wrapper command
+if test -f $DESTDIR/gid_Module_Root_Brand ; then
+ for dir in /usr/share/application-registry \
+ /usr/share/mimelnk/application \
+ /usr/share/mime/packages \
+ /usr/share/mime-info \
+ /usr/share/icons ; do
+ find "$DESTDIR$dir" \( -type f -o -type l \) -printf "$dir/%P\n" >>$DESTDIR/gid_Module_Root_Brand
+ done
+fi
+
+# wrappers and man pages
+# FIXME: do not have desktop file and MIME icon for unopkg
+add_wrapper lobase soffice "--base" "libreoffice" "libreoffice-base.desktop" "gid_Module_Brand_Prg_Base"
+add_wrapper localc soffice "--calc" "libreoffice" "libreoffice-calc.desktop" "gid_Module_Brand_Prg_Calc"
+add_wrapper lodraw soffice "--draw" "libreoffice" "libreoffice-draw.desktop" "gid_Module_Brand_Prg_Draw"
+add_wrapper lomath soffice "--math" "libreoffice" "libreoffice-math.desktop" "gid_Module_Brand_Prg_Math"
+add_wrapper loimpress soffice "--impress" "libreoffice" "libreoffice-impress.desktop" "gid_Module_Brand_Prg_Impress"
+add_wrapper loweb soffice "--web" "libreoffice" "" "gid_Module_Brand_Prg_Wrt"
+add_wrapper lowriter soffice "--writer" "libreoffice" "libreoffice-writer.desktop" "gid_Module_Brand_Prg_Wrt"
+add_wrapper lofromtemplate soffice ".uno:NewDoc" "libreoffice" "libreoffice-base.desktop" "gid_Module_Root_Brand"
+add_wrapper libreoffice soffice "" "libreoffice" "libreoffice-startcenter.desktop" "gid_Module_Root_Brand"
+add_wrapper loffice soffice "" "libreoffice" "" "gid_Module_Root_Brand"
+add_wrapper unopkg unopkg "" "unopkg" "" "gid_Module_Root_Brand"
+
+# /usr/bin/ooffice symlink is necessary by java UNO components to find
+# the UNO installation using $PATH, see
+# http://udk.openoffice.org/common/man/spec/transparentofficecomponents.html
+# Note: if you want to support parallel installation of more OOo versions
+# you cannot include this link directly into the package
+# For example, the Novell package mark this symlink as %ghost
+# and update it in %post and %postun
+ln -sf $INSTALLDIR/program/soffice $PREFIXDIR/bin/soffice
+
+# create bash completion
+mkdir -p $DESTDIR/etc/bash_completion.d
+./bin/generate-bash-completion bin/bash-completion.in $DESTDIR/etc/bash_completion.d/$INSTALLDIRNAME.sh
+test -f $DESTDIR/gid_Module_Root_Brand && echo "/etc/bash_completion.d/$INSTALLDIRNAME.sh" >>$DESTDIR/gid_Module_Root_Brand
+if test "$WITH_COMPAT_OOWRAPPERS" = "YES" ; then
+ ./bin/generate-bash-completion --compat-oowrappers bin/bash-completion.in $DESTDIR/etc/bash_completion.d/ooffice.sh
+ test -f $DESTDIR/gid_Module_Root_Brand && echo "/etc/bash_completion.d/ooffice.sh" >>$DESTDIR/gid_Module_Root_Brand
+fi
+
+echo "Install $OOINSTDIR/basis$VERSION/program/java-set-classpath";
+mkdir -p $DESTDIR$INSTALLDIR/basis$PRODUCTVERSION/program
+sed -e "s|@INSTALLDIR@|$INSTALLDIR|g" bin/java-set-classpath.in >| "$DESTDIR$INSTALLDIR/basis$PRODUCTVERSION/program/java-set-classpath" || exit 1;
+chmod 755 "$DESTDIR$INSTALLDIR/basis$PRODUCTVERSION/program/java-set-classpath"
+test -f $DESTDIR/gid_Module_Root_Brand && echo "$INSTALLDIR/basis$PRODUCTVERSION/program/java-set-classpath" >>$DESTDIR/gid_Module_Root_Brand
+
+exit 0 \ No newline at end of file