LibraryDefinition.st
changeset 9885 2b52de27eef7
parent 9884 3c4fe9230405
child 9899 1c1ed66c7163
equal deleted inserted replaced
9884:3c4fe9230405 9885:2b52de27eef7
   430 
   430 
   431 !LibraryDefinition class methodsFor:'mappings'!
   431 !LibraryDefinition class methodsFor:'mappings'!
   432 
   432 
   433 bc_dot_def_mappings
   433 bc_dot_def_mappings
   434     ^ (super bc_dot_def_mappings)
   434     ^ (super bc_dot_def_mappings)
   435         at:#'LIBRARY_NAME' put:[ self libraryName ];
   435         at:'LIBRARY_NAME' put:( self libraryName );
   436         yourself
   436         yourself
   437 
   437 
   438     "Created: / 09-08-2006 / 11:17:59 / fm"
   438     "Created: / 09-08-2006 / 11:17:59 / fm"
   439     "Modified: / 16-08-2006 / 18:19:25 / User"
   439     "Modified: / 16-08-2006 / 18:19:25 / User"
   440     "Modified: / 18-08-2006 / 17:14:00 / cg"
   440     "Modified: / 14-09-2006 / 18:56:11 / cg"
   441 !
   441 !
   442 
   442 
   443 classLine_libInit_dot_cc_mappings: aClassName
   443 classLine_libInit_dot_cc_mappings: aClassName
   444 
   444 
   445 ^Dictionary new                                               
   445 ^Dictionary new                                               
   446     at: #'CLASS' put: [self st2c:aClassName];
   446     at: 'CLASS' put: ( self st2c:aClassName );
   447     yourself
   447     yourself
   448 
   448 
   449     "Created: / 08-08-2006 / 14:04:00 / fm"
   449     "Created: / 08-08-2006 / 14:04:00 / fm"
   450     "Modified: / 09-08-2006 / 18:27:07 / fm"
   450     "Modified: / 09-08-2006 / 18:27:07 / fm"
       
   451     "Modified: / 14-09-2006 / 18:56:18 / cg"
   451 !
   452 !
   452 
   453 
   453 extensionLine_libInit_dot_cc_mappings
   454 extensionLine_libInit_dot_cc_mappings
   454 
   455 
   455 ^Dictionary new                                               
   456 ^Dictionary new                                               
   456     at: #'LIBRARY_NAME' put: [self st2c:(self package copy asString replaceAny:':/' with:$_)];
   457     at: 'LIBRARY_NAME' put: ( self st2c:(self package copy asString replaceAny:':/' with:$_) );
   457     yourself
   458     yourself
   458 
   459 
   459     "Created: / 09-08-2006 / 11:19:59 / fm"
   460     "Created: / 09-08-2006 / 11:19:59 / fm"
   460     "Modified: / 23-08-2006 / 01:23:40 / cg"
   461     "Modified: / 14-09-2006 / 18:56:26 / cg"
   461 !
   462 !
   462 
   463 
   463 libInit_dot_cc_mappings
   464 libInit_dot_cc_mappings
   464 
   465 
   465 ^Dictionary new
   466 ^Dictionary new
   466     at: #'LIBRARY_NAME' put: [self libraryName];
   467     at: 'LIBRARY_NAME' put: (self libraryName);
   467     at: #'PACKAGE' put: [self package];
   468     at: 'PACKAGE' put: (self package);
   468     at: #'CLASSES' put: [self generateClassLines_libInit_dot_cc];
   469     at: 'CLASSES' put: (self generateClassLines_libInit_dot_cc);
   469     at: #'EXTENSION' put: [self generateExtensionLine_libInit_dot_cc];
   470     at: 'EXTENSION' put: (self generateExtensionLine_libInit_dot_cc);
   470 
   471 
   471     yourself
   472     yourself
   472 
   473 
   473     "Created: / 09-08-2006 / 11:20:24 / fm"
   474     "Created: / 09-08-2006 / 11:20:24 / fm"
   474     "Modified: / 16-08-2006 / 18:19:03 / User"
   475     "Modified: / 16-08-2006 / 18:19:03 / User"
   475 !
   476     "Modified: / 14-09-2006 / 18:56:42 / cg"
   476 
       
   477 lib_dot_rc_mappings
       
   478 
       
   479 ^Dictionary new
       
   480     at: #'FILEVERSION' put: ['5,2,8,1'];
       
   481     at: #'PRODUCTVERSION' put: ['5,2,8,1'];
       
   482     at: #'FILETYPE' put: 'VFT_DLL';
       
   483     yourself
       
   484 
       
   485     "Created: / 17-08-2006 / 19:35:05 / cg"
       
   486 !
   477 !
   487 
   478 
   488 make_dot_proto_mappings
   479 make_dot_proto_mappings
   489     ^ Dictionary new
   480     ^ Dictionary new
   490         at: #'TAB' put: ( Character tab asString );
   481         at: 'TAB' put: ( Character tab asString );
   491         at: #'TOP' put: ( self pathToTop_unix );
   482         at: 'TOP' put: ( self pathToTop_unix );
   492         at: #'LIBRARY_NAME' put: ( self libraryName );
   483         at: 'LIBRARY_NAME' put: ( self libraryName );
   493         at: #'SUBDIRECTORIES' put: (self generateSubDirectories);
   484         at: 'SUBDIRECTORIES' put: (self generateSubDirectories);
   494         at: #'LOCAL_INCLUDES' put: (self generateLocalIncludes_unix);
   485         at: 'LOCAL_INCLUDES' put: (self generateLocalIncludes_unix);
   495         at: #'LOCAL_DEFINES' put: '';
   486         at: 'LOCAL_DEFINES' put: '';
   496         at: #'COMMONSYMFLAG' put: (self commonSymbolsFlag);
   487         at: 'COMMONSYMFLAG' put: (self commonSymbolsFlag);
   497         at: #'HEADEROUTPUTARG' put: (self headerFileOutputArg);
   488         at: 'HEADEROUTPUTARG' put: (self headerFileOutputArg);
   498         at: #'ADDITIONAL_DEFINITIONS' put: (self additionalDefinitions_make_dot_proto);
   489         at: 'ADDITIONAL_DEFINITIONS' put: (self additionalDefinitions_make_dot_proto);
   499         at: #'ADDITIONAL_RULES' put: (self additionalRules_make_dot_proto);
   490         at: 'ADDITIONAL_RULES' put: (self additionalRules_make_dot_proto);
   500         at: #'ADDITIONAL_TARGETS' put: (self additionalTargets_make_dot_proto);
   491         at: 'ADDITIONAL_TARGETS' put: (self additionalTargets_make_dot_proto);
   501         at: #'ADDITIONAL_LINK_LIBRARIES' put: (self additionalLinkLibraries_make_dot_proto);
   492         at: 'ADDITIONAL_LINK_LIBRARIES' put: (self additionalLinkLibraries_make_dot_proto);
   502         at: #'DEPENDENCIES' put: (self generateDependencies_unix);
   493         at: 'DEPENDENCIES' put: (self generateDependencies_unix);
   503         yourself
   494         yourself
   504 
   495 
   505     "Created: / 09-08-2006 / 11:20:45 / fm"
   496     "Created: / 09-08-2006 / 11:20:45 / fm"
   506     "Modified: / 09-08-2006 / 16:44:48 / fm"
   497     "Modified: / 09-08-2006 / 16:44:48 / fm"
   507     "Modified: / 14-09-2006 / 12:33:08 / cg"
   498     "Modified: / 14-09-2006 / 18:57:52 / cg"
   508 !
   499 !
   509 
   500 
   510 nt_dot_def_mappings
   501 nt_dot_def_mappings
   511 
   502 
   512 ^Dictionary new
   503 ^Dictionary new
   513     at: #'LIBRARY_NAME' put: [self libraryName];
   504     at: 'LIBRARY_NAME' put: (self libraryName);
   514     at: #'DESCRIPTION' put: [self description asString storeString];
   505     at: 'DESCRIPTION' put: (self description asString storeString);
   515     at: #'VERSION_NUMBER' put: [self versionNumber];
   506     at: 'VERSION_NUMBER' put: (self versionNumber);
   516     yourself
   507     yourself
   517 
   508 
   518     "Created: / 09-08-2006 / 11:21:21 / fm"
   509     "Created: / 09-08-2006 / 11:21:21 / fm"
       
   510     "Modified: / 14-09-2006 / 18:58:07 / cg"
   519 !
   511 !
   520 
   512 
   521 nt_dot_mak_mappings
   513 nt_dot_mak_mappings
   522     |d resFileName|
   514     |d resFileName|
   523 
   515 
   524     resFileName := (self package copyFrom:(self package lastIndexOfAny:':/')+1),'.res'.
   516     resFileName := (self package copyFrom:(self package lastIndexOfAny:':/')+1),'.res'.
   525 
   517 
   526     d := super nt_dot_mak_mappings.
   518     d := super nt_dot_mak_mappings.
   527     d
   519     d
   528         at: #'LIBRARY_NAME' put: ( self libraryName );
   520         at: 'LIBRARY_NAME' put: ( self libraryName );
   529         at: #'LOCAL_INCLUDES' put: (self generateLocalIncludes_win32);
   521         at: 'LOCAL_INCLUDES' put: (self generateLocalIncludes_win32);
   530         at: #'COMMONSYMFLAG' put: (self commonSymbolsFlag);
   522         at: 'COMMONSYMFLAG' put: (self commonSymbolsFlag);
   531         at: #'HEADEROUTPUTARG' put: (self headerFileOutputArg);
   523         at: 'HEADEROUTPUTARG' put: (self headerFileOutputArg);
   532         at: #'RESFILENAME' put: resFileName;
   524         at: 'RESFILENAME' put: resFileName;
   533         at: #'ADDITIONAL_DEFINITIONS' put: (self additionalDefinitions_nt_dot_mak);
   525         at: 'ADDITIONAL_DEFINITIONS' put: (self additionalDefinitions_nt_dot_mak);
   534         at: #'ADDITIONAL_RULES' put: (self additionalRules_nt_dot_mak);
   526         at: 'ADDITIONAL_RULES' put: (self additionalRules_nt_dot_mak);
   535         at: #'ADDITIONAL_TARGETS' put: (self additionalTargets_nt_dot_mak);
   527         at: 'ADDITIONAL_TARGETS' put: (self additionalTargets_nt_dot_mak);
   536         at: #'DEPENDENCIES' put: (self generateDependencies_win32);
   528         at: 'DEPENDENCIES' put: (self generateDependencies_win32);
   537         yourself.
   529         yourself.
   538     ^ d.
   530     ^ d.
   539 
   531 
   540     "Created: / 09-08-2006 / 11:44:36 / fm"
   532     "Created: / 09-08-2006 / 11:44:36 / fm"
   541     "Modified: / 09-08-2006 / 20:00:01 / fm"
   533     "Modified: / 09-08-2006 / 20:00:01 / fm"
   542     "Modified: / 14-09-2006 / 12:32:45 / cg"
   534     "Modified: / 14-09-2006 / 18:58:15 / cg"
   543 !
   535 !
   544 
   536 
   545 st2c:aString
   537 st2c:aString
   546         ^ (aString asString
   538         ^ (aString asString
   547             copyReplaceString:'_' withString:('_',($_ codePoint printStringRadix:8)))
   539             copyReplaceString:'_' withString:('_',($_ codePoint printStringRadix:8)))
   635     "Created: / 09-08-2006 / 11:21:48 / fm"
   627     "Created: / 09-08-2006 / 11:21:48 / fm"
   636     "Modified: / 16-08-2006 / 18:52:10 / User"
   628     "Modified: / 16-08-2006 / 18:52:10 / User"
   637     "Modified: / 14-09-2006 / 13:11:57 / cg"
   629     "Modified: / 14-09-2006 / 13:11:57 / cg"
   638 !
   630 !
   639 
   631 
   640 generateDependencies:whichArchitecture
       
   641     ^ String streamContents:[:s |
       
   642         |classNames classesLoaded classesSorted classNamesSorted putDependencyForClass
       
   643          archClassNames archClassesLoaded putSingleClassDependencyEntry putDependencyForExtensions|
       
   644 
       
   645         putSingleClassDependencyEntry :=
       
   646             [:cls | |sclsBaseName|
       
   647                 s nextPutAll:' $(INCLUDE_TOP)'.                 
       
   648                 s nextPutAll:(self pathSeparator:whichArchitecture) asString.
       
   649                 sclsBaseName := cls classFilename asFilename withoutSuffix baseName.
       
   650                 s nextPutAll:(self topRelativePathTo:sclsBaseName inPackage:cls package architecture:whichArchitecture).
       
   651                 s nextPutAll:'.$(H)'.
       
   652             ].
       
   653 
       
   654         putDependencyForClass :=
       
   655             [:cls |
       
   656                 |clsBaseName already|
       
   657 
       
   658                 clsBaseName := cls classFilename asFilename withoutSuffix baseName.
       
   659                 s nextPutAll:'$(OUTDIR)'.
       
   660                 s nextPutAll:clsBaseName.
       
   661                 s nextPutAll:'.$(O)'.
       
   662 
       
   663                 s nextPutAll:' '.
       
   664                 s nextPutAll:clsBaseName.
       
   665                 s nextPutAll:'.$(H)'.
       
   666 
       
   667                 s nextPutAll:': '.
       
   668                 s nextPutAll:clsBaseName.
       
   669                 s nextPutAll:'.st'.
       
   670                 already := Set new.
       
   671                 cls allSuperclassesDo:[:scls |
       
   672                     putSingleClassDependencyEntry value:scls.
       
   673                     already add:scls.
       
   674                 ].
       
   675                 cls privateClassesDo:[:eachPrivateClass |
       
   676                     eachPrivateClass allSuperclassesDo:[:scls | |sclsBaseName|
       
   677                         scls ~~ cls ifTrue:[
       
   678                             scls isPrivate ifFalse:[
       
   679                                 (already includes:scls) ifFalse:[
       
   680                                     putSingleClassDependencyEntry value:scls.
       
   681                                     already add:scls.
       
   682                                 ].
       
   683                             ].
       
   684                         ].
       
   685                     ]
       
   686                 ].
       
   687 
       
   688                 s nextPutAll:' $(STCHDR)'.                 
       
   689                 s cr.
       
   690             ].
       
   691 
       
   692         putDependencyForExtensions :=
       
   693             [
       
   694                 |already|
       
   695 
       
   696                 s nextPutAll:'$(OUTDIR)extensions.$(O): extensions.st'.
       
   697 
       
   698                 already := Set new.
       
   699                 self extensionMethodNames pairWiseDo:[:className :selector |
       
   700                     |mthdCls cls|
       
   701 
       
   702                     ((mthdCls := Smalltalk classNamed:className) notNil and:[mthdCls isLoaded]) ifTrue:[
       
   703                         cls := mthdCls theNonMetaclass.
       
   704                         (already includes:cls) ifFalse:[
       
   705                             cls allSuperclassesDo:[:scls |
       
   706                                 (already includes:scls) ifFalse:[
       
   707                                     putSingleClassDependencyEntry value:scls.
       
   708                                     already add:scls.
       
   709                                 ].
       
   710                             ].
       
   711                         ].
       
   712                     ].
       
   713                 ].
       
   714 
       
   715                 s nextPutAll:' $(STCHDR)'.                 
       
   716                 s cr.
       
   717             ].
       
   718 
       
   719         classNames := self common_compiled_classNames.
       
   720         classesLoaded := classNames 
       
   721                     collect:[:className | |cls| cls := Smalltalk classNamed:className]
       
   722                     thenSelect:[:cls |  cls notNil and:[cls isLoaded] ].
       
   723 
       
   724         classesSorted := Class classesSortedByLoadOrder:classesLoaded.
       
   725         classesSorted do:putDependencyForClass.
       
   726 
       
   727         self namesAndAttributesIn:(self additionalClassNamesAndAttributes) do:[:className :attr |
       
   728             |cls|
       
   729 
       
   730             (attr isEmptyOrNil or:[(attr includes:#autoload) not]) ifTrue:[
       
   731                 ((cls := Smalltalk classNamed:className) notNil and:[cls isLoaded]) ifTrue:[
       
   732                     putDependencyForClass value:cls.
       
   733                 ]
       
   734             ].
       
   735         ].
       
   736 
       
   737         archClassNames := self compiled_classNamesForArchitecture:whichArchitecture.    
       
   738         archClassesLoaded := archClassNames 
       
   739                     collect:[:className | |cls| cls := Smalltalk classNamed:className]
       
   740                     thenSelect:[:cls |  cls notNil and:[cls isLoaded] ].
       
   741 
       
   742         archClassesLoaded notEmpty ifTrue:[
       
   743             (Class classesSortedByLoadOrder:archClassesLoaded) do:putDependencyForClass.
       
   744         ].
       
   745 
       
   746         self hasExtensions ifTrue:putDependencyForExtensions.
       
   747     ]
       
   748 
       
   749     "
       
   750      stx_libbasic3 generateDependencies:#unix
       
   751      stx_libbasic3 generateDependencies:#win32
       
   752     "
       
   753 
       
   754     "Modified: / 16-08-2006 / 18:52:10 / User"
       
   755     "Created: / 14-09-2006 / 12:38:57 / cg"
       
   756     "Modified: / 14-09-2006 / 17:04:21 / cg"
       
   757 !
       
   758 
       
   759 generateDependencies_unix
       
   760     ^ self generateDependencies:#unix
       
   761 
       
   762     "
       
   763      stx_libbasic3 generateDependencies:#unix
       
   764      stx_libbasic3 generateDependencies:#win32
       
   765     "
       
   766 
       
   767     "Modified: / 14-09-2006 / 13:32:34 / cg"
       
   768 !
       
   769 
       
   770 generateDependencies_win32
       
   771     ^ self generateDependencies:#win32
       
   772 
       
   773     "Created: / 14-09-2006 / 12:39:18 / cg"
       
   774 !
       
   775 
       
   776 generateExtensionLine_libInit_dot_cc
   632 generateExtensionLine_libInit_dot_cc
   777     |mappings|
   633     |mappings|
   778 
   634 
   779     ^self hasExtensions 
   635     ^self hasExtensions 
   780         ifFalse:['']
   636         ifFalse:['']
   811 
   667 
   812     "Created: / 09-08-2006 / 16:46:49 / fm"
   668     "Created: / 09-08-2006 / 16:46:49 / fm"
   813     "Modified: / 14-09-2006 / 15:38:16 / cg"
   669     "Modified: / 14-09-2006 / 15:38:16 / cg"
   814 !
   670 !
   815 
   671 
   816 generateLocalIncludes_win32
       
   817     ^ String streamContents:[:s |
       
   818         s nextPutAll:(self localIncludes_win32).
       
   819         self searchForProjectsWhichProvideHeaderFiles
       
   820             do:[:includeProject |
       
   821                 s nextPutAll:' -I$(INCLUDE_TOP)\',(self topRelativePathToPackage_win32: includeProject) 
       
   822             ]
       
   823     ]
       
   824 
       
   825     "
       
   826      bosch_dapasx_application generateLocalIncludes_win32
       
   827      bosch_dapasx_datenbasis generateLocalIncludes_win32  
       
   828      stx_libbasic generateLocalIncludes_win32              
       
   829      stx_libview generateLocalIncludes_win32               
       
   830      stx_libtool2 generateLocalIncludes_win32             
       
   831     "
       
   832 
       
   833     "Created: / 09-08-2006 / 16:46:49 / fm"
       
   834     "Modified: / 14-09-2006 / 15:37:35 / cg"
       
   835 !
       
   836 
       
   837 generateSubDirectories
   672 generateSubDirectories
   838     ^ String streamContents:[:s |
   673     ^ String streamContents:[:s |
   839         self subProjects 
   674         self subProjects 
   840             do:[:subProjectName |    
   675             do:[:projectID |    
   841                 s space; nextPutAll:subProjectName
   676                 s space; nextPutAll:projectID
   842             ]
   677             ]
   843     ]
   678     ]
   844 
   679 
   845     "
   680     "
   846      DapasXProject generateSubDirectories
   681      DapasXProject generateSubDirectories
   847      DapasX_Datenbasis generateSubDirectories
   682      DapasX_Datenbasis generateSubDirectories
   848     "
   683     "
   849 
   684 
   850     "Created: / 09-08-2006 / 11:26:59 / fm"
   685     "Created: / 09-08-2006 / 11:26:59 / fm"
   851     "Modified: / 18-08-2006 / 11:59:32 / cg"
   686     "Modified: / 14-09-2006 / 18:46:18 / cg"
   852 !
   687 !
   853 
   688 
   854 generateUnixLocalIncludes
   689 generateUnixLocalIncludes
   855     ^ String streamContents:[:s |
   690     ^ String streamContents:[:s |
   856         s nextPutAll:(self localIncludes_unix).
   691         s nextPutAll:(self localIncludes_unix).
   971 ! !
   806 ! !
   972 
   807 
   973 !LibraryDefinition class methodsFor:'documentation'!
   808 !LibraryDefinition class methodsFor:'documentation'!
   974 
   809 
   975 version
   810 version
   976     ^ '$Header: /cvs/stx/stx/libbasic/LibraryDefinition.st,v 1.63 2006-09-14 15:06:50 cg Exp $'
   811     ^ '$Header: /cvs/stx/stx/libbasic/LibraryDefinition.st,v 1.64 2006-09-14 17:07:26 cg Exp $'
   977 ! !
   812 ! !