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 -f Do not create subdirs in the autoloader's dir. This option is only
38 -h Show this help text.
39 -i dir The dir where libreoffice is installed. Defaults to whatever -a is.
40 -p dir The dir where pretty printers are placed.
43 DESTDIR If set, it is prepended to all dir arguments.
46 1) Install pretty printers into /usr/share/libreoffice/gdb, with
47 autoloaders in /usr/share/gdb/auto-load (run
48 "info gdb 'Extending GDB' Python Auto-loading" to learn more) and
49 installation in /usr/lib64/libreoffice (this is what Fedora does):
51 install-gdb-printers -a /usr/share/gdb/auto-load/usr/lib64/libreoffice -c \\
52 -i /usr/lib64/libreoffice -p /usr/share/libreoffice/gdb
57 local dir
="${DESTDIR}${autoloaddir}"
58 ${flat} || dir
="${dir}/$2"
63 local resolved
="$(readlink "${DESTDIR}${installdir}/$2/$3")"
64 [ -n "$resolved" ] && lib
=$resolved
69 mkdir
-p "${dir}" || die
"cannot create dir '${dir}'"
72 [[ -f ${lib}-gdb.py
]] && rm -f "${lib}-gdb.py"
73 if [[ -n "${merged}" ]]; then
74 sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULES%!${*:5}!" \
75 "${GDBDIR}/autoload.template" > "${lib}-gdb.py"
77 sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULES%!$1!" \
78 "${GDBDIR}/autoload.template" > "${lib}-gdb.py"
82 # dir where the autoloaders will be placed
84 # The installation dir. If only one of these is set, the other is set to
87 # dir where the pretty printers will be placed
89 # Create autoload dir if it does not exist. This only makes sense when
90 # installing into system gdb dir, so $autoloaddir must be absolute path.
92 # This option is only here to enable using the script during build of
93 # solenv/gdb . We must (or, better, want to :) avoid using the
94 # installation subpaths (like ure-link), because all libs in solver
95 # are in the same dir.
98 # b de g jklmno qrstuvwxyzABCDEFGHIJK MNOPQRSTUVWXYZ0123456789
99 while getopts :a
:cfhi
:p
:L opt
; do
101 a
) autoloaddir
="${OPTARG}" ;;
105 i
) installdir
="${OPTARG}" ;;
106 p
) pythondir
="${OPTARG}" ;;
107 *) die
"unknown option ${OPTARG}" ;;
111 if [[ -z ${autoloaddir} && -z ${installdir} ]]; then
112 autoloaddir
="${INSTALLDIR}"
113 installdir
="${INSTALLDIR}"
114 elif [[ -n ${autoloaddir} && -z ${installdir} ]]; then
115 installdir
="${autoloaddir}"
116 elif [[ -z ${autoloaddir} && -n ${installdir} ]]; then
117 autoloaddir
="${installdir}"
120 if [[ -n ${DESTDIR} ]]; then
121 [[ ${autoloaddir:0:1} = / ]] || die
'the arg to -a must be an absolute path'
122 [[ ${pythondir:0:1} = / ]] || die
'the arg to -p must be an absolute path'
125 [[ ${autoloaddir:0:1} = / ]] || die
'the arg to -a must be an absolute path'
127 [[ ! -d ${DESTDIR}${autoloaddir} ]] && die "directory '${DESTDIR}${autoloaddir}' does not exist"
129 [[ ! -d ${DESTDIR}${installdir} ]] && die "directory '${DESTDIR}${installdir}' does not exist
"
130 [[ ! -d ${GDBDIR} ]] && die "directory
'${GDBDIR}' does not exist
"
132 if [[ ${DESTDIR}${pythondir} != ${GDBDIR} ]]; then
133 mkdir -p "${DESTDIR}${pythondir}" || die "cannot create dir '${DESTDIR}${pythondir}'"
134 cp -pr "${GDBDIR}/libreoffice" "${DESTDIR}${pythondir}"
137 # keep in sync with solenv/Package_gdb.mk
138 if [[ -n "${MERGELIBS}" ]]; then
139 make_autoload merged program libmergedlo."$DYLIB" merge svl tl basegfx `[[ ${MERGELIBS} == "ALL" ]] && echo sw`
140 if [[ ${MERGELIBS} == "ALL" ]]; then
141 make_autoload urelibs ure/lib liburelibs."$DYLIB" merge cppu sal
143 make_autoload cppu ure/lib libuno_cppu."$DYLIB".3
144 make_autoload sal ure/lib libuno_sal."$DYLIB".3
145 make_autoload sw program libswlo."$DYLIB"
148 make_autoload basegfx program libbasegfxlo."$DYLIB"
149 make_autoload cppu ure/lib libuno_cppu."$DYLIB".3
150 make_autoload sal ure/lib libuno_sal."$DYLIB".3
151 make_autoload svl program libsvllo."$DYLIB"
152 make_autoload sw program libswlo."$DYLIB"
153 make_autoload tl program libtllo."$DYLIB"
155 make_autoload writerfilter program libwriterfilterlo."$DYLIB"
157 # vim:set shiftwidth=4 softtabstop=4 expandtab: