]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/fault_mgmt.git/blob - package.bld
Initial commit.
[keystone-rtos/fault_mgmt.git] / package.bld
1 /******************************************************************************
2  * FILE PURPOSE: Build description for the Fault Management
3  ******************************************************************************
4  * FILE NAME: package.bld
5  *
6  * DESCRIPTION: 
7  *  This file contains the build specification and description for the 
8  *  Packet Library
9  *  
10  *  The file takes the following parameters from the command line through the
11  *  XDCARGS variable.
12  *      XDCARGS[0] = Consumer Library Install Type 
13  *      Valid Values are "TAR" or "SETUP"
14  *      DEFAULT is "SETUP"
15  *
16  *  Example for a valid command:
17  *      xdc XDCARGS="SETUP" release   
18  *
19  * Copyright (C) 2012-2014 Texas Instruments, Inc.
20  *****************************************************************************/
22 /* List of all subdirectories that combine to make the Fault Management Package. */
23 var subDirectories = [ "src", "docs", "device", "test", "include", "util"];
25 /* Determine if we need to create the InstallJammer Application or not? 
26  * Fault Management Deliverables be either of the following formats:
27  *  - TAR Ball Package
28  *  - Setup Executable 
29  * DEFAULT is a TAR Executable. */
31 if ((arguments[0] != "TAR") && (arguments[0] != "SETUP"))
32     fault_mgmtlibInstallType = "TAR";
33 else
34     fault_mgmtlibInstallType = arguments[0];
36 /* Irrespective of the InstallType we always create a TAR Ball Package as a part
37  * of the RTSC Build. Here we determine the name of the TAR Ball Package
38  *  Format is as follows:
39  *      fault_mgmtlib_<version> */
40 var fault_mgmtlibRTSCFileName = "fault_mgmtlib" + "_" + fault_mgmtlibPartNumber + "_" +
41                       fault_mgmtlibReleaseVersion[0] + "_" +  fault_mgmtlibReleaseVersion[1] + "_" + 
42                       fault_mgmtlibReleaseVersion[2]  + "_" + fault_mgmtlibReleaseVersion[3];
44 /*****************************************************************
45  ************************ Release Banner *************************
46  *****************************************************************/
48 print ("************* Fault Management Library Build Information *************");
49 print ("Fault Management Lib Install : " + fault_mgmtlibInstallType);
50 print ("Fault Management Lib Version : " + fault_mgmtlibReleaseVersion);
51 print ("Tools Directory              : " + toolsBaseDir);
52 print ("RTSC File Name               : " + fault_mgmtlibRTSCFileName);
53 print ("Fault Management Lib Path    : " + fault_mgmtlibPath);
54 print ("Coverity Analysis            : " + (coverityAnalysis == "ON" ? "ON" : "OFF"));
55 print ("C66  LE opts                 : " + C66LE.ccOpts.prefix);
56 print ("C66  BE opts                 : " + C66BE.ccOpts.prefix);
57 print ("***********************************************************");
59 /* Create the release package for the Fault Management Library */
60 Pkg.defaultRelease = Pkg.addRelease (fault_mgmtlibRTSCFileName, {prefix: "./packages/"});
62 /* Moving forward we need to set the Archiver of the package to be ZIP. This is currently
63  * not supported in the XDC tools being used. Currenly builds need to be done with the 
64  * following options:-
65  *   xdc MK_FIXLISTOPTS=-t release 
66  * ZIP is a better option as it works natively with INSTALL Jammer and we can remove the
67  * uncompression into a temporary directory. XDC Tools with xdc-rXX support the ZIP archiver. */
68 //Pkg.attrs = {archiver : "zip"};
70 /* Cycle through all the sub-directories and build all the files */
71 for (var i = 0; i < subDirectories.length; i++) 
72 {
73     /* Load the capsule in the sub directory. */
74     var caps = xdc.loadCapsule (subDirectories[i]+"/Module.xs");
76     print ("Building directory " + subDirectories[i]);
78     /* Build the capsule. */
79     caps.modBuild();
81     /* Package the module.xs files for building via package */
82     Pkg.otherFiles[Pkg.otherFiles.length++] = subDirectories[i]+"/Module.xs";
83 }
85 /* Package the remaining files */
86 Pkg.otherFiles[Pkg.otherFiles.length++] = "config.bld";
87 Pkg.otherFiles[Pkg.otherFiles.length++] = "package.bld";
88 Pkg.otherFiles[Pkg.otherFiles.length++] = "package.xdc";
89 Pkg.otherFiles[Pkg.otherFiles.length++] = "Settings.xdc";
90 Pkg.otherFiles[Pkg.otherFiles.length++] = "fault_mgmt.h";
91 Pkg.otherFiles[Pkg.otherFiles.length++] = "fault_mgmt_osal.h";
92 Pkg.otherFiles[Pkg.otherFiles.length++] = "fault_mgmtlibver.h";
93 Pkg.otherFiles[Pkg.otherFiles.length++] = "docs/Doxyfile";
94 Pkg.otherFiles[Pkg.otherFiles.length++] = "build/buildlib.xs";
95 Pkg.otherFiles[Pkg.otherFiles.length++] = "docs/ReleaseNotes_fault_mgmt.pdf";
96 Pkg.otherFiles[Pkg.otherFiles.length++] = "makefile";
98 /* Generate Users Manual Doxyfile */
99 var tplt = xdc.loadTemplate("./docs/doxyfile.xdt");
100 tplt.genFile("./docs/Doxyfile",fault_mgmtlibReleaseVersion); 
102 /* Generate Settings.xdc */
103 var tplt = xdc.loadTemplate("./Settings.xdc.xdt");
104 tplt.genFile("./Settings.xdc",fault_mgmtlibReleaseVersion); 
106 /* Generate fault_mgmtlibver.h */
107 var tplt = xdc.loadTemplate("./fault_mgmtlibver.h.xdt");
108 tplt.genFile("./fault_mgmtlibver.h",fault_mgmtlibReleaseVersion);      
110 /* Check if we need to create the mini package? */
111 var miniBuild = java.lang.System.getenv("MINI_PACKAGE");
113 if (miniBuild == "ON")
115     /***************************************************************************
116      ********************************* MINI Package ****************************
117      ***************************************************************************/
118     /* Create the MINI RTSC Package */
119     var libUtility = xdc.loadCapsule ("build/buildlib.xs");
120     libUtility.createMiniPkg(fault_mgmtlibRTSCFileName);
123 /********************************************************************* 
124  *********************** INSTALL-JAMMER Support **********************
125  * In order to create the InstallJammer Application; we need to UNTAR
126  * the package into a temporary directory. This is required because 
127  * currently the InstallJammer does not support the TAR Files and thus
128  * creating an UNTAR of the file. So to work-around the problem we will
129  * do the following in the EPILOGUE Section:-
130  *  (a) Create a temporary directory called 'tmp'
131  *  (b) UNTAR the package into 'tmp'
132  *  (c) Run the INSTALL Jammer on 'tmp'
133  *  (d) Remove the 'tmp' directory.
134  *
135  * This can be done only after the 'release' package has been created.
136  * Thus all of this work is being done in the EPILOGUE.
137  *********************************************************************/
138 if (fault_mgmtlibInstallType == "SETUP")
140     /* Create the Install Jammer Version Variable. This is used inside the 
141      * MPI File to create the Final executable. 
142      *  The format supported is as follows:-
143      *   - setupwin32_fault_mgmtlib-<part_number>-<version>.exe 
144      *      This is for Fault Management Libraries and Header files
145      */
146     var InstallJammerVersion = "-DVersion " + fault_mgmtlibPartNumber + "_" +
147                                fault_mgmtlibReleaseVersion[0] + "_" +  fault_mgmtlibReleaseVersion[1]  + "_" + 
148                                fault_mgmtlibReleaseVersion[2]  + "_" + fault_mgmtlibReleaseVersion[3];
150     /* This is the location where the tmp directory is located; this is used as 
151      * the input directory for the Install Jammer. */ 
152     var PackageBaseDir = " -DPackageBaseDir " + fault_mgmtlibPath + "./tmp";
154     /* This is the location where the Fault Management will be installed by default. */
155     var WinInstallDir = " -DWinInstallDir C:/Program Files/Texas Instruments/fault_mgmtlib" + "_" + 
156                             fault_mgmtlibPartNumber + "_" + 
157                             fault_mgmtlibReleaseVersion[0] + "_" + fault_mgmtlibReleaseVersion[1] + "_" +  
158                             fault_mgmtlibReleaseVersion[2]  + "_" + fault_mgmtlibReleaseVersion[3];
160     /* Create the actual EPILOGUE Section for the INSTALLER */
161     Pkg.makeEpilogue += "release: install_application\n";
162     Pkg.makeEpilogue += "install_application:\n";
163     Pkg.makeEpilogue += "\t @echo -------------------------------------------------------\n";
164     Pkg.makeEpilogue += "\t @echo Creating the Install\n";
165     Pkg.makeEpilogue += "\t @echo -------------------------------------------------------\n";
166     Pkg.makeEpilogue += "\t -$(MKDIR) tmp\n";
167     Pkg.makeEpilogue += "\t -$(MKDIR) tmp/packages\n";
168     Pkg.makeEpilogue += "\t -$(MKDIR) tmp/eclipse\n";
169     Pkg.makeEpilogue += "\t -$(CP) -R eclipse tmp\n";
170     Pkg.makeEpilogue += "\t tar -xf ./packages/" + fault_mgmtlibRTSCFileName + ".tar" + " -Ctmp/packages \n";
171     Pkg.makeEpilogue += "\t installjammer " + InstallJammerVersion + PackageBaseDir + WinInstallDir + 
172                         " --output-dir packages/ --build install/fault_mgmtlib.mpi\n";
173     Pkg.makeEpilogue += "\t -$(RMDIR) /S /Q tmp\n\n";
175 /* We need to clean after ourselves; extend the 'clean' target to take care of this. */
176 Pkg.makeEpilogue += "clean::\n";
177     Pkg.makeEpilogue += "\t -$(RM) packages/*.exe\n";
178     Pkg.makeEpilogue += "\t -$(RM) packages/*.bin\n";