wxgtk and wxstring link problems


eyecreate

Member
Joined
Feb 3, 2009
Messages
253
Website
git.eyecreate.org
This seems to be a common problem when googling when compiling wx apps, but I can't seem to figure out what's wrong.


undefined reference to `wxStringBase::InitWith(wchar_t const*, unsigned int, unsigned int)'


undefined reference to `wxString::mb_str(wxMBConv const&) const'


undefined reference to `operator+(wchar_t const*, wxString const&)'


I tried the suggestions I saw like making sure I had the unicode macro on(I am using a wx build with unicode and dynamic lib) and using --no-as-needed, but neither allowed linking to work. Maybe this is all because the scons I'm using is breaking the build env, but I went through the Sconstruct file and thought I changed the needed lines.


This is the link line that is failing:



Code:
/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++ -o Aria -pthread -Wl,-rpath,/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib -Wl,--rpath,/mnt/utmp/aria/lib/ rtmidi/RtMidi.o irrXML/irrXML.o libjdkmidi/src/jdkmidi_smpte.o libjdkmidi/src/jdkmidi_edittrack.o libjdkmidi/src/jdkmidi_process.o libjdkmidi/src/jdkmidi_fileshow.o libjdkmidi/src/jdkmidi_showcontrolhandler.o libjdkmidi/src/jdkmidi_matrix.o libjdkmidi/src/jdkmidi_midi.o libjdkmidi/src/jdkmidi_file.o libjdkmidi/src/jdkmidi_advancedsequencer.o libjdkmidi/src/jdkmidi_filewrite.o libjdkmidi/src/jdkmidi_showcontrol.o libjdkmidi/src/jdkmidi_filereadmultitrack.o libjdkmidi/src/jdkmidi_sequencer.o libjdkmidi/src/jdkmidi_multitrack.o libjdkmidi/src/jdkmidi_tick.o libjdkmidi/src/jdkmidi_queue.o libjdkmidi/src/jdkmidi_manager.o libjdkmidi/src/jdkmidi_filewritemultitrack.o libjdkmidi/src/jdkmidi_track.o libjdkmidi/src/jdkmidi_msg.o libjdkmidi/src/jdkmidi_tempo.o libjdkmidi/src/jdkmidi_fileread.o libjdkmidi/src/jdkmidi_driverdump.o libjdkmidi/src/jdkmidi_keysig.o libjdkmidi/src/jdkmidi_parser.o libjdkmidi/src/jdkmidi_driver.o libjdkmidi/src/jdkmidi_sysex.o libjdkmidi/src/win32/jdkmidi_driverwin32.o Src/LeakCheck.o Src/PresetManager.o Src/UnitTest.o Src/PreferencesData.o Src/UnitTestUtils.o Src/AriaCore.o Src/Clipboard.o Src/languages.o Src/main.o Src/Singleton.o Src/Editors/ScoreEditor.o Src/Editors/RelativeXCoord.o Src/Editors/ControllerEditor.o Src/Editors/KeyboardEditor.o Src/Editors/DrumEditor.o Src/Editors/GuitarEditor.o Src/Editors/Editor.o Src/Dialogs/AboutDialog.o Src/Dialogs/TrackPropertiesDialog.o Src/Dialogs/TuningDialog.o Src/Dialogs/PresetEditor.o Src/Dialogs/Preferences.o Src/Dialogs/CustomKeyDialog.o Src/Dialogs/CopyrightWindow.o Src/Dialogs/CustomNoteSelectDialog.o Src/Dialogs/WaitWindow.o Src/Dialogs/ScaleDialog.o Src/Dialogs/PrintSetupDialog.o Src/Midi/InstrumentChoice.o Src/Midi/GuitarTuning.o Src/Midi/ControllerEvent.o Src/Midi/KeyPresets.o Src/Midi/MeasureData.o Src/Midi/DrumChoice.o Src/Midi/Track.o Src/Midi/MagneticGrid.o Src/Midi/Sequence.o Src/Midi/CommonMidiUtils.o Src/Midi/Note.o Src/Midi/TimeSigChange.o Src/Midi/Players/PlatformMidiManager.o Src/Midi/Players/NullDevice.o Src/Midi/Players/Sequencer.o Src/Midi/Players/Alsa/AlsaPlayer.o Src/Midi/Players/Alsa/AlsaPort.o Src/Midi/Players/Alsa/AlsaNotePlayer.o Src/Midi/Players/Mac/OutputBase.o Src/Midi/Players/Mac/MacPlayerInterface.o Src/Midi/Players/Mac/CoreMIDIOutput.o Src/Midi/Players/Mac/AudioUnitOutput.o Src/Midi/Players/Example/ExamplePlayer.o Src/Midi/Players/Jack/JackMidiManager.o Src/Midi/Players/Win/WinPlayer.o Src/IO/MidiFileReader.o Src/IO/IOUtils.o Src/IO/AriaFileWriter.o Src/IO/MidiToMemoryStream.o Src/Analysers/SilenceAnalyser.o Src/Analysers/ScoreAnalyser.o Src/Actions/DeleteTrack.o Src/Actions/SnapNotesToGrid.o Src/Actions/ScaleSong.o Src/Actions/Duplicate.o Src/Actions/RearrangeNotes.o Src/Actions/ShiftBySemiTone.o Src/Actions/InsertEmptyMeasures.o Src/Actions/RemoveOverlapping.o Src/Actions/Record.o Src/Actions/Paste.o Src/Actions/EditAction.o Src/Actions/ResizeNotes.o Src/Actions/MoveNotes.o Src/Actions/AddControllerSlide.o Src/Actions/SetAccidentalSign.o Src/Actions/AddTrack.o Src/Actions/UpdateGuitarTuning.o Src/Actions/AddNote.o Src/Actions/ScaleTrack.o Src/Actions/RemoveMeasures.o Src/Actions/DeleteSelected.o Src/Actions/SetNoteVolume.o Src/Actions/ShiftFrets.o Src/Actions/ShiftString.o Src/Actions/NumberPressed.o Src/Actions/AddControlEvent.o Src/Pickers/MagneticGridPicker.o Src/Pickers/VolumeSlider.o Src/Pickers/KeyPicker.o Src/Pickers/TuningPicker.o Src/Pickers/ControllerChoice.o Src/Pickers/TimeSigPicker.o Src/Pickers/InstrumentPicker.o Src/Pickers/NotePickerWidget.o Src/Pickers/DrumPicker.o Src/Renderers/wxImage.o Src/Renderers/AbstractDrawable.o Src/Renderers/wxDrawable.o Src/Renderers/wxRenderPane.o Src/Renderers/GLImage.o Src/Renderers/GLwxString.o Src/Renderers/GLDrawable.o Src/Renderers/GLRenderImp.o Src/Renderers/GLPane.o Src/Renderers/wxRenderImp.o Src/Renderers/wxDCString.o Src/Printing/wxEasyPrintWrapper.o Src/Printing/KeyrollPrintableSequence.o Src/Printing/AbstractPrintableSequence.o Src/Printing/AriaPrintable.o Src/Printing/RenderRoutines.o Src/Printing/SymbolPrinter/TabPrint.o Src/Printing/SymbolPrinter/ScorePrint.o Src/Printing/SymbolPrinter/EditorPrintable.o Src/Printing/SymbolPrinter/SymbolPrintableSequence.o Src/Printing/SymbolPrinter/PrintLayout/LayoutElement.o Src/Printing/SymbolPrinter/PrintLayout/RelativePlacementManager.o Src/Printing/SymbolPrinter/PrintLayout/PrintLayoutAbstract.o Src/Printing/SymbolPrinter/PrintLayout/PrintLayoutLine.o Src/Printing/SymbolPrinter/PrintLayout/PrintLayoutNumeric.o Src/Printing/SymbolPrinter/PrintLayout/PrintLayoutMeasure.o Src/GUI/MainPane.o Src/GUI/ImageProvider.o Src/GUI/GraphicalSequence.o Src/GUI/MainFrame.o Src/GUI/MainFrameMenuBar.o Src/GUI/MeasureBar.o Src/GUI/GraphicalTrack.o -L/mnt/utmp/aria/lib -L/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib -Lmnt/utmp/aria/lib -Lmnt/utmp/aria/lib -L/opt/gnome/lib -lwx_gtk2u_core-2.8-arm-angstrom-linux-gnueabi -lwx_baseu-2.8-arm-angstrom-linux-gnueabi -lasound -ldl -lm -lglib-2.0



Here's the Sconstruct file I modified:





Has anyone else had issues compiling wxwidgets apps and if you have had success, what have you done?

Code:
import sys

import os

import platform

import subprocess

Help("""

  	Usage:

    	% scons

        	does a release build, auto-detects your system


    	Flags you can pass when calling 'scons' :

        	platform=[macosx/linux/unix/windows]

            	specify platform, if not auto-detected

        	config=[debug/release]

            	specify build type

        	jack=[0/1]

            	whether to enable the Jack MIDI driver (on by default for non-Linux unices, disabled everywhere else by default)

        	WXCONFIG=/path/to/wx-config

            	build using a specified wx-config

        	compiler_arch=[32bit/64bit]

            	specify whether the compiler will build as 32 bits or 64 bits

            	(does _not_ add flags to cross-compile, only selects the right lib dirs)

            	* currently only has an effect on Linux.

        	renderer=[opengl/wxwidgets]

            	choose whether to use the OpenGL renderer or the software (wxWidgets-based) renderer

        	CXXFLAGS="custom build flags"

            	To add other flags to pass when compiling

        	LDFLAGS="custom link flags"

            	To add other flags to pass when linking

        	WX_HOME="C:\wxWidgets-2.8.10"

            	for windows only, defire the wx home directory


    	Furthermore, the CXX environment variable is read if it exists, allowing

    	you to choose which g++ executable you wish to use.

    	The PATH environment variable is also considered.


    	% scons install

        	Installs Aria, auto-detects system (run as root if necessary)


    	Flags you can pass when calling 'scons install' :

        	platform=[macosx/linux/unix]

            	specify platform, if not auto-detected

        	prefix=[/opt/local or something else]

            	install to a different prefix than default /usr/local


    	% scons uninstall

        	Uninstalls Aria, takes same flags as 'scons install'.

        	If you specified a custom install prefix, you need to specify it again.

        	* Not available on mac OS X, just drag the generated app to the trash.


    	Use scons -H for help about scons itself, and its terminal flags.

  	""")

# recursive Glob

import fnmatch

class RecursiveGlob:

	def __init__(self, directory, pattern="*"):

    	self.dir_stack = [directory]

    	self.pattern = pattern

    	self.files = []

    	self.index = 0

	def pop_dir(self):

    	# pop next directory from stack

    	self.directory = self.dir_stack.pop()

    	self.files = os.listdir(self.directory)

    	self.index = 0

    	#if 'libjdkmidi' in self.directory:

    	#	# ignore libjdkmidi stuff

    	#	self.pop_dir()

    	if 'scons' in self.directory:

        	# ignore scons stuff

        	self.pop_dir()


	def __getitem__(self, index):

    	while 1:

        	try:

            	file = self.files[self.index]

            	self.index = self.index + 1

        	except IndexError:

            	# pop next directory from stack

            	self.pop_dir()

        	else:

            	# got a filename

            	fullname = os.path.join(self.directory, file)

            	if os.path.isdir(fullname) and not os.path.islink(fullname):

                	self.dir_stack.append(fullname)

            	if fnmatch.fnmatch(file, self.pattern):

                	return fullname

# ------------------------------- find system, build type ----------------------

def main_Aria_func():


	# find operating system

	which_os = ARGUMENTS.get('platform', 0)

	if which_os == 0:

    	#auto-detect

    	if os.name == 'nt':

        	which_os = "windows"

    	elif os.uname()[0] == 'Linux':

        	which_os = "linux"

    	elif os.uname()[0] == 'Darwin':

        	which_os = "macosx"

    	else:

        	print "!! Unknown operating system '" + os.uname()[0] + "', defaulting to Unix"

        	which_os = "unix"

	if not which_os in ["linux", "macosx", "unix", "windows"]:

    	print "!! Unknown operating system '" + which_os + "', please specify 'platform=[linux/macosx/unix/windows]'"

    	sys.exit(0)


	print">> Operating system : " + which_os

	# check what to do

	if 'uninstall' in COMMAND_LINE_TARGETS:

    	# uninstall

    	if which_os in ["linux", "unix"]:

        	uninstall_Aria_unix()

    	else:

        	print "!! Unknown operation or system (uninstall is not valid on your system)"

        	sys.exit(0)

	elif 'install' in COMMAND_LINE_TARGETS:

    	# install

    	if which_os in ["linux", "unix"]:

        	compile_Aria(which_os)

    	elif which_os == "macosx":

        	install_Aria_mac()

    	else:

        	print "!! Unknown operation or system (install is not valid on your system)"

        	sys.exit(0)    

	else:

    	# compile

    	compile_Aria(which_os)

# ---------------------------- Install Mac OS X -----------------------------

def install_Aria_mac():

	sys_command("mkdir -p ./Aria\ Maestosa.app/Contents/MacOS")

	sys_command("cp ./Aria ./Aria\ Maestosa.app/Contents/MacOS/Aria\ Maestosa")

	sys_command("cp ./OSX/release.plist ./Aria\ Maestosa.app/Contents/Info.plist")

	sys_command("cp -r ./Resources ./Aria\ Maestosa.app/Contents/")

	sys_command("cp -r ./OSX/mac-i18n/. ./Aria\ Maestosa.app/Contents/Resources/.")

	sys_command("cp -r ./OSX/*.icns ./Aria\ Maestosa.app/Contents/Resources/.")

	sys_command("touch ./Aria\ Maestosa.app")

	print "*** Cleaning up..."

	os.system("cd ./Aria\ Maestosa.app && find . -name \".svn\" -exec rm -rf '{}' \;")


	print "*** Done"

	sys.exit(0)

# ---------------------------- Uninstall Linux -----------------------------

def uninstall_Aria_unix():


	# check if user defined his own prefix, else use defaults

	prefix = ARGUMENTS.get('prefix', 0)


	if prefix == 0:

    	print ">> No prefix specified, defaulting to /usr/local/"

    	prefix = '/usr/local/'

	else:

		print ">> Prefix: " + prefix


	if prefix[-1] != "/":

    	prefix += "/"


	resource_path = prefix + "share/Aria/"

	app_path = prefix + "bin/Aria"

	locale_path = prefix + "share/locale/"


	os.system("rm -r " + resource_path)

	os.system("rm " + app_path)

	os.system("rm " + locale_path + "*/LC_MESSAGES/aria_maestosa.mo")

	print "\n*** Uninstall done"

	sys.exit(0)

# -- small helper func

# executes a command on the system shell and prints it to stdout

def sys_command(command):

	print command

	return_status = os.system(command)

	if return_status != 0:

    	print "An error occured"

    	sys.exit(0)


# ---------------------------- Compile -----------------------------

def compile_Aria(which_os):

	if which_os == "windows":

    	# on Windows ask for MinGW, VC++ can't handle Aria

    	env = Environment(tools = ['mingw'])

	else:

    	env = Environment()


	env.Decider('MD5-timestamp')


	env.Append(PATH = os.environ['PATH'])

	if 'CXX' in os.environ:

    	print ">> Using compiler " + os.environ['CXX']

    	env.Replace(CXX = os.environ['CXX'])

	# check build style

	build_type = ARGUMENTS.get('config', 'release')

	if build_type != 'release' and build_type != 'debug':

    	print "!! Unknown build config " + build_type

    	sys.exit(0)


	print ">> Build type : " + build_type


	# check renderer

	if which_os == "macosx":

    	renderer = ARGUMENTS.get('renderer', 'opengl')

	else:

    	renderer = ARGUMENTS.get('renderer', 'wxwidgets')

	if renderer != 'opengl' and renderer != 'wxwidgets':

    	print "!! Unknown renderer " + renderer

    	sys.exit(0)

	print ">> Renderer : " + renderer

	if renderer == 'opengl':

    	env.Append(CCFLAGS=['-DRENDERER_OPENGL'])

	elif renderer == 'wxwidgets':

    	env.Append(CCFLAGS=['-DRENDERER_WXWIDGETS'])

	# Check architecture

	compiler_arch = ARGUMENTS.get('compiler_arch', platform.architecture(env['CXX']))[0]

	if compiler_arch != '32bit' and compiler_arch != '64bit':

    	print 'Invalid architecture : ', compiler_arch, '; assuming 32bit'

    	compiler_arch = '32bit'


	print ">> Architecture : " + compiler_arch


	# add wxWidgets flags

	# check if user defined his own WXCONFIG, else use defaults

	WXCONFIG = ARGUMENTS.get('WXCONFIG', 'wx-config')

	print ">> wx-config : " + WXCONFIG


	if which_os == 'windows':

    	# work around bugs in scons 'ParseConfig' on Windows...

    	if renderer == "opengl":

        	winCppFlags=subprocess.check_output(WXCONFIG.split() + ["--cppflags","core,base,gl"])

        	winLdFlags=subprocess.check_output(WXCONFIG.split() + ["--libs", "core,base,gl"])

    	else:

        	winCppFlags=subprocess.check_output(WXCONFIG.split() + ["--cppflags","core,base"])

        	winLdFlags=subprocess.check_output(WXCONFIG.split() + ["--libs", "core,base"])

    	print "Build flags :", winCppFlags

    	print "Link flags :", winLdFlags


    	wxHomePath = ARGUMENTS.get('WX_HOME', None)

    	if wxHomePath is None:

        	sys.stderr.write("Please pass WX_HOME for Windows builds")

        	sys.exit(1)


    	try:

        	command = ["windres", "--include-dir="+wxHomePath+"\include", "--input", "win32\Aria.rc", "--output", "msvcr.o"]

        	print command

        	out = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()

    	except:

        	sys.stderr.write("could not execute 'windres', is mingw installed?\n")


    	env.Append(CCFLAGS=winCppFlags.split())


    	#env.Append(LINKFLAGS=['-mwindows'] + winLdFlags.split())

    	# Ugly hack : wx flags need to appear at the end of the command, but scons doesn't support that, so I need to hack their link command

    	env['LINKCOM'] 	= '$LINK -o $TARGET $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS -mwindows ' + winLdFlags

	else:

    	wxversion = subprocess.Popen([WXCONFIG,"--version"], stdout=subprocess.PIPE).communicate()[0].strip()

    	print ">> wxWidgets version : " + wxversion

    	is_wx_3 = (wxversion[0] == '3' or (wxversion[0] == '2' and wxversion[2] == '9'))

    	if is_wx_3:

        	if renderer == "opengl":

            	env.ParseConfig( [WXCONFIG] + ['--cppflags','--libs','core,base,gl,webview'])

        	else:

            	env.ParseConfig( [WXCONFIG] + ['--cppflags','--libs','core,base,webview'])

    	else:

        	if renderer == "opengl":

            	env.ParseConfig( [WXCONFIG] + ['--cppflags','--libs','core,base,gl'])

        	else:

            	env.ParseConfig( [WXCONFIG] + ['--prefix=/mnt/utmp/aria','--host=arm-angstrom-linux-gnueabi','--cppflags','--libs','core,base'])


	# check build type and init build flags

	if build_type == "debug":

    	env.Append(CCFLAGS=['-g','-Wall','-Wextra','-Wno-unused-parameter','-D_MORE_DEBUG_CHECKS','-D_CHECK_FOR_LEAKS','-Wfatal-errors','-DDEBUG=1'])


	elif build_type == "release":

    	env.Append(CCFLAGS=['-O3','-DNDEBUG=1','-DwxUSE_UNICODE'])


	else:

    	print 'Unknown build type, cannot continue'

    	sys.exit(0)


	# init common header search paths

	env.Append(CPPPATH = ['./Src','.','./libjdkmidi/include','./rtmidi'])

	print " "

	# add common sources

	print "*** Adding source files"


	sources = []

	for file in RecursiveGlob(".", "*.cpp"):

    	sources = sources + [file]

	# add additional flags if any

	user_flags = ARGUMENTS.get('CXXFLAGS', 0)

	if user_flags != 0:

    	env.Append(CCFLAGS=Split(user_flags))

	user_flags = ARGUMENTS.get('LDFLAGS', 0)

	if user_flags != 0:

    	env.Append(LINKFLAGS=Split(user_flags))



	# **********************************************************************************************

	# ********************************* PLATFORM SPECIFIC ******************************************

	# **********************************************************************************************

	use_jack = ARGUMENTS.get('jack', False)

	# OS X (QTKit, CoreAudio, audiotoolbox)

	if which_os == "macosx":

    	print "*** Adding mac source files and libraries"

    	env.Append(CCFLAGS=['-D_MAC_QUICKTIME_COREAUDIO'])

    	sources = sources + ['Src/Midi/Players/Mac/QuickTimeExport.mm','Src/GUI/Machelper.mm']

    	env.Append(CPPPATH=['Src/Midi/Players/Mac'])


    	env.Append(LINKFLAGS = ['-framework','QTKit','-framework', 'Quicktime','-framework','CoreAudio',

    	'-framework','AudioToolbox','-framework','AudioUnit','-framework','AppKit',

    	'-framework','Carbon','-framework','Cocoa','-framework','IOKit','-framework','System',

    	'-framework','CoreMIDI'])


    	if compiler_arch == '32bit':

        	env.Append(CCFLAGS=['-arch','i386'])

        	env.Append(LINKFLAGS = ['-arch','i386'])

    	elif compiler_arch == '64bit':

        	env.Append(CCFLAGS=['-arch','x86_64'])

        	env.Append(LINKFLAGS = ['-arch','x86_64'])



    	if renderer == 'opengl':

        	env.Append(LINKFLAGS = ['-framework','OpenGL','-framework','AGL'])


	# linux (Alsa/tiMidity)

	elif which_os == "linux":


    	print "*** Adding Alsa libraries and defines"


    	if renderer == 'opengl':

        	env.Append(CCFLAGS=['-DwxUSE_GLCANVAS=1'])


    	env.Append(CCFLAGS=['-D_ALSA'])


    	env.Append(CPPPATH = ['/mnt/utmp/aria/include'])


    	if compiler_arch == '32bit':

        	env.Append(LINKFLAGS = ['-Wl,--rpath,/mnt/utmp/aria/lib/'])

        	env.Append(LIBPATH = ['mnt/utmp/aria/lib/','mnt/utmp/aria/lib/', '/opt/gnome/lib'])

    	elif compiler_arch == '64bit':

        	env.Append(LINKFLAGS = ['-Wl,--rpath,/usr/local/lib64/'])

        	env.Append(LIBPATH = ['usr/local/lib64/','usr/lib64/'])

        	env.Append(CCFLAGS=['-D__X86_64__'])


    	if renderer == 'opengl':

        	env.Append(LIBS = ['GL', 'GLU'])


    	env.Append(LIBS = ['asound'])

    	env.Append(LIBS = ['dl','m'])

    	env.ParseConfig( 'pkg-config --cflags glib-2.0' )

    	env.ParseConfig( 'pkg-config --libs glib-2.0' )


	elif which_os == "unix":

    	print "*** Adding libraries and defines for Unix"


    	if renderer == 'opengl':

        	env.Append(CCFLAGS=['-DwxUSE_GLCANVAS=1'])

        	env.Append(LIBS = ['GL', 'GLU'])

    	# default sound driver for Unix, if not explicitely set

    	if ARGUMENTS.get('jack', '!') == '!':

        	use_jack = True

    	env.Append(CPPPATH = ['/usr/local/include'])

    	env.Append(LIBPATH = ['/usr/local/lib'])

    	env.ParseConfig('pkg-config --cflags glib-2.0')

    	env.ParseConfig('pkg-config --libs glib-2.0')


	# Windows

	elif which_os == "windows":

    	pass

	else:


    	print "\n\n/!\\ Platform ", which_os, " is unknown"

    	sys.exit(0)


	if use_jack:

    	env.Append(CCFLAGS=['-DUSE_JACK'])

    	env.Append(LIBS = ['jack'])



	# *********************************************************************************************

	# **************************************** COMPILE ********************************************

	# *********************************************************************************************


	print " "

	print "====================="

	print " 	Setup done "

	print "====================="

	print " "

	# compile to .o

	object_list = env.Object(source = sources)


	if which_os == "windows":

    	object_list = object_list + ["msvcr.o"]


	# link program

	executable = env.Program( target = 'Aria', source = object_list)

	# install target

	if 'install' in COMMAND_LINE_TARGETS:

    	# check if user defined his own prefix, else use defaults

    	prefix = ARGUMENTS.get('prefix', 0)


    	if prefix == 0:

        	print ">> No prefix specified, defaulting to /usr/local/"

        	prefix = '/usr/local/'

    	else:

        	print ">> Prefix : " + prefix

    	# set umask so created directories have the correct permissions

    	try:

        	umask = os.umask(022)

    	except OSError: 	# ignore on systems that don't support umask

        	pass


    	bin_dir = os.path.join(prefix, "bin")

    	data_dir = os.path.join(prefix, "share/Aria")

    	locale_dir = os.path.join(prefix, "share/locale")

    	if not os.path.exists(prefix):

        	Execute(Mkdir(prefix))

    	# install executable

    	executable_target = bin_dir + "/Aria"

    	env.Alias("install", executable_target)

    	env.Command( executable_target, executable,

    	[

    	Copy("$TARGET","$SOURCE"),

    	Chmod("$TARGET", 0775),

    	])      


    	# install data files

    	data_files = []

    	for file in RecursiveGlob("./Resources", "*"):

        	if ".svn" in file or ".icns" in file or "*" in file:

            	continue

        	index = file.find("Resources/") + len("Resources/")

        	filename_relative = file[index:]

        	source = os.path.join("./Resources", filename_relative)

        	target = os.path.join(data_dir, filename_relative)


        	env.Alias("install", target)

        	env.Command( target, source,

        	[

        	Copy("$TARGET","$SOURCE"),

        	Chmod("$TARGET", 0664),

        	])

    	# install .mo files

    	mo_files = Glob("./international/*/aria_maestosa.mo",strings=True)

    	for mo in mo_files:

        	index_lo = mo.find("international/") + len("international/")

        	index_hi = mo.find("/aria_maestosa.mo")

        	lang_name = mo[index_lo:index_hi]

        	install_location = locale_dir + "/" + lang_name + "/LC_MESSAGES/aria_maestosa.mo"

        	env.Alias("install", env.InstallAs( install_location, mo ) )

main_Aria_func()
 
Back
Top