Subversion Repositories DevTools

Rev

Rev 289 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 289 Rev 295
Line 8... Line 8...
8
#       Delphi7 for WIN32
8
#       Delphi7 for WIN32
9
#............................................................................#
9
#............................................................................#
10
 
10
 
11
use strict;
11
use strict;
12
use warnings;
12
use warnings;
-
 
13
use FileUtils;
13
 
14
 
14
################################################################################
15
################################################################################
15
#   Globals
16
#   Globals
16
#
17
#
17
my $toolset_version;
18
my $toolset_version;
Line 156... Line 157...
156
    {
157
    {
157
        #
158
        #
158
        #   Strip out known project files
159
        #   Strip out known project files
159
        #   Must leave in .pas files
160
        #   Must leave in .pas files
160
        #
161
        #
161
        next if ( m~\.dpr~ );
162
        next if ( m~\.dpr$~i );
162
        next if ( m~\.dpk~ );
163
        next if ( m~\.dpk$~i );
163
        next if ( m~descpkg~ );
164
        next if ( m~^descpkg$~ );
164
        push @dlist, $_;
165
        push @dlist, $_;
165
    }
166
    }
166
 
167
 
167
    if ( @dlist )
168
    if ( @dlist )
168
    {
169
    {
Line 190... Line 191...
190
        ToolsetDefine ($data);
191
        ToolsetDefine ($data);
191
    }
192
    }
192
}
193
}
193
 
194
 
194
#-------------------------------------------------------------------------------
195
#-------------------------------------------------------------------------------
-
 
196
# Function        : ToolsetPostprocess
-
 
197
#
-
 
198
# Description     : Process any .RC files that have been specified
-
 
199
#                   by the user
-
 
200
#
-
 
201
# Inputs          : 
-
 
202
#
-
 
203
# Returns         : 
-
 
204
#
-
 
205
sub ToolsetPostprocess
-
 
206
{
-
 
207
    foreach my $rcfile ( @::RCSRCS )
-
 
208
    {
-
 
209
        my $name = StripDirExt($rcfile);
-
 
210
        my $base = StripDir($rcfile);
-
 
211
        my $res_name = '$(OBJDIR)/' . $name . '.res';
-
 
212
 
-
 
213
        #
-
 
214
        #   Create rules and recipes to build file
-
 
215
        #
-
 
216
        my $me = MakeEntry::New (*MAKEFILE, $res_name );
-
 
217
        $me->AddComment ("Create Resource File: $name" );
-
 
218
        $me->AddDependancy ( $rcfile );
-
 
219
        $me->AddDependancy ( '$(SCM_MAKEFILE)' );
-
 
220
        $me->AddDependancy ( '$(GBE_OBJDIR)' );
-
 
221
        $me->AddDependancy ( split( /$;/, $::SRC_DEPEND{$base} ) ) if exists($::SRC_DEPEND{$base});
-
 
222
        $me->AddRecipe ( '$(DRES)' );
-
 
223
        $me->Print();
-
 
224
 
-
 
225
        #
-
 
226
        #   Add the file to the list of generated files
-
 
227
        #   This will ensure that its created early
-
 
228
        #
-
 
229
        GenerateSrcFile( 1, $res_name );
-
 
230
    }
-
 
231
}
-
 
232
 
-
 
