On Friday 25 November 2005 09:37, jpff@codemist.co.uk wrote: > Is not the best way to handle the need for an environment variable to > create a shell wrapper? I could adjust the installation program to > create such a wrapped system; would need a name though! I actually used this method and it works well for standalone executables, and also makes the utilities much smaller. It still requires the user to set up the environment in the case of using Csound modules from external software like PD, Python, etc., though (of course, if you are only interested in a Csound4-style package with static command line executables only, this is not an issue). For example, the wrapper script for the single precision "csound" frontend is (installed as /usr/local/bin/csound): #!/bin/sh export OPCODEDIR="/usr/local/lib/csound/plugins" export CSSTRNGS="/usr/local/lib/csound/xmg" if [ "${LD_LIBRARY_PATH}" == "" ] ; then export LD_LIBRARY_PATH="/usr/local/lib/csound/lib" else export LD_LIBRARY_PATH="/usr/local/lib/csound/lib:${LD_LIBRARY_PATH}" fi exec "/usr/local/lib/csound/bin/csound" "$@" Another example (/usr/local/bin/cvanal64): #!/bin/sh export OPCODEDIR64="/usr/local/lib/csound/plugins64" export CSSTRNGS="/usr/local/lib/csound/xmg" if [ "${LD_LIBRARY_PATH}" == "" ] ; then export LD_LIBRARY_PATH="/usr/local/lib/csound/lib" else export LD_LIBRARY_PATH="/usr/local/lib/csound/lib:${LD_LIBRARY_PATH}" fi exec "/usr/local/lib/csound/bin/csound64" -U cvanal "$@" I generate the wrapper scripts with the following Python function: pkgDir = '../__csound' binDir = '/usr/local/bin' binDir2 = '/usr/local/lib/csound/bin' libDir2 = '/usr/local/lib/csound/lib' pluginDir32 = '/usr/local/lib/csound/plugins' pluginDir64 = '/usr/local/lib/csound/plugins64' xmgDir = '/usr/local/lib/csound/xmg' def makeFrontEnd(utilName, is64bit): fName = '%s%s/%s%s' % (pkgDir, binDir, utilName, ['', '64'][is64bit]) f = open(fName, 'w') tmp = '#!/bin/sh\n' tmp += '\n' tmp += 'export %s="%s"\n' tmp += 'export CSSTRNGS="%s"\n' tmp += '\n' tmp += 'if [ "${LD_LIBRARY_PATH}" == "" ] ; then\n' tmp += ' export LD_LIBRARY_PATH="%s"\n' tmp += 'else\n' tmp += ' export LD_LIBRARY_PATH="%s:${LD_LIBRARY_PATH}"\n' tmp += 'fi\n' tmp += '\n' tmp += 'exec "%s/%s"%s "$@"\n' print >> f, tmp % (['OPCODEDIR', 'OPCODEDIR64'][is64bit], [pluginDir32, pluginDir64][is64bit], xmgDir, libDir2, libDir2, binDir2, ['csound', 'csound64'][is64bit], ['', ' -U %s' % utilName][int(utilName != 'csound')]) f.close os.chmod(fName, 0755) ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net