diff options
Diffstat (limited to 'adk/tools')
-rw-r--r-- | adk/tools/Makefile | 6 | ||||
-rw-r--r-- | adk/tools/depmaker.c | 4 | ||||
-rw-r--r-- | adk/tools/pkgmaker.c | 87 |
3 files changed, 50 insertions, 47 deletions
diff --git a/adk/tools/Makefile b/adk/tools/Makefile index fd0a3c791..dec651462 100644 --- a/adk/tools/Makefile +++ b/adk/tools/Makefile @@ -6,12 +6,12 @@ include $(ADK_TOPDIR)/rules.mk install: ${STAGING_HOST_DIR}/usr/bin/depmaker ${STAGING_HOST_DIR}/usr/bin/pkgrebuild ${STAGING_HOST_DIR}/usr/bin/dkgetsz ${STAGING_HOST_DIR}/usr/bin/depmaker: depmaker.c - ${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -o $@ depmaker.c + ${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -w -o $@ depmaker.c ${STAGING_HOST_DIR}/usr/bin/pkgrebuild: pkgrebuild.c strmap.c - ${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -o $@ pkgrebuild.c strmap.c + ${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -w -o $@ pkgrebuild.c strmap.c ${STAGING_HOST_DIR}/usr/bin/dkgetsz: dkgetsz.c - ${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -o $@ dkgetsz.c + ${CC_FOR_BUILD} ${FLAGS_FOR_BUILD} -w -o $@ dkgetsz.c include $(ADK_TOPDIR)/mk/tools.mk diff --git a/adk/tools/depmaker.c b/adk/tools/depmaker.c index 7b04b3781..609d95a6a 100644 --- a/adk/tools/depmaker.c +++ b/adk/tools/depmaker.c @@ -133,7 +133,6 @@ static char *parse_line(char *package, char *pkgvar, char *string, int checksym, } strncat(depvar, dep, strlen(dep)-5); if ((strncmp(depvar, "bc", 2) == 0) || - (strncmp(depvar, "bzip2", 5) == 0) || (strncmp(depvar, "file", 4) == 0) || (strncmp(depvar, "gawk", 4) == 0) || (strncmp(depvar, "grep", 4) == 0) || @@ -277,6 +276,8 @@ int main() { tmp = parse_line(pkgdirp->d_name, dpkg, stringtmp, 1, 0, 2, &prefix); } else if (strncmp("MUSL", dpkg, 4) == 0) { tmp = parse_line(pkgdirp->d_name, dpkg, stringtmp, 1, 0, 2, &prefix); + } else if (strncmp("GLIBC", dpkg, 5) == 0) { + tmp = parse_line(pkgdirp->d_name, dpkg, stringtmp, 1, 0, 2, &prefix); } else { tmp = parse_line(pkgdirp->d_name, dpkg, stringtmp, 1, 0, 1, &prefix); } @@ -339,6 +340,7 @@ int main() { } } } else if (strncmp(buf, "HOST_BUILDDEP", 13) == 0) { + //printf("DEBUG: HOST_BUILDDEP found for %s\n", pkgdirp->d_name); asprintf(&string, "%s-host", pkgdirp->d_name); // check retval; string for NULL tmp = parse_line(string, NULL, buf, 2, 0, 0, &hprefix); diff --git a/adk/tools/pkgmaker.c b/adk/tools/pkgmaker.c index 451300548..e4306d7cc 100644 --- a/adk/tools/pkgmaker.c +++ b/adk/tools/pkgmaker.c @@ -19,6 +19,7 @@ #include <ctype.h> #include <dirent.h> +#include <errno.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> @@ -290,22 +291,44 @@ static char *tolowerstr(char *string) { static char *toupperstr(char *string) { + static char *sdup = NULL; + static int sduplen = 0; int i; - char *str; - + + if (!string) { + free(sdup); + sduplen = 0; + return NULL; + } + + if (sduplen <= strlen(string)) { + sduplen = strlen(string) + 1; + sdup = realloc(sdup, sduplen); + if (!sdup) + fatal_error("%s: memory allocation failed: %s\n", + __func__, strerror(errno)); + } + /* transform to uppercase variable name */ - str = strdup(string); - for (i=0; i<(int)strlen(str); i++) { - if (str[i] == '+') - str[i] = 'X'; - if (str[i] == '-') - str[i] = '_'; - /* remove negation here, useful for package host depends */ - if (str[i] == '!') - str[i] = '_'; - str[i] = toupper(str[i]); + for (i = 0; i < strlen(string) + 1; i++) { + switch (string[i]) { + case '+': + sdup[i] = 'X'; + break; + case '-': + sdup[i] = '_'; + break; + case '!': + sdup[i] = '_'; + break; + case '\0': + sdup[i] = '\0'; + break; + default: + sdup[i] = toupper(string[i]); + } } - return(str); + return sdup; } @@ -330,7 +353,7 @@ int main() { char *pkg_name, *pkg_depends, *pkg_kdepends, *pkg_needs, *pkg_depends_system, *pkg_depends_libc, *pkg_section, *pkg_descr, *pkg_url; char *pkg_subpkgs, *pkg_cfline, *pkg_dflt; char *pkgname, *sysname, *pkg_debug, *pkg_bb; - char *pkg_libc_depends, *pkg_host_depends, *pkg_system_depends, *pkg_arch_depends, *pkg_flavours, *pkg_flavours_string, *pkg_choices, *pseudo_name; + char *pkg_libc_depends, *pkg_system_depends, *pkg_arch_depends, *pkg_flavours, *pkg_flavours_string, *pkg_choices, *pseudo_name; char *packages, *pkg_name_u, *pkgs, *pkg_opts, *pkg_libname; char *saveptr, *p_ptr, *s_ptr, *pkg_helper, *sname, *sname2; int result; @@ -354,7 +377,6 @@ int main() { pkg_subpkgs = NULL; pkg_arch_depends = NULL; pkg_system_depends = NULL; - pkg_host_depends = NULL; pkg_libc_depends = NULL; pkg_dflt = NULL; pkg_cfline = NULL; @@ -463,10 +485,12 @@ int main() { icfg = fopen(runtime, "a"); if (icfg == NULL) continue; - if (strncmp("busybox", sname, 7) == 0) - fprintf(icfg, "config ADK_RUNTIME_START_%s_%s\n", toupperstr(sname), toupperstr(sname2)); - else + if (strncmp("busybox", sname, 7) == 0) { + fprintf(icfg, "config ADK_RUNTIME_START_%s", toupperstr(sname)); + fprintf(icfg, "_%s\n", toupperstr(sname2)); + } else { fprintf(icfg, "config ADK_RUNTIME_START_%s\n", toupperstr(sname)); + } fprintf(icfg, "\tprompt \"Start %s on boot\"\n", sname2); fprintf(icfg, "\ttristate\n"); if (strncmp("busybox", sname, 7) == 0) @@ -549,8 +573,6 @@ int main() { continue; if ((parse_var(buf, "PKG_LIBC_DEPENDS", NULL, &pkg_libc_depends)) == 0) continue; - if ((parse_var(buf, "PKG_HOST_DEPENDS", NULL, &pkg_host_depends)) == 0) - continue; if ((parse_var(buf, "PKG_ARCH_DEPENDS", NULL, &pkg_arch_depends)) == 0) continue; if ((parse_var(buf, "PKG_SYSTEM_DEPENDS", NULL, &pkg_system_depends)) == 0) @@ -813,7 +835,7 @@ int main() { if (result == 1) { val = strtok_r(hvalue, " ", &saveptr); while (val != NULL) { - fprintf(cfg, "\tselect ADK_KERNEL_%s\n", toupperstr(val)); + fprintf(cfg, "\tselect ADK_LINUX_KERNEL_%s\n", toupperstr(val)); val = strtok_r(NULL, " ", &saveptr); } } @@ -839,26 +861,6 @@ int main() { free(pkg_helper); pkg_helper = NULL; } - /* create package host dependency information */ - if (pkg_host_depends != NULL) { - pkg_helper = strdup(pkg_host_depends); - token = strtok(pkg_helper, " "); - fprintf(cfg, "\tdepends on "); - sp = ""; - while (token != NULL) { - if(strncmp(token, "!", 1) == 0) { - fprintf(cfg, "%s!ADK_HOST%s", sp, toupperstr(token)); - sp = " && "; - } else { - fprintf(cfg, "%sADK_HOST_%s", sp, toupperstr(token)); - sp = " || "; - } - token = strtok(NULL, " "); - } - fprintf(cfg, "\n"); - free(pkg_helper); - pkg_helper = NULL; - } /* create package libc dependency information */ if (pkg_libc_depends != NULL) { @@ -1223,7 +1225,6 @@ int main() { free(pkg_subpkgs); free(pkg_arch_depends); free(pkg_system_depends); - free(pkg_host_depends); free(pkg_libc_depends); free(pkg_dflt); free(pkg_cfline); @@ -1241,7 +1242,6 @@ int main() { pkg_subpkgs = NULL; pkg_arch_depends = NULL; pkg_system_depends = NULL; - pkg_host_depends = NULL; pkg_libc_depends = NULL; pkg_dflt = NULL; pkg_cfline = NULL; @@ -1282,6 +1282,7 @@ int main() { fatal_error("removing file failed."); } } + toupperstr(NULL); closedir(pkglistdir); return(0); } |