ProjectBuilder.st
changeset 2683 ff39502be3a2
parent 2680 3f2dbbd7743f
child 2684 80fe0f753fd8
equal deleted inserted replaced
2682:54418b0e52fb 2683:ff39502be3a2
    68     ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
    68     ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
    69 !
    69 !
    70 
    70 
    71 projectDefinitionClass:something
    71 projectDefinitionClass:something
    72     projectDefinitionClass := something.
    72     projectDefinitionClass := something.
       
    73 !
       
    74 
       
    75 suffixForHeaderFiles
       
    76     ^ OperatingSystem isUNIXlike ifTrue:['.H'] ifFalse:['.STH']
    73 !
    77 !
    74 
    78 
    75 usedCompiler:something
    79 usedCompiler:something
    76     usedCompiler := something.
    80     usedCompiler := something.
    77 ! !
    81 ! !
   104                             makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
   108                             makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
   105                             makeOutput nextPut:char.
   109                             makeOutput nextPut:char.
   106                             makeOutput emphasis:nil.
   110                             makeOutput emphasis:nil.
   107                         ]
   111                         ]
   108                     ];
   112                     ];
   109                     nextPutAllBlock:[:char |
   113                     nextPutAllBlock:[:string |
   110                         lock critical:[
   114                         lock critical:[          (string includesString:'das Ziel' )ifTrue:[self halt].
   111                             makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
   115                             makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
   112                             makeOutput nextPutAll:char.
   116                             makeOutput nextPutAll:string.
   113                             makeOutput emphasis:nil.
   117                             makeOutput emphasis:nil.
   114                         ]
   118                         ]
   115                     ].
   119                     ].
   116     stdOut := ActorStream new
   120     stdOut := ActorStream new
   117                     nextPutBlock:[:char |
   121                     nextPutBlock:[:char |
   118                         lock critical:[
   122                         lock critical:[
   119                             makeOutput nextPut:char.
   123                             makeOutput nextPut:char.
   120                         ]
   124                         ]
   121                     ];
   125                     ];
   122                     nextPutAllBlock:[:char |
   126                     nextPutAllBlock:[:string |
   123                         lock critical:[
   127                         lock critical:[         (string includesString:'das Ziel' )ifTrue:[self halt].
   124                             makeOutput nextPutAll:char.
   128                             makeOutput nextPutAll:string.
   125                         ]
   129                         ]
   126                     ].
   130                     ].
   127 
   131 
   128     self buildWithOutputTo:stdOut errorTo:stdErr.
   132     self buildWithOutputTo:stdOut errorTo:stdErr.
   129 !
   133 !
   297         or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[
   301         or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[
   298             self activityNotification:'copying ',sourceFile pathName,'...'.
   302             self activityNotification:'copying ',sourceFile pathName,'...'.
   299             sourceFile copyTo:targetFile
   303             sourceFile copyTo:targetFile
   300         ].
   304         ].
   301     ].
   305     ].
       
   306 
       
   307     OperatingSystem isUNIXlike ifTrue:[
       
   308         (targetDir / 'stc') makeExecutableForAll    
       
   309     ].
       
   310 
   302     self activityNotification:nil
   311     self activityNotification:nil
   303 !
   312 !
   304 
   313 
   305 copyStartupFilesFromSmalltalk
   314 copyStartupFilesFromSmalltalk
   306     (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[
   315     (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[
   342                     'projects/smalltalk/stx_32x32.ico'
   351                     'projects/smalltalk/stx_32x32.ico'
   343                     'projects/smalltalk/stx_splash.bmp'
   352                     'projects/smalltalk/stx_splash.bmp'
   344                  ).
   353                  ).
   345     ] ifFalse:[
   354     ] ifFalse:[
   346         files := #(
   355         files := #(
   347                     'librun/genDate'
       
   348                     'librun/main.c'
   356                     'librun/main.c'
   349                     'librun/librun.so'
   357                     'librun/librun.so'
   350                 )
   358                 )
   351     ].
   359     ].
   352     files := files asOrderedCollection.
   360     files := files asOrderedCollection.
   425 #ifdef _HEADER_CLASSINST_
   433 #ifdef _HEADER_CLASSINST_
   426 %(ClassInstVarList)
   434 %(ClassInstVarList)
   427 #endif /* _HEADER_CLASSINST_ */
   435 #endif /* _HEADER_CLASSINST_ */
   428 '.
   436 '.
   429     newContents := template bindWithArguments:bindings.
   437     newContents := template bindWithArguments:bindings.
   430     file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),'.STH').
   438     file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),(self suffixForHeaderFiles)).
   431     (file exists not
   439     (file exists not
   432     or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[
   440     or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[
   433         file contents: newContents.
   441         file contents: newContents.
   434     ].
   442     ].
   435 !
   443 !
   576 
   584 
   577     makeCommand := ParserFlags makeCommand.
   585     makeCommand := ParserFlags makeCommand.
   578     usedCompiler = 'vc' ifTrue:[ makeCommand := 'vcmake'. compilerFlag := 'USEVC=1' ].
   586     usedCompiler = 'vc' ifTrue:[ makeCommand := 'vcmake'. compilerFlag := 'USEVC=1' ].
   579     usedCompiler = 'lcc' ifTrue:[ makeCommand := 'lcmake'. compilerFlag := 'USELCC=1' ].
   587     usedCompiler = 'lcc' ifTrue:[ makeCommand := 'lcmake'. compilerFlag := 'USELCC=1' ].
   580     usedCompiler = 'gcc' ifTrue:[ makeCommand := 'make'. ].
   588     usedCompiler = 'gcc' ifTrue:[ makeCommand := 'make'. ].
       
   589 
       
   590     OperatingSystem isUNIXlike ifTrue:[
       
   591         OperatingSystem
       
   592             executeCommand:'sh ../../stx/rules/stmkmf'
       
   593             inputFrom:nil
       
   594             outputTo:stdOut
       
   595             errorTo:stdErr
       
   596             inDirectory:(buildDirectory / module / directory)
       
   597             onError:[:status| self error:'make failed'].
       
   598     ].
   581 
   599 
   582     projectDefinitionClass isLibraryDefinition ifTrue:[
   600     projectDefinitionClass isLibraryDefinition ifTrue:[
   583         OperatingSystem
   601         OperatingSystem
   584             executeCommand:(makeCommand,' classLibRule')
   602             executeCommand:(makeCommand,' classLibRule')
   585             inputFrom:nil
   603             inputFrom:nil
   606                 onError:[:status| self error:'make failed'].
   624                 onError:[:status| self error:'make failed'].
   607         ]
   625         ]
   608     ]
   626     ]
   609 !
   627 !
   610 
   628 
       
   629 recursiveCopyDirectoryForBuild:subdir
       
   630     |targetDir|
       
   631 
       
   632     targetDir := buildDirectory / 'stx' / subdir.
       
   633     targetDir exists ifFalse:[
       
   634         targetDir makeDirectory.
       
   635     ].
       
   636     (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile |
       
   637         eachFile recursiveCopyTo:(targetDir construct:eachFile baseName)
       
   638     ].
       
   639     self activityNotification:nil
       
   640 !
       
   641 
   611 setupBuildDirectory
   642 setupBuildDirectory
   612     buildDirectory exists ifFalse:[
   643     buildDirectory exists ifFalse:[
   613         buildDirectory recursiveMakeDirectory.
   644         buildDirectory recursiveMakeDirectory.
   614     ].
   645     ].
   615     (buildDirectory / 'stx') exists ifFalse:[
   646     (buildDirectory / 'stx') exists ifFalse:[
   616         (buildDirectory / 'stx') makeDirectory.
   647         (buildDirectory / 'stx') makeDirectory.
   617     ].
   648     ].
   618 
   649 
   619     self copyDirectoryForBuild:'include'.
   650     self copyDirectoryForBuild:'include'.
   620     self copyDirectoryForBuild:'rules'.
   651     self copyDirectoryForBuild:'rules'.
       
   652     OperatingSystem isUNIXlike ifTrue:[
       
   653         self recursiveCopyDirectoryForBuild:'configurations'.
       
   654     ]
   621 !
   655 !
   622 
   656 
   623 validateBuildDirectoryIsPresent
   657 validateBuildDirectoryIsPresent
   624 
   658 
   625     ^ self.
   659     ^ self.