From 5561cc50064f0f3e8c184d1ac7ae32db3832d323 Mon Sep 17 00:00:00 2001 From: "Philippe C.D. Robert" Date: Fri, 1 Mar 2002 14:18:41 +0000 Subject: [PATCH] Support for bundles git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12926 72102866-910b-0410-8b05-ffd578937521 --- PCLib/PCMakefileFactory.h | 24 +++++-- PCLib/PCMakefileFactory.m | 145 +++++++++++++++++++++++++++----------- 2 files changed, 121 insertions(+), 48 deletions(-) diff --git a/PCLib/PCMakefileFactory.h b/PCLib/PCMakefileFactory.h index 88bf252..8c439c3 100644 --- a/PCLib/PCMakefileFactory.h +++ b/PCLib/PCMakefileFactory.h @@ -25,8 +25,6 @@ - (void)appendString:(NSString *)aString; -- (void)appendApplication; - - (void)appendHeaders:(NSArray *)array; - (void)appendClasses:(NSArray *)array; - (void)appendCFiles:(NSArray *)array; @@ -34,11 +32,7 @@ - (void)appendResources; - (void)appendResourceItems:(NSArray *)array; -- (void)appendInstallDir:(NSString*)dir; -- (void)appendAppIcon:(NSString*)icn; - - (void)appendSubprojects:(NSArray*)array; -- (void)appendGuiLibraries:(NSArray*)array; - (void)appendTailForApp; - (void)appendTailForLibrary; @@ -50,5 +44,23 @@ @end +@interface PCMakefileFactory (ApplicationProject) + +- (void)appendApplication; +- (void)appendAppIcon:(NSString*)icn; +- (void)appendGuiLibraries:(NSArray*)array; +- (void)appendInstallDir:(NSString*)dir; + +@end + +@interface PCMakefileFactory (BundleProject) + +- (void)appendBundle; +- (void)appendPrincipalClass:(NSString *)cname; +- (void)appendBundleInstallDir:(NSString*)dir; +- (void)appendLibraries:(NSArray*)array; + +@end + #endif // _PCMAKEFILEFACTORY_H_ diff --git a/PCLib/PCMakefileFactory.m b/PCLib/PCMakefileFactory.m index 13b0029..3708373 100644 --- a/PCLib/PCMakefileFactory.m +++ b/PCLib/PCMakefileFactory.m @@ -17,6 +17,7 @@ #define COMMENT_SUBPROJECTS @"\n\n#\n# Subprojects\n#\n\n" #define COMMENT_APP @"\n\n#\n# Main application\n#\n\n" #define COMMENT_LIBRARIES @"\n\n#\n# Additional libraries\n#\n\n" +#define COMMENT_BUNDLE @"\n\n#\n# Bundle\n#\n\n" @implementation PCMakefileFactory @@ -65,14 +66,6 @@ static PCMakefileFactory *_factory = nil; [mfile appendString:aString]; } -- (void)appendApplication -{ - [self appendString:COMMENT_APP]; - - [self appendString:[NSString stringWithFormat:@"PACKAGE_NAME=%@\n",pnme]]; - [self appendString:[NSString stringWithFormat:@"APP_NAME=%@\n",pnme]]; -} - - (void)appendHeaders:(NSArray *)array { [self appendString:COMMENT_HEADERS]; @@ -140,18 +133,6 @@ static PCMakefileFactory *_factory = nil; } } -- (void)appendInstallDir:(NSString*)dir -{ - [self appendString: - [NSString stringWithFormat:@"GNUSTEP_INSTALLATION_DIR=%@\n",dir]]; -} - -- (void)appendAppIcon:(NSString*)icn -{ - [self appendString: - [NSString stringWithFormat:@"%@_APPLICATION_ICON=%@\n",pnme, icn]]; -} - - (void)appendSubprojects:(NSArray*)array { [self appendString:COMMENT_SUBPROJECTS]; @@ -168,27 +149,6 @@ static PCMakefileFactory *_factory = nil; } -- (void)appendGuiLibraries:(NSArray*)array -{ - [self appendString:COMMENT_LIBRARIES]; - [self appendString:@"ADDITIONAL_GUI_LIBS += "]; - - if( array && [array count] ) - { - NSString *tmp; - NSEnumerator *enumerator = [array objectEnumerator]; - - while (tmp = [enumerator nextObject]) - { - if (![tmp isEqualToString:@"gnustep-base"] && - ![tmp isEqualToString:@"gnustep-gui"]) - { - [self appendString:[NSString stringWithFormat:@"-l%@ ",tmp]]; - } - } - } -} - - (void)appendTailForApp { [self appendString:@"\n\n"]; @@ -212,7 +172,12 @@ static PCMakefileFactory *_factory = nil; - (void)appendTailForBundle { - [self appendString:@""]; + [self appendString:@"\n\n"]; + + [self appendString:@"-include GNUmakefile.preamble\n"]; + [self appendString:@"-include GNUmakefile.local\n"]; + [self appendString:@"include $(GNUSTEP_MAKEFILES)/bundle.make\n"]; + [self appendString:@"-include GNUmakefile.postamble\n"]; } - (void)appendTailForGormApp @@ -228,3 +193,99 @@ static PCMakefileFactory *_factory = nil; } @end + +@implementation PCMakefileFactory (ApplicationProject) + +- (void)appendApplication +{ + [self appendString:COMMENT_APP]; + + [self appendString:[NSString stringWithFormat:@"PACKAGE_NAME=%@\n",pnme]]; + [self appendString:[NSString stringWithFormat:@"APP_NAME=%@\n",pnme]]; +} + +- (void)appendAppIcon:(NSString*)icn +{ + [self appendString: + [NSString stringWithFormat:@"%@_APPLICATION_ICON=%@\n",pnme, icn]]; +} + +- (void)appendGuiLibraries:(NSArray*)array +{ + [self appendString:COMMENT_LIBRARIES]; + [self appendString:@"ADDITIONAL_GUI_LIBS += "]; + + if( array && [array count] ) + { + NSString *tmp; + NSEnumerator *enumerator = [array objectEnumerator]; + + while (tmp = [enumerator nextObject]) + { + if (![tmp isEqualToString:@"gnustep-base"] && + ![tmp isEqualToString:@"gnustep-gui"]) + { + [self appendString:[NSString stringWithFormat:@"-l%@ ",tmp]]; + } + } + } +} + +- (void)appendInstallDir:(NSString*)dir +{ + [self appendString: + [NSString stringWithFormat:@"GNUSTEP_INSTALLATION_DIR=%@\n",dir]]; +} + +@end + +@implementation PCMakefileFactory (BundleProject) + +- (void)appendBundle +{ + [self appendString:COMMENT_BUNDLE]; + + [self appendString:[NSString stringWithFormat:@"PACKAGE_NAME=%@\n",pnme]]; + [self appendString:[NSString stringWithFormat:@"BUNDLE_NAME=%@\n",pnme]]; + [self appendString:[NSString stringWithFormat:@"BUNDLE_EXTENSION=.bundle\n"]]; + +} + +- (void)appendPrincipalClass:(NSString *)cname +{ + [self appendString: + [NSString stringWithFormat:@"%@_PRINCIPAL_CLASS=%@\n",pnme,cname]]; + +} + +- (void)appendBundleInstallDir:(NSString*)dir +{ + [self appendString: + [NSString stringWithFormat:@"BUNDLE_INSTALL_DIR=%@\n",dir]]; +} + +- (void)appendLibraries:(NSArray*)array +{ + [self appendString:COMMENT_LIBRARIES]; + + [self appendString: + [NSString stringWithFormat:@"%@_LIBRARIES_DEPEND_UPON += ",pnme]]; + + if( array && [array count] ) + { + NSString *tmp; + NSEnumerator *enumerator = [array objectEnumerator]; + + while (tmp = [enumerator nextObject]) + { + if (![tmp isEqualToString:@"gnustep-base"] && + ![tmp isEqualToString:@"gnustep-gui"]) + { + [self appendString:[NSString stringWithFormat:@"-l%@ ",tmp]]; + } + } + } +} + +@end +