1 /******************************************************************************
2 * FILE PURPOSE: Build description for the Watchdog Timer Module
3 ******************************************************************************
4 * FILE NAME: package.bld
5 *
6 * DESCRIPTION:
7 * This file contains the build specification and description for the
8 * Watchdog Timer Library
9 *
10 * The file takes the following parameters from the command line through the
11 * XDCARGS variable.
12 * XDCARGS[0] = WatchdogTimer 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 Watchdog Timer Package. */
23 var subDirectories = [ "src", "docs", "test"];
25 /* Generate WatchdogTimerver.h */
26 var tplt = xdc.loadTemplate("./WatchdogTimerver.h.xdt");
27 tplt.genFile("./WatchdogTimerver.h",lldReleaseVersion);
29 /* Determine if we need to create the InstallJammer Application or not?
30 * Watchdog Timer 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 = "WatchdogTimer" + "_" + lldPartNumber + "_" +
45 lldReleaseVersion[0] + "_" + lldReleaseVersion[1] + "_" +
46 lldReleaseVersion[2] + "_" + lldReleaseVersion[3];
48 /*****************************************************************
49 ************************ Release Banner *************************
50 *****************************************************************/
52 print ("************* Watchdog Timer Module Build Information *************");
53 print ("Watchdog Timer Install : " + lldInstallType);
54 print ("Watchdog Timer Version : " + lldReleaseVersion);
55 print ("C66 Tools Directory : " + c66ToolsBaseDir);
56 print ("RTSC File Name : " + lldRTSCFileName);
57 print ("Watchdog Timer Path : " + lldPath);
58 print ("CC LE opts : " + C66LE.ccOpts.prefix);
59 print ("CC BE opts : " + C66BE.ccOpts.prefix);
60 print ("***********************************************************");
62 /* Create the release package for the Watchdog Timer Module */
63 Pkg.defaultRelease = Pkg.addRelease (lldRTSCFileName, {prefix: "./packages/"});
65 /* Moving forward we need to set the Archiver of the package to be ZIP. This is currently
66 * not supported in the XDC tools being used. Currenly builds need to be done with the
67 * following options:-
68 * xdc MK_FIXLISTOPTS=-t release
69 * ZIP is a better option as it works natively with INSTALL Jammer and we can remove the
70 * uncompression into a temporary directory. XDC Tools with xdc-rXX support the ZIP archiver. */
71 //Pkg.attrs = {archiver : "zip"};
73 /* Cycle through all the sub-directories and build all the files */
74 for (var i = 0; i < subDirectories.length; i++)
75 {
76 /* Load the capsule in the sub directory. */
77 var caps = xdc.loadCapsule (subDirectories[i]+"/Module.xs");
79 print ("Building directory " + subDirectories[i]);
81 /* Build the capsule. */
82 caps.modBuild();
84 /* Package the module.xs files for building via package */
85 Pkg.otherFiles[Pkg.otherFiles.length++] = subDirectories[i]+"/Module.xs";
86 }
88 /* Package the remaining files */
89 Pkg.otherFiles[Pkg.otherFiles.length++] = "config.bld";
90 Pkg.otherFiles[Pkg.otherFiles.length++] = "package.bld";
91 Pkg.otherFiles[Pkg.otherFiles.length++] = "package.xdc";
92 Pkg.otherFiles[Pkg.otherFiles.length++] = "package.xs";
93 Pkg.otherFiles[Pkg.otherFiles.length++] = "Settings.xdc";
94 Pkg.otherFiles[Pkg.otherFiles.length++] = "Settings.xdc.xdt";
95 Pkg.otherFiles[Pkg.otherFiles.length++] = "WatchdogTimer.xdc";
96 Pkg.otherFiles[Pkg.otherFiles.length++] = "WatchdogTimer.xs";
97 Pkg.otherFiles[Pkg.otherFiles.length++] = "WatchdogTimer.h";
98 Pkg.otherFiles[Pkg.otherFiles.length++] = "WatchdogTimerver.h";
99 Pkg.otherFiles[Pkg.otherFiles.length++] = "WatchdogTimerver.h.xdt";
100 Pkg.otherFiles[Pkg.otherFiles.length++] = "docs/Doxyfile";
101 Pkg.otherFiles[Pkg.otherFiles.length++] = "docs/doxyfile.xdt";
102 Pkg.otherFiles[Pkg.otherFiles.length++] = "build/buildlib.xs";
103 Pkg.otherFiles[Pkg.otherFiles.length++] = "makefile";
105 /* Generate Users Manual Doxyfile */
106 var tplt = xdc.loadTemplate("./docs/doxyfile.xdt");
107 tplt.genFile("./docs/Doxyfile",lldReleaseVersion);
109 /* Generate Settings.xdc */
110 var tplt = xdc.loadTemplate("./Settings.xdc.xdt");
111 tplt.genFile("./Settings.xdc",lldReleaseVersion);
113 /* Check if we need to create the mini package? */
114 var miniBuild = java.lang.System.getenv("MINI_PACKAGE");
116 if (miniBuild == "ON")
117 {
118 /***************************************************************************
119 ********************************* MINI Package ****************************
120 ***************************************************************************/
121 /* Create the MINI RTSC Package */
122 var libUtility = xdc.loadCapsule ("build/buildlib.xs");
123 libUtility.createMiniPkg(lldRTSCFileName);
124 }
126 /*********************************************************************
127 *********************** INSTALL-JAMMER Support **********************
128 * In order to create the InstallJammer Application; we need to UNTAR
129 * the package into a temporary directory. This is required because
130 * currently the InstallJammer does not support the TAR Files and thus
131 * creating an UNTAR of the file. So to work-around the problem we will
132 * do the following in the EPILOGUE Section:-
133 * (a) Create a temporary directory called 'tmp'
134 * (b) UNTAR the package into 'tmp'
135 * (c) Run the INSTALL Jammer on 'tmp'
136 * (d) Remove the 'tmp' directory.
137 *
138 * This can be done only after the 'release' package has been created.
139 * Thus all of this work is being done in the EPILOGUE.
140 *********************************************************************/
141 if (lldInstallType == "SETUP")
142 {
143 /* Create the Install Jammer Version Variable. This is used inside the
144 * MPI File to create the Final executable.
145 * The format supported is as follows:-
146 * - setupwin32_WatchdogTimer-<part_number>-<version>.exe
147 * This is for WatchdogTimer libraries and Header files
148 */
149 var InstallJammerVersion = "-DVersion " + lldPartNumber + "_" + lldReleaseVersion[0] + "_" +
150 lldReleaseVersion[1] + "_" + lldReleaseVersion[2] + "_" + lldReleaseVersion[3];
152 /* This is the location where the tmp directory is located; this is used as
153 * the input directory for the Install Jammer. */
154 var PackageBaseDir = " -DPackageBaseDir " + lldPath + "./tmp";
156 /* This is the location where the WatchdogTimer module will be installed by default. */
157 var WinInstallDir = " -DWinInstallDir C:/ti/WatchdogTimer" + "_" +
158 lldPartNumber + "_" +
159 lldReleaseVersion[0] + "_" + lldReleaseVersion[1] + "_" +
160 lldReleaseVersion[2] + "_" + lldReleaseVersion[3];
162 /* Create the actual EPILOGUE Section for the INSTALLER */
163 Pkg.makeEpilogue += "release: install_application\n";
164 Pkg.makeEpilogue += "install_application:\n";
165 Pkg.makeEpilogue += "\t @echo -------------------------------------------------------\n";
166 Pkg.makeEpilogue += "\t @echo Creating the Install\n";
167 Pkg.makeEpilogue += "\t @echo -------------------------------------------------------\n";
168 Pkg.makeEpilogue += "\t -$(MKDIR) tmp\n";
169 Pkg.makeEpilogue += "\t -$(MKDIR) tmp/packages\n";
170 Pkg.makeEpilogue += "\t -$(MKDIR) tmp/eclipse\n";
171 Pkg.makeEpilogue += "\t -$(CP) -R eclipse tmp\n";
172 Pkg.makeEpilogue += "\t tar -xf ./packages/" + lldRTSCFileName + ".tar" + " -Ctmp/packages \n";
173 Pkg.makeEpilogue += "\t installjammer " + InstallJammerVersion + PackageBaseDir + WinInstallDir +
174 " --output-dir packages/ --build install/WatchdogTimer.mpi\n";
175 Pkg.makeEpilogue += "\t -$(RMDIR) /S /Q tmp\n\n";
176 }
178 /* We need to clean after ourselves; extend the 'clean' target to take care of this. */
179 Pkg.makeEpilogue += "clean::\n";
180 Pkg.makeEpilogue += "\t -$(RM) docs/Doxyfile Settings.xdc WatchdogTimerver.h\n";
181 Pkg.makeEpilogue += "\t -$(RM) makefile\n";
182 Pkg.makeEpilogue += "\t -$(RMDIR) docs/doxygen\n";
183 if (lldInstallType == "SETUP")
184 {
185 Pkg.makeEpilogue += "\t -$(RM) packages/*.exe\n";
186 Pkg.makeEpilogue += "\t -$(RM) packages/*.bin\n";
187 Pkg.makeEpilogue += "\t -$(RMDIR) eclipse\n\n";
188 }
189 if (miniBuild == "ON")
190 {
191 Pkg.makeEpilogue += "\t -$(RM) simpleC66LE.mak\n";
192 Pkg.makeEpilogue += "\t -$(RM) simpleC66BE.mak\n";
193 }