ProjectBuilder.st
author Claus Gittinger <cg@exept.de>
Thu, 06 Sep 2012 20:59:03 +0200
changeset 2921 bea9c6bb6a90
parent 2918 47d5c20da62d
child 2958 d842f4a91d44
permissions -rw-r--r--
class definition
added: #cancelButtonVisible
changed:
#postBuildWith:
#windowSpec
cg@2741
     1
"
cg@2741
     2
 COPYRIGHT (c) 2009 by eXept Software AG
cg@2741
     3
              All Rights Reserved
cg@2741
     4
cg@2741
     5
 This software is furnished under a license and may be used
cg@2741
     6
 only in accordance with the terms of that license and with the
cg@2741
     7
 inclusion of the above copyright notice.   This software may not
cg@2741
     8
 be provided or otherwise made available to, or used by, any
cg@2741
     9
 other person.  No title to or ownership of the software is
cg@2741
    10
 hereby transferred.
cg@2741
    11
"
cg@2596
    12
"{ Package: 'stx:libtool2' }"
cg@2596
    13
cg@2635
    14
"{ NameSpace: Tools }"
cg@2635
    15
cg@2596
    16
Object subclass:#ProjectBuilder
cg@2596
    17
	instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory
cg@2673
    18
		myWorkingDirectory mySTXTopDirectory myTopDirectory outputStream
cg@2921
    19
		makeExeOnly usedCompiler stdOut stdErr'
cg@2596
    20
	classVariableNames:'PreviousBuildDirectory'
cg@2596
    21
	poolDictionaries:''
cg@2596
    22
	category:'System-Support-Projects'
cg@2596
    23
!
cg@2596
    24
cg@2741
    25
!ProjectBuilder class methodsFor:'documentation'!
cg@2741
    26
cg@2741
    27
copyright
cg@2741
    28
"
cg@2741
    29
 COPYRIGHT (c) 2009 by eXept Software AG
cg@2741
    30
              All Rights Reserved
cg@2741
    31
cg@2741
    32
 This software is furnished under a license and may be used
cg@2741
    33
 only in accordance with the terms of that license and with the
cg@2741
    34
 inclusion of the above copyright notice.   This software may not
cg@2741
    35
 be provided or otherwise made available to, or used by, any
cg@2741
    36
 other person.  No title to or ownership of the software is
cg@2741
    37
 hereby transferred.
cg@2741
    38
"
cg@2741
    39
! !
cg@2596
    40
cg@2633
    41
!ProjectBuilder class methodsFor:'accessing'!
cg@2633
    42
cg@2633
    43
previousBuildDirectory
cg@2633
    44
    ^ PreviousBuildDirectory
cg@2633
    45
!
cg@2633
    46
cg@2633
    47
previousBuildDirectory:something
cg@2633
    48
    PreviousBuildDirectory := something.
cg@2633
    49
! !
cg@2633
    50
cg@2596
    51
!ProjectBuilder class methodsFor:'examples'!
cg@2596
    52
cg@2644
    53
example1
cg@2644
    54
    Smalltalk loadPackage:'stx:projects/helloWorldApp' asAutoloaded:true.
cg@2644
    55
cg@2644
    56
    self new
cg@2644
    57
        package:'stx:projects/helloWorldApp';
cg@2644
    58
        build
cg@2622
    59
!
cg@2622
    60
cg@2644
    61
example2
cg@2644
    62
    |builder|
cg@2644
    63
cg@2644
    64
    Smalltalk loadPackage:'stx:clients/Demos/foxCalcApplication' asAutoloaded:true.
cg@2644
    65
cg@2644
    66
    builder := self new.
cg@2909
    67
    builder 
cg@2909
    68
        package:'stx:clients/Demos/foxCalcApplication';
cg@2909
    69
        build.
cg@2644
    70
cg@2644
    71
    UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
cg@2909
    72
cg@2909
    73
    "Modified: / 03-09-2012 / 19:23:53 / cg"
cg@2596
    74
! !
cg@2596
    75
cg@2873
    76
!ProjectBuilder class methodsFor:'queries'!
cg@2873
    77
cg@2873
    78
defaultUsedCompiler
cg@2873
    79
    |compiler|
cg@2873
    80
cg@2873
    81
    (compiler := UserPreferences current usedCompilerForBuild) notNil ifTrue:[
cg@2873
    82
        ^ compiler
cg@2873
    83
    ].
cg@2873
    84
cg@2921
    85
    ^ OperatingSystem isMSWINDOWSlike 
cg@2921
    86
        ifTrue:[ 'bcc' ]
cg@2921
    87
        ifFalse:[ 'gcc' ]
cg@2873
    88
cg@2873
    89
    "Created: / 21-01-2012 / 14:06:51 / cg"
cg@2873
    90
!
cg@2873
    91
cg@2873
    92
listOfPossibleCompilers
cg@2873
    93
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2918
    94
        OperatingSystem getLoginName = 'cg' ifTrue:[
cg@2921
    95
            ^ #(
cg@2921
    96
                'bcc'   "/ OK
cg@2921
    97
                'vc'    "/ almost OK
cg@2921
    98
                'lcc'   "/ experimental, but only free for non-commercial work
cg@2921
    99
                'tcc'   "/ experimental; limited but free
cg@2921
   100
                'mingw' "/ experimental; free
cg@2921
   101
             )
cg@2918
   102
        ].
cg@2921
   103
        ^ #('bcc' 'vc' "'lcc' 'mingw'" )
cg@2873
   104
    ].
cg@2873
   105
    ^ #('gcc')
cg@2873
   106
cg@2873
   107
    "Created: / 21-01-2012 / 14:04:15 / cg"
cg@2921
   108
!
cg@2921
   109
cg@2921
   110
suiteNameOfCompiler:usedCompiler
cg@2921
   111
    usedCompiler = 'bcc' ifTrue:[
cg@2921
   112
        ^ 'Borland C-Compiler'.
cg@2921
   113
    ].
cg@2921
   114
    usedCompiler = 'vc' ifTrue:[
cg@2921
   115
        ^ 'Microsoft Visual C C-Compiler'.
cg@2921
   116
    ].
cg@2921
   117
    usedCompiler = 'lcc' ifTrue:[
cg@2921
   118
        ^ 'LCC C-Compiler'.
cg@2921
   119
    ].
cg@2921
   120
    usedCompiler = 'tcc' ifTrue:[
cg@2921
   121
        ^ 'Tiny C-Compiler'.
cg@2921
   122
    ].
cg@2921
   123
    usedCompiler = 'gcc' ifTrue:[
cg@2921
   124
        ^ 'GNU C-Compiler'.
cg@2921
   125
    ].
cg@2921
   126
    usedCompiler = 'mingw' ifTrue:[
cg@2921
   127
        ^ 'MINGW GNU C-Compiler'.
cg@2921
   128
    ].
cg@2921
   129
    self halt:'unknown compiler'.
cg@2921
   130
cg@2921
   131
    ^ 'C-Compiler'.
