Skip to content

Commit 8aec283

Browse files
committed
Fixed build of highlight to run on Leopard
* Added qlcc_debug option for debugging colorize.sh
1 parent b5a9275 commit 8aec283

4 files changed

Lines changed: 34 additions & 7 deletions

File tree

ChangeLog.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2.0.1:
2+
* Corrected build of Highlight to run on Leopard.
3+
* Stop redirecting stdout of colorize.sh to stdin. Error output will appear
4+
in the console instead of the preview.
5+
* Added qlcc_debug option. To enable, use:
6+
defaults write org.n8gray.qlcolorcode qlcc_debug 1
7+
To disable, use:
8+
defaults delete org.n8gray.qlcolorcode qlcc_debug
9+
110
2.0:
211
* Added a note about conflict with Xcode 3.2's source code QL plugin. If
312
you're having problems with QLCC on Snow Leopard please read it!

Common.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
NSPipe *pipe;
2626
pipe = [NSPipe pipe];
2727
[task setStandardOutput: pipe];
28-
[task setStandardError: pipe];
28+
// Let stderr go to the usual place
29+
//[task setStandardError: pipe];
2930

3031
NSFileHandle *file;
3132
file = [pipe fileHandleForReading];
@@ -69,6 +70,9 @@
6970
NSMutableDictionary *env = [NSMutableDictionary dictionaryWithDictionary:
7071
[[NSProcessInfo processInfo] environment]];
7172
[env addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
73+
#ifdef DEBUG
74+
@"1", @"qlcc_debug",
75+
#endif
7276
@"9", @"fontSizePoints",
7377
@"Monaco", @"font",
7478
@"ide-xcode", @"hlTheme",
@@ -85,7 +89,8 @@
8589

8690
output = runTask(cmd, env, status);
8791
if (*status != 0) {
88-
NSLog(@"QLColorCode: colorize.sh failed with exit code %d", *status);
92+
NSLog(@"QLColorCode: colorize.sh failed with exit code %d. Command was (%@).",
93+
*status, cmd);
8994
}
9095
return output;
9196
}

QLColorCode.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
);
328328
runOnlyForDeploymentPostprocessing = 0;
329329
shellPath = "/bin/zsh -x";
330-
shellScript = "set err_exit\ncd $PROJECT_DIR/highlight\nexport CFLAGS='-arch i386 -arch ppc -arch x86_64'\nexport LDFLAGS=$CFLAGS\nmake\n# Make sure it was built universal\nlipo -info src/highlight | grep -q ppc || exit 1\nlipo -info src/highlight | grep -q i386 || exit 1\nlipo -info src/highlight | grep -q x86_64 || exit 1\nmake \\\n\tDESTDIR=$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH \\\n\tPREFIX=/highlight/ \\\n\tinstall\n\n";
330+
shellScript = "set err_exit\ncd $PROJECT_DIR/highlight\nX='-arch ppc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5'\nexport CFLAGS=$X\nexport LDFLAGS=$X\nmake -j 2\n# Make sure it was built universal\nlipo -info src/highlight | grep -q ppc || exit 1\nlipo -info src/highlight | grep -q i386 || exit 1\nlipo -info src/highlight | grep -q x86_64 || exit 1\nmake \\\n\tDESTDIR=$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH \\\n\tPREFIX=/highlight/ \\\n\tinstall\n\n";
331331
showEnvVarsInLog = 0;
332332
};
333333
/* End PBXShellScriptBuildPhase section */
@@ -427,7 +427,7 @@
427427
2CA326230896AD4900168862 /* Debug */ = {
428428
isa = XCBuildConfiguration;
429429
buildSettings = {
430-
CURRENT_PROJECT_VERSION = 2.0.0;
430+
CURRENT_PROJECT_VERSION = 2.0.1;
431431
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
432432
GCC_WARN_ABOUT_RETURN_TYPE = YES;
433433
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -444,7 +444,7 @@
444444
i386,
445445
x86_64,
446446
);
447-
CURRENT_PROJECT_VERSION = 2.0.0;
447+
CURRENT_PROJECT_VERSION = 2.0.1;
448448
GCC_WARN_ABOUT_RETURN_TYPE = YES;
449449
GCC_WARN_UNUSED_VARIABLE = YES;
450450
PREBINDING = NO;

colorize.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@
1919
# Fail immediately on failure of sub-command
2020
setopt err_exit
2121

22-
#echo QLColorCode Devel Version!
23-
2422
rsrcDir=$1
2523
target=$2
2624
thumb=$3
2725

26+
debug () {
27+
if [ "x$qlcc_debug" != "x" ]; then if [ "x$thumb" = "x0" ]; then
28+
echo "QLColorCode: $@" 1>&2
29+
fi; fi
30+
}
31+
32+
debug Starting colorize.sh
2833
#echo target is $target
2934

3035
hlDir=$rsrcDir/highlight
@@ -36,8 +41,10 @@ cmdOpts=(-I --font $font --quiet --add-data-dir $rsrcDir/override \
3641

3742
#for o in $cmdOpts; do echo $o\<br/\>; done
3843

44+
debug Setting reader
3945
reader=(cat $target)
4046

47+
debug Handling special cases
4148
case $target in
4249
*.graffle )
4350
# some omnigraffle files are XML and get passed to us. Ignore them.
@@ -80,8 +87,10 @@ case $target in
8087
lang=${target##*.}
8188
;;
8289
esac
90+
debug Resolved $target to language $lang
8391

8492
go4it () {
93+
debug Generating the preview
8594
if [ $thumb = "1" ]; then
8695
$reader | head -n 100 | head -c 20000 | $cmd --syntax $lang $cmdOpts && exit 0
8796
elif [ -n "$maxFileSize" ]; then
@@ -92,7 +101,11 @@ go4it () {
92101
}
93102

94103
setopt no_err_exit
104+
debug First try...
95105
go4it
96106
# Uh-oh, it didn't work. Fall back to rendering the file as plain
107+
debug First try failed, second try...
97108
lang=txt
98109
go4it
110+
debug Reached the end of the file. That should not happen.
111+
exit 101

0 commit comments

Comments
 (0)