All pastes #977200 Raw Edit

dynamic plist generation

public diff v1 · immutable
·published 2008-04-08 18:12 UTC
rendered paste body
Index: configure===================================================================--- configure	(revision 1396)+++ configure	(working copy)@@ -1,5 +1,8 @@ #! /bin/sh +# This line needs to be manually bumped for each release.+HB_VERSION="0.9.3";+ CC="gcc" CXX="g++" CCFLAGS="$CCFLAGS -Wall -g"@@ -117,6 +120,17 @@ FULL_PATH=$(pwd) SVN_REV=$(svnversion) +# In Mac OS X, generate a .plist file for Xcode+if [[ $SYSTEM == "Darwin" ]]+then+    if [[ $SNAPSHOT == 1 ]]+    then+        macosx/plist-generator.rb "$FULL_PATH" "svn$SVN_REV" "$BUILD_DATE""01"+    else+        macosx/plist-generator.rb "$FULL_PATH" "$HB_VERSION" "$BUILD_DATE""00"+    fi+fi+ # Generate config.jam rm -f config.jam cat << EOF > config.jam@@ -133,6 +147,7 @@ BUILD_DATE = $BUILD_DATE ; FULL_PATH = $FULL_PATH ; SVN_REV = $SVN_REV ;+HB_VERSION = $HB_VERSION ; CSS      = $CSS ; EOF Index: Jamrules===================================================================--- Jamrules	(revision 1396)+++ Jamrules	(working copy)@@ -11,9 +11,6 @@     Exit "Please run ./configure first." ; } -# This line needs to be manually bumped for each release.-HB_VERSION  = 0.9.3 ;- # If the user configured with the --snapshot argument, # generate  version and build numbers that include # the svn revision and are marked as unstable.@@ -45,11 +42,8 @@ {     $(RM) $(<) macosx/build/HandBrake.app && \       ( cd macosx && \-         defaults write "$(FULL_PATH)"/macosx/HandBrake CFBundleGetInfoString '"$(HB_VERSION)"' &&\-         defaults write "$(FULL_PATH)"/macosx/HandBrake CFBundleShortVersionString '"$(HB_VERSION)"' &&\-         defaults write "$(FULL_PATH)"/macosx/HandBrake CFBundleVersion '"$(HB_BUILD)"' &&\-         plutil -convert xml1 "$(FULL_PATH)"/macosx/HandBrake.plist &&\-        xcodebuild OTHER_CFLAGS_QUOTED_1="-g -HB_BUILD="$(HB_BUILD)" -HB_VERSION=\\\"$(HB_VERSION)\\\" -DHB_BUILD="$(HB_BUILD)" -DHB_VERSION=\\\"$(HB_VERSION)\\\" -CURRENT_PROJECT_VERSION=\\\"$(HB_VERSION)\\\" " -target libhb -target HandBrake -target HandBrakeCLI ) && \+         ./plist-generator.rb "$(FULL_PATH)" "$(HB_VERSION)" "$(HB_BUILD)" &&\+         xcodebuild OTHER_CFLAGS_QUOTED_1="-g -HB_BUILD="$(HB_BUILD)" -HB_VERSION=\\\"$(HB_VERSION)\\\" -DHB_BUILD="$(HB_BUILD)" -DHB_VERSION=\\\"$(HB_VERSION)\\\" -CURRENT_PROJECT_VERSION=\\\"$(HB_VERSION)\\\" " -target libhb -target HandBrake -target HandBrakeCLI ) && \       for i in $(LANGUAGES) ; do \         ( cd $(<)/Contents/Resources && \           cp -r English.lproj $i.lproj && \Index: macosx/HandBrake.xcodeproj/project.pbxproj===================================================================--- macosx/HandBrake.xcodeproj/project.pbxproj	(revision 1396)+++ macosx/HandBrake.xcodeproj/project.pbxproj	(working copy)@@ -620,6 +620,7 @@ 			isa = PBXNativeTarget; 			buildConfigurationList = 0DFF0B730B6BC70400549488 /* Build configuration list for PBXNativeTarget "libhb" */; 			buildPhases = (+				743AC8100DABE69C00BB9C7F /* ShellScript */, 				0DFF0B6E0B6BC6E600549488 /* Headers */, 				0DFF0B6F0B6BC6E600549488 /* Sources */, 				0DFF0B700B6BC6E600549488 /* Frameworks */,@@ -747,6 +748,22 @@ 		}; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */+		743AC8100DABE69C00BB9C7F /* ShellScript */ = {+			isa = PBXShellScriptBuildPhase;+			buildActionMask = 2147483647;+			files = (+			);+			inputPaths = (+			);+			outputPaths = (+			);+			runOnlyForDeploymentPostprocessing = 0;+			shellPath = /bin/sh;+			shellScript = "if test ! -e HandBrake.plist\nthen\n\tcd ..\n\t./configure\n\tcd macosx\nfi";+		};+/* End PBXShellScriptBuildPhase section */+ /* Begin PBXSourcesBuildPhase section */ 		0D096DFC0B707D1200A845D4 /* Sources */ = { 			isa = PBXSourcesBuildPhase;Index: macosx/plist-generator.rb===================================================================--- macosx/plist-generator.rb	(revision 0)+++ macosx/plist-generator.rb	(revision 0)@@ -0,0 +1,41 @@+#! /usr/bin/ruby+# Dynamically generates the macosx/HandBrake.plist file at build-time.++# Passed arguments in the order: path/to/trunk/dir/ HB_VERSION HB_BUILD+$full_path = ARGV[0]+hb_version = ARGV[1]+hb_build =   ARGV[2]++plistArray = # These will be the keys and values of the plist dictionary+  [ +    { "CFBundleDevelopmentRegion" =>         "English" },+    { "CFBundleDisplayName" =>             "HandBrake" },+    { "CFBundleExecutable" =>              "HandBrake" },+    { "CFBundleGetInfoString" =>       "#{hb_version}" }, # HB_VERSION+    { "CFBundleIconFile" =>                "HandBrake" },+    { "CFBundleIdentifier" =>      "org.m0k.handbrake" },+    { "CFBundleInfoDictionaryVersion" =>         "6.0" },+    { "CFBundleName" =>                    "HandBrake" },+    { "CFBundlePackageType" =>                  "APPL" },+    { "CFBundleShortVersionString" =>  "#{hb_version}" }, # HB_VERSION+    { "CFBundleSignature" =>                     "HB##"},+    { "CFBundleVersion" =>               "#{hb_build}" }, # HB_BUILD+    { "NSHumanReadableCopyright" =>   "HandBrake Devs" },+    { "NSMainNibFile" =>                    "MainMenu" },+    { "NSPrincipalClass" =>            "NSApplication" },+    { "SUFeedURL" => "http://handbrake.fr/appcast.xml" }  # Sparke feed URL+  ]++def writeDefaults(plistArray) # Wrutes the plist from a given array of hashed key value pairs+  plistArray.each do |plistHash|+    plistHash.each do |key, value|+      `defaults write #{$full_path}/macosx/HandBrake #{key} '#{value}'`+    end+  end+  +  # Make the plist xml, instead of the default binary.+  `plutil -convert xml1 #{$full_path}/macosx/HandBrake.plist`    +end++writeDefaults(plistArray) # Run everything+Property changes on: macosx/plist-generator.rb___________________________________________________________________Name: svn:executable   + *