cg@2921
   132
cg@2921
   133
    "Created: / 06-09-2012 / 15:58:33 / cg"
cg@2873
   134
! !
cg@2873
   135
cg@2596
   136
!ProjectBuilder methodsFor:'accessing'!
cg@2596
   137
cg@2644
   138
buildDirectory
cg@2644
   139
    ^ buildDirectory
cg@2622
   140
!
cg@2622
   141
cg@2634
   142
buildDirectory:something
cg@2634
   143
    buildDirectory := something.
cg@2634
   144
!
cg@2634
   145
cg@2673
   146
makeExeOnly:aBoolean
cg@2673
   147
    makeExeOnly := aBoolean.
cg@2673
   148
!
cg@2673
   149
cg@2644
   150
package:aPackageIDOrSymbol
cg@2644
   151
    package := aPackageIDOrSymbol asPackageId.
cg@2596
   152
!
cg@2596
   153
cg@2644
   154
packageBuildDirectory
cg@2644
   155
    "the directoray, where the deployable binary is created (xxxSetup.exe)"
cg@2622
   156
cg@2622
   157
    ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
cg@2635
   158
!
cg@2635
   159
cg@2644
   160
projectDefinitionClass:something
cg@2644
   161
    projectDefinitionClass := something.
cg@2680
   162
!
cg@2680
   163
sr@2683
   164
suffixForHeaderFiles
sr@2683
   165
    ^ OperatingSystem isUNIXlike ifTrue:['.H'] ifFalse:['.STH']
sr@2683
   166
!
sr@2683
   167
cg@2873
   168
usedCompilerForBuild:something
cg@2680
   169
    usedCompiler := something.
cg@2873
   170
cg@2873
   171
    "Created: / 22-01-2012 / 10:50:48 / cg"
cg@2596
   172
! !
cg@2596
   173
cg@2596
   174
!ProjectBuilder methodsFor:'building'!
cg@2596
   175
cg@2644
   176
build
cg@2644
   177
    "/ intermediate - this will move into a commonly used utility class
cg@2635
   178
    "/ (where all the project code support will be collected).
cg@2635
   179
cg@2647
   180
    |makeOutput|
cg@2647
   181
cg@2647
   182
    makeOutput := TextStream on:(Text new:10000).
cg@2647
   183
    self buildWithColorizedOutputTo:makeOutput.
cg@2647
   184
cg@2647
   185
    TextView openWith:makeOutput contents.
cg@2647
   186
!
cg@2647
   187
cg@2647
   188
buildWithColorizedOutputTo:makeOutput
cg@2647
   189
    "/ intermediate - this will move into a commonly used utility class
cg@2647
   190
    "/ (where all the project code support will be collected).
cg@2647
   191
cg@2921
   192
    |lock|
cg@2635
   193
cg@2644
   194
    lock := Semaphore forMutualExclusion.
cg@2647
   195
cg@2644
   196
    stdErr := ActorStream new
cg@2644
   197
                    nextPutBlock:[:char |
cg@2644
   198
                        lock critical:[
cg@2921
   199
                            makeOutput 
cg@2921
   200
                                withEmphasis:{#backgroundColor->Color red. #color->Color white.}
cg@2921
   201
                                do:[makeOutput nextPut:char].
cg@2644
   202
                        ]
cg@2644
   203
                    ];
sr@2683
   204
                    nextPutAllBlock:[:string |
cg@2873
   205
                        lock critical:[          
cg@2873
   206
                            "/ (string includesString:'das Ziel' )ifTrue:[self halt].
cg@2921
   207
                            makeOutput
cg@2921
   208
                                withEmphasis:{#backgroundColor->Color red. #color->Color white.}
cg@2921
   209
                                do:[makeOutput nextPutAll:string].
cg@2644
   210
                        ]
cg@2644
   211
                    ].
cg@2644
   212
    stdOut := ActorStream new
cg@2644
   213
                    nextPutBlock:[:char |
cg@2644
   214
                        lock critical:[
cg@2644
   215
                            makeOutput nextPut:char.
cg@2644
   216
                        ]
cg@2644
   217
                    ];
sr@2683
   218
                    nextPutAllBlock:[:string |
cg@2873
   219
                        lock critical:[         
cg@2873
   220
                            "/ (string includesString:'das Ziel' )ifTrue:[self halt].
sr@2683
   221
                            makeOutput nextPutAll:string.
cg@2644
   222
                        ]
cg@2644
   223
                    ].
cg@2635
   224
cg@2644
   225
    self buildWithOutputTo:stdOut errorTo:stdErr.
cg@2873
   226
cg@2921
   227
    "Modified: / 06-09-2012 / 16:15:50 / cg"
cg@2611
   228
!
cg@2611
   229
cg@2611
   230
buildWithOutputTo:stdOut errorTo:stdErr
cg@2611
   231
    "/ intermediate - this will move into a commonly used utility class
cg@2611
   232
    "/ (where all the project code support will be collected).
cg@2611
   233
cg@2596
   234
    |module directory|
cg@2596
   235
cg@2596
   236
    projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
cg@2596
   237
    projectDefinitionClass isNil ifTrue:[
cg@2596
   238
        self error:('Missing ProjectDefinition class for "',package asString,'"')
cg@2596
   239
    ].
cg@2596
   240
cg@2596
   241
    "/ ensure that everything is loaded...
cg@2596
   242
    projectDefinitionClass loadAsAutoloaded:false.
cg@2596
   243
    projectDefinitionClass loadExtensions.
cg@2596
   244
    projectDefinitionClass loadAllClassesAsAutoloaded:false.
cg@2596
   245
cg@2596
   246
    module := package module.
cg@2596
   247
    directory := package directory.
cg@2596
   248
cg@2596
   249
    buildDirectory isNil ifTrue:[
cg@2634
   250
        buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
cg@2634
   251
        buildDirectory isNil ifTrue:[
cg@2634
   252
            buildDirectory := Filename tempDirectory construct:'stx_build'.
cg@2634
   253
        ].
cg@2596
   254
    ].
cg@2596
   255
    buildDirectory := buildDirectory asFilename.
cg@2596
   256
cg@2596
   257
    "/ self validateBuildDirectoryIsPresent.
cg@2596
   258
cg@2596
   259
    PreviousBuildDirectory := buildDirectory.
cg@2596
   260
cg@2596
   261
    "/ UserPreferences current localBuild:true
cg@2596
   262
    UserPreferences current localBuild ifFalse:[
cg@2596
   263
        SourceCodeManager notNil ifTrue:[
sv@2861
   264
            sourceCodeManager := SourceCodeManagerUtilities default sourceCodeManagerFor:projectDefinitionClass.
cg@2596
   265
        ]
cg@2596
   266
    ].
cg@2596
   267
    sourceCodeManager := nil.
cg@2596
   268
cg@2598
   269
    myTopDirectory := 
cg@2596
   270
        Smalltalk packagePath 
cg@2596
   271
            detect:[:aPath |
cg@2596
   272
                (aPath asFilename / 'stx' / 'include') exists
cg@2596
   273
                and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
cg@2596
   274
            ifNone:nil.       
cg@2598
   275
    myTopDirectory isNil ifTrue:[
cg@2598
   276
        self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
cg@2596
   277
    ].
cg@2598
   278
    myTopDirectory := myTopDirectory asFilename.
cg@2598
   279
    mySTXTopDirectory := myTopDirectory / 'stx'.
cg@2613
   280
cg@2596
   281
    self setupBuildDirectory.
cg@2628
   282
    self activityNotification:'Generating stc directory...'.
cg@2599
   283
    self copySTCDirectoryForBuild.
cg@2628
   284
    self activityNotification:'Generating source files...'.
cg@2596
   285
    self generateSourceFiles.
cg@2672
   286
    self activityNotification:'Copying dlls for linkage...'.
cg@2600
   287
    self copyDLLsForLinkage.
cg@2912
   288
    self activityNotification:'Copying support files for compilation and linkage...'.
cg@2912
   289
    self copySupportFilesForCompilation.
cg@2600
   290
    self copySupportFilesForLinkage.
cg@2600
   291
    self copyStartupFilesFromSmalltalk.
cg@2596
   292
cg@2628
   293
    self activityNotification:'Executing make...'.
cg@2611
   294
    self makeWithOutputTo:stdOut errorTo:stdErr.
cg@2912
   295
cg@2912
   296
    "Modified: / 04-09-2012 / 00:49:52 / cg"
cg@2898
   297
! !
cg@2898
   298
cg@2898
   299
!ProjectBuilder methodsFor:'building/private'!
cg@2596
   300
cg@2644
   301
copyDLLsForLinkage
cg@2911
   302
    |targetBuildDir preRequisites dllRelativeSourcePathes dllRelativeDestPathes|
sv@2723
   303
cg@2644
   304
    targetBuildDir := buildDirectory / package module / package directory.
cg@2644
   305
sv@2723
   306
    preRequisites := projectDefinitionClass allPreRequisites.
sv@2723
   307
    OperatingSystem isUNIXlike ifTrue:[
sv@2723
   308
        "For now: unix Makefiles require some libs implicitely..."
sv@2723
   309
        preRequisites := preRequisites union:#(
sv@2723
   310
                               'stx:goodies/refactoryBrowser/parser'
sv@2723
   311
                               'stx:libtool'
sv@2723
   312
                            ).
sv@2723
   313
    ].
sv@2723
   314
sv@2723
   315
    preRequisites do:[:eachPackageToFileout |
cg@2644
   316
        |packageId packageDef packageModule packageDirectory packageTargetDir
cg@2911
   317
         dllSource dllSourceDir libraryName dllRelativePathSource 
cg@2916
   318
         dllRelativePathDest objDirSource objDirDest alternativeObjDirSource|
cg@2644
   319
cg@2644
   320
        packageId := eachPackageToFileout asPackageId.
cg@2644
   321
        packageModule := packageId module.
cg@2644
   322
        packageDirectory := packageId directory.
cg@2644
   323
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2644
   324
cg@2644
   325
        packageDef := packageId projectDefinitionClass.
cg@2644
   326
        libraryName := packageDef libraryName.
cg@2644
   327
cg@2644
   328
        "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
cg@2644
   329
        dllSourceDir := myTopDirectory / packageModule / packageDirectory.
cg@2909
   330
cg@2644
   331
        OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2911
   332
            objDirDest := self objDirForUsedCompiler:usedCompiler.
cg@2916
   333
            objDirSource := objDirDest.
cg@2916
   334
"/            "/ use visual-c files for tcc linkage
cg@2916
   335
"/            usedCompiler = 'tcc' ifTrue:[
cg@2916
   336
"/                objDirSource := self objDirForUsedCompiler:'vc'.
cg@2916
   337
"/            ] ifFalse:[
cg@2916
   338
"/                objDirSource := objDirDest
cg@2916
   339
"/            ].
cg@2916
   340
            (dllSourceDir / objDirSource / (libraryName, '.dll')) exists ifFalse:[
cg@2916
   341
                alternativeObjDirSource := self objDirForUsedCompiler:'vc'.
cg@2916
   342
                (dllSourceDir / alternativeObjDirSource / (libraryName, '.dll')) exists ifTrue:[
cg@2921
   343
                    objDirSource := alternativeObjDirSource.
cg@2921
   344
                    stdErr nextPutLine:(('Warning: using alternative %1 from %2 (%3 version)...' 
cg@2921
   345
                                                bindWith:libraryName 
cg@2921
   346
                                                with:alternativeObjDirSource 
cg@2921
   347
                                                with:(self class suiteNameOfCompiler:'vc'))
cg@2921
   348
                                            emphasizeAllWith:(#color -> Color red darkened)).
cg@2921
   349
                ] ifFalse:[
cg@2921
   350
                    alternativeObjDirSource := self objDirForUsedCompiler:'bcc'.
cg@2921
   351
                    (dllSourceDir / alternativeObjDirSource / (libraryName, '.dll')) exists ifTrue:[
cg@2921
   352
                        objDirSource := alternativeObjDirSource.
cg@2921
   353
                        stdErr nextPutLine:('Warning: using alternative %1 from %2 (%3 version)...' 
cg@2921
   354
                                    bindWith:libraryName 
cg@2921
   355
                                    with:alternativeObjDirSource 
cg@2921
   356
                                    with:(self class suiteNameOfCompiler:'bcc')).
cg@2921
   357
                    ]
cg@2921
   358
                ].
cg@2911
   359
            ].
cg@2916
   360
cg@2905
   361
"/            dllRelativePath := objDir,'/',(libraryName,'.dll').
cg@2644
   362
"/            (dllSourceDir / dllRelativePath) exists 
cg@2911
   363
            dllRelativeSourcePathes := Array with:(objDirSource,'\', libraryName, '.dll').
cg@2911
   364
            dllRelativeDestPathes := Array with:(objDirDest,'\', libraryName, '.dll').
cg@2644
   365
        ] ifFalse:[
cg@2911
   366
            dllRelativeSourcePathes := Array with:(libraryName,'.so').
sv@2723
   367
            (packageModule = 'stx' and:[packageDirectory = 'libview']) ifTrue:[
cg@2911
   368
                dllRelativeSourcePathes := dllRelativeSourcePathes, #('XWorkstation.so' 'GLXWorkstation.so').
sv@2723
   369
            ].
cg@2644
   370
        ].
cg@2911
   371
        dllRelativeSourcePathes with:dllRelativeDestPathes do:[:dllRelativeSourcePath :dllRelativeDestPath|
cg@2896
   372
            |source dest|
cg@2896
   373
cg@2911
   374
            source := dllSourceDir / dllRelativeSourcePath.
cg@2911
   375
            dest := packageTargetDir / dllRelativeDestPath.
cg@2896
   376
            (dest exists not
cg@2896
   377
             or:[source fileSize ~= dest fileSize
cg@2896
   378
             or:[source modificationTime >= dest modificationTime
sv@2723
   379
             "/ or:[ ((dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath)) not ]
sv@2723
   380
            ]]) ifTrue:[
cg@2911
   381
                Transcript showCR:'updating ',dllRelativeDestPath.
cg@2896
   382
                dest directory recursiveMakeDirectory.
cg@2896
   383
                source copyTo:dest.    
sv@2723
   384
            ].
sv@2723
   385
        ].
cg@2614
   386
    ].
cg@2896
   387
cg@2921
   388
    "Modified: / 06-09-2012 / 16:19:29 / cg"
cg@2600
   389
!
cg@2600
   390
cg@2644
   391
copyDirectory:relativepath
cg@2644
   392
    "/ need rules in stx
cg@2644
   393
    ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
cg@2644
   394
        recursiveCopyTo:(buildDirectory construct:'stx').
cg@2596
   395
!
cg@2596
   396
cg@2644
   397
copyDirectoryForBuild:subdir
cg@2644
   398
    |targetDir targetFile|
cg@2644
   399
cg@2644
   400
    targetDir := buildDirectory / 'stx' / subdir.
cg@2644
   401
    targetDir exists ifFalse:[
cg@2644
   402
        targetDir makeDirectory.
cg@2644
   403
    ].
cg@2644
   404
    (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile |
cg@2644
   405
        eachFile isDirectory ifFalse:[
cg@2644
   406
            targetFile := targetDir / eachFile baseName.
cg@2644
   407
            (targetFile exists not
cg@2644
   408
            or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[
cg@2644
   409
                self activityNotification:'copying ',eachFile pathName,'...'.
cg@2644
   410
                eachFile copyTo:(targetDir construct:eachFile baseName)
cg@2644
   411
            ]
cg@2644
   412
        ].
cg@2644
   413
    ].
cg@2644
   414
    self activityNotification:nil
cg@2598
   415
!
cg@2598
   416
cg@2644
   417
copyResourcesForPackage:aPackage
cg@2644
   418
    |module directory|
cg@2644
   419
cg@2644
   420
    module := aPackage asPackageId module.
cg@2644
   421
    directory := aPackage asPackageId directory.
cg@2644
   422
cg@2644
   423
    (myTopDirectory / module / directory / 'resources' ) exists ifTrue:[
cg@2644
   424
        (myTopDirectory / module / directory / 'resources' )
cg@2644
   425
            recursiveCopyTo:(buildDirectory / module / directory)
cg@2644
   426
    ].
cg@2644
   427
    (myTopDirectory / module / directory / 'styles' ) exists ifTrue:[
cg@2644
   428
        (myTopDirectory / module / directory / 'styles' )
cg@2644
   429
            recursiveCopyTo:(buildDirectory / module / directory)
cg@2644
   430
    ].
cg@2600
   431
!
cg@2600
   432
cg@2644
   433
copySTCDirectoryForBuild
cg@2912
   434
    "copy stc files to the build directory"
cg@2912
   435
cg@2644
   436
    |targetDir stc files|
cg@2644
   437
cg@2644
   438
    targetDir := buildDirectory / 'stx' / 'stc'.
cg@2644
   439
    targetDir exists ifFalse:[ targetDir makeDirectory ].
cg@2644
   440
cg@2644
   441
    stc := OperatingSystem isMSWINDOWSlike 
cg@2644
   442
                ifTrue:[ 'stc.exe' ]
cg@2644
   443
                ifFalse:[ 'stc' ].
cg@2644
   444
cg@2644
   445
    files := #( ) copyWith:stc.
cg@2644
   446
cg@2644
   447
    files do:[:eachFile |
cg@2644
   448
        |sourceFile targetFile|
cg@2644
   449
cg@2644
   450
        sourceFile := mySTXTopDirectory / 'stc' / eachFile.
cg@2644
   451
        targetFile := targetDir / eachFile.
cg@2644
   452
        (targetFile exists not
cg@2644
   453
        or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[
cg@2644
   454
            self activityNotification:'copying ',sourceFile pathName,'...'.
cg@2644
   455
            sourceFile copyTo:targetFile
cg@2644
   456
        ].
cg@2644
   457
    ].
sr@2683
   458
sr@2683
   459
    OperatingSystem isUNIXlike ifTrue:[
sr@2683
   460
        (targetDir / 'stc') makeExecutableForAll    
sr@2683
   461
    ].
sr@2683
   462
cg@2644
   463
    self activityNotification:nil
cg@2912
   464
cg@2912
   465
    "Modified (comment): / 04-09-2012 / 00:49:19 / cg"
cg@2599
   466
!
cg@2599
   467
cg@2644
   468
copyStartupFilesFromSmalltalk
cg@2912
   469
    "copy additional smalltalk startup files to the build directory"
cg@2912
   470
cg@2644
   471
    (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[
cg@2644
   472
        (buildDirectory / 'stx' / 'projects/smalltalk' ) recursiveMakeDirectory.
cg@2644
   473
    ].
cg@2644
   474
cg@2678
   475
    #( 
cg@2678
   476
        'keyboard.rc' 
cg@2678
   477
        'keyboardMacros.rc' 
cg@2678
   478
        'display.rc' 
cg@2678
   479
        'd_win32.rc'
cg@2678
   480
        'host.rc' 
cg@2678
   481
        'h_win32.rc'  
cg@2678
   482
        'smalltalk.rc'  
cg@2678
   483
        'private.rc'  
cg@2644
   484
    ) do:[:fn |
cg@2644
   485
        (myTopDirectory / 'stx' / 'projects/smalltalk' / fn)
cg@2644
   486
            copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn)
cg@2678
   487
    ].
cg@2678
   488
cg@2678
   489
    (myTopDirectory / 'stx' / 'doc/online/english/LICENCE_STX.html')
cg@2678
   490
            copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / 'LICENCE_STX.html').
cg@2912
   491
cg@2912
   492
    "Modified (comment): / 04-09-2012 / 00:48:47 / cg"
cg@2912
   493
!
cg@2912
   494
cg@2912
   495
copySupportFilesForCompilation
cg@2912
   496
    "copy the tcc compiler to the build directory"
cg@2912
   497
cg@2912
   498
    |files|
cg@2912
   499
cg@2912
   500
    files := #().
cg@2912
   501
cg@2912
   502
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2912
   503
        usedCompiler = 'tcc' ifTrue:[
cg@2912
   504
            files := files , #( 
cg@2912
   505
                        'support/tcc'
cg@2912
   506
                    ).
cg@2912
   507
        ].
cg@2912
   508
    ] ifFalse:[
cg@2912
   509
        files := files , #(
cg@2912
   510
                )
cg@2912
   511
    ].
cg@2912
   512
    files := files asOrderedCollection.
cg@2912
   513
cg@2912
   514
    files do:[:relativePath |
cg@2912
   515
        (mySTXTopDirectory / relativePath) exists ifTrue:[
cg@2912
   516
            ((buildDirectory / 'stx' / relativePath) exists
cg@2912
   517
            and:[ (mySTXTopDirectory / relativePath) fileSize = (buildDirectory / 'stx' / relativePath) fileSize
cg@2912
   518
            and:[ (mySTXTopDirectory / relativePath) modificationTime < (buildDirectory / 'stx' / relativePath) modificationTime
cg@2912
   519
            "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ]
cg@2912
   520
            ]]) ifFalse:[
cg@2912
   521
                (mySTXTopDirectory / relativePath) recursiveCopyTo:(buildDirectory / 'stx' / relativePath).    
cg@2912
   522
            ]
cg@2912
   523
        ] ifFalse:[
cg@2912
   524
            self error:'Missing directory: ',relativePath printString mayProceed:true.
cg@2912
   525
        ].
cg@2912
   526
    ].
cg@2912
   527
cg@2912
   528
    "Created: / 04-09-2012 / 00:47:49 / cg"
cg@2600
   529
!
cg@2600
   530
cg@2644
   531
copySupportFilesForLinkage
cg@2912
   532
    "copy additional files which are req'd for linkage to the build directory"
cg@2912
   533
cg@2644
   534
    |files|
cg@2644
   535
cg@2644
   536
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2644
   537
        files := #( 
cg@2644
   538
                    'librun/genDate.exe'
cg@2644
   539
                    'librun/main.c'
cg@2673
   540
                    'projects/smalltalk/stx_16x16.ico'
cg@2673
   541
                    'projects/smalltalk/stx_32x32.ico'
cg@2673
   542
                    'projects/smalltalk/stx_splash.bmp'
cg@2644
   543
                 ).
cg@2905
   544
cg@2905
   545
        usedCompiler = 'bcc' ifTrue:[
cg@2905
   546
            files := files , #( 
cg@2905
   547
                        'librun/objbc/librun.dll'
cg@2905
   548
                        'support/win32/borland/cs3245.dll' 
cg@2905
   549
                        'support/win32/X11.dll'
cg@2905
   550
                        'support/win32/Xext.dll'
cg@2916
   551
                        'lib/bc/librun.lib'
cg@2916
   552
                        'lib/bc/cs32i.lib'
cg@2905
   553
                    ).
cg@2905
   554
        ].
cg@2905
   555
        usedCompiler = 'vc' ifTrue:[
cg@2905
   556
            files := files , #( 
cg@2905
   557
                        'librun/objvc/librun.dll'
cg@2916
   558
                        'lib/vc/librun.lib'
cg@2905
   559
                    ).
cg@2905
   560
        ].
cg@2911
   561
        usedCompiler = 'tcc' ifTrue:[
cg@2911
   562
            files := files , #( 
cg@2916
   563
                        'librun/objvc/librun.dll'   "/ linkage is against vc version!!
cg@2916
   564
                        'lib/vc/librun.lib'
cg@2916
   565
                    ).
cg@2916
   566
        ].
cg@2916
   567
        usedCompiler = 'lcc' ifTrue:[
cg@2916
   568
            files := files , #( 
cg@2916
   569
                        'librun/objvc/librun.dll'   "/ linkage is against vc version!!
cg@2916
   570
                        'lib/vc/librun.lib'
cg@2911
   571
                    ).
cg@2911
   572
        ].
cg@2918
   573
        usedCompiler = 'mingw' ifTrue:[
cg@2918
   574
            files := files , #( 
cg@2918
   575
                        'librun/objvc/librun.dll'   "/ linkage is against vc version!!
cg@2918
   576
                        'lib/vc/librun.lib'
cg@2918
   577
                    ).
cg@2918
   578
        ].
cg@2644
   579
    ] ifFalse:[
cg@2644
   580
        files := #(
cg@2644
   581
                    'librun/main.c'
cg@2644
   582
                    'librun/librun.so'
cg@2644
   583
                )
cg@2644
   584
    ].
cg@2677
   585
    files := files asOrderedCollection.
cg@2677
   586
cg@2677
   587
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2677
   588
        projectDefinitionClass applicationIconFileName notNil ifTrue:[
cg@2678
   589
            files add:('projects/smalltalk/',projectDefinitionClass applicationIconFileName,'.ico')
cg@2678
   590
        ].
cg@2678
   591
        projectDefinitionClass splashFileName notNil ifTrue:[
cg@2678
   592
            files add:('projects/smalltalk/',projectDefinitionClass splashFileName,'.bmp')
cg@2678
   593
        ].
cg@2677
   594
    ].
cg@2644
   595
cg@2914
   596
    files do:[:relativePath |
cg@2914
   597
        (mySTXTopDirectory / relativePath) exists ifTrue:[
cg@2914
   598
            ((buildDirectory / 'stx' / relativePath) exists
cg@2914
   599
            and:[ (mySTXTopDirectory / relativePath) fileSize = (buildDirectory / 'stx' / relativePath) fileSize
cg@2914
   600
            and:[ (mySTXTopDirectory / relativePath) modificationTime < (buildDirectory / 'stx' / relativePath) modificationTime
sr@2684
   601
            "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ]
sr@2684
   602
            ]]) ifFalse:[
cg@2914
   603
                (buildDirectory / 'stx' / relativePath) directory recursiveMakeDirectory.
cg@2914
   604
                (mySTXTopDirectory / relativePath) copyTo:(buildDirectory / 'stx' / relativePath).    
sr@2684
   605
            ]
sr@2684
   606
        ] ifFalse:[
cg@2914
   607
            self error:'Missing file: ',relativePath printString mayProceed:true.
sr@2684
   608
        ].
cg@2644
   609
    ].
cg@2873
   610
cg@2918
   611
    "Modified: / 05-09-2012 / 16:26:25 / cg"
cg@2600
   612
!
cg@2600
   613
cg@2644
   614
createHeaderFileFor:aClass in:packageTargetDir
cg@2644
   615
    |instVarList classInstVarList classVarList bindings superclassFilename
cg@2644
   616
     template file newContents oldContents|
cg@2644
   617
cg@2644
   618
    instVarList := StringCollection new.
cg@2644
   619
    aClass instVarNames do:[:v |
cg@2644
   620
        instVarList add:('OBJ %1;' bindWith:v)
cg@2644
   621
    ].
cg@2644
   622
    classInstVarList := StringCollection new.
cg@2644
   623
    aClass class instVarNames do:[:v |
cg@2644
   624
(v includes:$_) ifTrue:[self halt].
cg@2644
   625
        classInstVarList add:('OBJ %1;' bindWith:v)
cg@2644
   626
    ].
cg@2644
   627
    classVarList := StringCollection new.
cg@2644
   628
    aClass classVarNames do:[:v |
cg@2644
   629
        classVarList add:('extern OBJ %1_%2;' bindWith:aClass name with:v)
cg@2644
   630
    ].
cg@2644
   631
cg@2644
   632
    bindings := Dictionary new.
cg@2644
   633
    bindings at:'ClassName' put:aClass name. 
