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 * FM Library
9 *
10 * The file takes the following parameters from the command line through the
11 * XDCARGS variable.
12 * XDCARGS[0] = FM 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-2015, Texas Instruments, Inc.
20 *****************************************************************************/
22 /* List of all subdirectories that combine to make the Fault Management Package. */
23 var subDirectories = ["src", "docs", "device", "include", "test", "util"];
25 /* Generate fault_mgmtlibver.h */
26 var tplt = xdc.loadTemplate("./fault_mgmtlibver.h.xdt");
27 tplt.genFile("./fault_mgmtlibver.h",lldReleaseVersion);
29 /* Determine if we need to create the InstallJammer Application or not?
30 * Fault Management Deliverables be either of the following formats:
31 * - TAR Ball Package
32 * - Setup Executable
33 * DEFAULT is a TAR Executable. */
35 if ((arguments[0] != "TAR") && (arguments[0] != "SETUP"))
36 lldInstallType = "TAR";
37 else
38 lldInstallType = arguments[0];
40 /* Irrespective of the InstallType we always create a TAR Ball Package as a part
41 * of the RTSC Build. Here we determine the name of the TAR Ball Package
42 * Format is as follows:
43 * lld_<version> */
44 var lldRTSCFileName = "fault_mgmtlib" + "_" + lldPartNumber + "_" +
45 lldReleaseVersion[0] + "_" + lldReleaseVersion[1] + "_" +
46 lldReleaseVersion[2] + "_" + lldReleaseVersion[3];
48 /******************************************************************
49 ************************ Release Banner **************************
50 ******************************************************************/
52 print ("************* Fault Management Library Build Information *************");
53 print ("Fault Management Lib Install : " + lldInstallType);
54 print ("Fault Management Lib Version : " + lldReleaseVersion);
55 print ("C66 Tools Directory : " + c66ToolsBaseDir);
56 print ("RTSC File Name : " + lldRTSCFileName);
57 print ("Fault Management Lib Path : " + lldPath);
58 print ("CC LE opts : " + C66LE.ccOpts.prefix);
59 print ("***********************************************************");
61 /* Create the release package for the Fault Management Library */
62 Pkg.defaultRelease = Pkg.addRelease (lldRTSCFileName, {prefix: "./packages/"});
64 /* Moving forward we need to set the Archiver of the package to be ZIP. This is currently
65 * not supported in the XDC tools being used. Currenly builds need to be done with the
66 * following options:-
67 * xdc MK_FIXLISTOPTS=-t release
68 * ZIP is a better option as it works natively with INSTALL Jammer and we can remove the
69 * uncompression into a temporary directory. XDC Tools with xdc-rXX support the ZIP archiver. */
70 //Pkg.attrs = {archiver : "zip"};
72 /* Cycle through all the sub-directories and build all the files */
73 for (var i = 0; i < subDirectories.length; i++)
74 {
75 /* Load the capsule in the sub directory. */
76 var caps = xdc.loadCapsule (subDirectories[i]+"/Module.xs");
78 print ("Building directory " + subDirectories[i]);
80 /* Build the capsule. */
81 caps.modBuild();
83 /* Package the module.xs files for building via package */
84 Pkg.otherFiles[Pkg.otherFiles.length++] = subDirectories[i]+"/Module.xs";
85 }
87 /* Package the remaining files */
88 Pkg.otherFiles[Pkg.otherFiles.length++] = "config.bld";
89 Pkg.otherFiles[Pkg.otherFiles.length++] = "package.bld";
90 Pkg.otherFiles[Pkg.otherFiles.length++] = "package.xdc";
91 Pkg.otherFiles[Pkg.otherFiles.length++] = "package.xs";
92 Pkg.otherFiles[Pkg.otherFiles.length++] = "Settings.xdc";
93 Pkg.otherFiles[Pkg.otherFiles.length++] = "Settings.xdc.xdt";
94 Pkg.otherFiles[Pkg.otherFiles.length++] = "fault_mgmt.h";
95 Pkg.otherFiles[Pkg.otherFiles.length++] = "fault_mgmt_osal.h";
96 Pkg.otherFiles[Pkg.otherFiles.length++] = "fault_mgmtlibver.h";
97 Pkg.otherFiles[Pkg.otherFiles.length++] = "fault_mgmtlibver.h.xdt";
98 Pkg.otherFiles[Pkg.otherFiles.length++] = "docs/Doxyfile";
99 Pkg.otherFiles[Pkg.otherFiles.length++] = "docs/doxyfile.xdt";
100 Pkg.otherFiles[Pkg.otherFiles.length++] = "build/buildlib.xs";
101 Pkg.otherFiles[Pkg.otherFiles.length++] = "makefile";
103 /* Generate Users Manual Doxyfile */
104 var tplt = xdc.loadTemplate("./docs/doxyfile.xdt");
105 tplt.genFile("./docs/Doxyfile",lldReleaseVersion);
107 /* Generate Settings.xdc */
108 var tplt = xdc.loadTemplate("./Settings.xdc.xdt");
109 tplt.genFile("./Settings.xdc",lldReleaseVersion);
111 /* Check if we need to create the mini package? */
112 var miniBuild = java.lang.System.getenv("MINI_PACKAGE");
114 if (miniBuild == "ON")
115 {
116 /***************************************************************************
117 ********************************* MINI Package ****************************
118 ***************************************************************************/
119 /* Create the MINI RTSC Package */
120 var libUtility = xdc.loadCapsule ("build/buildlib.xs");
121 libUtility.createMiniPkg(lldRTSCFileName);
122 }
124 /*********************************************************************
125 *********************** INSTALL-JAMMER Support **********************
126 * In order to create the InstallJammer Application; we need to UNTAR
127 * the package into a temporary directory. This is required because
128 * currently the InstallJammer does not support the TAR Files and thus
129 * creating an UNTAR of the file. So to work-around the problem we will
130 * do the following in the EPILOGUE Section:-
131 * (a) Create a temporary directory called 'tmp'
132 * (b) UNTAR the package into 'tmp'
133 * (c) Run the INSTALL Jammer on 'tmp'
134 * (d) Remove the 'tmp' directory.
135 *
136 * This can be done only after the 'release' package has been created.
137 * Thus all of this work is being done in the EPILOGUE.
138 *********************************************************************/
139 if (lldInstallType == "SETUP")
140 {
141 /* Create the Install Jammer Version Variable. This is used inside the
142 * MPI File to create the Final executable.
143 * The format supported is as follows:-
144 * - setupwin32_fault_mgmtlib-<part_number>-<version>.exe
145 * This is for Fault Management Libraries and Header files
146 */
147 var InstallJammerVersion = "-DVersion " + lldPartNumber + "_" + lldReleaseVersion[0] + "_" +
148 lldReleaseVersion[1] + "_" + lldReleaseVersion[2] + "_" + lldReleaseVersion[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 " + lldPath + "./tmp";
154 /* This is the location where the Fault Management will be installed by default. */
155 var WinInstallDir = " -DWinInstallDir C:/ti/fault_mgmtlib" + "_" +
156 lldPartNumber + "_" +
157 lldReleaseVersion[0] + "_" + lldReleaseVersion[1] + "_" +
158 lldReleaseVersion[2] + "_" + lldReleaseVersion[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/" + lldRTSCFileName + ".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";
174 }
176 /* We need to clean after ourselves; extend the 'clean' target to take care of this. */
177 Pkg.makeEpilogue += "clean::\n";
178 Pkg.makeEpilogue += "\t -$(RM) docs/Doxyfile Settings.xdc fault_mgmtlibver.h\n";
179 Pkg.makeEpilogue += "\t -$(RM) makefile\n";
180 Pkg.makeEpilogue += "\t -$(RMDIR) docs/doxygen\n";
181 if (lldInstallType == "SETUP")
182 {
183 Pkg.makeEpilogue += "\t -$(RM) packages/*.exe\n";
184 Pkg.makeEpilogue += "\t -$(RM) packages/*.bin\n";
185 Pkg.makeEpilogue += "\t -$(RMDIR) eclipse\n\n";
186 }
187 if (miniBuild == "ON")
188 {
189 Pkg.makeEpilogue += "\t -$(RM) simpleC66LE.mak\n";
190 }