106 lines (87 with data), 3.1 kB
# Copyright (c) 2009 D. Michael McIntyre <email@example.com>
# Released under the GPL
# REQUIRES: a working copy under Subversion version control
# PURPOSE: Having to edit data.qrc by hand every time I add a file is annoying,
# and so I decided to write a script to assemble a .qrc file for me. I'm
# surprised there wasn't one already.
# After some iterations, this script now refuses to add files that aren't under
# version control, so we can't (easily) commit a data.qrc that refers to
# local-only files.
echo "QRC Builder: Assembling a new data/data.qrc based on the current contents of data/"
cd data||exit 1
echo " assembling files of type $1..."
if (svn info > /dev/null 2>&1); then
for f in $(find . -name \*.$1 | sort); do
if (svn info $f > /dev/null 2>&1); then
# skip rosegarden.ts
[ "$(basename $f)" == "rosegarden.ts" ] && continue
# change .ts extension to .qm, which are the files we actually
# need to bundle for every .ts we eventually have
f=$(echo $f|sed "s/\.ts/\.qm/g")
cat >> $ofile << EOF
cat > $ofile << EOF
WARNING! This file was created automatically by $0, probably as a result of
DO NOT EDIT THIS FILE BY HAND! All changes will be LOST!
for ext in pfa png ts qss rc rg rgd rgp rgt xml xpm; do
cat >> $ofile << EOF
if [ "$not_added" != "" ]; then
cat << EOF
WARNING! The following files are not under Subversion version control, and were
ignored. They must be added to the Subversion repository in order to be
compiled into the resource bundle, and you must be working from a
Subversion-controlled working copy in order to add new resources to the project.
PLEASE NOTE: This only applies if you are ADDING NEW resources to the project,
such as new icons. You may build EXISTING resources from a working copy under
any kind of version control, or one that is not under version control at all,
even if you have changed those existing resources in some way. (For example, if
you change data/rc/matrix.rc, this file is already referenced by data.qrc, and
any changes you make to it will be picked up in due course.)
In order to add NEW data files to the resource bundle, you must first 'svn
add' them to your local working copy. This policy ensures that all files
referred to by data.qrc will exist in the repository, so that developers will be
discouraged from committing a data.qrc that refers to missing files. This
causes the entire build to fail for everyone else. If you wish to add new data
files, you will need a Subversion-controlled working copy available for that
for f in $not_added;do
echo All resources successfully added!