cg@2644
   634
    aClass superclass isNil ifTrue:[
cg@2644
   635
        bindings at:'SuperclassName' put:'-'. 
cg@2852
   636
        bindings at:'SuperclassFileInclude' put:''.
cg@2644
   637
    ] ifFalse:[
cg@2644
   638
        bindings at:'SuperclassName' put:aClass superclass name. 
cg@2644
   639
        bindings at:'SuperclassFileName' put:(superclassFilename := Smalltalk fileNameForClass:aClass superclass).
cg@2644
   640
        bindings at:'SuperclassFileInclude' put:('#include "%1.STH"' bindWith:superclassFilename).
cg@2644
   641
    ].
cg@2644
   642
    bindings at:'InstVarList' put:instVarList asString. 
cg@2644
   643
    bindings at:'ClassVarList' put:classVarList asString. 
cg@2644
   644
    bindings at:'ClassInstVarList' put:classInstVarList asString. 
cg@2644
   645
cg@2644
   646
    template := 
cg@2644
   647
'/* This file was generated by ProjectBuilder. */
cg@2644
   648
/* !!!!!!!! Do not change by hand !!!!!!!! */
cg@2644
   649
cg@2644
   650
/* Class: %(ClassName) */
cg@2644
   651
/* Superclass: %(SuperclassName) */
cg@2644
   652
cg@2644
   653
%(SuperclassFileInclude)
cg@2644
   654
cg@2644
   655
/* INDIRECTGLOBALS */
cg@2644
   656
#ifdef _HEADER_INST_
cg@2644
   657
%(InstVarList)
cg@2644
   658
#endif /* _HEADER_INST_ */
cg@2644
   659
cg@2644
   660
#ifdef _HEADER_CLASS_
cg@2644
   661
%(ClassVarList)
cg@2644
   662
#endif /* _HEADER_CLASS_ */
cg@2644
   663
cg@2644
   664
#ifdef _HEADER_CLASSINST_
cg@2644
   665
%(ClassInstVarList)
cg@2644
   666
#endif /* _HEADER_CLASSINST_ */
cg@2644
   667
'.
cg@2644
   668
    newContents := template bindWithArguments:bindings.
sr@2683
   669
    file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),(self suffixForHeaderFiles)).
cg@2644
   670
    (file exists not
cg@2644
   671
    or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[
cg@2644
   672
        file contents: newContents.
cg@2644
   673
    ].
cg@2852
   674
cg@2852
   675
    "Modified: / 15-08-2011 / 14:58:46 / cg"
cg@2596
   676
!
cg@2596
   677
cg@2644
   678
generateSourceFiles
cg@2644
   679
    sourceCodeManager notNil ifTrue:[
cg@2644
   680
        "/ check out / generate files there
cg@2644
   681
        self generateSourceFilesByCheckingOutUsing:sourceCodeManager
cg@2644
   682
    ] ifFalse:[
cg@2644
   683
        "/ local build
cg@2644
   684
        "/ fileout the project
cg@2644
   685
        self generateSourceFilesByFilingOut
cg@2644
   686
    ]
cg@2596
   687
!
cg@2596
   688
cg@2644
   689
generateSourceFilesByCheckingOutUsing:aSourceCodeManager
cg@2644
   690
    "/ will no longer be needed/supported
cg@2644
   691
cg@2644
   692
    |repository stxRepository module directory|
cg@2644
   693
cg@2868
   694
    self breakPoint:#cg.
cg@2868
   695
cg@2644
   696
    "/ check out / generate files there
cg@2644
   697
    repository := (aSourceCodeManager repositoryNameForModule:module) ifNil:[aSourceCodeManager repositoryName].
cg@2644
   698
    stxRepository := aSourceCodeManager repositoryName.
cg@2644
   699
cg@2644
   700
    (buildDirectory construct:'stx') exists ifFalse:[
cg@2644
   701
        (module ~= 'stx') ifTrue:[
cg@2644
   702
            OperatingSystem
cg@2644
   703
                executeCommand:('cvs -d ',stxRepository,' co stx')
cg@2644
   704
                inputFrom:nil
cg@2644
   705
                outputTo:Transcript
cg@2644
   706
                errorTo:Transcript
cg@2644
   707
                inDirectory:buildDirectory
cg@2644
   708
                onError:[:status| self error:'cvs update stx failed'].
cg@2644
   709
        ].
cg@2644
   710
    ].
cg@2644
   711
cg@2644
   712
    ((buildDirectory construct:module) construct:'CVS') exists ifFalse:[
cg@2644
   713
        OperatingSystem
cg@2644
   714
            executeCommand:('cvs -d ',repository,' co -l ',directory)
cg@2644
   715
            inputFrom:nil
cg@2644
   716
            outputTo:Transcript
cg@2644
   717
            errorTo:Transcript
cg@2644
   718
            inDirectory:buildDirectory
cg@2644
   719
            onError:[:status| self error:'cvs update failed'].
cg@2644
   720
    ].
cg@2644
   721
    OperatingSystem
cg@2644
   722
        executeCommand:'cvs upd -d'
cg@2644
   723
        inputFrom:nil
cg@2644
   724
        outputTo:Transcript
cg@2644
   725
        errorTo:Transcript
cg@2644
   726
        inDirectory:(buildDirectory construct:module)
cg@2644
   727
        onError:[:status| self error:'cvs update failed'].
cg@2644
   728
self halt.
cg@2868
   729
cg@2868
   730
    "Modified: / 29-12-2011 / 14:02:56 / cg"
cg@2596
   731
!
cg@2596
   732
cg@2644
   733
generateSourceFilesByFilingOut
cg@2644
   734
    "/ local build
cg@2644
   735
    "/ fileout the project
cg@2644
   736
sv@2844
   737
    |fullPathName|
sv@2844
   738
cg@2644
   739
    (package module ~= 'stx') ifTrue:[
cg@2644
   740
        (buildDirectory / package module) makeDirectory.
cg@2644
   741
    ].
cg@2644
   742
cg@2644
   743
    "/ file out the package(s) which are to be built
cg@2644
   744
    ((Array with:package))
cg@2644
   745
    do:[:eachPackageToFileout |
cg@2644
   746
        |packageId packageModule packageDirectory packageTargetDir packageDef|
cg@2644
   747
cg@2644
   748
        packageId := eachPackageToFileout asPackageId.
cg@2644
   749
        packageModule := packageId module.
cg@2644
   750
        packageDirectory := packageId directory.
cg@2644
   751
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2644
   752
cg@2644
   753
        packageDef := packageId projectDefinitionClass.
cg@2644
   754
        (packageDef compiled_classNames_common ,
cg@2644
   755
        packageDef compiled_classNamesForPlatform) do:[:eachClassName |
cg@2644
   756
            |cls fileName newSource|
cg@2644
   757
cg@2644
   758
            cls := Smalltalk classNamed:eachClassName.
cg@2644
   759
            self assert:cls isLoaded.
cg@2644
   760
            fileName := (Smalltalk fileNameForClass:cls),'.st'.
cg@2644
   761
            fileName := packageTargetDir asFilename construct:fileName.
cg@2644
   762
            fileName exists ifTrue:[
cg@2644
   763
                newSource := String streamContents:[:s | cls fileOutOn:s withTimeStamp:false].
cg@2644
   764
                newSource = fileName contentsAsString ifFalse:[
cg@2644
   765
                    fileName contents:newSource
cg@2644
   766
                ].
cg@2644
   767
            ] ifFalse:[
cg@2644
   768
                cls fileOutIn:packageTargetDir withTimeStamp:false
cg@2644
   769
            ].
cg@2644
   770
        ].
cg@2644
   771
cg@2644
   772
"/        (Smalltalk allClassesInPackage:eachPackageToFileout) do:[:cls |
cg@2644
   773
"/            cls isPrivate ifFalse:[
cg@2644
   774
"/                cls isLoaded ifFalse:[
cg@2644
   775
"/                    self halt.
cg@2644
   776
"/                    cls autoload.
cg@2644
   777
"/                ].
cg@2644
   778
"/                cls fileOutIn:packageTargetDir
cg@2644
   779
"/            ]
cg@2644
   780
"/        ].
cg@2644
   781
cg@2644
   782
        projectDefinitionClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents |
sv@2844
   783
            fullPathName := packageTargetDir construct:fileName.
sv@2844
   784
            fullPathName directory exists ifFalse:[
sv@2844
   785
                "take care for files like 'autopackage/default.apspec'"
sv@2844
   786
                fullPathName directory makeDirectory.
sv@2844
   787
            ].
sv@2844
   788
            (fullPathName exists
sv@2844
   789
             and:[ fullPathName contents = fileContents ]) ifFalse:[
sv@2844
   790
                fullPathName contents:fileContents.
cg@2644
   791
            ].
cg@2644
   792
        ].    
cg@2644
   793
    ].
