1# *************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20# *************************************************************
21umask 022
22
23if [ "${KDEMAINDIR}" ]
24then
25  echo Copying icons ..
26  for i in `cd ${ICON_SOURCE_DIR}; find ${ICON_THEMES:-hicolor/??x?? hicolor/???x??? locolor} -name "*.png"`
27  do
28    targetdir=${DESTDIR}/${KDEMAINDIR}/share/icons/`dirname $i`
29    mkdir -p $targetdir
30    destfile=$targetdir/${ICON_PREFIX:-}${ICON_PREFIX:+-}`basename $i`
31    cp ${ICON_SOURCE_DIR}/$i $destfile
32    chmod 0644 $destfile
33  done
34
35  mkdir -p ${DESTDIR}/${KDEMAINDIR}/share/mimelnk/application
36  for i in `cat mimelnklist`; do
37    cp $i ${DESTDIR}/${KDEMAINDIR}/share/mimelnk/application/${PREFIX}-$i
38  done
39  chmod 0644 ${DESTDIR}/${KDEMAINDIR}/share/mimelnk/application/*
40fi
41
42if [ "${GNOMEDIR}" ]
43then
44  echo Copying GNOME icons ..
45  for i in `cd ${ICON_SOURCE_DIR}/hicolor; find ??x?? ???x??? -name "*.png"`
46  do
47    targetdir=${DESTDIR}/${GNOMEDIR}/share/icons/gnome/`dirname $i`
48    mkdir -p $targetdir
49    destfile=$targetdir/${ICON_PREFIX:-}${ICON_PREFIX:+-}`basename $i`
50    cp ${ICON_SOURCE_DIR}/hicolor/$i $destfile
51    chmod 0644 $destfile
52  done
53
54  mkdir -p ${DESTDIR}/${GNOMEDIR}/share/mime-info
55  cp openoffice.mime ${DESTDIR}/${GNOMEDIR}/share/mime-info/${PREFIX}.mime
56  cp openoffice.keys ${DESTDIR}/${GNOMEDIR}/share/mime-info/${PREFIX}.keys
57  chmod 0644 ${DESTDIR}/${GNOMEDIR}/share/mime-info/${PREFIX}.*
58
59  mkdir -p ${DESTDIR}/${GNOMEDIR}/share/application-registry
60  cp openoffice.applications ${DESTDIR}/${GNOMEDIR}/share/application-registry/${PREFIX}.applications
61  chmod 0644 ${DESTDIR}/${GNOMEDIR}/share/application-registry/${PREFIX}.*
62
63  if [ "${GNOME_MIME_THEME}" ]
64  then
65    echo "Creating legacy mimetype symlinks for GNOME .."
66    # add symlinks so that nautilus can identify the mime-icons
67    # not strictly freedesktop-stuff but there is no common naming scheme yet.
68    # One proposal is "mime-application:vnd.oasis.opendocument.spreadsheet.png"
69    # for e.g. application/vnd.oasis.opendocument.spreadsheet
70    link_target_root="${DESTDIR}/${GNOMEDIR}/share/icons/${GNOME_MIME_THEME}"
71    if [ ! -d "${link_target_root}" ]
72    then
73      link_target_root="${DESTDIR}/${GNOMEDIR}/share/icons/gnome"
74    fi
75
76    for subdir in `cd ${link_target_root}; ls -d *`
77    do
78      link_target_dir=""
79      link_dir="${DESTDIR}/${GNOMEDIR}/share/icons/${GNOME_MIME_THEME}/$subdir/mimetypes"
80      if [ ! -d "${link_dir}" ]
81      then
82        mkdir -p "${link_dir}"
83	link_target_dir="../../../gnome/$subdir/mimetypes/"
84      fi
85      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}drawing.png                     ${link_dir}/gnome-mime-application-vnd.sun.xml.draw.png
86      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}drawing-template.png            ${link_dir}/gnome-mime-application-vnd.sun.xml.draw.template.png
87      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}formula.png                     ${link_dir}/gnome-mime-application-vnd.sun.xml.math.png
88      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}master-document.png             ${link_dir}/gnome-mime-application-vnd.sun.xml.writer.global.png
89      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-database.png              ${link_dir}/gnome-mime-application-vnd.sun.xml.base.png
90      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-database.png              ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.database.png
91      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-drawing.png               ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.graphics.png
92      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-drawing-template.png      ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.graphics-template.png
93      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-formula.png               ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.formula.png
94      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-master-document.png       ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.text-master.png
95      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-presentation.png          ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.presentation.png
96      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-presentation-template.png ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.presentation-template.png
97      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-spreadsheet.png           ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.spreadsheet.png
98      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-spreadsheet-template.png  ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.spreadsheet-template.png
99      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-text.png                  ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.text.png
100      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-text-template.png         ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.text-template.png
101      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}oasis-web-template.png          ${link_dir}/gnome-mime-application-vnd.oasis.opendocument.text-web.png
102      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}presentation.png                ${link_dir}/gnome-mime-application-vnd.sun.xml.impress.png
103      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}presentation-template.png       ${link_dir}/gnome-mime-application-vnd.sun.xml.impress.template.png
104      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}spreadsheet.png                 ${link_dir}/gnome-mime-application-vnd.sun.xml.calc.png
105      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}spreadsheet-template.png        ${link_dir}/gnome-mime-application-vnd.sun.xml.calc.template.png
106      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}text.png                        ${link_dir}/gnome-mime-application-vnd.sun.xml.writer.png
107      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}text-template.png               ${link_dir}/gnome-mime-application-vnd.sun.xml.writer.template.png
108      ln -sf $link_target_dir${ICON_PREFIX:-}${ICON_PREFIX:+-}extension.png                   ${link_dir}/gnome-mime-application-vnd.openofficeorg.extension.png
109    done
110  fi
111fi
112
113mkdir -p ${DESTDIR}/usr/bin
114
115office_root=/opt/${PREFIX}
116
117ln -sf ${office_root}/program/soffice ${DESTDIR}/usr/bin/soffice
118
119cp openoffice.sh ${DESTDIR}/usr/bin/${PREFIX}
120cp printeradmin.sh ${DESTDIR}/usr/bin/${PREFIX}-printeradmin
121chmod 0755 ${DESTDIR}/usr/bin/${PREFIX} ${DESTDIR}/usr/bin/${PREFIX}-printeradmin
122
123mkdir -p ${DESTDIR}/usr/share/mime/packages
124cp apacheopenoffice.xml ${DESTDIR}/usr/share/mime/packages/
125chmod 0644 ${DESTDIR}/usr/share/mime/packages/apacheopenoffice.xml
126
127mkdir -p ${DESTDIR}/usr/share/applications
128for i in `cat launcherlist`; do
129  ln -sf ${office_root}/share/xdg/$i ${DESTDIR}/usr/share/applications/${PREFIX}-$i
130done
131
132