premake/patches/713.patch
author Ryan C. Gordon
Tue, 29 Dec 2015 02:29:56 -0500
changeset 9986 081fbd89a347
parent 7925 f090a47eb7f7
permissions -rwxr-xr-x
NetBSD: improved joystick support (thanks, Thomas!).

This patch skips non-joystick HID devices and gives joysticks on NetBSD
a human readable name.

Fixes Bugzilla #3178.
icculus@7925
     1
# HG changeset patch
icculus@7925
     2
# User Ben Henning
icculus@7925
     3
# Date 1376606083 25200
icculus@7925
     4
#      Thu Aug 15 15:34:43 2013 -0700
icculus@7925
     5
# Node ID 8c9cd352c70012a64779356bff3c81998c3fb6a0
icculus@7925
     6
# Parent  e8558df4fbdb173a2b9ed0d354d6c3e76b376698
icculus@7925
     7
Implemented the option to set custom source trees for Xcode frameworks (links)
icculus@7925
     8
using Visual Studio-esque variables, such as "$(SDKROOT)/OpenGLES.framework".
icculus@7925
     9
icculus@7925
    10
diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
icculus@7925
    11
--- a/src/actions/xcode/xcode_common.lua
icculus@7925
    12
+++ b/src/actions/xcode/xcode_common.lua
icculus@7925
    13
@@ -318,18 +318,36 @@
icculus@7925
    14
 					local pth, src
icculus@7925
    15
 					if xcode.isframework(node.path) then
icculus@7925
    16
 						--respect user supplied paths
icculus@7925
    17
-						if string.find(node.path,'/')  then
icculus@7925
    18
-							if string.find(node.path,'^%.')then
icculus@7925
    19
+						-- look for special variable-starting paths for different sources
icculus@7925
    20
+						local nodePath = node.path
icculus@7925
    21
+						local _, matchEnd, variable = string.find(nodePath, "^%$%((.+)%)/")
icculus@7925
    22
+						if variable then
icculus@7925
    23
+							-- by skipping the last '/' we support the same absolute/relative
icculus@7925
    24
+							-- paths as before
icculus@7925
    25
+							nodePath = string.sub(nodePath, matchEnd + 1)
icculus@7925
    26
+						end
icculus@7925
    27
+						if string.find(nodePath,'/')  then
icculus@7925
    28
+							if string.find(nodePath,'^%.')then
icculus@7925
    29
 								error('relative paths are not currently supported for frameworks')
icculus@7925
    30
 							end
icculus@7925
    31
-							pth = node.path
icculus@7925
    32
+							pth = nodePath
icculus@7925
    33
 						else
icculus@7925
    34
-							pth = "/System/Library/Frameworks/" .. node.path
icculus@7925
    35
+							pth = "/System/Library/Frameworks/" .. nodePath
icculus@7925
    36
 						end
icculus@7925
    37
-						src = "absolute"
icculus@7925
    38
+						-- if it starts with a variable, use that as the src instead
icculus@7925
    39
+						if variable then
icculus@7925
    40
+							src = variable
icculus@7925
    41
+							-- if we are using a different source tree, it has to be relative
icculus@7925
    42
+							-- to that source tree, so get rid of any leading '/'
icculus@7925
    43
+							if string.find(pth, '^/') then
icculus@7925
    44
+								pth = string.sub(pth, 2)
icculus@7925
    45
+							end
icculus@7925
    46
+						else
icculus@7925
    47
+							src = "<absolute>"
icculus@7925
    48
+						end
icculus@7925
    49
 					else
icculus@7925
    50
 						-- something else; probably a source code file
icculus@7925
    51
-						src = "group"
icculus@7925
    52
+						src = "<group>"
icculus@7925
    53
 
icculus@7925
    54
 						-- if the parent node is virtual, it won't have a local path
icculus@7925
    55
 						-- of its own; need to use full relative path from project
icculus@7925
    56
@@ -340,7 +358,7 @@
icculus@7925
    57
 						end
icculus@7925
    58
 					end
icculus@7925
    59
 					
icculus@7925
    60
-					_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "<%s>"; };',
icculus@7925
    61
+					_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "%s"; };',
icculus@7925
    62
 						node.id, node.name, xcode.getfiletype(node), node.name, pth, src)
icculus@7925
    63
 				end
icculus@7925
    64
 			end