cg@2644
   794
cg@2644
   795
    "/ generate header files in prerequisite packages...
cg@2644
   796
    (projectDefinitionClass allPreRequisites)
cg@2644
   797
    do:[:eachPackageToFileout |
cg@2644
   798
        |packageId packageDef packageModule packageDirectory packageTargetDir|
cg@2644
   799
cg@2644
   800
        packageId := eachPackageToFileout asPackageId.
cg@2644
   801
        packageModule := packageId module.
cg@2644
   802
        packageDirectory := packageId directory.
cg@2644
   803
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2644
   804
cg@2644
   805
        packageDef := packageId projectDefinitionClass.
cg@2644
   806
        (packageDef compiled_classNames_common ,
cg@2644
   807
        packageDef compiled_classNamesForPlatform) do:[:eachClassName |
cg@2644
   808
            |cls|
cg@2644
   809
cg@2644
   810
            cls := Smalltalk classNamed:eachClassName.
cg@2644
   811
            "/ self assert:cls isLoaded.
cg@2644
   812
            cls isLoaded ifTrue:[    
cg@2644
   813
                self createHeaderFileFor:cls in:packageTargetDir
cg@2644
   814
            ].
cg@2644
   815
        ].
cg@2644
   816
        self copyResourcesForPackage:eachPackageToFileout.
cg@2644
   817
    ].
cg@2644
   818
cg@2644
   819
"/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')
cg@2596
   820
!
cg@2596
   821
cg@2909
   822
makeCommandOfCompiler:usedCompiler
cg@2909
   823
    usedCompiler = 'bcc' ifTrue:[ 
cg@2909
   824
        ^ 'bmake'.
cg@2909
   825
    ].
cg@2909
   826
    usedCompiler = 'vc' ifTrue:[ 
cg@2909
   827
        ^ 'vcmake'. "/ compilerFlag := '-DUSEVC' 
cg@2909
   828
    ].
cg@2909
   829
    usedCompiler = 'lcc' ifTrue:[ 
cg@2909
   830
        ^ 'lccmake'. "/ compilerFlag := '-DUSELCC' 
cg@2909
   831
    ].
cg@2909
   832
    usedCompiler = 'tcc' ifTrue:[ 
cg@2909
   833
        ^ 'tccmake'. "/ compilerFlag := '-DUSELCC' 
cg@2909
   834
    ].
cg@2909
   835
    usedCompiler = 'gcc' ifTrue:[ 
cg@2921
   836
        ^ 'make'.       "/ compilerFlag := '-DUSEGCC' 
cg@2909
   837
    ].
cg@2918
   838
    usedCompiler = 'mingw' ifTrue:[ 
cg@2921
   839
        ^ 'mingwmake'.  "/ compilerFlag := '-DUSEMINGW' 
cg@2909
   840
    ].
cg@2909
   841
    self error:'unknown compiler specified'.
cg@2909
   842
cg@2909
   843
    "Created: / 03-09-2012 / 19:46:07 / cg"
cg@2909
   844
!
cg@2909
   845
cg@2644
   846
makeWithOutputTo:stdOut errorTo:stdErr
cg@2909
   847
    |module directory makeCommand|
cg@2644
   848
cg@2644
   849
    module := package module.
cg@2644
   850
    directory := package directory.
cg@2644
   851
cg@2680
   852
    makeCommand := ParserFlags makeCommand.
cg@2895
   853
    usedCompiler isNil ifTrue:[
cg@2895
   854
        usedCompiler := ParserFlags usedCompiler.
cg@2895
   855
    ].
cg@2909
   856
    makeCommand := self makeCommandOfCompiler:usedCompiler.
cg@2873
   857
cg@2852
   858
    "/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName.
cg@2680
   859
sr@2683
   860
    OperatingSystem isUNIXlike ifTrue:[
cg@2921
   861
        "/ generate the makefile first
sr@2683
   862
        OperatingSystem
sv@2845
   863
            executeCommand:('sh %1/rules/stmkmf' bindWith:mySTXTopDirectory pathName)
sr@2683
   864
            inputFrom:nil
sr@2683
   865
            outputTo:stdOut
sr@2683
   866
            errorTo:stdErr
sr@2683
   867
            inDirectory:(buildDirectory / module / directory)
cg@2921
   868
            onError:[:status | self error:'make failed'].
sr@2683
   869
    ].
sr@2683
   870
