[57029] users/toby/objcports

toby at macports.org toby at macports.org
Fri Sep 4 23:06:08 PDT 2009


Revision: 57029
          http://trac.macports.org/changeset/57029
Author:   toby at macports.org
Date:     2009-09-04 23:06:04 -0700 (Fri, 04 Sep 2009)
Log Message:
-----------
stash the variable plist in a mach-o section

Modified Paths:
--------------
    users/toby/objcports/MPPort.m
    users/toby/objcports/objcports.xcodeproj/project.pbxproj

Modified: users/toby/objcports/MPPort.m
===================================================================
--- users/toby/objcports/MPPort.m	2009-09-05 03:25:26 UTC (rev 57028)
+++ users/toby/objcports/MPPort.m	2009-09-05 06:06:04 UTC (rev 57029)
@@ -1,6 +1,7 @@
 #include <Foundation/Foundation.h>
 #include <tcl.h>
 #include <sys/utsname.h>
+#include <mach-o/getsect.h>
 
 #include "MPPort.h"
 #include "MPArrayAdditions.h"
@@ -28,7 +29,10 @@
 
 - (id)initWithURL:(NSURL *)url options:(NSDictionary *)options
 {
+	char *sectdata;
+	unsigned long sectsize;
 	NSData *vdata;
+
 	self = [super init];
 	_url = [url retain];
 
@@ -38,7 +42,9 @@
 	_variables = [[NSMutableDictionary alloc] initWithCapacity:0];
 
 	//_variableInfo = [[NSMutableDictionary alloc] initWithContentsOfFile:@"variables.plist"];
-	vdata = [[NSData alloc] initWithContentsOfMappedFile:@"variables.plist"];
+	sectdata = getsectdata("MacPorts", "variables", &sectsize);
+	assert(sectdata);
+	vdata = [[NSData alloc] initWithBytesNoCopy:sectdata length:sectsize freeWhenDone:NO];
 	_variableInfo = [[NSPropertyListSerialization propertyListWithData:vdata options:kCFPropertyListMutableContainersAndLeaves format:NULL error:NULL] retain];
 	[vdata release];
 

Modified: users/toby/objcports/objcports.xcodeproj/project.pbxproj
===================================================================
--- users/toby/objcports/objcports.xcodeproj/project.pbxproj	2009-09-05 03:25:26 UTC (rev 57028)
+++ users/toby/objcports/objcports.xcodeproj/project.pbxproj	2009-09-05 06:06:04 UTC (rev 57029)
@@ -181,6 +181,12 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				INSTALL_PATH = /usr/local/bin;
+				OTHER_LDFLAGS = (
+					"-sectcreate",
+					MacPorts,
+					variables,
+					"$(SRCROOT)/variables.plist",
+				);
 				PRODUCT_NAME = port;
 			};
 			name = Release;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090904/5818dce0/attachment.html>


More information about the macports-changes mailing list