diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d9ed053 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "hl/highlight"] + path = hl/highlight + url = https://gitlab.com/saalen/highlight.git +[submodule "hl/lua"] + path = hl/lua + url = https://github.com/lua/lua.git diff --git a/.travis.yml b/.travis.yml index e384eea..b8ab0cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +addons: + homebrew: + packages: + - boost language: objective-c -xcode_project: QLColorCode.xcodeproj -xcode_scheme: Travis +script: set -o pipefail && xcodebuild -project QLColorCode.xcodeproj -scheme Travis build | xcpretty diff --git a/QLColorCode.xcodeproj/project.pbxproj b/QLColorCode.xcodeproj/project.pbxproj index afa9935..c7fd927 100644 --- a/QLColorCode.xcodeproj/project.pbxproj +++ b/QLColorCode.xcodeproj/project.pbxproj @@ -19,10 +19,26 @@ name = Package; productName = Package; }; + 26BACA63257CF90200486D28 /* Apply patches */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 26BACA67257CF90200486D28 /* Build configuration list for PBXAggregateTarget "Apply patches" */; + buildPhases = ( + 26BACA66257CF90200486D28 /* ShellScript */, + ); + dependencies = ( + ); + name = "Apply patches"; + productName = Package; + }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ 0ECBBA6C0CFCA37500416538 /* QLColorCode.qlgenerator in Copy to Library */ = {isa = PBXBuildFile; fileRef = 8D576316048677EA00EA77CD /* QLColorCode.qlgenerator */; }; + 26BACA53257CF04E00486D28 /* plugins in Resources */ = {isa = PBXBuildFile; fileRef = 26BACA52257CF04A00486D28 /* plugins */; }; + 26BACA54257CF04E00486D28 /* filetypes.conf in Resources */ = {isa = PBXBuildFile; fileRef = 26BACA51257CF01B00486D28 /* filetypes.conf */; }; + 26BACA58257CF06200486D28 /* highlight in Resources */ = {isa = PBXBuildFile; fileRef = 26BACA57257CF06200486D28 /* highlight */; }; + 26BACA5C257CF17400486D28 /* themes in Resources */ = {isa = PBXBuildFile; fileRef = 26BACA5B257CF17400486D28 /* themes */; }; + 26BACA60257CF60700486D28 /* langDefs in Resources */ = {isa = PBXBuildFile; fileRef = 26BACA5F257CF60600486D28 /* langDefs */; }; EA43671C15F6BF9C009DA6C0 /* colorize.sh in Resources */ = {isa = PBXBuildFile; fileRef = EA43671615F6BF9C009DA6C0 /* colorize.sh */; }; EA43671D15F6BF9C009DA6C0 /* Common.h in Headers */ = {isa = PBXBuildFile; fileRef = EA43671715F6BF9C009DA6C0 /* Common.h */; }; EA43671E15F6BF9C009DA6C0 /* Common.m in Sources */ = {isa = PBXBuildFile; fileRef = EA43671815F6BF9C009DA6C0 /* Common.m */; }; @@ -42,6 +58,27 @@ remoteGlobalIDString = 8D57630D048677EA00EA77CD; remoteInfo = QLColorCode; }; + 26BAC9C4257CE96D00486D28 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 089C1669FE841209C02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 26BAC9AB257CE89900486D28; + remoteInfo = highlight; + }; + 26BAC9C6257CE97100486D28 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 089C1669FE841209C02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 26BAC9BC257CE93200486D28; + remoteInfo = lua; + }; + 26BACA6E257CF94500486D28 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 089C1669FE841209C02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 26BACA63257CF90200486D28; + remoteInfo = "Apply patches"; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -59,6 +96,11 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 26BACA51257CF01B00486D28 /* filetypes.conf */ = {isa = PBXFileReference; lastKnownFileType = text; name = filetypes.conf; path = hl/highlight/filetypes.conf; sourceTree = ""; }; + 26BACA52257CF04A00486D28 /* plugins */ = {isa = PBXFileReference; lastKnownFileType = folder; name = plugins; path = hl/highlight/plugins; sourceTree = ""; }; + 26BACA57257CF06200486D28 /* highlight */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = highlight; path = hl/highlight/src/highlight; sourceTree = ""; }; + 26BACA5B257CF17400486D28 /* themes */ = {isa = PBXFileReference; lastKnownFileType = folder; name = themes; path = hl/highlight/themes; sourceTree = ""; }; + 26BACA5F257CF60600486D28 /* langDefs */ = {isa = PBXFileReference; lastKnownFileType = folder; name = langDefs; path = hl/highlight/langDefs; sourceTree = ""; }; 8D576316048677EA00EA77CD /* QLColorCode.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QLColorCode.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; }; EA43671615F6BF9C009DA6C0 /* colorize.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = colorize.sh; path = src/colorize.sh; sourceTree = ""; }; EA43671715F6BF9C009DA6C0 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Common.h; path = src/Common.h; sourceTree = ""; }; @@ -86,6 +128,11 @@ 089C166AFE841209C02AAC07 /* QLColorCode */ = { isa = PBXGroup; children = ( + 26BACA5F257CF60600486D28 /* langDefs */, + 26BACA5B257CF17400486D28 /* themes */, + 26BACA57257CF06200486D28 /* highlight */, + 26BACA52257CF04A00486D28 /* plugins */, + 26BACA51257CF01B00486D28 /* filetypes.conf */, EACE3C6924E8D93800B58A51 /* CHANGELOG.md */, EA43672C15F6C1B8009DA6C0 /* COPYING */, EAE9D2CB169E2B3500A67B2F /* README.md */, @@ -138,6 +185,39 @@ }; /* End PBXHeadersBuildPhase section */ +/* Begin PBXLegacyTarget section */ + 26BAC9AB257CE89900486D28 /* highlight */ = { + isa = PBXLegacyTarget; + buildArgumentsString = "-j9 cli"; + buildConfigurationList = 26BAC9AC257CE89900486D28 /* Build configuration list for PBXLegacyTarget "highlight" */; + buildPhases = ( + ); + buildToolPath = /usr/bin/make; + buildWorkingDirectory = hl/highlight; + dependencies = ( + 26BAC9C7257CE97100486D28 /* PBXTargetDependency */, + ); + name = highlight; + passBuildSettingsInEnvironment = 1; + productName = highlight; + }; + 26BAC9BC257CE93200486D28 /* lua */ = { + isa = PBXLegacyTarget; + buildArgumentsString = "-j9 $(ACTION)"; + buildConfigurationList = 26BAC9BD257CE93200486D28 /* Build configuration list for PBXLegacyTarget "lua" */; + buildPhases = ( + ); + buildToolPath = /usr/bin/make; + buildWorkingDirectory = hl/lua; + dependencies = ( + 26BACA6F257CF94500486D28 /* PBXTargetDependency */, + ); + name = lua; + passBuildSettingsInEnvironment = 1; + productName = lua; + }; +/* End PBXLegacyTarget section */ + /* Begin PBXNativeTarget section */ 8D57630D048677EA00EA77CD /* QLColorCode */ = { isa = PBXNativeTarget; @@ -153,6 +233,7 @@ buildRules = ( ); dependencies = ( + 26BAC9C5257CE96D00486D28 /* PBXTargetDependency */, ); name = QLColorCode; productInstallPath = /Library/QuickLook; @@ -168,6 +249,14 @@ attributes = { BuildIndependentTargetsInParallel = YES; LastUpgradeCheck = 1200; + TargetAttributes = { + 26BAC9AB257CE89900486D28 = { + CreatedOnToolsVersion = 12.2; + }; + 26BAC9BC257CE93200486D28 = { + CreatedOnToolsVersion = 12.2; + }; + }; }; buildConfigurationList = 2CA326220896AD4900168862 /* Build configuration list for PBXProject "QLColorCode" */; compatibilityVersion = "Xcode 3.2"; @@ -183,6 +272,9 @@ targets = ( 8D57630D048677EA00EA77CD /* QLColorCode */, 0E0E34E90D0097020086C1E6 /* Package */, + 26BAC9AB257CE89900486D28 /* highlight */, + 26BAC9BC257CE93200486D28 /* lua */, + 26BACA63257CF90200486D28 /* Apply patches */, ); }; /* End PBXProject section */ @@ -192,6 +284,11 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 26BACA60257CF60700486D28 /* langDefs in Resources */, + 26BACA5C257CF17400486D28 /* themes in Resources */, + 26BACA58257CF06200486D28 /* highlight in Resources */, + 26BACA53257CF04E00486D28 /* plugins in Resources */, + 26BACA54257CF04E00486D28 /* filetypes.conf in Resources */, EA43671C15F6BF9C009DA6C0 /* colorize.sh in Resources */, EACE3C6A24E8D93800B58A51 /* CHANGELOG.md in Resources */, EA43673015F6C1B8009DA6C0 /* COPYING in Resources */, @@ -213,7 +310,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = "/bin/zsh -x"; - shellScript = "# shell script goes here\nif [ $BUILD_STYLE != \"Release\" ]; then\n echo \"Error: Must use Release build style\"\n exit 1\nfi\n\ncd $PROJECT_DIR\nmkdir -vp release\ncd release\npkgDir=QLColorCode-$CURRENT_PROJECT_VERSION\nrm -rf $pkgDir\nmkdir $pkgDir\ncp -rp $TARGET_BUILD_DIR/*.qlgenerator $pkgDir\ncp ../ReadMe.txt $pkgDir\ncp ../LICENSE.txt $pkgDir\ncp ../ChangeLog.txt $pkgDir\n# For some reason Xcode has been producing world-writable output on occasion\nchmod -R o-w $pkgDir\ntar cvzf $pkgDir.tgz $pkgDir\nopen $PROJECT_DIR/release"; + shellScript = "# shell script goes here\ncd $PROJECT_DIR\nmkdir -vp release\ncd release\npkgDir=QLColorCode-$CURRENT_PROJECT_VERSION\nrm -rf $pkgDir\nmkdir $pkgDir\ncp -rp $TARGET_BUILD_DIR/*.qlgenerator $pkgDir\ncp ../ReadMe.txt $pkgDir\ncp ../LICENSE.txt $pkgDir\ncp ../ChangeLog.txt $pkgDir\n# For some reason Xcode has been producing world-writable output on occasion\nchmod -R o-w $pkgDir\ntar cvzf $pkgDir.tgz $pkgDir\nopen $PROJECT_DIR/release\n"; }; 0E1280381061C3EA0078EC05 /* Reset quicklookd */ = { isa = PBXShellScriptBuildPhase; @@ -230,6 +327,19 @@ shellScript = "qlmanage -r\n"; showEnvVarsInLog = 0; }; + 26BACA66257CF90200486D28 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd hl\n./apply-patches.sh\n"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -252,6 +362,21 @@ target = 8D57630D048677EA00EA77CD /* QLColorCode */; targetProxy = 0E0E34ED0D0097280086C1E6 /* PBXContainerItemProxy */; }; + 26BAC9C5257CE96D00486D28 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26BAC9AB257CE89900486D28 /* highlight */; + targetProxy = 26BAC9C4257CE96D00486D28 /* PBXContainerItemProxy */; + }; + 26BAC9C7257CE97100486D28 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26BAC9BC257CE93200486D28 /* lua */; + targetProxy = 26BAC9C6257CE97100486D28 /* PBXContainerItemProxy */; + }; + 26BACA6F257CF94500486D28 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26BACA63257CF90200486D28 /* Apply patches */; + targetProxy = 26BACA6E257CF94500486D28 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -283,6 +408,192 @@ }; name = Release; }; + 26BAC9AD257CE89900486D28 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CODE_SIGN_STYLE = Automatic; + DEBUGGING_SYMBOLS = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = EU5R2QY9HJ; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 26BAC9AE257CE89900486D28 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = EU5R2QY9HJ; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 26BAC9BE257CE93200486D28 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CODE_SIGN_STYLE = Automatic; + DEBUGGING_SYMBOLS = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = EU5R2QY9HJ; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 26BAC9BF257CE93200486D28 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = EU5R2QY9HJ; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 26BACA68257CF90200486D28 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INFOPLIST_FILE = "Package copy-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + RUN_CLANG_STATIC_ANALYZER = YES; + }; + name = Debug; + }; + 26BACA69257CF90200486D28 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INFOPLIST_FILE = "Package copy-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + RUN_CLANG_STATIC_ANALYZER = YES; + ZERO_LINK = NO; + }; + name = Release; + }; 2CA3261F0896AD4900168862 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -451,6 +762,33 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 26BAC9AC257CE89900486D28 /* Build configuration list for PBXLegacyTarget "highlight" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 26BAC9AD257CE89900486D28 /* Debug */, + 26BAC9AE257CE89900486D28 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 26BAC9BD257CE93200486D28 /* Build configuration list for PBXLegacyTarget "lua" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 26BAC9BE257CE93200486D28 /* Debug */, + 26BAC9BF257CE93200486D28 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 26BACA67257CF90200486D28 /* Build configuration list for PBXAggregateTarget "Apply patches" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 26BACA68257CF90200486D28 /* Debug */, + 26BACA69257CF90200486D28 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 2CA3261E0896AD4900168862 /* Build configuration list for PBXNativeTarget "QLColorCode" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/README.md b/README.md index 1663016..6836fd5 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,17 @@ This is a Quick Look plug-in that renders source code with syntax highlighting, using the [Highlight library](http://www.andre-simon.de). -To install Highlight, [download the library manually](http://www.andre-simon.de/zip/download.php), or use Homebrew `brew install highlight` - To install the plug-in, just drag it to `~/Library/QuickLook`. You may need to create that folder if it doesn't already exist. -Alternative, if you use [Homebrew Cask](https://github.com/caskroom/homebrew-cask), +Alternatively, if you use [Homebrew Cask](https://github.com/caskroom/homebrew-cask), install with `brew cask install qlcolorcode`. +Also available on MacPorts: `port install QLColorCode`. + +To build the project, you must have Boost headers on your system in +`/opt/local/include` or `/usr/local/include`. + ## Settings If you want to configure `QLColorCode`, there are several `defaults` commands that could be useful: diff --git a/hl/apply-patches.sh b/hl/apply-patches.sh new file mode 100755 index 0000000..0d2eb96 --- /dev/null +++ b/hl/apply-patches.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" +cd "$DIR" +for i in lua highlight +do + pushd "$i" + git checkout . || true + patch -p1 < "../${i}.patch" + popd +done diff --git a/hl/highlight b/hl/highlight new file mode 160000 index 0000000..e55d1fd --- /dev/null +++ b/hl/highlight @@ -0,0 +1 @@ +Subproject commit e55d1fd5949cc5dc4444a1b9cbbb6a0ab1a93a3f diff --git a/hl/highlight.patch b/hl/highlight.patch new file mode 100644 index 0000000..b3e4afd --- /dev/null +++ b/hl/highlight.patch @@ -0,0 +1,24 @@ +diff --git a/src/makefile b/src/makefile +index 9d0a08e..0a7a833 100644 +--- a/src/makefile ++++ b/src/makefile +@@ -43,8 +43,8 @@ ifeq (${LUA_TEST},1) + LUA_PKG_NAME=lua + endif + +-LUA_CFLAGS=$(shell pkg-config --cflags ${LUA_PKG_NAME}) +-LUA_LIBS=$(shell pkg-config --libs ${LUA_PKG_NAME}) ++LUA_CFLAGS=-I../../lua -I../.. ++LUA_LIBS=../../lua/liblua.a + + # luajit lib + # LUA_LIBS=$(shell pkg-config --libs luajit) +@@ -75,7 +75,7 @@ LDFLAGS = -ldl + #LDFLAGS = ${LDFLAGS} -s + #LDFLAGS= -Wl,--as-needed + +-CXX_COMPILE=${CXX} ${CFLAGS} -c -I ${INCLUDE_DIR} ${LUA_CFLAGS} ++CXX_COMPILE=${CXX} ${CFLAGS} -c -I /opt/local/include -I /usr/local/include -I ${INCLUDE_DIR} ${LUA_CFLAGS} + + # Data directories (data dir, configuration file dir) + CXX_DIR=-DHL_DATA_DIR=\"${HL_DATA_DIR}\" -DHL_CONFIG_DIR=\"${HL_CONFIG_DIR}\" diff --git a/hl/lua b/hl/lua new file mode 160000 index 0000000..9d067ab --- /dev/null +++ b/hl/lua @@ -0,0 +1 @@ +Subproject commit 9d067ab73b6befa0a5418f1df35c711f6c6918b3 diff --git a/hl/lua.hpp b/hl/lua.hpp new file mode 100644 index 0000000..ec417f5 --- /dev/null +++ b/hl/lua.hpp @@ -0,0 +1,9 @@ +// lua.hpp +// Lua header files for C++ +// <> not supplied automatically because Lua also compiles as C++ + +extern "C" { +#include "lua.h" +#include "lualib.h" +#include "lauxlib.h" +} diff --git a/hl/lua.patch b/hl/lua.patch new file mode 100644 index 0000000..23b2174 --- /dev/null +++ b/hl/lua.patch @@ -0,0 +1,17 @@ +diff --git a/makefile b/makefile +index 9e537dcc..d275b809 100644 +--- a/makefile ++++ b/makefile +@@ -60,9 +60,9 @@ LOCAL = $(TESTS) $(CWARNS) + + + # enable Linux goodies +-MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX -DLUA_USE_READLINE +-MYLDFLAGS= $(LOCAL) -Wl,-E +-MYLIBS= -ldl -lreadline ++MYCFLAGS= $(LOCAL) -std=c99 ++MYLDFLAGS= $(LOCAL) ++MYLIBS= -ldl + + + CC= gcc diff --git a/src/Common.m b/src/Common.m index 8b57741..1b8290b 100644 --- a/src/Common.m +++ b/src/Common.m @@ -73,25 +73,6 @@ NSMutableDictionary *env = [NSMutableDictionary dictionaryWithDictionary: [[NSProcessInfo processInfo] environment]]; - NSString *path = [env objectForKey: @"PATH"]; - NSString *newPath = [path stringByAppendingString: @":/opt/local/bin:/usr/local/bin:/usr/local/sbin"]; - [env setObject: newPath forKey: @"PATH"]; - - // Try to find highlight location - NSString *highlightPath = [[defaults persistentDomainForName:myDomain] valueForKey:@"pathHL"]; - if (highlightPath == nil) { - NSUserDefaults *userDefaults = [[NSUserDefaults alloc] init]; - NSData* data = runTask(@"which highlight", env, status); - highlightPath = [[[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding] autorelease] stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - if (*status == 0 && [highlightPath hasPrefix: @"/"] && [highlightPath hasSuffix: @"highlight"]) { // i.e. highlightPath looks like the actual path - NSMutableDictionary *newDefaults = [NSMutableDictionary dictionaryWithObject:highlightPath forKey:@"pathHL"]; - [newDefaults addEntriesFromDictionary: [defaults persistentDomainForName:myDomain]]; - [userDefaults setPersistentDomain: newDefaults forName:myDomain]; - [userDefaults synchronize]; - } - [userDefaults release]; - } - [env addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: #ifdef DEBUG @"1", @"qlcc_debug", @@ -103,7 +84,7 @@ @"edit-xcode", @"hlTheme", // @"-lz -j 3 -t 4 --kw-case=capitalize ", @"extraHLFlags", @"-t 4 ", @"extraHLFlags", - @"/opt/local/bin/highlight", @"pathHL", + [rsrcEsc stringByAppendingString:@"/highlight"], @"pathHL", @"", @"maxFileSize", @"UTF-8", @"textEncoding", @"UTF-8", @"webkitTextEncoding", nil]]; diff --git a/src/colorize.sh b/src/colorize.sh index ce6a266..8392a12 100755 --- a/src/colorize.sh +++ b/src/colorize.sh @@ -138,11 +138,11 @@ go4it () { debug "Generating the preview" if [ "${thumb}" = "1" ]; then - ${reader} | head -n 100 | head -c 20000 | ${cmd} ${cmdOpts} && exit 0 + ${reader} | head -n 100 | head -c 20000 | ${cmd} -D "${rsrcDir}" ${cmdOpts} && exit 0 elif [ -n "${maxFileSize}" ]; then - ${reader} | head -c ${maxFileSize} | ${cmd} -T "${target}" ${cmdOpts} && exit 0 + ${reader} | head -c ${maxFileSize} | ${cmd} -D "${rsrcDir}" -T "${target}" ${cmdOpts} && exit 0 else - ${reader} | ${cmd} -T "${target}" ${cmdOpts} && exit 0 + ${reader} | ${cmd} -D "${rsrcDir}" -T "${target}" ${cmdOpts} && exit 0 fi }