Subversion Repositories DevTools

Rev

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

Rev 411 Rev 415
Line 118... Line 118...
118
my $opt_postrm = '';
118
my $opt_postrm = '';
119
my $opt_preinst = '';
119
my $opt_preinst = '';
120
my $opt_postinst = '';
120
my $opt_postinst = '';
121
my $opt_description;
121
my $opt_description;
122
 
122
 
-
 
123
#
-
 
124
#   Globals
-
 
125
#
-
 
126
my @ResolveFileList;                    # Cached Package File List
-
 
127
my @ResolveBinFileList;                 # Cached PackageBin File List
-
 
128
my @ResolveLibFileList;                 # Cached PackageLib File List
123
 
129
 
124
#-------------------------------------------------------------------------------
130
#-------------------------------------------------------------------------------
125
# Function        : Main Entry point
131
# Function        : Main Entry point
126
#
132
#
127
# Description     : This function will be called when the package is initialised
133
# Description     : This function will be called when the package is initialised
Line 1188... Line 1194...
1188
 
1194
 
1189
#-------------------------------------------------------------------------------
1195
#-------------------------------------------------------------------------------
1190
# Function        : ResolveFile
1196
# Function        : ResolveFile
1191
#
1197
#
1192
# Description     : Determine where the source for a file is
1198
# Description     : Determine where the source for a file is
1193
#                   Will look in:
1199
#                   Will look in (default):
1194
#                       Local directory
1200
#                       Local directory
1195
#                       Local Include
1201
#                       Local Include
-
 
1202
#                   Or  (FromPackage)
-
 
1203
#                       Our Package directory
-
 
1204
#                       Interface directory (BuildPkgArchives)
-
 
1205
#                       Packages (LinkPkgArchive)
-
 
1206
#
1196
#                   Will scan 'parts' subdirs
1207
#                   Will scan 'parts' subdirs
1197
#
1208
#
1198
# Inputs          : $from_package       - 0 - Local File
1209
# Inputs          : $from_package       - 0 - Local File
1199
#                   $file
1210
#                   $file
1200
#
1211
#
1201
# Returns         : Path
1212
# Returns         : Path
1202
#
1213
#
1203
sub ResolveFile
1214
sub ResolveFile
1204
{
1215
{
1205
    my ($from_package, $file) = @_;
1216
    my ($from_package, $file) = @_;
1206
    my @path = $from_package ? ($opt_pkgdir ,$opt_interfacedir) : ('.', $opt_localincdir);
-
 
1207
    my $wildcard = ($file =~ /[*?]/);
1217
    my $wildcard = ($file =~ /[*?]/);
-
 
1218
    my @path;
-
 
1219
 
-
 
1220
    #
-
 
1221
    #   Determine the paths to search
-
 
1222
    #
-
 
1223
    if ( $from_package )
-
 
1224
    {
-
 
1225
        unless ( @ResolveFileList )
-
 
1226
        {
-
 
1227
            push @ResolveFileList, $opt_pkgdir;
-
 
1228
            foreach my $entry ( getPackageList() )
-
 
1229
            {
-
 
1230
                push @ResolveFileList, $entry->getBase(3);
-
 
1231
            }
-
 
1232
        }
-
 
1233
        @path = @ResolveFileList;
-
 
1234
    }
-
 
1235
    else
-
 
1236
    {
-
 
1237
        @path = ('.', $opt_localincdir);
-
 
1238
    }
1208
 
1239
 
1209
    #
1240
    #
1210
    #   Determine a full list of 'parts' to search
1241
    #   Determine a full list of 'parts' to search
1211
    #   This is provided within the build information
1242
    #   This is provided within the build information
1212
    #
1243
    #
Line 1217... Line 1248...
1217
    foreach my $root (  @path )
1248
    foreach my $root (  @path )
1218
    {
1249
    {
1219
        foreach my $subdir ( @parts )
1250
        foreach my $subdir ( @parts )
1220
        {
1251
        {
1221
            my $sfile;
1252
            my $sfile;
1222
                $sfile = "$root/$subdir/$file";
1253
            $sfile = "$root/$subdir/$file";
1223
                $sfile =~ s~//~/~g;
1254
            $sfile =~ s~//~/~g;
1224
                $sfile =~ s~^./~~g;
1255
            $sfile =~ s~^./~~g;
1225
                Verbose2("LocateFile: $sfile, $root, $subdir");
1256
            Verbose2("LocateFile: $sfile, $root, $subdir");
1226
                if ( $wildcard )
1257
            if ( $wildcard )
1227
                {
1258
            {
1228
                    push @done, glob ( $sfile );
1259
                push @done, glob ( $sfile );
1229
                }
1260
            }
1230
                else
1261
            else
1231
                {
1262
            {
1232
                    push @done, $sfile if ( -f $sfile )
1263
                push @done, $sfile if ( -f $sfile || -l $sfile )
1233
                }
1264
            }
1234
        }
1265
        }
1235
    }
1266
    }
1236
 
1267
 
1237
    Error ("ResolveFile: File not found: $file")
1268
    Error ("ResolveFile: File not found: $file", "Search Path:", @path)
1238
        unless ( @done );
1269
        unless ( @done );
1239
 
1270
 
1240
    Warning ("ResolveFile: Multiple instances of file found. Only first is used", @done)
1271
    Warning ("ResolveFile: Multiple instances of file found. Only first is used", @done)
1241
        if ( $#done > 0 && ! $wildcard && !wantarray );
1272
        if ( $#done > 0 && ! $wildcard && !wantarray );
1242
 
1273
 
Line 1244... Line 1275...
1244
}
1275
}
1245
 
1276
 
1246
#-------------------------------------------------------------------------------
1277
#-------------------------------------------------------------------------------
1247
# Function        : ResolveBinFile
1278
# Function        : ResolveBinFile
1248
#
1279
#
1249
# Description     : Determine where the source for a file is
1280
# Description     : Determine where the source for a BIN file is
1250
#                   Will look in:
1281
#                   Will look in (default):
1251
#                       Local artifacts bin
1282
#                       Local directory
1252
#                       Local Bin
1283
#                       Local Include
-
 
1284
#                   Or  (FromPackage)
-
 
1285
#                       Our Package directory
-
 
1286
#                       Interface directory (BuildPkgArchives)
-
 
1287
#                       Packages (LinkPkgArchive)
1253
#                   Will scan 'parts' subdirs
1288
#                   Will scan 'parts' subdirs
1254
#
1289
#
1255
# Inputs          : $from_package       - 0 - Local File
1290
# Inputs          : $from_package       - 0 - Local File
1256
# Inputs          : $file
1291
#                   $file
1257
#
1292
#
1258
# Returns         : Path
1293
# Returns         : Path
1259
#
1294
#
1260
sub ResolveBinFile
1295
sub ResolveBinFile
1261
{
1296
{
1262
    my ($from_package, $file) = @_;
1297
    my ($from_package, $file) = @_;
1263
    my @path;
1298
    my @path;
1264
    my @types;
1299
    my @types;
1265
    my $wildcard = ($file =~ /[*?]/);
1300
    my $wildcard = ($file =~ /[*?]/);
1266
 
1301
 
-
 
1302
    #
-
 
1303
    #   Determine the paths to search
-
 
1304
    #
1267
    if ( $from_package )
1305
    if ( $from_package )
1268
    {
1306
    {
-
 
1307
        unless ( @ResolveBinFileList )
-
 
1308
        {
1269
        @path = ($opt_pkgdir . '/bin' ,$opt_interfacedir . '/bin' );
1309
            push @ResolveBinFileList, $opt_pkgdir . '/bin';
-
 
1310
            foreach my $entry ( getPackageList() )
-
 
1311
            {
-
 
1312
                if ( my $path = $entry->getBase(3) )
-
 
1313
                {
-
 
1314
                    $path .= '/bin';
-
 
1315
                    push @ResolveBinFileList, $path if ( -d $path );
-
 
1316
                }
-
 
1317
            }
-
 
1318
        }
-
 
1319
        @path = @ResolveBinFileList;
1270
        @types = ($opt_type, '');
1320
        @types = ($opt_type, '');
1271
    }
1321
    }
1272
    else
1322
    else
1273
    {
1323
    {
1274
        @path = ($opt_bindir, $opt_localbindir);
1324
        @path = ($opt_bindir, $opt_localbindir);
Line 1297... Line 1347...
1297
                {
1347
                {
1298
                    push @done, glob ( $sfile );
1348
                    push @done, glob ( $sfile );
1299
                }
1349
                }
1300
                else
1350
                else
1301
                {
1351
                {
1302
                    push @done, $sfile if ( -f $sfile )
1352
                    push @done, $sfile if ( -f $sfile || -l $sfile )
1303
                }
1353
                }
1304
            }
1354
            }
1305
        }
1355
        }
1306
    }
1356
    }
1307
 
1357
 
1308
    Error ("ResolveBinFile: File not found: $file")
1358
    Error ("ResolveBinFile: File not found: $file", "Search Path:", @path)
1309
        unless ( @done );
1359
        unless ( @done );
1310
 
1360
 
1311
    Warning ("ResolveBinFile: Multiple instances of file found. Only first is used", @done)
1361
    Warning ("ResolveBinFile: Multiple instances of file found. Only first is used", @done)
1312
        if ( $#done > 0 && ! $wildcard && !wantarray );
1362
        if ( $#done > 0 && ! $wildcard && !wantarray );
1313
 
-
 
1314
    return wantarray ? @done : $done[0];
1363
    return wantarray ? @done : $done[0];
1315
}
1364
}
1316
 
1365
 
1317
#-------------------------------------------------------------------------------
1366
#-------------------------------------------------------------------------------
1318
# Function        : ResolveLibFile
1367
# Function        : ResolveLibFile
1319
#
1368
#
1320
# Description     : Determine where the source for a file is
1369
# Description     : Determine where the source for a LIB file is
1321
#                   Will look in:
1370
#                   Will look in (default):
1322
#                       Local artifacts library
1371
#                       Local directory
1323
#                       Local Lib
1372
#                       Local Include
-
 
1373
#                   Or  (FromPackage)
-
 
1374
#                       Our Package directory
-
 
1375
#                       Interface directory (BuildPkgArchives)
-
 
1376
#                       Packages (LinkPkgArchive)
1324
#                   Will scan 'parts' subdirs
1377
#                   Will scan 'parts' subdirs
1325
#
1378
#
1326
# Inputs          : $from_package       - 0 - Local File
1379
# Inputs          : $from_package       - 0 - Local File
1327
# Inputs          : $file       - Basename for a 'realname'
1380
#                   $file       - Basename for a 'realname'
1328
#                                 Do not provide 'lib' or '.so' or version info
1381
#                                 Do not provide 'lib' or '.so' or version info
1329
#                                 May contain embedded options
1382
#                                 May contain embedded options
1330
#                                   --Dll - use Windows style versioned DLL
1383
#                                   --Dll - use Windows style versioned DLL
1331
#                                   --VersionDll - USe the versioned DLL
1384
#                                   --VersionDll - USe the versioned DLL
1332
#
1385
#
1333
# Returns         : Path
1386
# Returns         : Path
1334
#
1387
#
1335
sub ResolveLibFile
1388
sub ResolveLibFile
1336
{
1389
{
1337
    my ($from_package, $file) = @_;
1390
    my ($from_package, $file) = @_;
1338
    my @path = $from_package ? ($opt_pkgdir . '/lib', $opt_interfacedir . '/lib') : ($opt_libdir, $opt_locallibdir);
-
 
1339
    my $wildcard = ($file =~ /[*?]/);
1391
    my $wildcard = ($file =~ /[*?]/);
1340
    my @options;
1392
    my @options;
1341
    my $num_dll;
1393
    my $num_dll;
1342
 
1394
    my @path;
1343
    #
1395
    #
1344
    #   Extract options from file
1396
    #   Extract options from file
1345
    #
1397
    #
1346
    $num_dll = 0;
1398
    $num_dll = 0;
1347
    ($file, @options) = split ( ',', $file);
1399
    ($file, @options) = split ( ',', $file);
Line 1355... Line 1407...
1355
            Error ("Unknown suboption to ResolveLibFile: $_" );
1407
            Error ("Unknown suboption to ResolveLibFile: $_" );
1356
        }
1408
        }
1357
    }
1409
    }
1358
 
1410
 
1359
    #
1411
    #
-
 
1412
    #   Determine the paths to search
-
 
1413
    #
-
 
1414
    if ( $from_package )
-
 
1415
    {
-
 
1416
        unless ( @ResolveLibFileList )
-
 
1417
        {
-
 
1418
            push @ResolveLibFileList, $opt_pkgdir . '/lib';
-
 
1419
            foreach my $entry ( getPackageList() )
-
 
1420
            {
-
 
1421
                push @ResolveLibFileList, $entry->getLibDirs(3);
-
 
1422
            }
-
 
1423
        }
-
 
1424
        @path = @ResolveLibFileList;
-
 
1425
    }
-
 
1426
    else
-
 
1427
    {
-
 
1428
        @path = ($opt_libdir, $opt_locallibdir);
-
 
1429
    }
-
 
1430
 
-
 
1431
    #
1360
    #   Determine a full list of 'parts' to search
1432
    #   Determine a full list of 'parts' to search
1361
    #   This is provided within the build information
1433
    #   This is provided within the build information
1362
    #
1434
    #
1363
    my @parts = getPlatformParts ();
1435
    my @parts = getPlatformParts ();
1364
    push @parts, '';
1436
    push @parts, '';
Line 1384... Line 1456...
1384
                $sfile = "$root/$subdir/$sfile";
1456
                $sfile = "$root/$subdir/$sfile";
1385
                $sfile =~ s~//~/~g;
1457
                $sfile =~ s~//~/~g;
1386
                Verbose2("LocateLibFile: $sfile");
1458
                Verbose2("LocateLibFile: $sfile");
1387
                if ( $exact )
1459
                if ( $exact )
1388
                {
1460
                {
1389
                    push @done, $sfile if ( -f $sfile );
1461
                    push @done, $sfile if ( -f $sfile || -l $sfile );
1390
                }
1462
                }
1391
                else
1463
                else
1392
                {
1464
                {
1393
                    push @done, glob ( $sfile );
1465
                    push @done, glob ( $sfile );
1394
                }
1466
                }
1395
            }
1467
            }
1396
        }
1468
        }
1397
    }
1469
    }
1398
 
1470
 
1399
    Error ("ResolveLibFile: File not found: $file")
1471
    Error ("ResolveLibFile: File not found: $file", "Search Path:", @path)
1400
        unless ( @done );
1472
        unless ( @done );
1401
 
1473
 
1402
    Warning ("ResolveLibFile: Multiple instances of file found. Only first is used", @done)
1474
    Warning ("ResolveLibFile: Multiple instances of file found. Only first is used", @done)
1403
        if ( $#done > 0 && ! $wildcard && !wantarray );
1475
        if ( $#done > 0 && ! $wildcard && !wantarray );
1404
 
1476