diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/adk/depmaker.c | 42 | ||||
-rw-r--r-- | tools/adk/pkgrebuild.c | 81 |
2 files changed, 79 insertions, 44 deletions
diff --git a/tools/adk/depmaker.c b/tools/adk/depmaker.c index 1f11f1724..603a59739 100644 --- a/tools/adk/depmaker.c +++ b/tools/adk/depmaker.c @@ -1,7 +1,7 @@ /* * depmaker - create package/Depends.mk for OpenADK buildsystem * - * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> + * Copyright (C) 2010,2011 Waldemar Brodkorb <wbx@openadk.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,7 +130,7 @@ int main() { FILE *pkg; char buf[MAXLINE]; char path[MAXPATH]; - char *string, *pkgvar, *pkgdeps, *tmp; + char *string, *pkgvar, *pkgdeps, *tmp, *fpkg, *cpkg, *spkg, *key, *check; int i; /* read Makefile's for all packages */ @@ -200,23 +200,55 @@ int main() { strncat(pkgdeps, tmp, strlen(tmp)); } + // WE need to find the subpackage name here + string = strstr(buf, "PKG_FLAVOURS_"); + if (string != NULL) { + check = strstr(buf, ":="); + if (check != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + fpkg = strdup(key+13); + } + } + string = strstr(buf, "PKGFB_"); if (string != NULL) { - tmp = parse_line(pkgdirp->d_name, pkgvar, string, 1, 0); + tmp = parse_line(pkgdirp->d_name, fpkg, string, 1, 0); if (tmp != NULL) strncat(pkgdeps, tmp, strlen(tmp)); } + // WE need to find the subpackage name here + string = strstr(buf, "PKG_CHOICES_"); + if (string != NULL) { + check = strstr(buf, ":="); + if (check != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + cpkg = strdup(key+12); + } + } string = strstr(buf, "PKGCB_"); if (string != NULL) { - tmp = parse_line(pkgdirp->d_name, pkgvar, string, 1, 0); + tmp = parse_line(pkgdirp->d_name, cpkg, string, 1, 0); if (tmp != NULL) strncat(pkgdeps, tmp, strlen(tmp)); } + // WE need to find the subpackage name here + string = strstr(buf, "PKG_SUBPKGS_"); + if (string != NULL) { + check = strstr(buf, ":="); + if (check != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + spkg = strdup(key+12); + } + } + string = strstr(buf, "PKGSB_"); if (string != NULL) { - tmp = parse_line(pkgdirp->d_name, pkgvar, string, 1, 1); + tmp = parse_line(pkgdirp->d_name, spkg, string, 1, 1); if (tmp != NULL) { strncat(pkgdeps, tmp, strlen(tmp)); } diff --git a/tools/adk/pkgrebuild.c b/tools/adk/pkgrebuild.c index 0a91834e7..e7f037ae5 100644 --- a/tools/adk/pkgrebuild.c +++ b/tools/adk/pkgrebuild.c @@ -1,7 +1,7 @@ /* * pkgrebuild - recognize required package rebuilds in OpenADK * - * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> + * Copyright (C) 2010,2011 Waldemar Brodkorb <wbx@openadk.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,8 +98,8 @@ static char *toupperstr(char *string) { int main() { FILE *config, *configold, *pkg; - char *key, *value, *string, *token; - char *pkg_name, *keystr; + char *key, *value, *string, *token, *check; + char *pkg_name, *keystr, *realpkgname; char buf[128]; char path[320]; char pbuf[320]; @@ -163,26 +163,48 @@ int main() { keystr = NULL; } } - string = strstr(pbuf, "PKG_FLAVOURS:="); + string = strstr(pbuf, "PKG_FLAVOURS_"); if (string != NULL) { - string[strlen(string)-1] = '\0'; - key = strtok(string, ":="); - value = strtok(NULL, "=\t"); - token = strtok(value, " "); - while (token != NULL) { - keystr = malloc(256); - memset(keystr, 0, 256); - strncat(keystr, "ADK_PACKAGE_", 12); - strncat(keystr, toupperstr(pkg_name), strlen(pkg_name)); - strncat(keystr, "_", 1); - strncat(keystr, token, strlen(token)); - strmap_put(pkgmap, keystr, pkgdirp->d_name); - token = strtok(NULL, " "); - free(keystr); - keystr = NULL; + check = strstr(pbuf, ":="); + if (check != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + realpkgname = strdup(key+13); + value = strtok(NULL, "=\t"); + token = strtok(value, " "); + while (token != NULL) { + keystr = malloc(256); + memset(keystr, 0, 256); + strncat(keystr, "ADK_PACKAGE_", 12); + strncat(keystr, realpkgname, strlen(realpkgname)); + strncat(keystr, "_", 1); + strncat(keystr, token, strlen(token)); + strmap_put(pkgmap, keystr, pkgdirp->d_name); + token = strtok(NULL, " "); + free(keystr); + keystr = NULL; + } + } else { + string[strlen(string)-1] = '\0'; + key = strtok(string, "+="); + realpkgname = strdup(key+13); + value = strtok(NULL, "=\t"); + token = strtok(value, " "); + while (token != NULL) { + keystr = malloc(256); + memset(keystr, 0, 256); + strncat(keystr, "ADK_PACKAGE_", 12); + strncat(keystr, realpkgname, strlen(realpkgname)); + strncat(keystr, "_", 1); + strncat(keystr, token, strlen(token)); + strmap_put(pkgmap, keystr, pkgdirp->d_name); + token = strtok(NULL, " "); + free(keystr); + keystr = NULL; + } } } - string = strstr(pbuf, "PKG_CHOICES:="); + string = strstr(pbuf, "PKG_CHOICES_"); if (string != NULL) { string[strlen(string)-1] = '\0'; key = strtok(string, ":="); @@ -201,25 +223,6 @@ int main() { keystr = NULL; } } - string = strstr(pbuf, "PKG_FLAVOURS+="); - if (string != NULL) { - string[strlen(string)-1] = '\0'; - key = strtok(string, "+="); - value = strtok(NULL, "=\t"); - token = strtok(value, " "); - while (token != NULL) { - keystr = malloc(256); - memset(keystr, 0, 256); - strncat(keystr, "ADK_PACKAGE_", 12); - strncat(keystr, toupperstr(pkg_name), strlen(pkg_name)); - strncat(keystr, "_", 1); - strncat(keystr, token, strlen(token)); - strmap_put(pkgmap, keystr, pkgdirp->d_name); - token = strtok(NULL, " "); - free(keystr); - keystr = NULL; - } - } } } fclose(pkg); |