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