generate-ttl.sh (854B)
1 #!/bin/bash 2 3 # the realpath function is not available on some systems 4 if ! which realpath &>/dev/null; then 5 function realpath() { 6 [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 7 } 8 fi 9 10 set -e 11 12 BIN_DIR=${1} 13 14 if [ -z "${BIN_DIR}" ]; then 15 BIN_DIR=bin 16 fi 17 18 if [ ! -d ${BIN_DIR} ]; then 19 echo "Please run this script from the source root folder" 20 exit 21 fi 22 23 PWD="$(dirname "${0}")" 24 25 if [ -f "${PWD}/lv2_ttl_generator.exe" ]; then 26 GEN="$(realpath ${PWD}/lv2_ttl_generator.exe)" 27 EXT=dll 28 else 29 GEN="$(realpath ${PWD}/lv2_ttl_generator)" 30 if [ -d /Library/Audio ]; then 31 EXT=dylib 32 else 33 EXT=so 34 fi 35 fi 36 37 cd ${BIN_DIR} 38 FOLDERS=`find . -type d -name \*.lv2` 39 40 for i in ${FOLDERS}; do 41 cd ${i} 42 FILE="$(ls *.${EXT} 2>/dev/null | sort | head -n 1)" 43 if [ -n "${FILE}" ]; then 44 ${EXE_WRAPPER} "${GEN}" "./${FILE}" 45 fi 46 cd .. 47 done