cg@2644
   871
    projectDefinitionClass isLibraryDefinition ifTrue:[
cg@2921
   872
        "/ generate the library
cg@2644
   873
        OperatingSystem
cg@2680
   874
            executeCommand:(makeCommand,' classLibRule')
cg@2644
   875
            inputFrom:nil
cg@2644
   876
            outputTo:stdOut
cg@2644
   877
            errorTo:stdErr
cg@2644
   878
            inDirectory:(buildDirectory / module / directory)
cg@2921
   879
            onError:[:status | self error:'make failed'].
cg@2644
   880
    ] ifFalse:[
cg@2644
   881
        OperatingSystem
cg@2921
   882
            "/ generate the executable
cg@2680
   883
            executeCommand:(makeCommand,' exe')
cg@2644
   884
            inputFrom:nil
cg@2644
   885
            outputTo:stdOut
cg@2644
   886
            errorTo:stdErr
cg@2644
   887
            inDirectory:(buildDirectory / module / directory)
cg@2921
   888
            onError:[:status | self error:'make failed'].
cg@2644
   889
cg@2673
   890
        (makeExeOnly ? false) ifFalse:[
cg@2921
   891
            "/ generate the self-installable package
cg@2673
   892
            OperatingSystem
cg@2680
   893
                executeCommand:(makeCommand,' setup')
cg@2673
   894
                inputFrom:nil
cg@2673
   895
                outputTo:stdOut
cg@2673
   896
                errorTo:stdErr
cg@2673
   897
                inDirectory:(buildDirectory / module / directory)
cg@2921
   898
                onError:[:status | self error:'make failed'].
cg@2673
   899
        ]
cg@2644
   900
    ]
cg@2793
   901
cg@2909
   902
    "Modified: / 03-09-2012 / 19:47:15 / cg"
cg@2921
   903
    "Modified (comment): / 06-09-2012 / 16:22:38 / cg"
cg@2611
   904
!
cg@2611
   905
cg@2905
   906
objDirForUsedCompiler
cg@2909
   907
    ^ self objDirForUsedCompiler:usedCompiler
cg@2909
   908
cg@2909
   909
    "Created: / 20-08-2012 / 17:01:13 / cg"
cg@2909
   910
!
cg@2909
   911
cg@2909
   912
objDirForUsedCompiler:usedCompiler
cg@2918
   913
    usedCompiler = 'gcc' ifTrue:[^ 'obj'].      "/ unix case
cg@2918
   914
cg@2905
   915
    usedCompiler = 'bcc' ifTrue:[^ 'objbc'].
cg@2905
   916
    usedCompiler = 'vc' ifTrue:[^ 'objvc'].
cg@2909
   917
    usedCompiler = 'tcc' ifTrue:[^ 'objtcc'].
cg@2909
   918
    usedCompiler = 'lcc' ifTrue:[^ 'objlcc'].
cg@2918
   919
    usedCompiler = 'mingw' ifTrue:[^ 'objmingw'].
cg@2905
   920
    self halt:'please fill in here'.
cg@2905
   921
    ^ 'objbc'
cg@2905
   922
cg@2909
   923
    "Created: / 03-09-2012 / 19:55:34 / cg"
cg@2905
   924
!
cg@2905
   925
sr@2683
   926
recursiveCopyDirectoryForBuild:subdir
sr@2683
   927
    |targetDir|
sr@2683
   928
sr@2683
   929
    targetDir := buildDirectory / 'stx' / subdir.
sr@2683
   930
    targetDir exists ifFalse:[
sr@2683
   931
        targetDir makeDirectory.
sr@2683
   932
    ].
sr@2683
   933
    (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile |
sr@2683
   934
        eachFile recursiveCopyTo:(targetDir construct:eachFile baseName)
sr@2683
   935
    ].
sr@2683
   936
    self activityNotification:nil
sr@2683
   937
!
sr@2683
   938
cg@2644
   939
setupBuildDirectory
cg@2644
   940
    buildDirectory exists ifFalse:[
cg@2644
   941
        buildDirectory recursiveMakeDirectory.
cg@2644
   942
    ].
cg@2644
   943
    (buildDirectory / 'stx') exists ifFalse:[
cg@2644
   944
        (buildDirectory / 'stx') makeDirectory.
cg@2644
   945
    ].
cg@2644
   946
cg@2644
   947
    self copyDirectoryForBuild:'include'.
cg@2644
   948
    self copyDirectoryForBuild:'rules'.
sr@2683
   949
    OperatingSystem isUNIXlike ifTrue:[
sr@2683
   950
        self recursiveCopyDirectoryForBuild:'configurations'.
sr@2683
   951
    ]
cg@2635
   952
!
cg@2596
   953
cg@2644
   954
validateBuildDirectoryIsPresent
cg@2644
   955
cg@2644
   956
    ^ self.
cg@2644
   957
cg@2644
   958
"/    [
cg@2644
   959
"/        |default directoryIsOKForMe stc |
cg@2644
   960
"/
cg@2644
   961
"/        default := (buildDirectory ?
cg@2644
   962
"/                          PreviousBuildDirectory)
cg@2644
   963
"/                          ifNil:[ UserPreferences current buildDirectory].
cg@2644
   964
"/
cg@2644
   965
"/        buildDirectory := Dialog requestDirectoryName:'Temporary Work-ROOT for build:'
cg@2644
   966
"/                                 default:default.
cg@2644
   967
"/
cg@2644
   968
"/        buildDirectory isEmptyOrNil ifTrue:[^ self].
cg@2644
   969
"/        buildDirectory := buildDirectory asFilename.
cg@2644
   970
"/        directoryIsOKForMe := true.
cg@2644
   971
"/
cg@2644
   972
"/        buildDirectory exists ifFalse:[
cg@2644
   973
"/            Dialog warn:(self classResources string:'Work directory %1 does not exist.' with:buildDirectory).
cg@2644
   974
"/            directoryIsOKForMe := false.
cg@2644
   975
"/        ] ifTrue:[
cg@2644
   976
"/            (buildDirectory construct:'stx') exists ifFalse:[
cg@2644
   977
"/                Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stx subDirectory,\which contains (at least) the stc and include subdirectories.').
cg@2644
   978
"/                directoryIsOKForMe := false.
cg@2644
   979
"/            ] ifTrue:[
cg@2644
   980
"/                stc := (OperatingSystem isMSDOSlike) ifTrue:['stc.exe'] ifFalse:['stc'].
cg@2644
   981
"/                (((buildDirectory construct:'stx')construct:'stc')construct:stc) exists ifFalse:[
cg@2644
   982
"/                    Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stc compiler in the stx/stc subDirectory.').
cg@2644
   983
"/                    directoryIsOKForMe := false.
cg@2644
   984
"/                ].
cg@2644
   985
"/                ((buildDirectory construct:'stx')construct:'include') exists ifFalse:[
cg@2644
   986
"/                    Dialog warn:(self classResources stringWithCRs:'Work directory must have had a make run before (for include files to exists).').
cg@2644
   987
"/                    directoryIsOKForMe := false.
cg@2644
   988
"/                ].
cg@2644
   989
"/            ]
cg@2644
   990
"/        ].
cg@2644
   991
"/        directoryIsOKForMe
cg@2644
   992
"/    ] whileFalse
cg@2596
   993
! !
cg@2596
   994
cg@2596
   995
!ProjectBuilder class methodsFor:'documentation'!
cg@2596
   996
cg@2896
   997
version
cg@2896
   998
    ^ '$Header$'
cg@2896
   999
!
cg@2896
  1000
cg@2596
  1001
version_CVS
cg@2596
  1002
    ^ '$Header$'
cg@2596
  1003
! !