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"
58 local resolved
="$(readlink "${DESTDIR}${installdir}/$2/$3")"
59 [ -n "$resolved" ] && lib
=$resolved
63 mkdir
-p "${dir}" || die
"cannot create dir '${dir}'"
66 [[ -f ${lib}-gdb.py
]] && rm -f "${lib}-gdb.py"
67 if [[ -n "${merged}" ]]; then
68 sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULES%!${*:5}!" \
69 "${GDBDIR}/autoload.template" > "${lib}-gdb.py"
71 sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULES%!$1!" \
72 "${GDBDIR}/autoload.template" > "${lib}-gdb.py"
76 # dir where the autoloaders will be placed
78 # The installation dir. If only one of these is set, the other is set to
81 # dir where the pretty printers will be placed
83 # Create autoload dir if it does not exist. This only makes sense when
84 # installing into system gdb dir, so $autoloaddir must be absolute path.
87 # b de g jklmno qrstuvwxyzABCDEFGHIJK MNOPQRSTUVWXYZ0123456789
88 while getopts :a
:cfhi
:p
:L opt
; do
90 a
) autoloaddir
="${OPTARG}" ;;
93 i
) installdir
="${OPTARG}" ;;
94 p
) pythondir
="${OPTARG}" ;;
95 *) die
"unknown option ${OPTARG}" ;;
99 if [[ -z ${autoloaddir} && -z ${installdir} ]]; then
100 autoloaddir
="${INSTALLDIR}"
101 installdir
="${INSTALLDIR}"
102 elif [[ -n ${autoloaddir} && -z ${installdir} ]]; then
103 installdir
="${autoloaddir}"
104 elif [[ -z ${autoloaddir} && -n ${installdir} ]]; then
105 autoloaddir
="${installdir}"
108 if [[ -n ${DESTDIR} ]]; then
109 [[ ${autoloaddir:0:1} = / ]] || die
'the arg to -a must be an absolute path'
110 [[ ${pythondir:0:1} = / ]] || die
'the arg to -p must be an absolute path'
113 [[ ${autoloaddir:0:1} = / ]] || die
'the arg to -a must be an absolute path'
115 [[ ! -d ${DESTDIR}${autoloaddir} ]] && die "directory '${DESTDIR}${autoloaddir}' does not exist"
117 [[ ! -d ${DESTDIR}${installdir} ]] && die "directory '${DESTDIR}${installdir}' does not exist
"
118 [[ ! -d ${GDBDIR} ]] && die "directory
'${GDBDIR}' does not exist
"
120 if [[ ${DESTDIR}${pythondir} != ${GDBDIR} ]]; then
121 mkdir -p "${DESTDIR}${pythondir}" || die "cannot create dir '${DESTDIR}${pythondir}'"
122 cp -pr "${GDBDIR}/libreoffice" "${DESTDIR}${pythondir}"
125 if [[ -n "${MERGELIBS}" ]]; then
126 make_autoload merged program libmergedlo."$DYLIB" merge svl tl basegfx
127 make_autoload cppu program libuno_cppu."$DYLIB".3
128 make_autoload sal program libuno_sal."$DYLIB".3
129 make_autoload sw program libswlo."$DYLIB"
131 make_autoload basegfx program libbasegfxlo."$DYLIB"
132 make_autoload cppu program libuno_cppu."$DYLIB".3
133 make_autoload sal program libuno_sal."$DYLIB".3
134 make_autoload svl program libsvllo."$DYLIB"
135 make_autoload sw program libswlo."$DYLIB"
136 make_autoload tl program libtllo."$DYLIB"
138 make_autoload writerfilter program libwriterfilterlo."$DYLIB"
140 # vim:set shiftwidth=4 softtabstop=4 expandtab: