#!/usr/bin/env bash # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # GDBDIR="${SRCDIR}/solenv/gdb" INSTALLDIR="${TESTINSTALLDIR}" DYLIB=so if [ "$(uname)" = Darwin ]; then INSTALLDIR=$INSTALLDIR/LibreOffice.app/Contents DYLIB=dylib fi die() { echo "$1" >&2 exit 1 } usage() { cat < "${lib}-gdb.py" else sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULES%!$1!" \ "${GDBDIR}/autoload.template" > "${lib}-gdb.py" fi } # dir where the autoloaders will be placed autoloaddir= # The installation dir. If only one of these is set, the other is set to # the same value. installdir= # dir where the pretty printers will be placed pythondir="${GDBDIR}" # Create autoload dir if it does not exist. This only makes sense when # installing into system gdb dir, so $autoloaddir must be absolute path. create=false # b de g jklmno qrstuvwxyzABCDEFGHIJK MNOPQRSTUVWXYZ0123456789 while getopts :a:cfhi:p:L opt; do case ${opt} in a) autoloaddir="${OPTARG}" ;; c) create=true ;; h) usage; exit ;; i) installdir="${OPTARG}" ;; p) pythondir="${OPTARG}" ;; *) die "unknown option ${OPTARG}" ;; esac done if [[ -z ${autoloaddir} && -z ${installdir} ]]; then autoloaddir="${INSTALLDIR}" installdir="${INSTALLDIR}" elif [[ -n ${autoloaddir} && -z ${installdir} ]]; then installdir="${autoloaddir}" elif [[ -z ${autoloaddir} && -n ${installdir} ]]; then autoloaddir="${installdir}" fi if [[ -n ${DESTDIR} ]]; then [[ ${autoloaddir:0:1} = / ]] || die 'the arg to -a must be an absolute path' [[ ${pythondir:0:1} = / ]] || die 'the arg to -p must be an absolute path' fi if ${create}; then [[ ${autoloaddir:0:1} = / ]] || die 'the arg to -a must be an absolute path' else [[ ! -d ${DESTDIR}${autoloaddir} ]] && die "directory '${DESTDIR}${autoloaddir}' does not exist" fi [[ ! -d ${DESTDIR}${installdir} ]] && die "directory '${DESTDIR}${installdir}' does not exist" [[ ! -d ${GDBDIR} ]] && die "directory '${GDBDIR}' does not exist" if [[ ${DESTDIR}${pythondir} != ${GDBDIR} ]]; then mkdir -p "${DESTDIR}${pythondir}" || die "cannot create dir '${DESTDIR}${pythondir}'" cp -pr "${GDBDIR}/libreoffice" "${DESTDIR}${pythondir}" fi if [[ -n "${MERGELIBS}" ]]; then make_autoload merged program libmergedlo."$DYLIB" merge svl tl basegfx vcl utl make_autoload cppu program libuno_cppu."$DYLIB".3 make_autoload sal program libuno_sal."$DYLIB".3 make_autoload sw program libswlo."$DYLIB" else make_autoload basegfx program libbasegfxlo."$DYLIB" make_autoload cppu program libuno_cppu."$DYLIB".3 make_autoload sal program libuno_sal."$DYLIB".3 make_autoload svl program libsvllo."$DYLIB" make_autoload sw program libswlo."$DYLIB" make_autoload tl program libtllo."$DYLIB" make_autoload utl program libutllo."$DYLIB" make_autoload vcl program libvcllo."$DYLIB" fi make_autoload sw_writerfilter program libsw_writerfilterlo."$DYLIB" # vim:set shiftwidth=4 softtabstop=4 expandtab: