3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 GDBDIR
="${SRCDIR}/solenv/gdb"
11 INSTALLDIR
="${TESTINSTALLDIR}"
13 if [ "$(uname)" = Darwin
]; then
14 INSTALLDIR
=$INSTALLDIR/LibreOffice.app
/Contents
25 Install gdb pretty printers and autoloaders for them.
28 install-gdb-printers [ -a dir ] [ -i dir ] [ -p dir ] [ -c ]
29 install-gdb-printers -h
32 -a dir The dir where autoloaders will be placed. Defaults to whatever -i
34 -c Create the autoloader's dir if it does not exist. This option only
35 makes sense if both -a and -i are used.
36 -h Show this help text.
37 -i dir The dir where libreoffice is installed. Defaults to whatever -a is.
38 -p dir The dir where pretty printers are placed.
41 DESTDIR If set, it is prepended to all dir arguments.
44 1) Install pretty printers into /usr/share/libreoffice/gdb, with
45 autoloaders in /usr/share/gdb/auto-load (run
46 "info gdb 'Extending GDB' Python Auto-loading" to learn more) and
47 installation in /usr/lib64/libreoffice (this is what Fedora does):
49 install-gdb-printers -a /usr/share/gdb/auto-load/usr/lib64/libreoffice -c \\
50 -i /usr/lib64/libreoffice -p /usr/share/libreoffice/gdb
55 local lib
="${DESTDIR}${autoloaddir}/$2/$3"
59 resolved
=$
(readlink
"${DESTDIR}${installdir}/$2/$3")
60 [ -n "$resolved" ] && lib
=$resolved
64 mkdir
-p "${dir}" || die
"cannot create dir '${dir}'"
67 [[ -f ${lib}-gdb.py
]] && rm -f "${lib}-gdb.py"
68 if [[ -n "${merged}" ]]; then
69 sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULES%!${*:5}!" \
70 "${GDBDIR}/autoload.template" > "${lib}-gdb.py"
72 sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULES%!$1!" \
73 "${GDBDIR}/autoload.template" > "${lib}-gdb.py"
77 # dir where the autoloaders will be placed
79 # The installation dir. If only one of these is set, the other is set to
82 # dir where the pretty printers will be placed
84 # Create autoload dir if it does not exist. This only makes sense when
85 # installing into system gdb dir, so $autoloaddir must be absolute path.
88 # b de g jklmno qrstuvwxyzABCDEFGHIJK MNOPQRSTUVWXYZ0123456789
89 while getopts :a
:cfhi
:p
:L opt
; do
91 a
) autoloaddir
="${OPTARG}" ;;
94 i
) installdir
="${OPTARG}" ;;
95 p
) pythondir
="${OPTARG}" ;;
96 *) die
"unknown option ${OPTARG}" ;;
100 if [[ -z ${autoloaddir} && -z ${installdir} ]]; then
101 autoloaddir
="${INSTALLDIR}"
102 installdir
="${INSTALLDIR}"
103 elif [[ -n ${autoloaddir} && -z ${installdir} ]]; then
104 installdir
="${autoloaddir}"
105 elif [[ -z ${autoloaddir} && -n ${installdir} ]]; then
106 autoloaddir
="${installdir}"
109 if [[ -n ${DESTDIR} ]]; then
110 [[ ${autoloaddir:0:1} = / ]] || die
'the arg to -a must be an absolute path'
111 [[ ${pythondir:0:1} = / ]] || die
'the arg to -p must be an absolute path'
114 [[ ${autoloaddir:0:1} = / ]] || die
'the arg to -a must be an absolute path'
116 [[ ! -d ${DESTDIR}${autoloaddir} ]] && die "directory '${DESTDIR}${autoloaddir}' does not exist"
118 [[ ! -d ${DESTDIR}${installdir} ]] && die "directory '${DESTDIR}${installdir}' does not exist
"
119 [[ ! -d ${GDBDIR} ]] && die "directory
'${GDBDIR}' does not exist
"
121 if [[ ${DESTDIR}${pythondir} != ${GDBDIR} ]]; then
122 mkdir -p "${DESTDIR}${pythondir}" || die "cannot create dir '${DESTDIR}${pythondir}'"
123 cp -pr "${GDBDIR}/libreoffice" "${DESTDIR}${pythondir}"
126 if [[ -n "${MERGELIBS}" ]]; then
127 make_autoload merged program libmergedlo."$DYLIB" merge svl tl basegfx vcl
128 make_autoload cppu program libuno_cppu."$DYLIB".3
129 make_autoload sal program libuno_sal."$DYLIB".3
130 make_autoload sw program libswlo."$DYLIB"
132 make_autoload basegfx program libbasegfxlo."$DYLIB"
133 make_autoload cppu program libuno_cppu."$DYLIB".3
134 make_autoload sal program libuno_sal."$DYLIB".3
135 make_autoload svl program libsvllo."$DYLIB"
136 make_autoload sw program libswlo."$DYLIB"
137 make_autoload tl program libtllo."$DYLIB"
138 make_autoload vcl program libvcllo."$DYLIB"
140 make_autoload writerfilter program libwriterfilterlo."$DYLIB"
142 # vim:set shiftwidth=4 softtabstop=4 expandtab: