From c3fbbd781e061210637df6781ed10896e90485d2 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Thu, 14 Oct 2010 18:13:44 +0000 Subject: Tidy up build settings, by ensuring they are consistent across all targets, specifically the compiler used. Also add a very basic Makefile to ease builds from the command line during build testing. --- Makefile | 29 +++++++++ Scripts/build.sh | 40 +----------- Scripts/localize.sh | 56 +++++++++++++++++ sequel-pro.xcodeproj/project.pbxproj | 116 ++++++++++++++++++++++++++++++++--- 4 files changed, 195 insertions(+), 46 deletions(-) create mode 100644 Makefile create mode 100755 Scripts/localize.sh diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..3a3c98b3 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +# $Id$ + +CONFIG=Release + +BUILD_CONFIG?=$(CONFIG) + +CP=ditto --rsrc +RM=rm + +.PHONY: sequel-pro test clean clean-all localize latest + +sequel-pro: + xcodebuild -project sequel-pro.xcodeproj -configuration "$(BUILD_CONFIG)" CFLAGS="$(SP_CFLAGS)" build + +test: + xcodebuild -project sequel-pro.xcodeproj -configuration "$(BUILD_CONFIG)" CFLAGS="$(SP_CFLAGS)" -target "Unit Tests" build + +clean: + xcodebuild -project sequel-pro.xcodeproj -configuration "$(BUILD_CONFIG)" -nodependencies clean + +clean-all: + xcodebuild -project sequel-pro.xcodeproj -configuration "$(BUILD_CONFIG)" clean + +localize: + xcodebuild -project sequel-pro.xcodeproj -configuration "$(BUILD_CONFIG)" CFLAGS="$(SP_CFLAGS)" -target Localize + +latest: + svn update + make sequel-pro diff --git a/Scripts/build.sh b/Scripts/build.sh index 88641238..149705cb 100755 --- a/Scripts/build.sh +++ b/Scripts/build.sh @@ -13,7 +13,6 @@ BUILD_PRODUCT="${BUILT_PRODUCTS_DIR}/${TARGET_NAME}${WRAPPER_SUFFIX}" - echo 'Updating build version...' # Add the build/bundle version @@ -25,44 +24,7 @@ rm -rf "${BUILD_PRODUCT}/Contents/Frameworks/BWToolkitFramework.framework/Versio # Perform localisation updates for 'Release' or 'Distribution' builds if [[ "$CONFIGURATION" == 'Release' || "$CONFIGURATION" == 'Distribution' ]] then - - echo "Running genstrings to update 'Localizable.strings'..." - - # Update 'Localizable.strings' by running genstrings(1) - GENSTRINGS_ERRORS=$(genstrings -o "${SRCROOT}/Resources/English.lproj" "${SRCROOT}/Source/"*.m) - - # Check for genstrings errors - if [[ ${GENSTRINGS_ERRORS} -ne 0 ]] - then - echo "error: genstrings exited with error: ${GENSTRINGS_ERRORS}" - fi - - echo "Updating nib and xib localisations..." - - # Generate up-to-date nib .strings files for localisation - find "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"/**/*.nib | while read nibFile - do - stringsFilePath="${SOURCE_ROOT}/Resources/English.lproj/`basename "${nibFile}" .nib`.strings" - xibFile=`basename "${nibFile}" .nib`.xib - xibFilePath=`echo "${SOURCE_ROOT}"/Interfaces/**/"${xibFile}"` - if [[ -e ${xibFilePath} ]] - then - xibfileModDate=`stat -f "%m" "${xibFilePath}"` - if [[ -e ${stringsFilePath} ]] - then - stringsFileModDate=`stat -f "%m" "${stringsFilePath}"` - else - stringsFileModDate=0 - fi - if [[ ${xibfileModDate} -gt ${stringsFileModDate} ]] - then - printf "\tLocalising ${xibFile}...\n"; - ibtool --generate-stringsfile "${stringsFilePath}~" "${xibFilePath}" - "${BUILT_PRODUCTS_DIR}"/xibLocalizationPostprocessor "${stringsFilePath}~" "${stringsFilePath}" - rm "${stringsFilePath}~" - fi - fi - done + "${SRCROOT}/Scripts/localize.sh" fi # Trim the application if this is a 'Release' or 'Distribution' build diff --git a/Scripts/localize.sh b/Scripts/localize.sh new file mode 100755 index 00000000..911cf8ea --- /dev/null +++ b/Scripts/localize.sh @@ -0,0 +1,56 @@ +#! /bin/ksh + +## $Id$ +## +## Author: Created by Rowan Beentje. +## Copyright (c) 2010 Sequel Pro Team. All rights reserved. +## +## Paramters: +## +## Description: Localizes all of the application's NIB files. This script should only be run by Xcode. + +echo "Running genstrings to update 'Localizable.strings'..." + +# Update 'Localizable.strings' by running genstrings(1) +GENSTRINGS_ERRORS=$(genstrings -o "${SRCROOT}/Resources/English.lproj" "${SRCROOT}/Source/"*.m) + +# Check for genstrings errors +if [[ ${GENSTRINGS_ERRORS} -ne 0 ]] +then + echo "error: genstrings exited with error: ${GENSTRINGS_ERRORS}" +fi + +echo "Updating nib and xib localisations..." + +# Generate up-to-date nib .strings files for localisation +find "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"/**/*.nib | while read nibFile +do + stringsFilePath="${SOURCE_ROOT}/Resources/English.lproj/`basename "${nibFile}" .nib`.strings" + xibFile=`basename "${nibFile}" .nib`.xib + xibFilePath=`echo "${SOURCE_ROOT}"/Interfaces/**/"${xibFile}"` + + if [[ -e ${xibFilePath} ]] + then + xibfileModDate=`stat -f "%m" "${xibFilePath}"` + + if [[ -e ${stringsFilePath} ]] + then + stringsFileModDate=`stat -f "%m" "${stringsFilePath}"` + else + stringsFileModDate=0 + fi + + if [[ ${xibfileModDate} -gt ${stringsFileModDate} ]] + then + printf "\tLocalising ${xibFile}...\n"; + + ibtool --generate-stringsfile "${stringsFilePath}~" "${xibFilePath}" + + "${BUILT_PRODUCTS_DIR}"/xibLocalizationPostprocessor "${stringsFilePath}~" "${stringsFilePath}" + + rm "${stringsFilePath}~" + fi + fi +done + +exit 0 diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 050510e5..f622db3a 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -6,6 +6,22 @@ objectVersion = 45; objects = { +/* Begin PBXAggregateTarget section */ + 1798AB1C12676EA0000D946A /* Localize */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 1798AB2012676EBE000D946A /* Build configuration list for PBXAggregateTarget "Localize" */; + buildPhases = ( + 1798AB1B12676EA0000D946A /* ShellScript */, + ); + dependencies = ( + 1798AB2812676F14000D946A /* PBXTargetDependency */, + 1798AB411267731F000D946A /* PBXTargetDependency */, + ); + name = Localize; + productName = Localize; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ 112730571180788A000737FD /* SPTableCopyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 112730551180788A000737FD /* SPTableCopyTest.m */; }; 1127305B11807894000737FD /* SPDatabaseInfoTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1127305911807894000737FD /* SPDatabaseInfoTest.m */; }; @@ -395,6 +411,27 @@ remoteGlobalIDString = 17B7B5611016012700F057DE; remoteInfo = MCPKit; }; + 1798AAFF12676BAD000D946A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8D15AC270486D014006FF6A4 /* Sequel Pro */; + remoteInfo = "Sequel Pro"; + }; + 1798AB2712676F14000D946A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8D15AC270486D014006FF6A4 /* Sequel Pro */; + remoteInfo = "Sequel Pro"; + }; + 1798AB401267731F000D946A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 58B9096011C3A42B000826E5 /* xibLocalizationPostprocessor */; + remoteInfo = xibLocalizationPostprocessor; + }; 17B7B59A1016039200F057DE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */; @@ -549,6 +586,7 @@ 1792C13610AD75C800ABE758 /* SPServerVariablesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPServerVariablesController.m; sourceTree = ""; }; 1792C25F10AE1A2D00ABE758 /* SPConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPConnectionDelegate.h; sourceTree = ""; }; 1792C26010AE1A2D00ABE758 /* SPConnectionDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPConnectionDelegate.m; sourceTree = ""; }; + 1798AB0C12676CD9000D946A /* localize.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = localize.sh; sourceTree = ""; }; 179ECEC611F265EE009C6A40 /* libbz2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.dylib; path = usr/lib/libbz2.dylib; sourceTree = SDKROOT; }; 179F15040F7C433C00579954 /* SPEditorTokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPEditorTokens.h; sourceTree = ""; }; 179F15050F7C433C00579954 /* SPEditorTokens.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; path = SPEditorTokens.l; sourceTree = ""; }; @@ -1424,6 +1462,7 @@ isa = PBXGroup; children = ( 1713122F109C7DF600FB465F /* build.sh */, + 1798AB0C12676CD9000D946A /* localize.sh */, 1761FD9D0EF0488900331368 /* build-version.pl */, 178934980F30CDA10097539A /* trim-application.sh */, 17B7B698101611C800F057DE /* build-mysql-client.sh */, @@ -2266,6 +2305,7 @@ ); dependencies = ( 1792C2CD10AE239D00ABE758 /* PBXTargetDependency */, + 1798AB0012676BAD000D946A /* PBXTargetDependency */, ); name = "Unit Tests"; productName = "Unit Tests"; @@ -2392,6 +2432,7 @@ 58B906E511BD989A000826E5 /* PSMTabBar */, 58B9096011C3A42B000826E5 /* xibLocalizationPostprocessor */, 584754C1120A04560057631F /* Sequel Pro QLGenerator */, + 1798AB1C12676EA0000D946A /* Localize */, ); }; /* End PBXProject section */ @@ -2580,6 +2621,19 @@ shellPath = /bin/sh; shellScript = "# Run build tasks\n\"${SRCROOT}/Scripts/build.sh\"\n"; }; + 1798AB1B12676EA0000D946A /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Scripts/localize.sh\""; + }; 380F4ED70FC0B50500B0BFD7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -2809,6 +2863,21 @@ target = 17B7B5611016012700F057DE /* MCPKit */; targetProxy = 1792C2CC10AE239D00ABE758 /* PBXContainerItemProxy */; }; + 1798AB0012676BAD000D946A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8D15AC270486D014006FF6A4 /* Sequel Pro */; + targetProxy = 1798AAFF12676BAD000D946A /* PBXContainerItemProxy */; + }; + 1798AB2812676F14000D946A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8D15AC270486D014006FF6A4 /* Sequel Pro */; + targetProxy = 1798AB2712676F14000D946A /* PBXContainerItemProxy */; + }; + 1798AB411267731F000D946A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 58B9096011C3A42B000826E5 /* xibLocalizationPostprocessor */; + targetProxy = 1798AB401267731F000D946A /* PBXContainerItemProxy */; + }; 17B7B59B1016039200F057DE /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 17B7B5611016012700F057DE /* MCPKit */; @@ -3141,6 +3210,35 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 1798AB1D12676EA0000D946A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = Localize; + UNLOCALIZED_RESOURCES_FOLDER_PATH = "Sequel Pro.app/Contents/Resources"; + }; + name = Debug; + }; + 1798AB1E12676EA0000D946A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + PRODUCT_NAME = Localize; + ZERO_LINK = NO; + }; + name = Release; + }; + 1798AB1F12676EA0000D946A /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = Localize; + }; + name = Distribution; + }; 17B7B5641016012A00F057DE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3213,7 +3311,6 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "Resources/Plists/MCPKit-Info.plist"; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( @@ -3378,7 +3475,6 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "Resources/Plists/Sequel Pro QLGenerator-Info.plist"; INSTALL_PATH = /Library/QuickLook; OTHER_LDFLAGS = ""; @@ -3396,7 +3492,7 @@ GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; @@ -3437,7 +3533,6 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "\"$(SRCROOT)/Frameworks\"", "\"$(SRCROOT)\"", @@ -3445,7 +3540,6 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Source/Sequel-Pro.pch"; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = Resources/Plists/Info.plist; INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = ( @@ -3516,7 +3610,6 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "Resources/Plists/PSMTabBar-Info.plist"; INSTALL_PATH = "@executable_path/../Frameworks"; OTHER_LDFLAGS = ""; @@ -3647,7 +3740,6 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INSTALL_PATH = /usr/local/bin; OTHER_LDFLAGS = ( "-lstdc++", @@ -3828,6 +3920,16 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 1798AB2012676EBE000D946A /* Build configuration list for PBXAggregateTarget "Localize" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1798AB1D12676EA0000D946A /* Debug */, + 1798AB1E12676EA0000D946A /* Release */, + 1798AB1F12676EA0000D946A /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 17B7B5671016012A00F057DE /* Build configuration list for PBXNativeTarget "MCPKit" */ = { isa = XCConfigurationList; buildConfigurations = ( -- cgit v1.2.3