File indexing completed on 2024-12-08 05:05:48

0001 #!/bin/sh
0002 #
0003 # Copyright (c) 2016, Michal Policht. This file is dually licensed under terms of 
0004 # either WTFPL or BEER-WARE LICENSE. You may obtain the copy of WTFPL or BEER-WARE
0005 # LICENSE by googling it. NO WARRANTY. YOU WILL PAY ALL COSTS FOR ANY REPAIRS.
0006 #
0007 # This script calls qmlplugindump in order to generate QML typeinfo files.
0008 # Names of files and modules are currently hard coded.
0009 #
0010 # usage: qmltypes.sh [extrapath]
0011 # example: qmltypes.sh /path/to/lib1:/path/to/lib2
0012 #
0013 # parameters:
0014 # qmlplugindump - command invoking qmlplugindump.
0015 # dump_commands - a list of semicolon separated dump commands as passed to qmlplugindump.
0016 #   Commands may take form "command > file" to dump output into a file.
0017 # extrapath - path to be added to PATH environmental variable.
0018 #
0019 # required tools: sh, echo, tr, qmlplugindump
0020 
0021 
0022 function usage()
0023 {
0024     echo "usage: $0 [qmlplugindump] [dump_commands] [extrapath]"
0025 }
0026 
0027 if [ $# -lt 2 ]; then
0028     echo "error: too few arguments"
0029     usage
0030     exit 0
0031 fi
0032 
0033 if [ $# -gt 2 ]; then
0034     export PATH=$PATH:$3
0035     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$3
0036 fi
0037 
0038 qmlplugindump_program=$1
0039 dump_commands=$2
0040 
0041 echo "Running qmlplugindump..."
0042 
0043 dump_commands=$(echo $dump_commands | tr -d '\n')
0044 org_IFS=$IFS
0045 IFS=';'
0046 dump_commands_arr=($dump_commands)
0047 IFS=$org_IFS
0048 for dump_command in "${dump_commands_arr[@]}"
0049 do
0050     IFS='>' 
0051     dump_args_file=($dump_command)
0052     IFS=$org_IFS
0053     dump_args=$(echo ${dump_args_file[0]})
0054     if [ ${#dump_args_file[@]} -gt 1 ]; then
0055         dump_file=$(echo ${dump_args_file[1]} | tr -cd '[:print:]')
0056         echo "$qmlplugindump_program $dump_args > $dump_file"
0057         $qmlplugindump_program $dump_args > $dump_file
0058     else
0059         echo "$qmlplugindump_program $dump_args"
0060         $qmlplugindump_program $dump_args
0061     fi
0062 done
0063 
0064 echo ""
0065 echo "In case qmlplugindump fails:"
0066 echo "- Ensure that PATH environmental variable is being set correctly."
0067 echo "- All dependent libraries are visible (extrapath parameter may be handy)."
0068 echo "- Release versions of libraries are available (including QML plugin)."
0069