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
="${SOLARENV}/gdb"
11 SOLVERLIBDIR
="${SOLARVER}/${INPATH}/lib"
12 INSTALLDIR
="${DEVINSTALLDIR}/opt"
14 if [ "$(uname)" = Darwin
]; then
15 INSTALLDIR
=$INSTALLDIR/LibreOffice.app
/Contents
26 Install gdb pretty printers and autoloaders for them.
29 install-gdb-printers [ -a dir ] [ -i dir ] [ -p dir ] [ -c ] [ -L ]
30 install-gdb-printers -h
33 -a dir The dir where autoloaders will be placed. Defaults to whatever -i
35 -c Create the autoloader's dir if it does not exist. This option only
36 makes sense if both -a and -i are used.
37 -f Do not create subdirs in the autoloader's dir. This option is only
39 -h Show this help text.
40 -i dir The dir where libreoffice is installed. Defaults to whatever -a is.
41 -L Create symlinks to autoloaders already present in the build tree.
42 Only makes sense for dev. installation.
43 -p dir The dir where pretty printers are placed.
46 DESTDIR If set, it is prepended to all dir arguments.
49 1) Make pretty printers usable in your dev. installation (this is
50 already done as part of make dev-install, but it would not have been
51 run if smoketest failed):
53 install-gdb-printers -L
55 2) Install pretty printers into /usr/share/libreoffice/gdb, with
56 autoloaders in /usr/share/gdb/auto-load (run
57 "info gdb 'Extending GDB' Python Auto-loading" to learn more) and
58 installation in /usr/lib64/libreoffice (this is what Fedora does):
60 install-gdb-printers -a /usr/share/gdb/auto-load/usr/lib64/libreoffice -c \\
61 -i /usr/lib64/libreoffice -p /usr/share/libreoffice/gdb
66 local dir
="${DESTDIR}${autoloaddir}"
67 ${flat} || dir
="${dir}/$2"
72 local resolved
="$(readlink "${DESTDIR}${installdir}/$2/$3")"
73 [ -n "$resolved" ] && lib
=$resolved
78 mkdir
-p "${dir}" || die
"cannot create dir '${dir}'"
82 if [[ ${dir} != ${SOLVERLIBDIR} ]]; then
83 local gdbname
="${lib##*/}-gdb.py"
84 [[ -f ${dir}/${gdbname} ]] && rm -f "${dir}/${gdbname}"
85 ln -s "${SOLVERLIBDIR}/${gdbname}" "${dir}/${gdbname}"
88 [[ -f ${lib}-gdb.py ]] && rm -f "${lib}-gdb.py
"
89 if [[ -n "${merged}" ]]; then
90 sed -e "s
!%PYTHONDIR
%!${pythondir}!" -e "s
!%MODULES
%!${*:5}!" \
91 "${GDBDIR}/autoload.template
" > "${lib}-gdb.py
"
93 sed -e "s
!%PYTHONDIR
%!${pythondir}!" -e "s
!%MODULES
%!$1!" \
94 "${GDBDIR}/autoload.template
" > "${lib}-gdb.py
"
99 # dir where the autoloaders will be placed
101 # The installation dir. If only one of these is set, the other is set to
104 # dir where the pretty printers will be placed
105 pythondir="${GDBDIR}"
106 # Create autoload dir if it does not exist. This only makes sense when
107 # installing into system gdb dir, so $autoloaddir must be absolute path.
109 # Create symlinks to existing autoloaders in solver. This only makes
110 # sense for dev-install.
112 # This option is only here to enable using the script during build of
113 # solenv/gdb . We must (or, better, want to :) avoid using the
114 # installation subpaths (like ure-link), because all libs in solver
115 # are in the same dir.
118 # b de g jklmno qrstuvwxyzABCDEFGHIJK MNOPQRSTUVWXYZ0123456789
119 while getopts :a:cfhi:p:L opt; do
121 a) autoloaddir="${OPTARG}" ;;
125 i) installdir="${OPTARG}" ;;
126 p) pythondir="${OPTARG}" ;;
128 *) die "unknown option
${OPTARG}" ;;
132 if [[ -z ${autoloaddir} && -z ${installdir} ]]; then
133 autoloaddir="${INSTALLDIR}"
134 installdir="${INSTALLDIR}"
135 elif [[ -n ${autoloaddir} && -z ${installdir} ]]; then
136 installdir="${autoloaddir}"
137 elif [[ -z ${autoloaddir} && -n ${installdir} ]]; then
138 autoloaddir="${installdir}"
141 ${create} && ${link} && die "-c and
-L cannot be used together
"
142 if [[ -n ${DESTDIR} ]]; then
143 [[ ${autoloaddir:0:1} = / ]] || die 'the arg to -a must be an absolute path'
144 [[ ${pythondir:0:1} = / ]] || die 'the arg to -p must be an absolute path'
147 [[ ${autoloaddir:0:1} = / ]] || die 'the arg to -a must be an absolute path'
149 [[ ! -d ${DESTDIR}${autoloaddir} ]] && die "directory '${DESTDIR}${autoloaddir}' does not exist"
151 [[ ! -d ${DESTDIR}${installdir} ]] && die "directory '${DESTDIR}${installdir}' does not exist"
152 [[ ! -d ${GDBDIR} ]] && die "directory '${GDBDIR}' does not exist"
154 if [[ ${DESTDIR}${pythondir} != ${GDBDIR} ]]; then
155 mkdir -p "${DESTDIR}${pythondir}" || die "cannot create dir '${DESTDIR}${pythondir}'"
156 cp -pr "${GDBDIR}/libreoffice" "${DESTDIR}${pythondir}"
159 if [[ -n "${MERGELIBS}" ]]; then
160 make_autoload merged program libmergedlo."$DYLIB" merge svl tl `[[ ${MERGELIBS} == "ALL
" ]] && echo sw`
161 if [[ ${MERGELIBS} == "ALL
" ]]; then
162 make_autoload urelibs ure-link/lib liburelibs."$DYLIB" merge cppu sal
164 make_autoload cppu ure-link/lib libuno_cppu."$DYLIB".3
165 make_autoload sal ure-link/lib libuno_sal."$DYLIB".3
166 make_autoload sw program libswlo."$DYLIB"
169 make_autoload cppu ure-link/lib libuno_cppu."$DYLIB".3
170 make_autoload sal ure-link/lib libuno_sal."$DYLIB".3
171 make_autoload svl program libsvllo."$DYLIB"
172 make_autoload tl program libtllo."$DYLIB"
173 make_autoload sw program libswlo."$DYLIB"
176 # vim:set shiftwidth=4 softtabstop=4 expandtab: