summaryrefslogtreecommitdiffstats
path: root/kpresenter/scripts/mkstandalone.sh
blob: 0423feb48b1ee78bec162eb6166d6d85a193b610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
# This script copies everything that is needed to run kpresenter on a
# computer where KDE isn't installed.
# Relies on kpresenter being installed on the local machine, in $TDEDIR
#
# The script copies everything into a directory. You just need to tar it up,
# transfer it (CD-ROM or via Internet), untar it, cd into it,
# and run the script "go.sh" with your presentation as argument.
# Debug output goes to kpresenter.out to avoid cluttering the terminal
# with our junk :-)  Check it out in case of problems.
#
# (C) David Faure <[email protected]>

# Pass output dir as argument
if [ $# -ne 1 ]; then
  echo "Usage : $0 <outputdir>"
else
  out=$1
########### Data
  mkdir -p $out
  mkdir -p $out/share
  mkdir -p $out/share/apps
  cp -r $TDEDIR/share/apps/kpresenter $out/share/apps/
  cp -r $TDEDIR/share/apps/koffice $out/share/apps/
  cp -r $TDEDIR/share/apps/tdestyle $out/share/apps/
  mkdir -p $out/share/config
  cp $TDEDIR/share/config/kdebug.areas $out/share/config/
  cp ~/.trinity/share/config/kdeglobals $out/share/config/
  cp ~/.trinity/share/config/kpresenterrc $out/share/config/
  ### cp $TDEDIR/share/icons $out/share/
  cp -r $TDEDIR/share/toolbar $out/share/
  mkdir -p $out/share/servicetypes
  cp $TDEDIR/share/servicetypes/kofficepart.desktop $out/share/servicetypes
  mkdir -p $out/share/applnk
  cp $TDEDIR/share/applnk/KOffice/kpresenter.desktop $out/share/applnk/

########### Libraries (warning, using Linux specific ldd !)
  TMPFILE=/tmp/__kpresenter_ldd.tmp
  mkdir -p $out/lib
  ldd $TDEDIR/bin/kpresenter | sed -e 's/.*=> \([^ ]*\).*/\1/' > $TMPFILE
  # Add style libs
  echo $TDEDIR/lib/basicstyle.so >> $TMPFILE
  echo $TDEDIR/lib/kstepstyle.so >> $TMPFILE
  # Add image handler libs
  echo $TDEDIR/lib/kimg_jpeg.so >> $TMPFILE
  echo $TDEDIR/lib/kimg_tiff.so >> $TMPFILE
  # Add libs for embedded parts here

  cat $TMPFILE | while read libfile; do
    # ldd shows the fullpath to a link.
    # Extract the directory from the fullpath
    origdir=`dirname $libfile`
    libfile=`basename $libfile`
    while [ -L $origdir/$libfile ]; do
        # Follow the symlink and create the same in $out/lib
	pointsto=`readlink $origdir/$libfile`
	echo "ln -s $out/$libfile $pointsto"
	ln -s $pointsto $out/lib/$libfile
	libfile=$pointsto;
    done
    # Copy the library itself
    echo "cp $origdir/$libfile $out/lib"
    cp $origdir/$libfile $out/lib
    # Copy the .la file as well
    lafile=`echo $libfile | sed -e 's/\.so.*/\.la/'`
    if [ -f $origdir/$lafile ]; then cp $origdir/$lafile $out/lib ; fi
  done
  rm -f $TMPFILE

########### Binaries
  mkdir -p $out/bin
  cp $TDEDIR/bin/kpresenter $out/bin/
  cp $TDEDIR/bin/dcopserver $out/bin/
  # Take kded as well - we could copy the tdesycoca file but we would have
  # to install it in ~/.trinity ...
  cp $TDEDIR/bin/kded $out/bin/

########### Startup script
  echo '#!/bin/sh' > $out/go.sh
  echo 'export TDEDIR=`pwd`' >> $out/go.sh
  echo 'export LD_LIBRARY_PATH=$TDEDIR/lib' >> $out/go.sh
  echo 'mkdir -p ~/.trinity 2>/dev/null' >> $out/go.sh
  echo 'mkdir -p ~/.trinity/share 2>/dev/null' >> $out/go.sh
  echo 'mkdir -p ~/.trinity/share/config 2>/dev/null' >> $out/go.sh
  echo 'cp share/config/* ~/.trinity/share/config' >> $out/go.sh
  echo 'bin/dcopserver 2>/dev/null' >> $out/go.sh
  echo 'sleep 1 ; bin/kded 2>/dev/null' >> $out/go.sh
  echo 'sleep 1 ; bin/kpresenter $* 1>/dev/null 2>kpresenter.out &' >> $out/go.sh
  chmod u+x $out/go.sh
fi