233
#-------------------------------------------------------------------------------
195
# Function        : ToolsetAR
234
# Function        : ToolsetAR
196
#
235
#
197
# Description     : Toolset processing to create a static library
236
# Description     : Toolset processing to create a static library
198
#                   In Delphi these are called a unit
237
#                   In Delphi these are called a unit
199
#                   In Delphi there are several restrictions
238
#                   In Delphi there are several restrictions
Line 286... Line 325...
286
sub ToolsetSHLD
325
sub ToolsetSHLD
287
{
326
{
288
    my ( $name, $pArgs, $pObjs, $pLibs, $ver ) = @_;
327
    my ( $name, $pArgs, $pObjs, $pLibs, $ver ) = @_;
289
    my @psource;
328
    my @psource;
290
    my $no_implib = 0;
329
    my $no_implib = 0;
291
    my $isa_package = undef;
330
    my $auto_type = '';
292
 
331
 
293
    #.. Parse arguments
332
    #.. Parse arguments
294
    #
333
    #
295
    foreach ( @$pArgs ) {
334
    foreach ( @$pArgs ) {
296
        if (/^--NoImplib$/) {
335
        if (/^--NoImplib$/) {
297
            $no_implib = 1;
336
            $no_implib = 1;
298
 
337
 
299
        } elsif ( !/^--Package/ ) {
338
        } elsif ( /^--DCU/i ) {
300
            $isa_package = 1;
339
            $auto_type = 'dcu';
301
 
340
 
302
        } elsif ( !/^--NoPackage/ ) {
341
        } elsif ( /^--Package/i ) {
-
 
342
            $auto_type = 'pkg';
-
 
343
 
-
 
344
        } elsif ( /^--NoPackage/i || /^--DLL/i ) {
303
            $isa_package = 0;
345
            $auto_type = 'dll';
304
            
346
            
305
        } elsif ( !/^-/ ) {
347
        } elsif ( !/^-/ ) {
306
            push @psource, MakeSrcResolve($_);
348
            push @psource, MakeSrcResolve($_);
307
 
349
 
308
        } else {
350
        } else {
Line 342... Line 384...
342
    #       Library that creates DLLs
384
    #       Library that creates DLLs
343
    #       Library that creates a Delphi Package
385
    #       Library that creates a Delphi Package
344
    #
386
    #
345
    #   User can force the mode
387
    #   User can force the mode
346
    #
388
    #
347
    unless ( defined $isa_package )
389
    unless ( $auto_type )
348
    {
390
    {
349
        $isa_package = ($source =~ m~\.dpk~);
391
        $auto_type = 'pkg' if ($source =~ m~\.dpk~);
-
 
392
        $auto_type = 'dcu' if ($source =~ m~\.pas~);
350
    }
393
    }
351
 
394
 
352
    if ( $isa_package )
395
    if ( $auto_type eq 'pkg' )
353
    {
396
    {
354
        #
397
        #
355
        #   Determine the target output name
398
        #   Determine the target output name
356
        #
399
        #
357
        my $base = $name;
400
        my $base = $name;
Line 387... Line 430...
387
        #
430
        #
388
        PackageShlibAddFiles ( $name, $bpl );
431
        PackageShlibAddFiles ( $name, $bpl );
389
        PackageShlibAddFiles ( $name, $bcp );
432
        PackageShlibAddFiles ( $name, $bcp );
390
        PackageShlibAddFiles ( $name, "$root.map", "Class=map" );
433
        PackageShlibAddFiles ( $name, "$root.map", "Class=map" );
391
    }
434
    }
-
 
435
    elsif ( $auto_type eq 'dcu' )
-
 
436
    {
-
 
437
        #
-
 
438
        #   Really building a DCU
-
 
439
        #   Done as a shared lib so that it can access other packages
-
 
440
        #   with the -L option
-
 
441
        #
-
 
442
        my $base = $name;
-
 
443
        my $root = "\$(LIBDIR)/$base";
-
 
444
        my $dcu = $root . '.dcu';
-
 
445
        
-
 
446
        #
-
 
447
        #   Create Rules and Recipes to create the Package
-
 
448
        #
-
 
449
        my $me = MakeEntry::New (*MAKEFILE, $dcu );
-
 
450
        $me->AddComment ("Build Delpi Package: $name" );
-
 
451
        $me->AddDependancy ( $source );
-
 
452
        $me->AddDependancy ( '$(SCM_MAKEFILE)' );
-
 
453
        $me->AddDependancy ( '$(DELPHISRCS)' );
-
 
454
        $me->AddDependancy ( @psource );
-
 
455
        $me->AddRecipe ( '$(DCC_AR)' );
-
 
456
        $me->AddDefn ('PSOURCE', $source );
-
 
457
        $me->AddDefn ('PFLAGS',  '' );
-
 
458
        $me->AddDefn ('PACKAGES',  join ' ', @$pLibs );
-
 
459
        $me->Print();
-
 
460
 
-
 
461
        #
-
 
462
        #   Files to clean up
-
 
463
        #
-
 
464
        ToolsetGenerate( "$base.drc" );                 # Created in CWD
-
 
465
 
-
 
466
        #
-
 
467
        #   Specify the files to be packaged as part of the shared library
-
 
468
        #
-
 
469
        PackageShlibAddFiles ( $name, $dcu );
-
 
470
 
-
 
471
    }
392
    else
472
    else
393
    {
473
    {
394
        #
474
        #
395
        #   Determine the target output name
475
        #   Determine the target output name
396
        #
476
        #
Line 433... Line 513...
433
        #   Create an import library
513
        #   Create an import library
434
        #
514
        #
435
        unless ( $no_implib )
515
        unless ( $no_implib )
436
        {
516
        {
437
            #
517
            #
-
 
518
            #   Need:
-
 
519
            #       impdef.exe from Borland Cbuilder builder
438
            #   Ensure we have required tools
520
            #       link.exe from MS VC6
439
            #
521
            #
440
            unless ( $implib_found )
-
 
441
            {
-
 
442
                $implib_found = 1;
-
 
443
                Error ("Delphi7. Required program node found: implib32",
-
 
444
                       "You may need the DelphiTool (or equiv) package")
-
 
445
                    unless ( ToolExtensionProgram( 'implib32', '.exe' ) );
-
 
446
            }
-
 
447
 
-
 
448
            my $me = MakeEntry::New (*MAKEFILE, $stub );
522
            my $me = MakeEntry::New (*MAKEFILE, $stub );
449
            $me->AddComment ("Build Import Library: $name" );
523
            $me->AddComment ("Build Import Library: $name" );
450
            $me->AddDependancy ( $full );
524
            $me->AddDependancy ( $full );
451
            $me->AddRecipe ( '$(IMPLIB)' );
525
            $me->AddRecipe ( '$(IMPLIB)' );
-
 
526
            $me->AddDefn ('TMPFILE', "$root.tmp" );
452
            $me->Print();
527
            $me->Print();
453
 
528
 
-
 
529
            ToolsetGenerate( "$root.tmp" );
454
            ToolsetGenerate( "$root.exp" );
530
            ToolsetGenerate( "$root.exp" );
455
            PackageShlibAddFiles ( $name, $stub );
531
            PackageShlibAddFiles ( $name, $stub );
456
        }
532
        }
457
    }
533
    }
458
}
534
}