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