summaryrefslogtreecommitdiff
path: root/setup_native
diff options
context:
space:
mode:
authorEilidh McAdam <eilidh@lanedo.com>2012-07-13 14:41:17 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2012-07-18 11:02:44 +0200
commit0977c5121e63522137a7b00c41d07112c192ef9e (patch)
tree8d915977fbff250322b4eeb010c0361bd54e7cd5 /setup_native
parentae0e379a443585fd34522385144fdd69baa6105f (diff)
Use lcab to generate cabinets for now.
lcab is expected in the sys. path. Change-Id: Ie1cd8a45966bbd84ce84f2ad1d86da492eafa321 Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch>
Diffstat (limited to 'setup_native')
-rw-r--r--setup_native/source/win32/wintools/makecab/makecab.c66
1 files changed, 35 insertions, 31 deletions
diff --git a/setup_native/source/win32/wintools/makecab/makecab.c b/setup_native/source/win32/wintools/makecab/makecab.c
index b822cd669ba6..3cca94539db2 100644
--- a/setup_native/source/win32/wintools/makecab/makecab.c
+++ b/setup_native/source/win32/wintools/makecab/makecab.c
@@ -298,6 +298,8 @@ int main(int argc, char *argv[])
DDFSRCFILE *srcListCurr = NULL;
HFCI fci = NULL;
ERF erf;
+ char * cmd = NULL;
+ unsigned int cmdSize = 0;
while (argv[1] && (argv[1][0] == '-' || argv[1][0] == '/'))
{
@@ -324,44 +326,45 @@ int main(int argc, char *argv[])
}
CabVerb = v;
- srcList = srcListCurr;
- if (ddfFile != NULL)
+ if (ddfFile == NULL)
{
- cabLog(CABLOG_MSG, "=== Parsing directive file \"%s\"===", ddfFile);
- switch(ParseDdf(ddfFile, &ddfVars, &srcListCurr, v))
- {
- case DDFERR_UNREAD: cabLog(CABLOG_ERR, "Could not open directive file."); break;
- }
- getcwd(ddfVars.szCabPath, MAX_PATH-1);
- strcat(ddfVars.szCabPath, "/");
+ cabLog(CABLOG_ERR, "No DDF file specified.");
+ return 1;
}
- if (srcListCurr != NULL)
+ cabLog(CABLOG_MSG, "=== Parsing directive file \"%s\"===", ddfFile);
+ switch(ParseDdf(ddfFile, &ddfVars, &srcListCurr, v))
{
- cabLogCCAB(&ddfVars);
- fci = FCICreate(&erf, fnFilePlaced, fnMemAlloc, fnMemFree, fnOpen, fnRead,
- fnWrite, fnClose, fnSeek, fnDelete, fnGetTempFile, &ddfVars, NULL);
+ case DDFERR_UNREAD: cabLog(CABLOG_ERR, "Could not open directive file."); break;
+ }
+ getcwd(ddfVars.szCabPath, MAX_PATH-1);
+ strcat(ddfVars.szCabPath, "/");
- if (fci != NULL)
- {
- cabLog(CABLOG_MSG, "=== Adding files to cabinet ===");
- for (;srcListCurr != NULL; srcListCurr = srcListCurr->next)
- {
- cabLog(CABLOG_MSG, "Adding file: %s%s (%s)", ddfVars.szCabPath, srcListCurr->fileName, srcListCurr->cabName);
- if (!FCIAddFile(fci, srcListCurr->fileName, srcListCurr->cabName, srcListCurr->extract, fnGetNextCab, fnStatus, fnGetOpenInfo, srcListCurr->cmpType))
- cabLogErr(&erf, "A problem occurred while adding a file");
- }
+ srcList = srcListCurr;
+ if (srcList == NULL)
+ {
+ cabLog(CABLOG_ERR, "No input files were specified.");
+ return 2;
+ }
- cabLog(CABLOG_MSG, "=== Flushing the cabinet ===");
- if (!FCIFlushCabinet(fci, FALSE, fnGetNextCab, fnStatus))
- cabLogErr(&erf, "A problem occurred while flushing the cabinet");
- FCIDestroy(fci);
- }
- else
- {
- cabLogErr(&erf, "Could not get FCI context");
- }
+ /* Construct system call to lcab */
+ for(srcListCurr = srcList; srcListCurr != NULL; srcListCurr = srcListCurr->next)
+ cmdSize += strlen(srcListCurr->fileName) + 1;
+ cmdSize += strlen(ddfVars.szCabPath) + strlen(ddfVars.szCab);
+ cmdSize += 6; /* room for "lcab " and \0 */
+ cmd = malloc(cmdSize);
+ strcpy(cmd, "lcab ");
+ for (srcListCurr = srcList; srcListCurr != NULL; srcListCurr = srcListCurr->next)
+ {
+ strcat(cmd, srcListCurr->fileName);
+ strcat(cmd, " ");
}
+ strcat(cmd, ddfVars.szCabPath);
+ strcat(cmd, ddfVars.szCab);
+
+ cabLog(CABLOG_MSG, "syscall: %s\n", cmd);
+ system(cmd);
+ free(cmd);
cabLog(CABLOG_MSG, "=== Cleaning up resources ===");
/* Free list of cab source files */
@@ -371,5 +374,6 @@ int main(int argc, char *argv[])
free(srcListCurr);
srcListCurr = next;
}
+ cabLog(CABLOG_MSG, "Cabinet file %s/%s created.", ddfVars.szCabPath, ddfVars.szCab);
return 0;
}