Skip to content

Instantly share code, notes, and snippets.

@codebutler
Created March 6, 2009 07:47
Show Gist options
  • Save codebutler/74811 to your computer and use it in GitHub Desktop.
Save codebutler/74811 to your computer and use it in GitHub Desktop.
Quick-n-dirty script that verifies qyoto is correctly installed
#!/bin/bash
# List of all .pc files to verify.
LIBS="qyoto qttest-sharp qtscript-sharp qtwebkit-sharp qtuitools-sharp"
echo "Verifying .pc versions..."
ALLOK='true'
for lib in $LIBS; do
v=`pkg-config --modversion $lib 2>/dev/null`
r=`pkg-config --libs $lib 2>/dev/null`
v1=`monop2 $r | grep ^Version | sed s/Version=// 2>/dev/null | cut -c -5`
if [[ $v != '' && $v == $v1 ]]; then
echo "$lib: pc:$v asm:$v1 (PASS)"
else
echo "$lib: pc:$v asm:$v1 (FAIL)"
ALLOK='false'
fi
done
if [[ $ALLOK == 'false' ]]; then
echo 'Problems with .pc files!'
exit 1
fi
echo "Verifying that .pc files are usable..."
SOURCE_FILE=`tempfile`
cat > $SOURCE_FILE <<EOF
using Qyoto;
public class Test
{
public static void Main (string[] args)
{
// qt-dotnet.dll
new QApplication(args);
// qttest.dll
var obj = new QObject();
new QSignalSpy(obj, Qt.SIGNAL("destroyed(QObject*)"));
// qtscript.dll
new QScriptEngine();
// qtwebkit.dll
new QWebView();
// qtuitools.dll
new QUiLoader();
}
}
EOF
REFERENCES=`echo $LIBS | sed 's/\(\s\|^\)/ -pkg:/g'`
gmcs $REFERENCES $SOURCE -out:$SOURCE_FILE.exe $SOURCE_FILE
if [[ $? != 0 ]]; then
echo "Failed to compile!"
rm $SOURCE_FILE
exit 1
fi
mono $SOURCE_FILE.exe
if [[ $? != 0 ]]; then
echo "Failed to run!"
rm $SOURCE_FILE
exit 1
else
echo "Everything looks good!"
fi
rm $SOURCE_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment