premake/patches/712.patch
author Ryan C. Gordon
Mon, 04 Jan 2016 16:25:27 -0500
changeset 10006 5229da175b57
parent 7925 f090a47eb7f7
permissions -rwxr-xr-x
x11: Support _NET_WM_USER_TIME and give _NET_ACTIVE_WINDOW a valid timestamp.

Fixes Bugzilla #3056.
     1 # HG changeset patch
     2 # User Ben Henning
     3 # Date 1376509869 25200
     4 #      Wed Aug 14 12:51:09 2013 -0700
     5 # Node ID e8558df4fbdb173a2b9ed0d354d6c3e76b376698
     6 # Parent  a5f8b4f709722222e02fa481873d76ad25255e09
     7 Fixed a bug in Xcode project generation wherein pre/prelink/post-build commands
     8 would not be properly executed if the premake script only had the commands
     9 in configuration blocks, rather than in the project block. According to the
    10 website, these commands can exist in both blocks and the Xcode script does
    11 properly generate the commands, it just doesn't add a single line which allows
    12 Xcode to execute the commands at the correct stage. This patch fixes those
    13 issues.
    14 
    15 diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
    16 --- a/src/actions/xcode/xcode_common.lua
    17 +++ b/src/actions/xcode/xcode_common.lua
    18 @@ -432,20 +432,37 @@
    19  		for _, node in ipairs(tr.products.children) do
    20  			local name = tr.project.name
    21  			
    22 +			-- This function checks whether there are build commands of a specific
    23 +			-- type to be executed; they will be generated correctly, but the project
    24 +			-- commands will not contain any per-configuration commands, so the logic
    25 +			-- has to be extended a bit to account for that.
    26 +			local function hasBuildCommands(which)
    27 +				-- standard check...this is what existed before
    28 +				if #tr.project[which] > 0 then
    29 +					return true
    30 +				end
    31 +				-- what if there are no project-level commands? check configs...
    32 +				for _, cfg in ipairs(tr.configs) do
    33 +					if #cfg[which] > 0 then
    34 +						return true
    35 +					end
    36 +				end
    37 +			end
    38 +			
    39  			_p(2,'%s /* %s */ = {', node.targetid, name)
    40  			_p(3,'isa = PBXNativeTarget;')
    41  			_p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;', node.cfgsection, name)
    42  			_p(3,'buildPhases = (')
    43 -			if #tr.project.prebuildcommands > 0 then
    44 +			if hasBuildCommands('prebuildcommands') then
    45  				_p(4,'9607AE1010C857E500CD1376 /* Prebuild */,')
    46  			end
    47  			_p(4,'%s /* Resources */,', node.resstageid)
    48  			_p(4,'%s /* Sources */,', node.sourcesid)
    49 -			if #tr.project.prelinkcommands > 0 then
    50 +			if hasBuildCommands('prelinkcommands') then
    51  				_p(4,'9607AE3510C85E7E00CD1376 /* Prelink */,')
    52  			end
    53  			_p(4,'%s /* Frameworks */,', node.fxstageid)
    54 -			if #tr.project.postbuildcommands > 0 then
    55 +			if hasBuildCommands('postbuildcommands') then
    56  				_p(4,'9607AE3710C85E8F00CD1376 /* Postbuild */,')
    57  			end
    58  			_p(3,');')