Bläddra i källkod

add support for libc dependent dependencies

Waldemar Brodkorb 10 år sedan
förälder
incheckning
3d31baf4a1
2 ändrade filer med 37 tillägg och 14 borttagningar
  1. 23 13
      adk/tools/depmaker.c
  2. 14 1
      adk/tools/pkgmaker.c

+ 23 - 13
adk/tools/depmaker.c

@@ -84,20 +84,26 @@ static char *parse_line(char *package, char *pkgvar, char *string, int checksym,
 			perror("Can not allocate memory.");
 			exit(EXIT_FAILURE);
 		}
-		if (system == 0) {
-			if (pprefix == 0) {
-				if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_%s_", pkgvar) < 0)
+		switch(system) {
+			case 0:
+				if (pprefix == 0) {
+					if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_%s_", pkgvar) < 0)
+						perror("Can not create string variable.");
+				} else {
+					if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_") < 0)
+						perror("Can not create string variable.");
+				}
+				strncat(key_sym, key+6, strlen(key)-6);
+				break;
+			case 1:
+				if (snprintf(key_sym, MAXLINE, "ADK_TARGET_SYSTEM_%s", pkgvar) < 0)
 					perror("Can not create string variable.");
-			} else {
-				if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_") < 0)
-					perror("Can not create string variable.");
-			}
-			strncat(key_sym, key+6, strlen(key)-6);
-		} else {
-			if (snprintf(key_sym, MAXLINE, "ADK_TARGET_SYSTEM_%s", pkgvar) < 0)
+				break;
+			case 2:
+				if (snprintf(key_sym, MAXLINE, "ADK_TARGET_LIB_%s", pkgvar) < 0)
 					perror("Can not create string variable.");
+				break;
 		}
-			
 		if (check_symbol(key_sym) != 0) {
 			free(key_sym);
 			return(NULL);
@@ -213,7 +219,7 @@ int main() {
 							strncat(pkgdeps, tmp, strlen(tmp));
 					}
 
-					// We need to find the system name here
+					// We need to find the system or libc name here
 					string = strstr(buf, "PKG_BUILDDEP_");
 					if (string != NULL) {
 						check = strstr(buf, ":=");
@@ -222,7 +228,11 @@ int main() {
 							string[strlen(string)-1] = '\0';
 							key = strtok(string, ":=");
 							dpkg = strdup(key+13);
-							tmp = parse_line(pkgdirp->d_name, dpkg, stringtmp, 1, 0, 1, &prefix);
+							if (strncmp("UCLIBC", dpkg, 6) == 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);
+							}
 							if (tmp != NULL)
 								strncat(pkgdeps, tmp, strlen(tmp));
 						}

+ 14 - 1
adk/tools/pkgmaker.c

@@ -327,7 +327,7 @@ int main() {
 	char dir[MAXPATH];
 	char variable[2*MAXVAR];
 	char *key, *value, *token, *cftoken, *sp, *hkey, *val, *pkg_fd;
-	char *pkg_name, *pkg_depends, *pkg_depends_system, *pkg_section, *pkg_descr, *pkg_url;
+	char *pkg_name, *pkg_depends, *pkg_depends_system, *pkg_depends_libc, *pkg_section, *pkg_descr, *pkg_url;
 	char *pkg_cxx, *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;
@@ -343,6 +343,7 @@ int main() {
 	pkg_url = NULL;
 	pkg_depends = NULL;
 	pkg_depends_system = NULL;
+	pkg_depends_libc = NULL;
 	pkg_opts = NULL;
 	pkg_libname = NULL;
 	pkg_flavours = NULL;
@@ -567,6 +568,8 @@ int main() {
 						continue;
 					if ((parse_var_with_system(buf, "PKG_DEPENDS_", pkg_depends_system, &pkg_depends_system, &sysname, 12)) == 0)
 						continue;
+					if ((parse_var_with_system(buf, "PKG_DEPENDS_", pkg_depends_libc, &pkg_depends_libc, &sysname, 12)) == 0)
+						continue;
 					if ((parse_var(buf, "PKG_LIBNAME", pkg_libname, &pkg_libname)) == 0) 
 						continue;
 					if ((parse_var(buf, "PKG_OPTS", pkg_opts, &pkg_opts)) == 0)
@@ -897,6 +900,16 @@ int main() {
 					free(pkg_depends_system);
 					pkg_depends_system = NULL;
 				}
+				/* create libc specific package dependency information */
+				if (pkg_depends_libc != NULL) {
+					token = strtok(pkg_depends_libc, " ");
+					while (token != NULL) {
+						fprintf(cfg, "\tselect ADK_PACKAGE_%s if ADK_TARGET_LIB_%s\n", toupperstr(token), sysname);
+						token = strtok(NULL, " ");
+					}
+					free(pkg_depends_libc);
+					pkg_depends_libc = NULL;
+				}
 
 				if (pkg_bb != NULL) {
 					fprintf(cfg, "\tdepends on !ADK_PACKAGE_BUSYBOX_HIDE\n");